From: Howard Chu Date: Tue, 18 Sep 2001 12:03:20 +0000 (+0000) Subject: Fix previous patch, didn't take handle syntax/noidlen properly X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1090 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=84e4b860e101e9e643d9d271806bd38ef3b7650d;p=openldap Fix previous patch, didn't take handle syntax/noidlen properly --- diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c index 09fad74a03..ae482c3086 100644 --- a/libraries/libldap/schema.c +++ b/libraries/libldap/schema.c @@ -1838,11 +1838,25 @@ ldap_str2attributetype( const char * s, int * code, const char ** errp, const in flags); if ( !at->at_syntax_oid ) { if ( flags & LDAP_SCHEMA_ALLOW_OID_MACRO ) { - int len = ss-savepos; - at->at_syntax_oid = LDAP_MALLOC(len+1); - strncpy(at->at_syntax_oid, savepos, - len); - at->at_syntax_oid[len] = 0; + kind = get_token(&ss,&sval); + if (kind == TK_BAREWORD) + { + char *sp = strchr(sval, '{'); + at->at_syntax_oid = sval; + if (sp) + { + *sp++ = 0; + at->at_syntax_len = atoi(sp); + while ( LDAP_DIGIT(*sp) ) + sp++; + if ( *sp != '}' ) { + *code = LDAP_SCHERR_UNEXPTOKEN; + *errp = ss; + ldap_attributetype_free(at); + return NULL; + } + } + } } else { *errp = ss; ldap_attributetype_free(at);