[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: commit: ldap/servers/slapd/back-ldbm dn2id.c



> -----Original Message-----
> From: owner-openldap-devel@OpenLDAP.org
> [mailto:owner-openldap-devel@OpenLDAP.org]On Behalf Of Pierangelo
> Masarati

There are other places in the code that depend on this be_issuffix check.
Otherwise the (be) parameter could be completely removed. It looks like
all of that stuff needs to stay...

> Actually I was going to ask if that check in dn_parent was neded at all.
> This is the code before my reworking:
>
> /*
>  * dn_parent - return the dn's parent, in-place
>  */
> char *
> dn_parent(
> 	Backend *be,
> 	const char      *dn )
> {
> 	const char      *s;
> 	int     inquote;
>
> 	if( dn == NULL ) {
> 		return NULL;
> 	}
>
> 	while(*dn != '\0' && ASCII_SPACE(*dn)) {
> 		dn++;
> 	}
>
> 	if( *dn == '\0' ) {
> 		return NULL;
> 	}
>
> 	if ( be != NULL && be_issuffix( be, dn ) ) {
> 		return NULL;
> 	}
>
> 	// ...
>
> In this case, we'd better eliminate all of this.  Note that this implies
> we can eliminate also all the cleanup before calling ldap_str2rdn, because
> it is already performed by the parsing stuff.  I left it in place only
> to allow the be_issuffix() check :)
>
> Ando.
>