]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-passwd/search.c
Add search no-op support.
[openldap] / servers / slapd / back-passwd / search.c
index 8e985cf0f1108f4f95c8447539f3c5346bca0754..bad2c1776317487e1f3133a4a8e47d48454aaaaa 100644 (file)
@@ -47,7 +47,7 @@ passwd_back_search(
        int err = LDAP_SUCCESS;
 
        LDAPRDN *rdn = NULL;
-       char *parent = NULL;
+       struct berval parent = { 0, NULL };
        char *matched = NULL;
        const char *text = NULL;
 
@@ -68,7 +68,7 @@ passwd_back_search(
 #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;
@@ -90,8 +90,9 @@ passwd_back_search(
                        /* 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;
                        }
@@ -173,12 +174,14 @@ passwd_back_search(
                }
 
        } 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] ) ) {
@@ -194,13 +197,15 @@ passwd_back_search(
                        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;
                }