Fix nameAndOptionalIdentifer syntax.
char *match,
regmatch_t *matches)
{
- int size;
+ ber_len_t size;
char *sp;
char *dp;
int flag;
/* Create an entry corresponding to the base DN */
e = (Entry *) ch_calloc(1, sizeof(Entry));
e->e_attrs = NULL;
- e->e_dn = ch_strdup( base );
+ e->e_name.bv_val = ch_strdup( base );
+ e->e_name.bv_len = strlen( e->e_name.bv_val );
- e->e_ndn = ch_strdup( e->e_dn );
- (void) dn_normalize( e->e_ndn );
+ e->e_nname.bv_val = ch_strdup( base );
+ (void) dn_normalize( e->e_nname.bv_val );
+ e->e_nname.bv_len = strlen( e->e_nname.bv_val );
/* Use the first attribute of the DN
* as an attribute within the entry itself.
vals[1] = NULL;
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
+ e->e_private = NULL;
+ e->e_attrs = NULL;
+
+ e->e_name.bv_val = SLAPD_CONFIG_DN;
+ e->e_name.bv_len = sizeof( SLAPD_CONFIG_DN ) - 1;
+
e->e_attrs = NULL;
ber_str2bv( SLAPD_CONFIG_DN, sizeof(SLAPD_CONFIG_DN)-1, 1, &e->e_name );
- dnNormalize( NULL, &e->e_name, &ndn );
+ (void) dnNormalize( NULL, &e->e_name, &ndn );
e->e_nname = *ndn;
free( ndn );
e->e_private = NULL;
return NULL;
}
- e->e_nname.bv_val = ndn->bv_val;
- e->e_nname.bv_len = ndn->bv_len;
+ e->e_nname = *ndn;
free( ndn );
}
}
} else {
/* check for unescaped rdn separator */
- if ( !DN_SEPARATOR( ndn->bv_val[d-1] ) || DN_ESCAPE( ndn->bv_val[d-2] ) ) {
+ if ( !DN_SEPARATOR( ndn->bv_val[d-1] )
+ || DN_ESCAPE( ndn->bv_val[d-2] ) )
+ {
break;
}
}
if ( ndn->bv_len == 0 ) {
break;
}
- if ( regexec( &lm[0]->lm_dn_regex, ndn->bv_val, 0, NULL, 0 ) == 0 ) {
+ if ( regexec( &lm[0]->lm_dn_regex, ndn->bv_val, 0, NULL, 0 )
+ == 0 )
+ {
*limit = &lm[0]->lm_limits;
return( 0 );
}
return( 0 );
}
-int
+static int
add_limits(
Backend *be,
int type,
*/
LDAP_SLAPD_F (int) get_limits LDAP_P((
Backend *be, struct berval *ndn, struct slap_limits_set **limit ));
-LDAP_SLAPD_F (int) add_limits LDAP_P((
- Backend *be, int type, const char *pattern,
- struct slap_limits_set *limit ));
LDAP_SLAPD_F (int) parse_limits LDAP_P((
Backend *be, const char *fname, int lineno, int argc, char **argv ));
LDAP_SLAPD_F (int) parse_limit LDAP_P(( const char *arg,
if ( ! access_allowed( be, conn, op, e, desc, NULL, ACL_READ ) ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
- "send_search_entry: conn %d access to attribute %s not allowed\n",
- op->o_connid, desc->ad_cname.bv_val ));
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO, "send_search_entry: "
+ "conn %d access to attribute %s not allowed\n",
+ op->o_connid, desc->ad_cname.bv_val ));
#else
- Debug( LDAP_DEBUG_ACL, "acl: access to attribute %s not allowed\n",
+ Debug( LDAP_DEBUG_ACL, "acl: "
+ "access to attribute %s not allowed\n",
desc->ad_cname.bv_val, 0, 0 );
#endif
if (( rc = ber_printf( ber, "{O[" /*]}*/ , &desc->ad_cname )) == -1 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "send_search_entry: conn %d ber_printf failed\n",
- op->o_connid ));
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
e->e_attrs = NULL;
- e->e_dn = ch_strdup( LDAP_ROOT_DSE );
- e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
- /* the DN is an empty string so no normalization needed */
+ e->e_name.bv_val = ch_strdup( LDAP_ROOT_DSE );
+ e->e_name.bv_len = sizeof( LDAP_ROOT_DSE )-1;
+ e->e_nname.bv_val = ch_strdup( LDAP_ROOT_DSE );
+ e->e_nname.bv_len = sizeof( LDAP_ROOT_DSE )-1;
+
+ /* the DN is an empty string so no pretty/normalization is needed */
+ assert( !e->e_name.bv_len );
+ assert( !e->e_nname.bv_len );
+
+
e->e_private = NULL;
val.bv_val = "OpenLDAProotDSE";
return EXIT_FAILURE;
}
- /* make sure the DN is a valid rootdse(rootdse is a null string) */
- if( strcmp(e->e_ndn, "") != 0 ) {
+ /* make sure the DN is the empty DN */
+ if( e->e_nname.bv_len ) {
fprintf( stderr,
"root_dse: invalid rootDSE - dn=\"%s\" (line=%d)\n",
e->e_dn, lineno );
e->e_attrs = NULL;
ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1, &e->e_name);
- dnNormalize( NULL, &e->e_name, &ndn );
+ (void) dnNormalize( NULL, &e->e_name, &ndn );
e->e_nname = *ndn;
free( ndn );
e->e_private = NULL;
if( in->bv_len == 0 ) return LDAP_SUCCESS;
dn = ber_bvdup( in );
+ if( !dn ) return LDAP_OTHER;
- if( dn->bv_val[dn->bv_len-1] == '\'' ) {
+ if( dn->bv_val[dn->bv_len-1] == 'B'
+ && dn->bv_val[dn->bv_len-2] == '\'' )
+ {
/* assume presence of optional UID */
ber_len_t i;
- for(i=dn->bv_len-2; i>2; i--) {
+ for(i=dn->bv_len-3; i>1; i--) {
if( dn->bv_val[i] != '0' && dn->bv_val[i] != '1' ) {
break;
}
}
if( dn->bv_val[i] != '\'' ||
- dn->bv_val[i-1] != 'B' ||
- dn->bv_val[i-2] != '#' ) {
+ dn->bv_val[i-1] != '#' ) {
ber_bvfree( dn );
return LDAP_INVALID_SYNTAX;
}
- /* trim the UID to allow use of dn_validate */
- dn->bv_val[i-2] = '\0';
+ /* trim the UID to allow use of dnValidate */
+ dn->bv_val[i-1] = '\0';
+ dn->bv_len = i-1;
}
- /* FIXME: should use dnValidate */
- rc = dn_validate( dn->bv_val ) == NULL
- ? LDAP_INVALID_SYNTAX : LDAP_SUCCESS;
+ rc = dnValidate( NULL, dn );
ber_bvfree( dn );
return rc;
int rc;
if( out->bv_len != 0 ) {
- char *dn;
ber_len_t dnlen;
char *uid = NULL;
ber_len_t uidlen = 0;