NULL does not meet basic syntax rules.
*/
/* see if asker is listed in dnattr */
string_expand(buf, sizeof(buf), b->a_group_pat, edn, matches);
- (void) dn_normalize_case(buf);
+ if ( dn_normalize_case(buf) == NULL ) {
+ /* did not expand to a valid dn */
+ continue;
+ }
if (backend_group(be, e, buf, op->o_ndn,
b->a_group_oc, b->a_group_at) != 0)
do_add( Connection *conn, Operation *op )
{
BerElement *ber = op->o_ber;
- char *dn, *last;
+ char *dn, *ndn, *last;
ber_len_t len;
ber_tag_t tag;
Entry *e;
return -1;
}
+ ndn = ch_strdup( dn );
+
+ if ( dn_normalize_case( ndn ) == 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;
+ }
+
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
e->e_dn = dn;
- e->e_ndn = dn_normalize_case( ch_strdup( dn ) );
+ e->e_ndn = ndn;
e->e_private = NULL;
dn = NULL;
int count = 0;
e.e_dn = dn;
- e.e_ndn = dn_normalize_case( ch_strdup( dn ) );
+ e.e_ndn = ch_strdup( dn )
+ (void) dn_normalize_case( e.e_ndn );
try_again:
/* set cache mutex */
}
dn = ch_strdup( dn );
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
key.dptr = dn;
key.dsize = strlen( dn ) + 1;
dn = ch_strdup( dn );
Debug( LDAP_DEBUG_TRACE, "=> bdb2i_dn2id( \"%s\" )\n", dn, 0, 0 );
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
/* first check the cache */
if ( (id = bdb2i_cache_find_entry_dn2id( be, &li->li_cache, dn )) != NOID ) {
}
dn = ch_strdup( dn );
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
key.dptr = dn;
key.dsize = strlen( dn ) + 1;
"ldbm_back_modrdn: new parent requested...\n",
0, 0, 0 );
- np_ndn = dn_normalize_case( ch_strdup( np_dn ) );
+ np_ndn = ch_strdup( np_dn );
+ (void) dn_normalize_case( np_ndn );
/* newSuperior == oldParent?, if so ==> ERROR */
build_new_dn( &new_dn, e->e_dn, new_parent_dn, newrdn );
- new_ndn = dn_normalize_case( ch_strdup( new_dn ) );
+ new_ndn = ch_strdup( new_dn );
+ (void) dn_normalize_case( new_ndn );
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
new_ndn, 0, 0 );
}
+#ifdef DNS_DN
if ( dn_type( old_rdn ) == DN_X500 ) {
+#endif
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DN_X500\n",
0, 0, 0 );
}/* if (deleteoldrdn) */
+#ifdef DNS_DN
} else {
0, 0, 0 );
}
+#endif
/* modify memory copy of entry */
if ( bdb2i_back_modify_internal( be, conn, op, dn, &mod[0], e )
struct berval *dummy = NULL;
ent.e_dn = ldap_get_dn(lc->ld, e);
- ent.e_ndn = dn_normalize_case( ch_strdup( ent.e_dn));
+ ent.e_ndn = ch_strdup( ent.e_dn);
+ (void) dn_normalize_case( ent.e_ndn );
ent.e_id = 0;
ent.e_attrs = 0;
ent.e_private = 0;
int count = 0;
e.e_dn = dn;
- e.e_ndn = dn_normalize_case( ch_strdup( dn ) );
+ e.e_ndn = ch_strdup( dn );
+ (void) dn_normalize_case( e.e_ndn );
try_again:
/* set cache mutex */
}
dn = ch_strdup( dn );
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
key.dptr = dn;
key.dsize = strlen( dn ) + 1;
dn = ch_strdup( dn );
Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 );
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
/* first check the cache */
if ( (id = cache_find_entry_dn2id( be, &li->li_cache, dn )) != NOID ) {
}
dn = ch_strdup( dn );
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
key.dptr = dn;
key.dsize = strlen( dn ) + 1;
"ldbm_back_modrdn: new parent requested...\n",
0, 0, 0 );
- np_ndn = dn_normalize_case( ch_strdup( np_dn ) );
+ np_ndn = ch_strdup( np_dn );
+ (void) dn_normalize_case( np_ndn );
/* newSuperior == oldParent?, if so ==> ERROR */
/* newSuperior == entry being moved?, if so ==> ERROR */
build_new_dn( &new_dn, e->e_dn, new_parent_dn, newrdn );
- new_ndn = dn_normalize_case( ch_strdup(new_dn) );
+ new_ndn = ch_strdup(new_dn);
+ (void) dn_normalize_case( new_ndn );
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
new_ndn, 0, 0 );
}
+#ifdef DNS_DN
if ( dn_type( old_rdn ) == DN_X500 ) {
+#endif
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DN_X500\n",
0, 0, 0 );
old_rdn_val, 0, 0 );
}
+#ifdef DNS_DN
} else {
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DNS DN\n",
0, 0, 0 );
goto return_results;
}
+#endif
/* modify memory copy of entry */
if ( ldbm_modify_internal( be, conn, op, dn, &mod[0], e )
/* rdn attribute type should be a configuratable item */
sprintf( buf, "uid=%s,%s", pw->pw_name, be->be_suffix[0] );
e->e_dn = ch_strdup( buf );
- e->e_ndn = dn_normalize_case( ch_strdup( buf ) );
+ e->e_ndn = ch_strdup( buf );
+ (void) dn_normalize_case( e->e_ndn );
val.bv_val = pw->pw_name;
val.bv_len = strlen( pw->pw_name );
ber_int_t version;
ber_tag_t method;
char *mech;
- char *cdn, *ndn;
+ char *dn, *ndn;
ber_tag_t tag;
int rc = LDAP_SUCCESS;
struct berval cred;
Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
- cdn = NULL;
+ dn = NULL;
ndn = NULL;
mech = NULL;
cred.bv_val = NULL;
* }
*/
- tag = ber_scanf( ber, "{iat" /*}*/, &version, &cdn, &method );
+ tag = ber_scanf( ber, "{iat" /*}*/, &version, &dn, &method );
if ( tag == LBER_ERROR ) {
Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
goto cleanup;
}
+ ndn = ch_strdup( dn );
+
+ if ( dn_normalize_case( ndn ) == 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;
+ }
+
op->o_protocol = version;
if( method != LDAP_AUTH_SASL ) {
if( method == LDAP_AUTH_SASL ) {
Debug( LDAP_DEBUG_TRACE, "do_sasl_bind: dn (%s) mech %s\n",
- cdn, mech, NULL );
+ dn, mech, NULL );
} else {
Debug( LDAP_DEBUG_TRACE, "do_bind: version %d dn (%s) method %d\n",
- version, cdn, method );
+ version, dn, method );
}
- ndn = dn_normalize_case( ch_strdup( cdn ) );
-
Statslog( LDAP_DEBUG_STATS, "conn=%d op=%d BIND dn=\"%s\" method=%d\n",
op->o_connid, op->o_opid, ndn, method, 0 );
if ( (*be->be_bind)( be, conn, op, ndn, method, mech, &cred, &edn ) == 0 ) {
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
- conn->c_cdn = cdn;
- cdn = NULL;
+ conn->c_cdn = dn;
+ dn = NULL;
if(edn != NULL) {
conn->c_dn = edn;
}
cleanup:
- if( cdn != NULL ) {
- free( cdn );
+ if( dn != NULL ) {
+ free( dn );
}
if( ndn != NULL ) {
free( ndn );
return -1;
}
+ if( dn_normalize_case( ndn ) == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", ndn, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
+ "invalid DN", NULL, NULL );
+ free( ndn );
+ ava_free( &ava, 0 );
+ return rc;
+ }
+
if( ( rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
free( ndn );
ava_free( &ava, 0 );
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
ndn, ava.ava_type, ava.ava_value.bv_val );
- ndn = dn_normalize_case( ndn );
-
Statslog( LDAP_DEBUG_STATS, "conn=%d op=%d CMP dn=\"%s\" attr=\"%s\"\n",
op->o_connid, op->o_opid, ndn, ava.ava_type, 0 );
fname, lineno, 0 );
} else {
be->be_root_dn = ch_strdup( cargv[1] );
- be->be_root_ndn = dn_normalize_case( ch_strdup( cargv[1] ) );
+ be->be_root_ndn = ch_strdup( cargv[1] );
+
+ if( dn_normalize_case( be->be_root_ndn ) == NULL ) {
+ free( be->be_root_dn );
+ free( be->be_root_ndn );
+ Debug( LDAP_DEBUG_ANY,
+"%s: line %d: rootdn DN is invalid\n",
+ fname, lineno, 0 );
+ return( 1 );
+ }
}
/* set super-secret magic database password */
fname, lineno, 0 );
} else {
be->be_update_ndn = ch_strdup( cargv[1] );
- (void) dn_normalize_case( be->be_update_ndn );
+ if( dn_normalize_case( be->be_update_ndn ) == NULL ) {
+ Debug( LDAP_DEBUG_ANY,
+"%s: line %d: updatedn DN is invalid\n",
+ fname, lineno, 0 );
+ return 1;
+ }
}
} else if ( strcasecmp( cargv[0], "updateref" ) == 0 ) {
e->e_attrs = NULL;
e->e_dn = ch_strdup( SLAPD_CONFIG_DN );
- e->e_ndn = dn_normalize_case( ch_strdup( SLAPD_CONFIG_DN ));
+ e->e_ndn = ch_strdup( SLAPD_CONFIG_DN );
+ (void) dn_normalize_case( e->e_ndn );
e->e_private = NULL;
for ( i = 0; i < nbackends; i++ ) {
arg->co_op->o_bind_in_progress = conn->c_bind_in_progress;
arg->co_op->o_dn = ch_strdup( tmpdn != NULL ? tmpdn : "" );
- arg->co_op->o_ndn = dn_normalize_case( ch_strdup( arg->co_op->o_dn ) );
+ arg->co_op->o_ndn = ch_strdup( arg->co_op->o_dn );
+ (void) dn_normalize_case( arg->co_op->o_ndn );
arg->co_op->o_protocol = conn->c_protocol;
arg->co_op->o_connid = conn->c_connid;
return -1;
}
+ if( dn_normalize_case( ndn ) == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n", ndn, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
+ "invalid DN", NULL, NULL );
+ free( ndn );
+ return rc;
+ }
+
if( ( rc = get_ctrls( conn, op, 1 ) ) != LDAP_SUCCESS ) {
free( ndn );
Debug( LDAP_DEBUG_ANY, "do_add: get_ctrls failed\n", 0, 0, 0 );
}
Debug( LDAP_DEBUG_ARGS, "do_delete: dn (%s)\n", ndn, 0, 0 );
-
- dn_normalize_case( ndn );
-
Debug( LDAP_DEBUG_STATS, "DEL dn=\"%s\"\n", ndn, 0, 0 );
/*
* if we don't hold it.
*/
if ( (be = select_backend( ndn )) == NULL ) {
- free( ndn );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
+ free( ndn );
return rc;
}
#include "slap.h"
-#define B4TYPE 0
-#define INTYPE 1
-#define B4EQUAL 2
-#define B4VALUE 3
-#define INVALUE 4
-#define INQUOTEDVALUE 5
-#define B4SEPARATOR 6
+#define B4LEADTYPE 0
+#define B4TYPE 1
+#define INTYPE 2
+#define B4EQUAL 3
+#define B4VALUE 4
+#define INVALUE 5
+#define INQUOTEDVALUE 6
+#define B4SEPARATOR 7
/*
* dn_normalize - put dn into a canonical format. the dn is
- * normalized in place, as well as returned.
+ * normalized in place, as well as returned if valid.
*/
char *
char *d, *s;
int state, gotesc;
- /* Debug( LDAP_DEBUG_TRACE, "=> dn_normalize \"%s\"\n", dn, 0, 0 ); */
-
gotesc = 0;
- state = B4TYPE;
+ state = B4LEADTYPE;
for ( d = s = dn; *s; s++ ) {
switch ( state ) {
+ case B4LEADTYPE:
case B4TYPE:
if ( ! SPACE( *s ) ) {
state = INTYPE;
} else if ( ! SPACE( *s ) ) {
/* not a valid dn - but what can we do here? */
*d++ = *s;
+ dn = NULL;
}
break;
case B4VALUE:
}
break;
default:
+ dn = NULL;
Debug( LDAP_DEBUG_ANY,
"dn_normalize - unknown state %d\n", state, 0, 0 );
break;
}
*d = '\0';
- /* Debug( LDAP_DEBUG_TRACE, "<= dn_normalize \"%s\"\n", dn, 0, 0 ); */
+ if( gotesc ) {
+ /* shouldn't be left in escape */
+ dn = NULL;
+ }
+
+ /* check end state */
+ switch( state ) {
+ case B4LEADTYPE: /* looking for first type */
+ case B4SEPARATOR: /* looking for separator */
+ case INVALUE: /* inside value */
+ break;
+ default:
+ dn = NULL;
+ }
+
return( dn );
}
/*
* dn_normalize_case - put dn into a canonical form suitable for storing
* in a hash database. this involves normalizing the case as well as
- * the format. the dn is normalized in place as well as returned.
+ * the format. the dn is normalized in place as well as returned if valid.
*/
char *
dn_normalize_case( char *dn )
{
+ str2upper( dn );
+
/* normalize format */
- dn_normalize( dn );
+ dn = dn_normalize( dn );
/* and upper case it */
- return( str2upper( dn ) );
+ return( dn );
}
/*
dn = ch_strdup( dn );
+#ifdef DNS_DN
/*
* no =, assume it is a dns name, like blah@some.domain.name
* if the blah@ part is there, return some.domain.name. if
*s = '\0';
return( dn );
}
+#endif
/*
* else assume it is an X.500-style name, which looks like
return( strcmp( dn + dnlen - suffixlen, suffix ) == 0 );
}
+#ifdef DNS_DN
/*
* dn_type - tells whether the given dn is an X.500 thing or DNS thing
* returns (defined in slap.h): DN_DNS dns-style thing
{
return( strchr( dn, '=' ) == NULL ? DN_DNS : DN_X500 );
}
+#endif
char *
str2upper( char *str )
s++;
- }/* while ( *s && SPACE(*s) ) */
+ }
/* Copy word */
*str++ = *s++;
- }/* while ( *s && (*s != d) ) */
+ }
*str = '\0';
return r;
-}/* char * get_word() */
+}
/* rdn_attr_type:
return get_next_substring( s, '=' );
-}/* char * rdn_attr_type() */
+}
/* rdn_attr_value:
return get_next_substring(++str, '\0');
- }/* if ( (str = strpbrk( rdn, "=" )) != NULL ) */
+ }
return NULL;
-}/* char * rdn_attr_value() */
+}
+
+
+int rdn_validate( const char * rdn )
+{
+ /* just a simple check for now */
+ return strchr( rdn, '=' ) != NULL;
+}
/* build_new_dn:
*new_dn = (char *) ch_malloc( strlen( p_dn ) + strlen( newrdn ) + 3 );
+#ifdef DNS_DN
if ( dn_type( e_dn ) == DN_X500 ) {
+#endif
strcpy( *new_dn, newrdn );
strcat( *new_dn, "," );
strcat( *new_dn, p_dn );
+#ifdef DNS_DN
} else {
char *s;
sep[1] = '\0';
strcat( *new_dn, sep );
- }/* if ( (s = strpbrk( dn, ".@" )) != NULL ) */
+ }
- }/* if ( *s != '.' && *s != '@' ) */
+ }
strcat( *new_dn, p_dn );
- }/* if ( dn_type( e_dn ) == DN_X500 ) {}else */
+ }
+#endif
-}/* void build_new_dn() */
+}
e->e_id, e->e_ndn, value );
free( e->e_ndn );
}
- e->e_ndn = dn_normalize_case( ch_strdup( value ) );
+ e->e_ndn = ch_strdup( value );
+ (void) dn_normalize_case( e->e_ndn );
continue;
}
*/
if ( ber_scanf( op->o_ber, "{a" /*}*/, &ndn ) == LBER_ERROR ) {
- Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+ 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 );
- (void) dn_normalize_case( ndn );
+ if( dn_normalize_case( ndn ) == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "do_modify: invalid dn (%s)\n", ndn, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
+ "invalid DN", NULL, NULL );
+ free( ndn );
+ return rc;
+ }
/* collect modifications & save for later */
modlist = NULL;
return -1;
}
+ if( dn_normalize_case( ndn ) == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n", ndn, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
+ "invalid DN", NULL, NULL );
+ free( ndn );
+ free( newrdn );
+ return rc;
+ }
+
+ if( !rdn_validate( newrdn ) ) {
+ 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( newrdn );
+ return rc;
+ }
+
/* Check for newSuperior parameter, if present scan it */
if ( ber_peek_tag( op->o_ber, &length ) == LDAP_TAG_NEWSUPERIOR ) {
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return -1;
+ }
+
+ nnewSuperior = ch_strdup( newSuperior );
+ if( dn_normalize_case( nnewSuperior ) == NULL ) {
+ Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid new superior (%s)\n",
+ newSuperior, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
+ "invalid (new superior) DN", NULL, NULL );
+ free( ndn );
+ free( newrdn );
+ return rc;
}
}
free( ndn );
free( newrdn );
free( newSuperior );
+ free( nnewSuperior );
Debug( LDAP_DEBUG_ANY, "do_modrdn: ber_scanf failed\n", 0, 0, 0 );
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return rc;
}
- if( newSuperior != NULL ) {
- /* GET BACKEND FOR NEW SUPERIOR */
-
- nnewSuperior = strdup( newSuperior );
- dn_normalize_case( nnewSuperior );
-
- if ( (newSuperior_be = select_backend( nnewSuperior ))
- == NULL ) {
-
- /* We do not have a backend for newSuperior so we send
- * a referral.
- * XXX: We may need to do something else here, not sure
- * what though.
- */
-
- Debug( LDAP_DEBUG_ARGS,
- "do_modrdn: cant find backend for=(%s)\n",
- newSuperior, 0, 0 );
-
- free( ndn );
- free( newrdn );
- free( newSuperior );
- free( nnewSuperior );
- send_ldap_result( conn, op, LDAP_REFERRAL,
- NULL, NULL, default_referral, NULL );
- return 0;
- }
- }
-
- dn_normalize_case( ndn );
-
Statslog( LDAP_DEBUG_STATS, "conn=%d op=%d MODRDN dn=\"%s\"\n",
op->o_connid, op->o_opid, ndn, 0, 0 );
return rc;
}
+
/* Make sure that the entry being changed and the newSuperior are in
* the same backend, otherwise we return an error.
*/
+ if( newSuperior != NULL ) {
+ newSuperior_be = select_backend( nnewSuperior );
- if ( (newSuperior_be != NULL) && ( be != newSuperior_be) ) {
+ if ( newSuperior != be ) {
+ /* newSuperior is in same backend */
+ rc = LDAP_AFFECTS_MULTIPLE_DSAS;
- Debug( LDAP_DEBUG_ANY, "dn=(%s), newSuperior=(%s)\n", ndn,
- newSuperior, 0 );
-
- free( ndn );
- free( newrdn );
- free( newSuperior );
- free( nnewSuperior );
-
- send_ldap_result( conn, op, rc = LDAP_AFFECTS_MULTIPLE_DSAS,
- NULL, NULL, NULL, NULL );
-
- return rc;
+ send_ldap_result( conn, op, rc,
+ NULL, NULL, NULL, NULL );
+ free( ndn );
+ free( newrdn );
+ free( newSuperior );
+ free( nnewSuperior );
+
+ return rc;
+ }
}
/*
/* initialize reader/writer lock */
e->e_attrs = NULL;
e->e_dn = ch_strdup( SLAPD_MONITOR_DN );
- e->e_ndn = dn_normalize_case( ch_strdup(SLAPD_MONITOR_DN) );
+ e->e_ndn = ch_strdup(SLAPD_MONITOR_DN);
+ (void) dn_normalize_case( e->e_ndn );
e->e_private = NULL;
val.bv_val = (char *) Versionstr;
char * dn_parent LDAP_P(( Backend *be, char *dn ));
char * dn_rdn LDAP_P(( Backend *be, char *dn ));
int dn_issuffix LDAP_P(( char *dn, char *suffix ));
+#ifdef DNS_DN
int dn_type LDAP_P(( char *dn ));
+#endif
char * str2upper LDAP_P(( char *str ));
char * str2lower LDAP_P(( char *str ));
+int rdn_validate LDAP_P(( const char* str ));
char * rdn_attr_value LDAP_P(( char * rdn ));
char * rdn_attr_type LDAP_P(( char * rdn ));
void build_new_dn LDAP_P(( char ** new_dn, char *e_dn, char * p_dn,
e->e_attrs = NULL;
e->e_dn = ch_strdup( LDAP_ROOT_DSE );
- e->e_ndn = dn_normalize_case( ch_strdup( LDAP_ROOT_DSE ));
+ e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
+ (void) dn_normalize_case( e->e_ndn );
e->e_private = NULL;
for ( i = 0; i < nbackends; i++ ) {
e->e_attrs = NULL;
e->e_dn = ch_strdup( SLAPD_SCHEMA_DN );
- e->e_ndn = dn_normalize_case( ch_strdup( SLAPD_SCHEMA_DN ));
+ e->e_ndn = ch_strdup( SLAPD_SCHEMA_DN );
+ (void) dn_normalize_case( e->e_ndn );
e->e_private = NULL;
val.bv_val = ch_strdup( "top" );
goto return_results;
}
- (void) dn_normalize_case( base );
+ if( dn_normalize_case( base ) == NULL ) {
+ send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX,
+ NULL, "invalid DN", NULL, NULL );
+ rc = -1;
+ goto return_results;
+ }
Debug( LDAP_DEBUG_ARGS, "SRCH \"%s\" %d %d", base, scope, deref );
Debug( LDAP_DEBUG_ARGS, " %d %d %d\n", sizelimit, timelimit,
*/
#define LDAP_MOD_SOFTADD 0x1000
+#ifdef DNS_DN
#define DN_DNS 0
#define DN_X500 1
+#endif
#define ON 1
#define OFF (-1)
fprintf( stderr, "entry %ld has no dn\n",
id );
} else {
- key.dptr = dn_normalize_case( val );
+ (void) dn_normalize_case( val );
+ key.dptr = val;
key.dsize = strlen( val ) + 1;
data.dptr = (char *) &id;
data.dsize = sizeof(ID);
== NULL ) {
pid = 0;
} else {
- key.dptr =
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
+ key.dptr = dn;
key.dsize = strlen( dn ) + 1;
data = ldbm_fetch( db->dbc_db,
key );
free( dn );
if ( data.dptr == NULL ) {
- dn_normalize_case( val );
+ (void) dn_normalize_case( val );
if ( ! be_issuffix( be,
val ) ) {
Debug( LDAP_DEBUG_PARSE, "no parent \"%s\" of \"%s\"\n", dn, val, 0 );
fprintf( stderr, "entry %ld has no dn\n",
id );
} else {
- key.dptr = dn_normalize_case( val );
+ (void) dn_normalize_case( val );
+ key.dptr = val;
key.dsize = strlen( val ) + 1;
data.dptr = (char *) &id;
data.dsize = sizeof(ID);
== NULL ) {
pid = 0;
} else {
- key.dptr =
- dn_normalize_case( dn );
+ (void) dn_normalize_case( dn );
+ key.dptr = dn;
key.dsize = strlen( dn ) + 1;
data = ldbm_fetch( db->dbc_db,
key );
free( dn );
if ( data.dptr == NULL ) {
- dn_normalize_case( val );
+ (void) dn_normalize_case( val );
if ( ! be_issuffix( be,
val ) ) {
Debug( LDAP_DEBUG_PARSE, "no parent \"%s\" of \"%s\"\n", dn, val, 0 );