From 84e4b860e101e9e643d9d271806bd38ef3b7650d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 18 Sep 2001 12:03:20 +0000 Subject: [PATCH] Fix previous patch, didn't take handle syntax/noidlen properly --- libraries/libldap/schema.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) 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); -- 2.39.5