X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fschema.c;h=86f26e638828c28f3ecc4980e37e3796454960c7;hb=de01a6e3d791d3458549d2ceeccf4d7e0477ff78;hp=f478e003241b6e1af270d38fc79228caedec719b;hpb=5be72fe816c19d055357b2d63b9692f9429cde50;p=openldap
diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c
index f478e00324..86f26e6388 100644
--- a/libraries/libldap/schema.c
+++ b/libraries/libldap/schema.c
@@ -1,7 +1,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1028,7 +1028,7 @@ get_token( const char ** sp, char ** token_val )
**sp != '$' &&
**sp != '\'' &&
/* for suggested minimum upper bound on the number
- * of characters */
+ * of characters (RFC 4517) */
**sp != '{' &&
**sp != '\0' )
(*sp)++;
@@ -1414,16 +1414,20 @@ add_extension(LDAPSchemaExtensionItem ***extensions,
if ( !*extensions ) {
*extensions =
LDAP_CALLOC(2, sizeof(LDAPSchemaExtensionItem *));
- if ( !*extensions )
- return 1;
+ if ( !*extensions ) {
+ LDAP_FREE( ext );
+ return 1;
+ }
n = 0;
} else {
for ( n=0; (*extensions)[n] != NULL; n++ )
;
tmp = LDAP_REALLOC(*extensions,
(n+2)*sizeof(LDAPSchemaExtensionItem *));
- if ( !tmp )
+ if ( !tmp ) {
+ LDAP_FREE( ext );
return 1;
+ }
*extensions = tmp;
}
(*extensions)[n] = ext;
@@ -3231,6 +3235,21 @@ ldap_str2nameform( LDAP_CONST char * s,
seen_obsolete = 1;
nf->nf_obsolete = LDAP_SCHEMA_YES;
parse_whsp(&ss);
+ } else if ( !strcasecmp(sval,"OC") ) {
+ LDAP_FREE(sval);
+ if ( seen_class ) {
+ *code = LDAP_SCHERR_DUPOPT;
+ *errp = ss;
+ ldap_nameform_free(nf);
+ return(NULL);
+ }
+ seen_class = 1;
+ nf->nf_objectclass = parse_woid(&ss,code);
+ if ( !nf->nf_objectclass ) {
+ *errp = ss;
+ ldap_nameform_free(nf);
+ return NULL;
+ }
} else if ( !strcasecmp(sval,"MUST") ) {
LDAP_FREE(sval);
if ( seen_must ) {