int err = LDAP_SUCCESS;
LDAPRDN *rdn = NULL;
- char *parent = NULL;
+ struct berval parent = { 0, NULL };
char *matched = NULL;
const char *text = NULL;
#endif /* HAVE_SETPWFILE */
/* Handle a query for the base of this backend */
- if ( be_issuffix( be, nbase->bv_val ) ) {
+ if ( be_issuffix( be, nbase ) ) {
struct berval vals[2];
vals[1].bv_val = NULL;
/* Use the first attribute of the DN
* as an attribute within the entry itself.
*/
- if( ldap_str2rdn( base->bv_val, &rdn, &text,
- LDAP_DN_FORMAT_LDAP ) ) {
+ if( ldap_str2rdn( base->bv_val, &rdn, (char **)&text,
+ LDAP_DN_FORMAT_LDAP ) )
+ {
err = LDAP_INVALID_DN_SYNTAX;
goto done;
}
}
} else {
- parent = dn_parent( be, nbase->bv_val );
+ if (! be_issuffix( be, nbase ) ) {
+ dnParent( nbase, &parent );
+ }
/* This backend is only one layer deep. Don't answer requests for
* anything deeper than that.
*/
- if( !be_issuffix( be, parent ) ) {
+ if( !be_issuffix( be, &parent ) ) {
int i;
for( i=0; be->be_nsuffix[i] != NULL; i++ ) {
if( dnIsSuffix( nbase, be->be_nsuffix[i] ) ) {
goto done;
}
- if ( ldap_str2rdn( base->bv_val, &rdn, &text, LDAP_DN_FORMAT_LDAP )) {
+ if ( ldap_str2rdn( base->bv_val, &rdn, (char **)&text,
+ LDAP_DN_FORMAT_LDAP ))
+ {
err = LDAP_OPERATIONS_ERROR;
goto done;
}
if ( (pw = getpwnam( rdn[0][0]->la_value.bv_val )) == NULL ) {
- matched = parent;
+ matched = parent.bv_val;
err = LDAP_NO_SUCH_OBJECT;
goto done;
}