]> git.sur5r.net Git - openldap/commitdiff
fix previous commits
authorPierangelo Masarati <ando@openldap.org>
Sun, 14 Dec 2003 14:08:15 +0000 (14:08 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 14 Dec 2003 14:08:15 +0000 (14:08 +0000)
servers/slapd/saslauthz.c

index 8eb69e8318231413e92d3cf6e148fe4cf41d6e1b..b5d1d7b38c6ea41571a2713eccb566b15c6b79a2 100644 (file)
@@ -109,7 +109,10 @@ int slap_parse_user( struct berval *id, struct berval *user,
 
        u = id->bv_val[ 0 ];
        
-       assert( u == 'u' || u == 'U' );
+       if ( u != 'u' && u != 'U' ) {
+               /* called with something other than u: */
+               return LDAP_PROTOCOL_ERROR;
+       }
 
        /* uauthzid form:
         *              u[.mech[/realm]]:user
@@ -159,12 +162,11 @@ int slap_parse_user( struct berval *id, struct berval *user,
                realm->bv_val -= 2;
        }
 
-       if ( user->bv_val > id->bv_val + 2 ) {
-               user->bv_val -= 2;
-               user->bv_len += 2;
-               user->bv_val[ 0 ] = u;
-               user->bv_val[ 1 ] = ':';
-       }
+       /* leave "u:" before user */
+       user->bv_val -= 2;
+       user->bv_len += 2;
+       user->bv_val[ 0 ] = u;
+       user->bv_val[ 1 ] = ':';
 
        return LDAP_SUCCESS;
 }