From: Howard Chu Date: Sat, 18 Sep 1999 23:40:03 +0000 (+0000) Subject: Added mixed-case as well as up-cased DN argument. The behavior of back-bdb2 X-Git-Tag: UCDATA_2_4~420 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f991ef04e62e2036bf90341f8cf9028622c90c60;p=openldap Added mixed-case as well as up-cased DN argument. The behavior of back-bdb2 and back-ldbm are preserved, they only use the up-cased DNs. back-passwd uses the mixed-case DN. All others are using mixed-case DN, may need more fixing. --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 388ad9d629..eab269a130 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -67,17 +67,17 @@ do_add( Connection *conn, Operation *op ) return -1; } - ndn = ch_strdup( dn ); - - if ( dn_normalize_case( ndn ) == NULL ) { + if ( dn_normalize( dn ) == NULL ) { Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn, 0, 0 ); send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX, NULL, "invalid DN", NULL, NULL ); free( dn ); - free( ndn ); return LDAP_INVALID_DN_SYNTAX; } + ndn = ch_strdup( dn ); + ldap_pvt_str2upper( ndn ); + e = (Entry *) ch_calloc( 1, sizeof(Entry) ); e->e_dn = dn; diff --git a/servers/slapd/back-bdb2/bind.c b/servers/slapd/back-bdb2/bind.c index e022a5533b..40652e5579 100644 --- a/servers/slapd/back-bdb2/bind.c +++ b/servers/slapd/back-bdb2/bind.c @@ -316,6 +316,7 @@ bdb2_back_bind( Connection *conn, Operation *op, char *dn, + char *ndn, int method, char *mech, struct berval *cred, @@ -335,7 +336,7 @@ bdb2_back_bind( return( 1 ); } - ret = bdb2i_back_bind_internal( be, conn, op, dn, method, mech, cred, edn ); + ret = bdb2i_back_bind_internal( be, conn, op, ndn, method, mech, cred, edn ); (void) bdb2i_leave_backend_r( lock ); diff --git a/servers/slapd/back-bdb2/compare.c b/servers/slapd/back-bdb2/compare.c index 46093d61a6..db0c117750 100644 --- a/servers/slapd/back-bdb2/compare.c +++ b/servers/slapd/back-bdb2/compare.c @@ -108,6 +108,7 @@ bdb2_back_compare( Connection *conn, Operation *op, char *dn, + char *ndn, Ava *ava ) { @@ -126,7 +127,7 @@ bdb2_back_compare( } - ret = bdb2i_back_compare_internal( be, conn, op, dn, ava ); + ret = bdb2i_back_compare_internal( be, conn, op, ndn, ava ); (void) bdb2i_leave_backend_r( lock ); bdb2i_stop_timing( be->bd_info, time1, "CMP", conn, op ); diff --git a/servers/slapd/back-bdb2/delete.c b/servers/slapd/back-bdb2/delete.c index eee7b6d914..806dbd12fe 100644 --- a/servers/slapd/back-bdb2/delete.c +++ b/servers/slapd/back-bdb2/delete.c @@ -173,7 +173,8 @@ bdb2_back_delete( BackendDB *be, Connection *conn, Operation *op, - char *dn + char *dn, + char *ndn ) { DB_LOCK lock; @@ -189,7 +190,7 @@ bdb2_back_delete( return( -1 ); } - ret = bdb2i_back_delete_internal( be, conn, op, dn ); + ret = bdb2i_back_delete_internal( be, conn, op, ndn ); (void) bdb2i_leave_backend_w( lock ); bdb2i_stop_timing( be->bd_info, time1, "DEL", conn, op ); diff --git a/servers/slapd/back-bdb2/external.h b/servers/slapd/back-bdb2/external.h index 9af5a84ed6..dad989377a 100644 --- a/servers/slapd/back-bdb2/external.h +++ b/servers/slapd/back-bdb2/external.h @@ -22,35 +22,35 @@ extern int bdb2_back_db_config LDAP_P(( BackendDB *bd, extern int bdb2_back_bind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, int method, char* mech, + char *dn, char *ndn, int method, char* mech, struct berval *cred, char** edn )); extern int bdb2_back_unbind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op )); extern int bdb2_back_search LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - char *base, int scope, int deref, int sizelimit, int timelimit, + Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int sizelimit, int timelimit, Filter *filter, char *filterstr, char **attrs, int attrsonly )); extern int bdb2_back_compare LDAP_P((BackendDB *bd, Connection *conn, Operation *op, - char *dn, Ava *ava )); + char *dn, char *ndn, Ava *ava )); extern int bdb2_back_modify LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, LDAPModList *ml )); + char *dn, char *ndn, LDAPModList *ml )); extern int bdb2_back_modrdn LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, char*newrdn, int deleteoldrdn, + char *dn, char *ndn, char*newrdn, int deleteoldrdn, char *newSuperior )); extern int bdb2_back_add LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, Entry *e )); extern int bdb2_back_delete LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, char *dn )); + Connection *conn, Operation *op, char *dn, char *ndn )); extern int bdb2_back_abandon LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, int msgid )); diff --git a/servers/slapd/back-bdb2/modify.c b/servers/slapd/back-bdb2/modify.c index 817d3ba26f..de632c8df1 100644 --- a/servers/slapd/back-bdb2/modify.c +++ b/servers/slapd/back-bdb2/modify.c @@ -126,6 +126,7 @@ bdb2_back_modify( Connection *conn, Operation *op, char *dn, + char *ndn, LDAPModList *modlist ) { @@ -153,7 +154,7 @@ bdb2_back_modify( break; } - if ( (e = bdb2i_dn2entry_w( be, dn, &matched )) == NULL ) { + if ( (e = bdb2i_dn2entry_w( be, ndn, &matched )) == NULL ) { char *matched_dn = NULL; struct berval **refs = NULL; @@ -198,7 +199,7 @@ bdb2_back_modify( goto done; } - ret = bdb2i_back_modify_internal( be, conn, op, dn, modlist, e ); + ret = bdb2i_back_modify_internal( be, conn, op, ndn, modlist, e ); bdb2i_cache_return_entry_w( &li->li_cache, e ); done: diff --git a/servers/slapd/back-bdb2/modrdn.c b/servers/slapd/back-bdb2/modrdn.c index 47c260fed7..43b49cdb75 100644 --- a/servers/slapd/back-bdb2/modrdn.c +++ b/servers/slapd/back-bdb2/modrdn.c @@ -478,6 +478,7 @@ bdb2_back_modrdn( Connection *conn, Operation *op, char *dn, + char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior @@ -497,7 +498,7 @@ bdb2_back_modrdn( } - ret = bdb2i_back_modrdn_internal( be, conn, op, dn, + ret = bdb2i_back_modrdn_internal( be, conn, op, ndn, newrdn, deleteoldrdn, newSuperior ); diff --git a/servers/slapd/back-bdb2/search.c b/servers/slapd/back-bdb2/search.c index 4bec697151..d40dbd1a4f 100644 --- a/servers/slapd/back-bdb2/search.c +++ b/servers/slapd/back-bdb2/search.c @@ -329,6 +329,7 @@ bdb2_back_search( Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int slimit, @@ -353,7 +354,7 @@ bdb2_back_search( } - ret = bdb2i_back_search_internal( be, conn, op, base, scope, deref, + ret = bdb2i_back_search_internal( be, conn, op, nbase, scope, deref, slimit, tlimit, filter, filterstr, attrs, attrsonly ); (void) bdb2i_leave_backend_r( lock ); diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index 45f9df5c1e..263321f4c3 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -38,6 +38,7 @@ ldap_back_bind( Connection *conn, Operation *op, char *dn, + char *ndn, int method, char *mech, struct berval *cred, diff --git a/servers/slapd/back-ldap/compare.c b/servers/slapd/back-ldap/compare.c index 206437d432..98b0de3bef 100644 --- a/servers/slapd/back-ldap/compare.c +++ b/servers/slapd/back-ldap/compare.c @@ -38,6 +38,7 @@ ldap_back_compare( Connection *conn, Operation *op, char *dn, + char *ndn, Ava *ava ) { diff --git a/servers/slapd/back-ldap/delete.c b/servers/slapd/back-ldap/delete.c index b5e00cc2bb..b6f84b48ad 100644 --- a/servers/slapd/back-ldap/delete.c +++ b/servers/slapd/back-ldap/delete.c @@ -37,7 +37,8 @@ ldap_back_delete( Backend *be, Connection *conn, Operation *op, - char *dn + char *dn, + char *ndn ) { struct ldapinfo *li = (struct ldapinfo *) be->be_private; diff --git a/servers/slapd/back-ldap/external.h b/servers/slapd/back-ldap/external.h index 58b5e77a07..7493c816cd 100644 --- a/servers/slapd/back-ldap/external.h +++ b/servers/slapd/back-ldap/external.h @@ -17,35 +17,35 @@ extern int ldap_back_db_config LDAP_P(( BackendDB *bd, extern int ldap_back_bind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, int method, char* mech, + char *dn, char *ndn, int method, char* mech, struct berval *cred, char** edn )); extern int ldap_back_conn_destroy LDAP_P(( BackendDB *bd, Connection *conn )); extern int ldap_back_search LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - char *base, int scope, int deref, int sizelimit, int timelimit, + Connection *conn, Operation *op, char *base, char *nbase, + int scope, int deref, int sizelimit, int timelimit, Filter *filter, char *filterstr, char **attrs, int attrsonly )); extern int ldap_back_compare LDAP_P((BackendDB *bd, Connection *conn, Operation *op, - char *dn, Ava *ava )); + char *dn, char *ndn, Ava *ava )); extern int ldap_back_modify LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, LDAPModList *ml )); + char *dn, char *ndn, LDAPModList *ml )); extern int ldap_back_modrdn LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, char*newrdn, int deleteoldrdn, + char *dn, char *ndn, char*newrdn, int deleteoldrdn, char *newSuperior )); extern int ldap_back_add LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, Entry *e )); extern int ldap_back_delete LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, char *dn )); + Connection *conn, Operation *op, char *dn, char *ndn )); extern int ldap_back_abandon LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, int msgid )); diff --git a/servers/slapd/back-ldap/modify.c b/servers/slapd/back-ldap/modify.c index c1b7df0337..3245a231fd 100644 --- a/servers/slapd/back-ldap/modify.c +++ b/servers/slapd/back-ldap/modify.c @@ -38,6 +38,7 @@ ldap_back_modify( Connection *conn, Operation *op, char *dn, + char *ndn, LDAPModList *ml ) { diff --git a/servers/slapd/back-ldap/modrdn.c b/servers/slapd/back-ldap/modrdn.c index b2c4cecd3b..9e94f2f7d7 100644 --- a/servers/slapd/back-ldap/modrdn.c +++ b/servers/slapd/back-ldap/modrdn.c @@ -38,6 +38,7 @@ ldap_back_modrdn( Connection *conn, Operation *op, char *dn, + char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 8eb4a31f0b..9e8619cd47 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -42,6 +42,7 @@ ldap_back_search( Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int size, diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index 1880a8a8cc..aa60133725 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -69,6 +69,7 @@ ldbm_back_bind( Connection *conn, Operation *op, char *dn, + char *ndn, int method, char *mech, struct berval *cred, @@ -88,6 +89,7 @@ ldbm_back_bind( Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_bind: dn: %s\n", dn, 0, 0); *edn = NULL; + dn = ndn; /* get entry with reader lock */ if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) { diff --git a/servers/slapd/back-ldbm/compare.c b/servers/slapd/back-ldbm/compare.c index 96932cecfc..75e5695d9d 100644 --- a/servers/slapd/back-ldbm/compare.c +++ b/servers/slapd/back-ldbm/compare.c @@ -22,6 +22,7 @@ ldbm_back_compare( Connection *conn, Operation *op, char *dn, + char *ndn, Ava *ava ) { @@ -33,7 +34,7 @@ ldbm_back_compare( int manageDSAit = get_manageDSAit( op ); /* get entry with reader lock */ - if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) { + if ( (e = dn2entry_r( be, ndn, &matched )) == NULL ) { char *matched_dn = NULL; struct berval **refs = NULL; diff --git a/servers/slapd/back-ldbm/delete.c b/servers/slapd/back-ldbm/delete.c index eb3ed850e2..19437912fa 100644 --- a/servers/slapd/back-ldbm/delete.c +++ b/servers/slapd/back-ldbm/delete.c @@ -21,7 +21,8 @@ ldbm_back_delete( Backend *be, Connection *conn, Operation *op, - char *dn + char *dn, + char *ndn ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; @@ -35,7 +36,7 @@ ldbm_back_delete( Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn, 0, 0); /* get entry with writer lock */ - if ( (e = dn2entry_w( be, dn, &matched )) == NULL ) { + if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) { char *matched_dn = NULL; struct berval **refs = NULL; diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h index e1b8696db6..c8a1b25d5f 100644 --- a/servers/slapd/back-ldbm/external.h +++ b/servers/slapd/back-ldbm/external.h @@ -24,35 +24,35 @@ extern int ldbm_back_db_config LDAP_P(( BackendDB *bd, extern int ldbm_back_bind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, int method, char* mech, + char *dn, char *ndn, int method, char* mech, struct berval *cred, char** edn )); extern int ldbm_back_unbind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op )); extern int ldbm_back_search LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - char *base, int scope, int deref, int sizelimit, int timelimit, + Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int sizelimit, int timelimit, Filter *filter, char *filterstr, char **attrs, int attrsonly )); extern int ldbm_back_compare LDAP_P((BackendDB *bd, Connection *conn, Operation *op, - char *dn, Ava *ava )); + char *dn, char *ndn, Ava *ava )); extern int ldbm_back_modify LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, LDAPModList *ml )); + char *dn, char *ndn, LDAPModList *ml )); extern int ldbm_back_modrdn LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, char* newrdn, int deleteoldrdn, + char *dn, char *ndn, char* newrdn, int deleteoldrdn, char *newSuperior )); extern int ldbm_back_add LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, Entry *e )); extern int ldbm_back_delete LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, char *dn )); + Connection *conn, Operation *op, char *dn, char *ndn )); extern int ldbm_back_abandon LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, ber_int_t msgid )); diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 770be8dbc2..af69d50bc6 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -168,6 +168,7 @@ ldbm_back_modify( Connection *conn, Operation *op, char *dn, + char *ndn, LDAPModList *modlist ) { @@ -179,7 +180,7 @@ ldbm_back_modify( Debug(LDAP_DEBUG_ARGS, "ldbm_back_modify:\n", 0, 0, 0); /* acquire and lock entry */ - if ( (e = dn2entry_w( be, dn, &matched )) == NULL ) { + if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) { char* matched_dn = NULL; struct berval **refs = NULL; @@ -222,7 +223,7 @@ ldbm_back_modify( } /* Modify the entry */ - if ( ldbm_modify_internal( be, conn, op, dn, modlist, e ) != 0 ) { + if ( ldbm_modify_internal( be, conn, op, ndn, modlist, e ) != 0 ) { goto error_return; } diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 08300fbf68..e1e71b05d4 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -38,6 +38,7 @@ ldbm_back_modrdn( Connection *conn, Operation *op, char *dn, + char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior @@ -74,7 +75,7 @@ ldbm_back_modrdn( 0, 0 ); /* get entry with writer lock */ - if ( (e = dn2entry_w( be, dn, &matched )) == NULL ) { + if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) { char* matched_dn = NULL; struct berval** refs = NULL; diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 2858e24961..556653720f 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -30,6 +30,7 @@ ldbm_back_search( Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int slimit, @@ -57,10 +58,10 @@ ldbm_back_search( /* get entry with reader lock */ if ( deref & LDAP_DEREF_FINDING ) { - e = deref_dn_r( be, base, &err, &matched, &text ); + e = deref_dn_r( be, nbase, &err, &matched, &text ); } else { - e = dn2entry_r( be, base, &matched ); + e = dn2entry_r( be, nbase, &matched ); err = e != NULL ? LDAP_SUCCESS : LDAP_REFERRAL; text = NULL; } diff --git a/servers/slapd/back-passwd/external.h b/servers/slapd/back-passwd/external.h index 92dd26e95d..78cd5af150 100644 --- a/servers/slapd/back-passwd/external.h +++ b/servers/slapd/back-passwd/external.h @@ -7,8 +7,8 @@ LDAP_BEGIN_DECL extern int passwd_back_initialize LDAP_P(( BackendInfo *bi )); extern int passwd_back_search LDAP_P(( BackendDB *be, - Connection *c, Operation *o, - char *base, int scope, int deref, int slimit, int tlimit, + Connection *c, Operation *o, char *base, + char *nbase, int scope, int deref, int slimit, int tlimit, Filter *f, char *filterstr, char **attrs, int attrsonly)); extern int passwd_back_db_config LDAP_P((BackendDB *bd, diff --git a/servers/slapd/back-passwd/search.c b/servers/slapd/back-passwd/search.c index 68af4b3fa4..5e86049dc9 100644 --- a/servers/slapd/back-passwd/search.c +++ b/servers/slapd/back-passwd/search.c @@ -27,6 +27,7 @@ passwd_back_search( Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int slimit, @@ -65,7 +66,7 @@ passwd_back_search( #endif /* HAVE_SETPWFILE */ /* Handle a query for the base of this backend */ - if ( be_issuffix( be, base ) ) { + if ( be_issuffix( be, nbase ) ) { struct berval val, *vals[2]; vals[0] = &val; @@ -164,8 +165,8 @@ passwd_back_search( */ if( !be_issuffix( be, parent ) ) { int i; - for( i=0; be->be_suffix[i] != NULL; i++ ) { - if( dn_issuffix( base, be->be_suffix[i] ) ) { + for( i=0; be->be_nsuffix[i] != NULL; i++ ) { + if( dn_issuffix( nbase, be->be_nsuffix[i] ) ) { matched = ch_strdup( be->be_suffix[i] ); break; } @@ -185,8 +186,6 @@ passwd_back_search( goto done; } - user = ldap_pvt_str2lower( user ); - if ( (pw = getpwnam( user )) == NULL ) { matched = parent; parent = NULL; diff --git a/servers/slapd/back-perl/bind.c b/servers/slapd/back-perl/bind.c index 9d20afd783..23bc127815 100644 --- a/servers/slapd/back-perl/bind.c +++ b/servers/slapd/back-perl/bind.c @@ -34,6 +34,7 @@ perl_back_bind( Connection *conn, Operation *op, char *dn, + char *ndn, int method, char *mech, struct berval *cred, diff --git a/servers/slapd/back-perl/compare.c b/servers/slapd/back-perl/compare.c index 4c9f3904ef..a48d30c721 100644 --- a/servers/slapd/back-perl/compare.c +++ b/servers/slapd/back-perl/compare.c @@ -32,6 +32,7 @@ perl_back_compare( Connection *conn, Operation *op, char *dn, + char *ndn, Ava *ava ) { diff --git a/servers/slapd/back-perl/delete.c b/servers/slapd/back-perl/delete.c index 19d2346f9a..b0e90b922f 100644 --- a/servers/slapd/back-perl/delete.c +++ b/servers/slapd/back-perl/delete.c @@ -25,7 +25,8 @@ perl_back_delete( Backend *be, Connection *conn, Operation *op, - char *dn + char *dn, + char *ndn ) { int len; diff --git a/servers/slapd/back-perl/external.h b/servers/slapd/back-perl/external.h index d41fb13ea5..aa9f243014 100644 --- a/servers/slapd/back-perl/external.h +++ b/servers/slapd/back-perl/external.h @@ -17,35 +17,35 @@ extern int perl_back_db_config LDAP_P(( BackendDB *bd, extern int perl_back_bind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, int method, char* mech, + char *dn, char *ndn, int method, char* mech, struct berval *cred, char** edn )); extern int perl_back_unbind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op )); extern int perl_back_search LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - char *base, int scope, int deref, int sizelimit, int timelimit, + Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int sizelimit, int timelimit, Filter *filter, char *filterstr, char **attrs, int attrsonly )); extern int perl_back_compare LDAP_P((BackendDB *bd, Connection *conn, Operation *op, - char *dn, Ava *ava )); + char *dn, char *ndn, Ava *ava )); extern int perl_back_modify LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, LDAPModList *ml )); + char *dn, char *ndn, LDAPModList *ml )); extern int perl_back_modrdn LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, char*newrdn, int deleteoldrdn, + char *dn, char *ndn, char*newrdn, int deleteoldrdn, char *newSuperior )); extern int perl_back_add LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, Entry *e )); extern int perl_back_delete LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, char *dn )); + Connection *conn, Operation *op, char *dn, char *ndn )); LDAP_END_DECL diff --git a/servers/slapd/back-perl/modify.c b/servers/slapd/back-perl/modify.c index 028b42e136..3b52095c21 100644 --- a/servers/slapd/back-perl/modify.c +++ b/servers/slapd/back-perl/modify.c @@ -27,6 +27,7 @@ perl_back_modify( Connection *conn, Operation *op, char *dn, + char *ndn, LDAPModList *modlist ) { diff --git a/servers/slapd/back-perl/modrdn.c b/servers/slapd/back-perl/modrdn.c index d74701418f..18c303702b 100644 --- a/servers/slapd/back-perl/modrdn.c +++ b/servers/slapd/back-perl/modrdn.c @@ -40,6 +40,7 @@ perl_back_modrdn( Connection *conn, Operation *op, char *dn, + char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior diff --git a/servers/slapd/back-perl/search.c b/servers/slapd/back-perl/search.c index 0feb28852d..dc1e804464 100644 --- a/servers/slapd/back-perl/search.c +++ b/servers/slapd/back-perl/search.c @@ -32,6 +32,7 @@ perl_back_search( Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int sizelimit, diff --git a/servers/slapd/back-shell/bind.c b/servers/slapd/back-shell/bind.c index 44bd6cd5e2..287098467a 100644 --- a/servers/slapd/back-shell/bind.c +++ b/servers/slapd/back-shell/bind.c @@ -17,6 +17,7 @@ shell_back_bind( Connection *conn, Operation *op, char *dn, + char *ndn, int method, char *mech, struct berval *cred, diff --git a/servers/slapd/back-shell/compare.c b/servers/slapd/back-shell/compare.c index 940f213fc5..3562427f62 100644 --- a/servers/slapd/back-shell/compare.c +++ b/servers/slapd/back-shell/compare.c @@ -17,6 +17,7 @@ shell_back_compare( Connection *conn, Operation *op, char *dn, + char *ndn, Ava *ava ) { diff --git a/servers/slapd/back-shell/delete.c b/servers/slapd/back-shell/delete.c index 27f67a2c63..1a240d39ca 100644 --- a/servers/slapd/back-shell/delete.c +++ b/servers/slapd/back-shell/delete.c @@ -16,7 +16,8 @@ shell_back_delete( Backend *be, Connection *conn, Operation *op, - char *dn + char *dn, + char *ndn ) { struct shellinfo *si = (struct shellinfo *) be->be_private; diff --git a/servers/slapd/back-shell/external.h b/servers/slapd/back-shell/external.h index 64c2dce5bc..9c850fb6f2 100644 --- a/servers/slapd/back-shell/external.h +++ b/servers/slapd/back-shell/external.h @@ -17,35 +17,35 @@ extern int shell_back_db_config LDAP_P(( BackendDB *bd, extern int shell_back_bind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, int method, char* mech, + char *dn, char *ndn, int method, char* mech, struct berval *cred, char** edn )); extern int shell_back_unbind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op )); extern int shell_back_search LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - char *base, int scope, int deref, int sizelimit, int timelimit, + Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int sizelimit, int timelimit, Filter *filter, char *filterstr, char **attrs, int attrsonly )); extern int shell_back_compare LDAP_P((BackendDB *bd, Connection *conn, Operation *op, - char *dn, Ava *ava )); + char *dn, char *ndn, Ava *ava )); extern int shell_back_modify LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, LDAPModList *ml )); + char *dn, char *ndn, LDAPModList *ml )); extern int shell_back_modrdn LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, char*newrdn, int deleteoldrdn, + char *dn, char *ndn, char*newrdn, int deleteoldrdn, char *newSuperior )); extern int shell_back_add LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, Entry *e )); extern int shell_back_delete LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, char *dn )); + Connection *conn, Operation *op, char *dn, char *ndn )); extern int shell_back_abandon LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, int msgid )); diff --git a/servers/slapd/back-shell/modify.c b/servers/slapd/back-shell/modify.c index 154bd2a6eb..5408a096da 100644 --- a/servers/slapd/back-shell/modify.c +++ b/servers/slapd/back-shell/modify.c @@ -17,6 +17,7 @@ shell_back_modify( Connection *conn, Operation *op, char *dn, + char *ndn, LDAPModList *ml ) { diff --git a/servers/slapd/back-shell/modrdn.c b/servers/slapd/back-shell/modrdn.c index 1df37d579c..a9c26c4b37 100644 --- a/servers/slapd/back-shell/modrdn.c +++ b/servers/slapd/back-shell/modrdn.c @@ -30,6 +30,7 @@ shell_back_modrdn( Connection *conn, Operation *op, char *dn, + char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior diff --git a/servers/slapd/back-shell/search.c b/servers/slapd/back-shell/search.c index b2b6587719..05de6df7af 100644 --- a/servers/slapd/back-shell/search.c +++ b/servers/slapd/back-shell/search.c @@ -17,6 +17,7 @@ shell_back_search( Connection *conn, Operation *op, char *base, + char *nbase, int scope, int deref, int size, diff --git a/servers/slapd/back-tcl/external.h b/servers/slapd/back-tcl/external.h index ece4c51e62..ff79962782 100644 --- a/servers/slapd/back-tcl/external.h +++ b/servers/slapd/back-tcl/external.h @@ -20,35 +20,35 @@ extern int tcl_back_db_config LDAP_P ((BackendDB * bd, extern int tcl_back_bind LDAP_P ((BackendDB * bd, Connection * conn, Operation * op, - char *dn, int method, char *mech, + char *dn, char *ndn, int method, char *mech, struct berval * cred, char **edn)); extern int tcl_back_unbind LDAP_P ((BackendDB * bd, Connection * conn, Operation * op)); extern int tcl_back_search LDAP_P ((BackendDB * bd, - Connection * conn, Operation * op, - char *base, int scope, int deref, int sizelimit, int timelimit, + Connection * conn, Operation * op, char *base, + char *nbase, int scope, int deref, int sizelimit, int timelimit, Filter * filter, char *filterstr, char **attrs, int attrsonly)); extern int tcl_back_compare LDAP_P ((BackendDB * bd, Connection * conn, Operation * op, - char *dn, Ava * ava)); + char *dn, char *ndn, Ava * ava)); extern int tcl_back_modify LDAP_P ((BackendDB * bd, Connection * conn, Operation * op, - char *dn, LDAPModList * ml)); + char *dn, char *ndn, LDAPModList * ml)); extern int tcl_back_modrdn LDAP_P ((BackendDB * bd, Connection * conn, Operation * op, - char *dn, char *newrdn, int deleteoldrdn, + char *dn, char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior)); extern int tcl_back_add LDAP_P ((BackendDB * bd, Connection * conn, Operation * op, Entry * e)); extern int tcl_back_delete LDAP_P ((BackendDB * bd, - Connection * conn, Operation * op, char *dn)); + Connection * conn, Operation * op, char *dn, char *ndn)); extern int tcl_back_abandon LDAP_P ((BackendDB * bd, Connection * conn, Operation * op, int msgid)); diff --git a/servers/slapd/back-tcl/tcl_bind.c b/servers/slapd/back-tcl/tcl_bind.c index a26da559f9..7adc9ef01f 100644 --- a/servers/slapd/back-tcl/tcl_bind.c +++ b/servers/slapd/back-tcl/tcl_bind.c @@ -22,6 +22,7 @@ tcl_back_bind ( Connection * conn, Operation * op, char *dn, + char *ndn, int method, char *mech, struct berval *cred, diff --git a/servers/slapd/back-tcl/tcl_compare.c b/servers/slapd/back-tcl/tcl_compare.c index 06d23f54de..7f9ba0ea30 100644 --- a/servers/slapd/back-tcl/tcl_compare.c +++ b/servers/slapd/back-tcl/tcl_compare.c @@ -22,6 +22,7 @@ tcl_back_compare ( Connection * conn, Operation * op, char *dn, + char *ndn, Ava * ava ) { diff --git a/servers/slapd/back-tcl/tcl_delete.c b/servers/slapd/back-tcl/tcl_delete.c index 53946ec63c..e55d399044 100644 --- a/servers/slapd/back-tcl/tcl_delete.c +++ b/servers/slapd/back-tcl/tcl_delete.c @@ -20,7 +20,8 @@ tcl_back_delete ( Backend * be, Connection * conn, Operation * op, - char *dn + char *dn, + char *ndn ) { char *command, *suf_tcl, *results; diff --git a/servers/slapd/back-tcl/tcl_modify.c b/servers/slapd/back-tcl/tcl_modify.c index e79bc943d8..44d342ba1d 100644 --- a/servers/slapd/back-tcl/tcl_modify.c +++ b/servers/slapd/back-tcl/tcl_modify.c @@ -22,6 +22,7 @@ tcl_back_modify ( Connection * conn, Operation * op, char *dn, + char *ndn, LDAPModList * modlist ) { diff --git a/servers/slapd/back-tcl/tcl_modrdn.c b/servers/slapd/back-tcl/tcl_modrdn.c index d6aa9fbdf3..e3f7299172 100644 --- a/servers/slapd/back-tcl/tcl_modrdn.c +++ b/servers/slapd/back-tcl/tcl_modrdn.c @@ -35,6 +35,7 @@ tcl_back_modrdn ( Connection * conn, Operation * op, char *dn, + char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior diff --git a/servers/slapd/back-tcl/tcl_search.c b/servers/slapd/back-tcl/tcl_search.c index a26c4820f7..921c9f9527 100644 --- a/servers/slapd/back-tcl/tcl_search.c +++ b/servers/slapd/back-tcl/tcl_search.c @@ -22,6 +22,7 @@ tcl_back_search ( Connection * conn, Operation * op, char *base, + char *nbase, int scope, int deref, int sizelimit, diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index d42080d70f..a285c0328b 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -109,15 +109,16 @@ do_bind( goto cleanup; } - ndn = ch_strdup( dn ); - - if ( dn_normalize_case( ndn ) == NULL ) { + if ( dn_normalize( dn ) == NULL ) { Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n", dn, 0, 0 ); send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL, "invalid DN", NULL, NULL ); goto cleanup; } + ndn = ch_strdup( dn ); + ldap_pvt_str2upper( ndn ); + op->o_protocol = version; if( method != LDAP_AUTH_SASL ) { @@ -286,7 +287,7 @@ do_bind( /* deref suffix alias if appropriate */ ndn = suffix_alias( be, ndn ); - if ( (*be->be_bind)( be, conn, op, ndn, method, mech, &cred, &edn ) == 0 ) { + if ( (*be->be_bind)( be, conn, op, dn, ndn, method, mech, &cred, &edn ) == 0 ) { ldap_pvt_thread_mutex_lock( &conn->c_mutex ); conn->c_cdn = dn; diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 1176265b41..0ad02a5b9f 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -29,7 +29,7 @@ do_compare( Operation *op ) { - char *ndn; + char *dn, *ndn; Ava ava; Backend *be; int rc = LDAP_SUCCESS; @@ -56,7 +56,7 @@ do_compare( * } */ - if ( ber_scanf( op->o_ber, "{a{ao}}", &ndn, &ava.ava_type, + if ( ber_scanf( op->o_ber, "{a{ao}}", &dn, &ava.ava_type, &ava.ava_value ) == LBER_ERROR ) { Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 ); send_ldap_disconnect( conn, op, @@ -64,17 +64,17 @@ do_compare( return -1; } - if( dn_normalize_case( ndn ) == NULL ) { - Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", ndn, 0, 0 ); + if( dn_normalize( dn ) == NULL ) { + Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", dn, 0, 0 ); send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL, "invalid DN", NULL, NULL ); - free( ndn ); + free( dn ); ava_free( &ava, 0 ); return rc; } if( ( rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) { - free( ndn ); + free( dn ); ava_free( &ava, 0 ); Debug( LDAP_DEBUG_ANY, "do_compare: get_ctrls failed\n", 0, 0, 0 ); return rc; @@ -83,10 +83,13 @@ do_compare( value_normalize( ava.ava_value.bv_val, attr_syntax( ava.ava_type ) ); Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n", - ndn, ava.ava_type, ava.ava_value.bv_val ); + dn, ava.ava_type, ava.ava_value.bv_val ); Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n", - op->o_connid, op->o_opid, ndn, ava.ava_type, 0 ); + op->o_connid, op->o_opid, dn, ava.ava_type, 0 ); + + ndn = ch_strdup( dn ); + ldap_pvt_str2upper( ndn ); /* * We could be serving multiple database backends. Select the @@ -94,6 +97,7 @@ do_compare( * if we don't hold it. */ if ( (be = select_backend( ndn )) == NULL ) { + free( dn ); free( ndn ); ava_free( &ava, 0 ); @@ -106,12 +110,13 @@ do_compare( ndn = suffix_alias( be, ndn ); if ( be->be_compare ) { - (*be->be_compare)( be, conn, op, ndn, &ava ); + (*be->be_compare)( be, conn, op, dn, ndn, &ava ); } else { send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM, NULL, "Function not implemented", NULL, NULL ); } + free( dn ); free( ndn ); ava_free( &ava, 0 ); diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index 292e1019e4..235a425c0c 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -30,7 +30,7 @@ do_delete( Operation *op ) { - char *ndn; + char *dn, *ndn; Backend *be; int rc; @@ -50,29 +50,32 @@ do_delete( * DelRequest := DistinguishedName */ - if ( ber_scanf( op->o_ber, "a", &ndn ) == LBER_ERROR ) { + if ( ber_scanf( op->o_ber, "a", &dn ) == LBER_ERROR ) { Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 ); send_ldap_disconnect( conn, op, LDAP_PROTOCOL_ERROR, "decoding error" ); return -1; } - if( dn_normalize_case( ndn ) == NULL ) { - Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n", ndn, 0, 0 ); + if( dn_normalize( dn ) == NULL ) { + Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n", dn, 0, 0 ); send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL, "invalid DN", NULL, NULL ); - free( ndn ); + free( dn ); return rc; } if( ( rc = get_ctrls( conn, op, 1 ) ) != LDAP_SUCCESS ) { - free( ndn ); + free( dn ); Debug( LDAP_DEBUG_ANY, "do_add: get_ctrls failed\n", 0, 0, 0 ); return rc; } - Debug( LDAP_DEBUG_ARGS, "do_delete: dn (%s)\n", ndn, 0, 0 ); - Debug( LDAP_DEBUG_STATS, "DEL dn=\"%s\"\n", ndn, 0, 0 ); + Debug( LDAP_DEBUG_ARGS, "do_delete: dn (%s)\n", dn, 0, 0 ); + Debug( LDAP_DEBUG_STATS, "DEL dn=\"%s\"\n", dn, 0, 0 ); + + ndn = ch_strdup( dn ); + ldap_pvt_str2upper( ndn ); /* * We could be serving multiple database backends. Select the @@ -82,6 +85,7 @@ do_delete( if ( (be = select_backend( ndn )) == NULL ) { send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL, default_referral, NULL ); + free( dn ); free( ndn ); return rc; } @@ -89,6 +93,7 @@ do_delete( if ( global_readonly || be->be_readonly ) { Debug( LDAP_DEBUG_ANY, "do_delete: database is read-only\n", 0, 0, 0 ); + free( dn ); free( ndn ); send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL, "database is read-only", NULL, NULL ); @@ -111,13 +116,13 @@ do_delete( strcmp( be->be_update_ndn, op->o_ndn ) == 0 ) #endif { - if ( (*be->be_delete)( be, conn, op, ndn ) == 0 ) { + if ( (*be->be_delete)( be, conn, op, dn, ndn ) == 0 ) { #ifdef SLAPD_MULTIMASTER if (be->be_update_ndn == NULL || strcmp( be->be_update_ndn, op->o_ndn )) #endif { - replog( be, op, ndn, NULL ); + replog( be, op, dn, NULL ); } } #ifndef SLAPD_MULTIMASTER @@ -132,6 +137,7 @@ do_delete( NULL, "Function not implemented", NULL, NULL ); } + free( dn ); free( ndn ); return rc; } diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 8e3521bfac..7a61fc1cd6 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -35,7 +35,7 @@ do_modify( Operation *op ) { - char *ndn; + char *dn, *ndn; char *last; ber_tag_t tag; ber_len_t len; @@ -76,20 +76,20 @@ do_modify( * } */ - if ( ber_scanf( op->o_ber, "{a" /*}*/, &ndn ) == LBER_ERROR ) { + if ( ber_scanf( op->o_ber, "{a" /*}*/, &dn ) == LBER_ERROR ) { Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 ); send_ldap_disconnect( conn, op, LDAP_PROTOCOL_ERROR, "decoding error" ); return -1; } - Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", ndn, 0, 0 ); + Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn, 0, 0 ); - if( dn_normalize_case( ndn ) == NULL ) { - Debug( LDAP_DEBUG_ANY, "do_modify: invalid dn (%s)\n", ndn, 0, 0 ); + if( dn_normalize( dn ) == NULL ) { + Debug( LDAP_DEBUG_ANY, "do_modify: invalid dn (%s)\n", dn, 0, 0 ); send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL, "invalid DN", NULL, NULL ); - free( ndn ); + free( dn ); return rc; } @@ -111,7 +111,7 @@ do_modify( { send_ldap_disconnect( conn, op, LDAP_PROTOCOL_ERROR, "decoding modlist error" ); - free( ndn ); + free( dn ); free( *modtail ); *modtail = NULL; modlist_free( modlist ); @@ -129,7 +129,7 @@ do_modify( (long) (*modtail)->ml_op, 0, 0 ); send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL, "unrecognized modify operation", NULL, NULL ); - free( ndn ); + free( dn ); modlist_free( modlist ); return LDAP_PROTOCOL_ERROR; } @@ -144,7 +144,7 @@ do_modify( send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL, "unrecognized modify operation without values", NULL, NULL ); - free( ndn ); + free( dn ); modlist_free( modlist ); return LDAP_PROTOCOL_ERROR; } @@ -165,14 +165,17 @@ do_modify( #endif if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) { - free( ndn ); + free( dn ); modlist_free( modlist ); Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 ); return rc; } Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MOD dn=\"%s\"\n", - op->o_connid, op->o_opid, ndn, 0, 0 ); + op->o_connid, op->o_opid, dn, 0, 0 ); + + ndn = ch_strdup( ndn ); + ldap_pvt_str2upper( ndn ); /* * We could be serving multiple database backends. Select the @@ -180,6 +183,7 @@ do_modify( * if we don't hold it. */ if ( (be = select_backend( ndn )) == NULL ) { + free( dn ); free( ndn ); modlist_free( modlist ); send_ldap_result( conn, op, rc = LDAP_REFERRAL, @@ -220,6 +224,7 @@ do_modify( rc = add_modified_attrs( op, &modlist ); if( rc != LDAP_SUCCESS ) { + free( dn ); free( ndn ); modlist_free( modlist ); send_ldap_result( conn, op, rc, @@ -229,14 +234,14 @@ do_modify( } } - if ( (*be->be_modify)( be, conn, op, ndn, modlist ) == 0 + if ( (*be->be_modify)( be, conn, op, dn, ndn, modlist ) == 0 #ifdef SLAPD_MULTIMASTER && ( be->be_update_ndn == NULL || strcmp( be->be_update_ndn, op->o_ndn ) != 0 ) #endif ) { /* but we log only the ones not from a replicator user */ - replog( be, op, ndn, modlist ); + replog( be, op, dn, modlist ); } #ifndef SLAPD_MULTIMASTER @@ -253,6 +258,7 @@ do_modify( } done: + free( dn ); free( ndn ); modlist_free( modlist ); return rc; diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 14d643545b..60441237f4 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -43,7 +43,7 @@ do_modrdn( Operation *op ) { - char *ndn, *newrdn; + char *dn, *ndn, *newrdn; ber_int_t deloldrdn; Backend *be; /* Vars for LDAP v3 newSuperior support */ @@ -74,7 +74,7 @@ do_modrdn( * } */ - if ( ber_scanf( op->o_ber, "{aab", &ndn, &newrdn, &deloldrdn ) + if ( ber_scanf( op->o_ber, "{aab", &dn, &newrdn, &deloldrdn ) == LBER_ERROR ) { Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 ); send_ldap_disconnect( conn, op, @@ -82,11 +82,11 @@ do_modrdn( return -1; } - if( dn_normalize_case( ndn ) == NULL ) { - Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n", ndn, 0, 0 ); + if( dn_normalize( dn ) == NULL ) { + Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n", dn, 0, 0 ); send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL, "invalid DN", NULL, NULL ); - free( ndn ); + free( dn ); free( newrdn ); return rc; } @@ -95,7 +95,7 @@ do_modrdn( Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid rdn (%s)\n", newrdn, 0, 0 ); send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL, "invalid RDN", NULL, NULL ); - free( ndn ); + free( dn ); free( newrdn ); return rc; } @@ -112,7 +112,7 @@ do_modrdn( 0, 0, 0 ); send_ldap_disconnect( conn, op, LDAP_PROTOCOL_ERROR, "newSuperior requires LDAPv3" ); - free( ndn ); + free( dn ); free( newrdn ); return -1; } @@ -124,7 +124,7 @@ do_modrdn( 0, 0, 0 ); send_ldap_disconnect( conn, op, LDAP_PROTOCOL_ERROR, "decoding error" ); - free( ndn ); + free( dn ); free( newrdn ); return -1; } @@ -143,11 +143,11 @@ do_modrdn( Debug( LDAP_DEBUG_ARGS, "do_modrdn: dn (%s) newrdn (%s) newsuperior (%s)\n", - ndn, newrdn, + dn, newrdn, newSuperior != NULL ? newSuperior : "" ); if ( ber_scanf( op->o_ber, /*{*/ "}") == LBER_ERROR ) { - free( ndn ); + free( dn ); free( newrdn ); free( newSuperior ); free( nnewSuperior ); @@ -164,7 +164,7 @@ do_modrdn( } Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n", - op->o_connid, op->o_opid, ndn, 0, 0 ); + op->o_connid, op->o_opid, dn, 0, 0 ); /* * We could be serving multiple database backends. Select the @@ -172,7 +172,11 @@ do_modrdn( * if we don't hold it. */ + ndn = ch_strdup( dn ); + ldap_pvt_str2upper( ndn ); + if ( (be = select_backend( ndn )) == NULL ) { + free( dn ); free( ndn ); free( newrdn ); free( newSuperior ); @@ -203,6 +207,7 @@ do_modrdn( send_ldap_result( conn, op, rc, NULL, NULL, NULL, NULL ); + free( dn ); free( ndn ); free( newrdn ); free( newSuperior ); @@ -231,7 +236,7 @@ do_modrdn( strcmp( be->be_update_ndn, op->o_ndn ) == 0 ) #endif { - if ( (*be->be_modrdn)( be, conn, op, ndn, newrdn, + if ( (*be->be_modrdn)( be, conn, op, dn, ndn, newrdn, deloldrdn, newSuperior ) == 0 #ifdef SLAPD_MULTIMASTER && ( be->be_update_ndn == NULL || @@ -243,7 +248,7 @@ do_modrdn( moddn.deloldrdn = deloldrdn; moddn.newsup = newSuperior; - replog( be, op, ndn, &moddn ); + replog( be, op, dn, &moddn ); } #ifndef SLAPD_MULTIMASTER } else { @@ -257,6 +262,7 @@ do_modrdn( } done: + free( dn ); free( ndn ); free( newrdn ); free( newSuperior ); diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 32a797d249..3e28c17ae7 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -30,7 +30,7 @@ do_search( int i, err; ber_int_t scope, deref, attrsonly; ber_int_t sizelimit, timelimit; - char *base = NULL, *fstr = NULL; + char *base = NULL, *nbase = NULL, *fstr = NULL; Filter *filter = NULL; char **attrs = NULL; Backend *be; @@ -105,7 +105,7 @@ do_search( goto return_results; } - if( dn_normalize_case( base ) == NULL ) { + if( dn_normalize( base ) == NULL ) { send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX, NULL, "invalid DN", NULL, NULL ); rc = -1; @@ -161,29 +161,32 @@ do_search( "conn=%ld op=%d SRCH base=\"%s\" scope=%d filter=\"%s\"\n", op->o_connid, op->o_opid, base, scope, fstr ); + nbase = ch_strdup( base ); + ldap_pvt_str2upper( nbase ); + if ( scope == LDAP_SCOPE_BASE ) { #if defined( SLAPD_MONITOR_DN ) - if ( strcmp( base, SLAPD_MONITOR_DN ) == 0 ) { + if ( strcmp( nbase, SLAPD_MONITOR_DN ) == 0 ) { monitor_info( conn, op, attrs, attrsonly ); goto return_results; } #endif #if defined( SLAPD_CONFIG_DN ) - if ( strcmp( base, SLAPD_CONFIG_DN ) == 0 ) { + if ( strcmp( nbase, SLAPD_CONFIG_DN ) == 0 ) { config_info( conn, op, attrs, attrsonly ); goto return_results; } #endif #if defined( SLAPD_SCHEMA_DN ) - if ( strcmp( base, SLAPD_SCHEMA_DN ) == 0 ) { + if ( strcmp( nbase, SLAPD_SCHEMA_DN ) == 0 ) { schema_info( conn, op, attrs, attrsonly ); goto return_results; } #endif - if ( strcmp( base, LDAP_ROOT_DSE ) == 0 ) { + if ( strcmp( nbase, LDAP_ROOT_DSE ) == 0 ) { root_dse_info( conn, op, attrs, attrsonly ); goto return_results; } @@ -194,7 +197,7 @@ do_search( * appropriate one, or send a referral to our "referral server" * if we don't hold it. */ - if ( (be = select_backend( base )) == NULL ) { + if ( (be = select_backend( nbase )) == NULL ) { send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL, default_referral, NULL ); @@ -202,11 +205,11 @@ do_search( } /* deref the base if needed */ - base = suffix_alias( be, base ); + nbase = suffix_alias( be, nbase ); /* actually do the search and send the result(s) */ if ( be->be_search ) { - (*be->be_search)( be, conn, op, base, scope, deref, sizelimit, + (*be->be_search)( be, conn, op, base, nbase, scope, deref, sizelimit, timelimit, filter, fstr, attrs, attrsonly ); } else { send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM, @@ -215,6 +218,7 @@ do_search( return_results:; if( base != NULL) free( base ); + if( nbase != NULL) free( nbase ); if( fstr != NULL) free( fstr ); if( filter != NULL) filter_free( filter ); if ( attrs != NULL ) { diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 7cec633145..304a5090d7 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -542,32 +542,32 @@ struct slap_backend_info { /* LDAP Operations Handling Routines */ int (*bi_op_bind) LDAP_P(( BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *dn, int method, char* mechanism, + char *dn, char *ndn, int method, char* mechanism, struct berval *cred, char** edn )); int (*bi_op_unbind) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o )); int (*bi_op_search) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *base, int scope, int deref, + char *base, char *nbase, int scope, int deref, int slimit, int tlimit, Filter *f, char *filterstr, char **attrs, int attrsonly)); int (*bi_op_compare)LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *dn, Ava *ava)); + char *dn, char *ndn, Ava *ava)); int (*bi_op_modify) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *dn, LDAPModList *m)); + char *dn, char *ndn, LDAPModList *m)); int (*bi_op_modrdn) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *dn, char *newrdn, int deleteoldrdn, + char *dn, char *ndn, char *newrdn, int deleteoldrdn, char *newSuperior)); int (*bi_op_add) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, Entry *e)); int (*bi_op_delete) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *dn)); + char *dn, char *ndn)); int (*bi_op_abandon) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, ber_int_t msgid));