]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/extended.c
Per ITS#419, don't require SLAPD_RLOOKUPS when HAVE_TCPD
[openldap] / servers / slapd / extended.c
index 9aa6f11201d2a37021b9e82640cd7057906e69a6..a1c5c8a293a6cb64d6a04e97d287ac0b8485d506 100644 (file)
@@ -54,6 +54,7 @@ struct {
 #ifdef HAVE_TLS
                { LDAP_EXOP_START_TLS, starttls_extop },
 #endif
+               { LDAP_EXOP_X_MODIFY_PASSWD, passwd_extop },
                { NULL, NULL }
        };
 
@@ -85,17 +86,20 @@ do_extended(
 )
 {
        int rc = LDAP_SUCCESS;
-       char* oid;
+       char* reqoid;
        struct berval *reqdata;
        ber_tag_t tag;
        ber_len_t len;
        extop_list_t *ext;
        char *text;
+       struct berval **refs;
+       char *rspoid;
        struct berval *rspdata;
+       LDAPControl **rspctrls;
 
        Debug( LDAP_DEBUG_TRACE, "do_extended\n", 0, 0, 0 );
 
-       oid = NULL;
+       reqoid = NULL;
        reqdata = NULL;
 
        if( op->o_protocol < LDAP_VERSION3 ) {
@@ -107,7 +111,7 @@ do_extended(
                goto done;
        }
 
-       if ( ber_scanf( op->o_ber, "{a" /*}*/, &oid ) == LBER_ERROR ) {
+       if ( ber_scanf( op->o_ber, "{a" /*}*/, &reqoid ) == LBER_ERROR ) {
                Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
@@ -115,9 +119,9 @@ do_extended(
                goto done;
        }
 
-       if( !(ext = find_extop(supp_ext_list, oid)) ) {
+       if( !(ext = find_extop(supp_ext_list, reqoid)) ) {
                Debug( LDAP_DEBUG_ANY, "do_extended: unsupported operation \"%s\"\n",
-                       oid, 0 ,0 );
+                       reqoid, 0 ,0 );
                send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
                        NULL, "unsupported extended operation", NULL, NULL );
                goto done;
@@ -140,17 +144,29 @@ do_extended(
                return rc;
        } 
 
-       Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n", oid, 0 ,0 );
+       Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n", reqoid, 0 ,0 );
 
+       rspoid = NULL;
        rspdata = NULL;
+       rspctrls = NULL;
        text = NULL;
+       refs = NULL;
 
        rc = (ext->ext_main)( extop_callback, conn, op,
-               oid, reqdata, &rspdata, &text );
+               reqoid, reqdata,
+               &rspoid, &rspdata, &rspctrls, &text, &refs );
 
        if( rc != SLAPD_ABANDON ) {
-               send_ldap_extended( conn, op, rc, NULL, text,
-                       oid, rspdata );
+               if (rc == LDAP_REFERRAL) {
+                       refs = default_referral;
+               }
+
+               send_ldap_extended( conn, op, rc, NULL, text, refs,
+                       rspoid, rspdata, rspctrls );
+       }
+
+       if ( rspoid != NULL ) {
+               free( rspoid );
        }
 
        if ( rspdata != NULL )
@@ -163,8 +179,8 @@ done:
        if ( reqdata != NULL ) {
                ber_bvfree( reqdata );
        }
-       if ( oid != NULL ) {
-               free( oid );
+       if ( reqoid != NULL ) {
+               free( reqoid );
        }
 
        return rc;