]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/sasl.c
Clean up include logging
[openldap] / servers / slapd / sasl.c
index b33c08dd6cc35b923c62139b323672ba57f1094f..29a83f5adab5134da34332cf57fc6e306f1be80a 100644 (file)
@@ -82,7 +82,7 @@ slap_sasl_log(
 
 int slap_sasl_getdn( Connection *conn, char *id, char **dnptr, int flags )
 {
-       char *c, *c1, *dn=NULL;
+       char *c=NULL, *c1, *dn=NULL;
        int rc, len;
        sasl_conn_t *ctx;
 
@@ -111,7 +111,7 @@ int slap_sasl_getdn( Connection *conn, char *id, char **dnptr, int flags )
        /* An authcID needs to be converted to authzID form */
        if( flags & FLAG_GETDN_AUTHCID ) {
                if( sasl_external_x509dn_convert && conn->c_sasl_bind_mech
-                       && ( strcasecmp( LDAP_SASL_EXTERNAL, conn->c_sasl_bind_mech ) == 0 ) 
+                       && ( strcasecmp( "EXTERNAL", conn->c_sasl_bind_mech ) == 0 ) 
                        && len && dn[0] == '/' && dn[len-1]== '/' )
                {
                        /* check SASL external for X.509 style DN and */
@@ -119,7 +119,7 @@ int slap_sasl_getdn( Connection *conn, char *id, char **dnptr, int flags )
                        char *tmpdn = ldap_dcedn2dn( id );
                        len = strlen( tmpdn );
 
-                       dn = ch_malloc( dn, len+4 );
+                       dn = ch_malloc( len+4 );
                        dn[0] = 'd';
                        dn[1] = 'n';
                        dn[2] = ':';
@@ -128,7 +128,7 @@ int slap_sasl_getdn( Connection *conn, char *id, char **dnptr, int flags )
 
                } else {
                        /* convert to u:<username> form */
-                       dn = ch_malloc( dn, len+3 );
+                       dn = ch_malloc( len+3 );
                        dn[0] = 'u';
                        dn[1] = ':';
                        memmove( &dn[2], id, len+1 );
@@ -224,7 +224,7 @@ int slap_sasl_getdn( Connection *conn, char *id, char **dnptr, int flags )
        }
 
        if( ( flags & FLAG_GETDN_FINAL ) == 0 )  {
-               dn_normalize( dn );
+               dn_normalize( dn+3 );
        }
 
        *dnptr = dn;
@@ -311,7 +311,7 @@ slap_sasl_authorize(
 #ifdef NEW_LOGGING
        LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
                   "slap_sasl_authorize: conn %d authorization allowed\n",
-                  (long)(conn ? conn->c_connid : -1 ) );
+                  (long)(conn ? conn->c_connid : -1 ) ));
 #else
        Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
                " authorization allowed\n",