]> git.sur5r.net Git - openldap/commitdiff
Previous commit included undesired changes.
authorHoward Chu <hyc@openldap.org>
Sun, 14 Apr 2002 04:15:17 +0000 (04:15 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 14 Apr 2002 04:15:17 +0000 (04:15 +0000)
servers/slapd/sasl.c

index 6587a4b4acbd1541c7fe64c403101e190453a03f..d14c5b8f2b28cc6fff3efaaeef34fa636095ad30 100644 (file)
@@ -387,30 +387,23 @@ slap_sasl_canonicalize(
                        in ? in : "<empty>" );
 #endif
 
-       if (flags == SASL_CU_AUTHID) {
-               rc = slap_sasl_getdn( conn, (char *)in, (char *)user_realm,
-                       &dn, FLAG_GETDN_AUTHCID);
-               if ( rc != LDAP_SUCCESS ) {
-                       sasl_seterror( sconn, 0, ldap_err2string( rc ) );
-                       return SASL_NOAUTHZ;
-               }               
-
-               if ( out_max < dn.bv_len ) {
-                       return SASL_BUFOVER;
-               }
-
-               AC_MEMCPY( out, dn.bv_val, dn.bv_len );
-               out[dn.bv_len] = '\0';
+       rc = slap_sasl_getdn( conn, (char *)in, (char *)user_realm, &dn,
+               (flags == SASL_CU_AUTHID) ? FLAG_GETDN_AUTHCID : FLAG_GETDN_AUTHZID );
+       if ( rc != LDAP_SUCCESS ) {
+               sasl_seterror( sconn, 0, ldap_err2string( rc ) );
+               return SASL_NOAUTHZ;
+       }               
 
-               *out_len = dn.bv_len;
+       if ( out_max < dn.bv_len ) {
+               return SASL_BUFOVER;
+       }
 
-               ch_free( dn.bv_val );
+       AC_MEMCPY( out, dn.bv_val, dn.bv_len );
+       out[dn.bv_len] = '\0';
 
-       } else {
-               strcpy( out, in );
+       *out_len = dn.bv_len;
 
-               *out_len = strlen( in );
-       }
+       ch_free( dn.bv_val );
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,