]> git.sur5r.net Git - openldap/commitdiff
allow oidmacros in syntax (e.g. AD)
authorPierangelo Masarati <ando@openldap.org>
Thu, 18 Aug 2005 23:34:10 +0000 (23:34 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 18 Aug 2005 23:34:10 +0000 (23:34 +0000)
libraries/libldap/schema.c

index 3a472391d5d4378371c52fd31c59cfec03d770b6..182fe94c9c8d9fe642240efed02a9827edb4c1b7 100644 (file)
@@ -1229,10 +1229,13 @@ parse_woid(const char **sp, int *code)
 
 /* Parse a noidlen */
 static char *
-parse_noidlen(const char **sp, int *code, int *len, int allow_quoted)
+parse_noidlen(const char **sp, int *code, int *len, int flags)
 {
        char * sval;
+       const char *savepos;
        int quoted = 0;
+       int allow_quoted = ( flags & LDAP_SCHEMA_ALLOW_QUOTED );
+       int allow_oidmacro = ( flags & LDAP_SCHEMA_ALLOW_OID_MACRO );
 
        *len = 0;
        /* Netscape puts the SYNTAX value in quotes (incorrectly) */
@@ -1240,9 +1243,22 @@ parse_noidlen(const char **sp, int *code, int *len, int allow_quoted)
                quoted = 1;
                (*sp)++;
        }
+       savepos = *sp;
        sval = ldap_int_parse_numericoid(sp, code, 0);
        if ( !sval ) {
-               return NULL;
+               if ( allow_oidmacro
+                       && *sp == savepos
+                       && *code == LDAP_SCHERR_NODIGIT )
+               {
+                       if ( get_token(sp, &sval) == TK_BAREWORD ) {
+                               int len = *sp - savepos;
+                               sval = LDAP_MALLOC(len+1);
+                               strncpy(sval, savepos, len);
+                               sval[len] = '\0';
+                       }
+               } else {
+                       return NULL;
+               }
        }
        if ( **sp == '{' /*}*/ ) {
                (*sp)++;