]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/saslauthz.c
ITS#1882: fix typo
[openldap] / servers / slapd / saslauthz.c
index d196a4f084ba1d4c1de2e9278fccc3d43d3dc513..8efc6d6713204c6e1c91e9744ca3a3b2a7c3197d 100644 (file)
@@ -357,21 +357,22 @@ static int sasl_sc_sasl2dn( BackendDB *be, Connection *conn, Operation *o,
        struct berval *ndn = o->o_callback->sc_private;
 
        /* We only want to be called once */
-       if (ndn->bv_val) {
+       if( ndn->bv_val ) {
                free(ndn->bv_val);
                ndn->bv_val = NULL;
+
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
-                  "slap_sasl2dn: search DN returned more than 1 entry\n" ));
+               LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
+                       "slap_sasl2dn: search DN returned more than 1 entry\n" ));
 #else
-       Debug( LDAP_DEBUG_TRACE,
-          "slap_sasl2dn: search DN returned more than 1 entry\n", 0,0,0 );
+               Debug( LDAP_DEBUG_TRACE,
+                       "slap_sasl2dn: search DN returned more than 1 entry\n", 0,0,0 );
 #endif
                return -1;
-       } else {
-               ber_dupbv(ndn, &e->e_nname);
-               return 0;
        }
+
+       ber_dupbv(ndn, &e->e_nname);
+       return 0;
 }
 
 /*
@@ -396,9 +397,10 @@ void slap_sasl2dn( Connection *conn, struct berval *saslname, struct berval *dn
        LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
                "slap_sasl2dn: converting SASL name %s to DN.\n", saslname->bv_val ));
 #else
-       Debug( LDAP_DEBUG_TRACE,
-               "==>slap_sasl2dn: Converting SASL name %s to a DN\n", saslname->bv_val, 0,0 );
+       Debug( LDAP_DEBUG_TRACE, "==>slap_sasl2dn: "
+               "converting SASL name %s to a DN\n", saslname->bv_val, 0,0 );
 #endif
+
        dn->bv_val = NULL;
        dn->bv_len = 0;
        cb.sc_private = dn;
@@ -414,8 +416,6 @@ void slap_sasl2dn( Connection *conn, struct berval *saslname, struct berval *dn
 
        be = select_backend( &uri.dn, 0, 1 );
 
-       conn->c_authz_backend = be;
-
        /* Massive shortcut: search scope == base */
        if( uri.scope == LDAP_SCOPE_BASE ) {
                *dn = uri.dn;
@@ -426,16 +426,17 @@ void slap_sasl2dn( Connection *conn, struct berval *saslname, struct berval *dn
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
-                  "slap_sasl2dn: performing internal search (base=%s, scope=%d)\n",
-                  uri.dn.bv_val, uri.scope ));
+               "slap_sasl2dn: performing internal search (base=%s, scope=%d)\n",
+               uri.dn.bv_val, uri.scope ));
 #else
        Debug( LDAP_DEBUG_TRACE,
           "slap_sasl2dn: performing internal search (base=%s, scope=%d)\n",
           uri.dn.bv_val, uri.scope, 0 );
 #endif
 
-       if(( be == NULL ) || ( be->be_search == NULL))
+       if(( be == NULL ) || ( be->be_search == NULL)) {
                goto FINISHED;
+       }
        suffix_alias( be, &uri.dn );
 
        op.o_tag = LDAP_REQ_SEARCH;
@@ -444,10 +445,14 @@ void slap_sasl2dn( Connection *conn, struct berval *saslname, struct berval *dn
        op.o_callback = &cb;
        op.o_time = slap_get_time();
 
-       (*be->be_search)( be, /*conn*/NULL, &op, /*base*/NULL, &uri.dn,
-          uri.scope, /*deref=*/1, /*sizelimit=*/1, /*time=*/0, filter, /*fstr=*/NULL,
-          /*attrs=*/NULL, /*attrsonly=*/0 );
+       (*be->be_search)( be, NULL, &op, NULL, &uri.dn,
+               uri.scope, LDAP_DEREF_NEVER, 1, 0,
+               filter, NULL, NULL, 1 );
        
+       if( dn->bv_len ) {
+               conn->c_authz_backend = be;
+       }
+
 FINISHED:
        if( uri.dn.bv_len ) ch_free( uri.dn.bv_val );
        if( uri.filter.bv_len ) ch_free( uri.filter.bv_val );