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.
This commit is contained in:
Howard Chu 1999-09-18 23:40:03 +00:00
parent 86813f2b4b
commit f991ef04e6
52 changed files with 201 additions and 137 deletions

View file

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

View file

@ -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 );

View file

@ -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 );

View file

@ -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 );

View file

@ -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 ));

View file

@ -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:

View file

@ -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 );

View file

@ -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 );

View file

@ -38,6 +38,7 @@ ldap_back_bind(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
int method,
char *mech,
struct berval *cred,

View file

@ -38,6 +38,7 @@ ldap_back_compare(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
Ava *ava
)
{

View file

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

View file

@ -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 ));

View file

@ -38,6 +38,7 @@ ldap_back_modify(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
LDAPModList *ml
)
{

View file

@ -38,6 +38,7 @@ ldap_back_modrdn(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
char *newrdn,
int deleteoldrdn,
char *newSuperior

View file

@ -42,6 +42,7 @@ ldap_back_search(
Connection *conn,
Operation *op,
char *base,
char *nbase,
int scope,
int deref,
int size,

View file

@ -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 ) {

View file

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

View file

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

View file

@ -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 ));

View file

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

View file

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

View file

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

View file

@ -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,

View file

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

View file

@ -34,6 +34,7 @@ perl_back_bind(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
int method,
char *mech,
struct berval *cred,

View file

@ -32,6 +32,7 @@ perl_back_compare(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
Ava *ava
)
{

View file

@ -25,7 +25,8 @@ perl_back_delete(
Backend *be,
Connection *conn,
Operation *op,
char *dn
char *dn,
char *ndn
)
{
int len;

View file

@ -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

View file

@ -27,6 +27,7 @@ perl_back_modify(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
LDAPModList *modlist
)
{

View file

@ -40,6 +40,7 @@ perl_back_modrdn(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
char *newrdn,
int deleteoldrdn,
char *newSuperior

View file

@ -32,6 +32,7 @@ perl_back_search(
Connection *conn,
Operation *op,
char *base,
char *nbase,
int scope,
int deref,
int sizelimit,

View file

@ -17,6 +17,7 @@ shell_back_bind(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
int method,
char *mech,
struct berval *cred,

View file

@ -17,6 +17,7 @@ shell_back_compare(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
Ava *ava
)
{

View file

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

View file

@ -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 ));

View file

@ -17,6 +17,7 @@ shell_back_modify(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
LDAPModList *ml
)
{

View file

@ -30,6 +30,7 @@ shell_back_modrdn(
Connection *conn,
Operation *op,
char *dn,
char *ndn,
char *newrdn,
int deleteoldrdn,
char *newSuperior

View file

@ -17,6 +17,7 @@ shell_back_search(
Connection *conn,
Operation *op,
char *base,
char *nbase,
int scope,
int deref,
int size,

View file

@ -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));

View file

@ -22,6 +22,7 @@ tcl_back_bind (
Connection * conn,
Operation * op,
char *dn,
char *ndn,
int method,
char *mech,
struct berval *cred,

View file

@ -22,6 +22,7 @@ tcl_back_compare (
Connection * conn,
Operation * op,
char *dn,
char *ndn,
Ava * ava
)
{

View file

@ -20,7 +20,8 @@ tcl_back_delete (
Backend * be,
Connection * conn,
Operation * op,
char *dn
char *dn,
char *ndn
)
{
char *command, *suf_tcl, *results;

View file

@ -22,6 +22,7 @@ tcl_back_modify (
Connection * conn,
Operation * op,
char *dn,
char *ndn,
LDAPModList * modlist
)
{

View file

@ -35,6 +35,7 @@ tcl_back_modrdn (
Connection * conn,
Operation * op,
char *dn,
char *ndn,
char *newrdn,
int deleteoldrdn,
char *newSuperior

View file

@ -22,6 +22,7 @@ tcl_back_search (
Connection * conn,
Operation * op,
char *base,
char *nbase,
int scope,
int deref,
int sizelimit,

View file

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

View file

@ -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 );

View file

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

View file

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

View file

@ -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 );

View file

@ -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 ) {

View file

@ -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));