int
be_isroot( Backend *be, char *dn )
{
- if ( dn == NULL ) {
+ int rc;
+ char *ndn;
+
+ if ( dn == NULL || be->be_rootdn == NULL ) {
return( 0 );
}
- return( be->be_rootdn != NULL
- ? strcasecmp( be->be_rootdn, dn ) == 0
- : 0 );
+ ndn = dn_normalize_case( ch_strdup( dn ) );
+ rc = strcmp( be->be_rootdn, ndn ) ? 0 : 1;
+
+ free(ndn);
+ return(rc);
}
int
read_config( char *fname, Backend **bep, FILE *pfp )
{
FILE *fp;
- char *line, *savefname, *dn;
+ char *line, *savefname;
int cargc, savelineno;
char *cargv[MAXARGS];
int lineno, i;
"%s: line %d: suffix line must appear inside a database definition (ignored)\n",
fname, lineno, 0 );
} else {
- dn = ch_strdup( cargv[1] );
+ char *dn = ch_strdup( cargv[1] );
(void) dn_normalize( dn );
charray_add( &be->be_suffix, dn );
}
"%s: line %d: suffixAlias line must appear inside a database definition (ignored)\n",
fname, lineno, 0 );
} else {
- dn = ch_strdup( cargv[1] );
+ char *dn = ch_strdup( cargv[1] );
(void) dn_normalize( dn );
charray_add( &be->be_suffixAlias, dn );
"%s: line %d: rootdn line must appear inside a database definition (ignored)\n",
fname, lineno, 0 );
} else {
- dn = ch_strdup( cargv[1] );
- (void) dn_normalize( dn );
- be->be_rootdn = dn;
+ be->be_rootdn = dn_normalize_case( ch_strdup( cargv[1] ) );
}
/* set super-secret magic database password */