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

inconsistencies in attribute chars macros (ITS#3225)

Full_Name: Pierangelo Masarati
Version: HEAD (possibly 2.2/2.1)
OS: irrlevant
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

In servers/slapd/slap.h the following defines seem to be inconsistent:

#define ATTR_LEADCHAR(c)        ( DESC_LEADCHAR(c) || OID_LEADCHAR(c) )
#define ATTR_CHAR(c)    ( DESC_CHAR((c)) || (c) == '.' )

#define AD_LEADCHAR(c)  ( ATTR_CHAR(c) )
#define AD_CHAR(c)              ( ATTR_CHAR(c) || (c) == ';' )

In fact, a AD_LEADCHAR can be a '.'; apparently, AD_LEADCHAR is not used.
Moreover, since the '.' in an attributeType is only allowed when the
attributeType is in OID form, I'd rather use 

#define ATTR_LEADCHAR(c)        ( DESC_LEADCHAR(c) || OID_LEADCHAR(c) )
#define ATTR_CHAR(c)    ( DESC_CHAR((c)) || OID_CHAR(c) )

#define AD_LEADCHAR(c)  ( ATTR_LEADCHAR(c) )
#define AD_CHAR(c)              ( ATTR_CHAR(c) || (c) == ';' )

Moreover, in servers/slapd/ad.c a static function ad_keystring()
is defined, whose code is a bit odd; I'd replace the first occurrence
of AD_CHAR() with AD_LEADCHAR() as defined above.

Finally, later on in slap_bv2ad the error message "attribute description
contains inappropriate characters", which is mentioned in 
sounds a bit misleading, since it seems to indicate that the error is
in the DESC field of an attributeType, while it is testing the string 
used in the NAME field, i.e. the attributeType itself.  I'd change it to
"attributeType contains inappropriate characters".

I'll prepare a patch, unless there is a reason I'm missing for the code 
to be like that.