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
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;
}