check_and_send_extended_result(Slapi_PBlock *pb, ber_tag_t tag, BerElement *ber)
{
    /*
     * if this is an LDAPv3 ExtendedResponse to an ExtendedRequest,
     * check to see if the optional responseName and response OCTET
     * STRING need to be appended.
     */
    int rc = 0;
    char *exop_oid;
    struct berval *exop_value;
    slapi_pblock_get(pb, SLAPI_EXT_OP_RET_OID, &exop_oid);
    slapi_pblock_get(pb, SLAPI_EXT_OP_RET_VALUE, &exop_value);
    if (LDAP_RES_EXTENDED == tag) {
        if (exop_oid != NULL) {
            rc = ber_printf(ber, "ts",
                            LDAP_TAG_EXOP_RES_OID, exop_oid);
        }
        if (rc != LBER_ERROR && exop_value != NULL) {
            rc = ber_printf(ber, "to",
                            LDAP_TAG_EXOP_RES_VALUE,
                            exop_value->bv_val ? exop_value->bv_val : "",
                            exop_value->bv_len);
        }
    }
    return rc;
}
check_and_send_extended_result(Slapi_PBlock *pb, ber_tag_t tag, BerElement *ber)
{
     
    int rc = 0;
    char *exop_oid;
    struct berval *exop_value;
    slapi_pblock_get(pb, SLAPI_EXT_OP_RET_OID, &exop_oid);
    slapi_pblock_get(pb, SLAPI_EXT_OP_RET_VALUE, &exop_value);
    if (LDAP_RES_EXTENDED == tag) {
        if (exop_oid != NULL) {
            rc = ber_printf(ber, "ts",
                            LDAP_TAG_EXOP_RES_OID, exop_oid);
        }
        if (rc != LBER_ERROR && exop_value != NULL) {
            rc = ber_printf(ber, "to",
                            LDAP_TAG_EXOP_RES_VALUE,
                            exop_value->bv_val ? exop_value->bv_val : "",
                            exop_value->bv_len);
        }
    }
    return rc;
}