X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fschemaparse.c;h=202329978f0562f97dd957ac2bf56f6b541c8940;hb=6147119dc8526a758a7c576940fe8483e2b93915;hp=83865d488bf30e197cc93926df4f20f6fdc3e576;hpb=7f357399cfc635c148789e9728087ee7472bc75b;p=openldap diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index 83865d488b..202329978f 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -1,4 +1,8 @@ /* schemaparse.c - routines to parse config file objectclass definitions */ +/* + * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ #include "portable.h" @@ -10,10 +14,8 @@ #include "slap.h" #include "ldap_schema.h" -ObjectClass *global_oc; static Avlnode *object_classes = NULL; -AttributeType *global_at; int global_schemacheck = 1; /* schemacheck on is default */ static void oc_usage_old(void); @@ -25,7 +27,14 @@ static char *err2text[] = { "Objectclass not found", "Attribute type not found", "Duplicate objectclass", - "Duplicate attributetype" + "Duplicate attributetype", + "Duplicate syntax", + "Duplicate matchingrule", + "OID or name required", + "Syntax or superior required", + "Matchingrule not found", + "Syntax not found", + "Syntax required" }; char * @@ -51,13 +60,16 @@ parse_oc_old( char last; LDAP_OBJECT_CLASS *oc; int code; - char *err; + const char *err; char **namep; oc = (LDAP_OBJECT_CLASS *) ch_calloc( 1, sizeof(LDAP_OBJECT_CLASS) ); oc->oc_names = ch_calloc( 2, sizeof(char *) ); oc->oc_names[0] = ch_strdup( argv[1] ); oc->oc_names[1] = NULL; + if ( strcasecmp( oc->oc_names[0], "top" ) ) { + oc->oc_kind = LDAP_SCHEMA_STRUCTURAL; + } for ( i = 2; i < argc; i++ ) { /* required attributes */ if ( strcasecmp( argv[i], "requires" ) == 0 ) { @@ -105,7 +117,7 @@ parse_oc_old( if ( code ) { fprintf( stderr, "%s: line %d: %s %s\n", fname, lineno, scherr2str(code), *namep); - exit( 1 ); + exit( EXIT_FAILURE ); } namep++; } @@ -117,7 +129,7 @@ parse_oc_old( if ( code ) { fprintf( stderr, "%s: line %d: %s %s\n", fname, lineno, scherr2str(code), *namep); - exit( 1 ); + exit( EXIT_FAILURE ); } namep++; } @@ -127,7 +139,7 @@ parse_oc_old( if ( code ) { fprintf( stderr, "%s: line %d: %s %s\n", fname, lineno, scherr2str(code), err); - exit( 1 ); + exit( EXIT_FAILURE ); } ldap_memfree(oc); } @@ -141,7 +153,7 @@ parse_oc( { LDAP_OBJECT_CLASS *oc; int code; - char *err; + const char *err; oc = ldap_str2objectclass(line,&code,&err); if ( !oc ) { @@ -153,7 +165,7 @@ parse_oc( if ( code ) { fprintf( stderr, "%s: line %d: %s %s\n", fname, lineno, scherr2str(code), err); - exit( 1 ); + exit( EXIT_FAILURE ); } ldap_memfree(oc); } @@ -172,7 +184,7 @@ oc_usage( void ) fprintf( stderr, " [ \"MUST\" oids ] ; AttributeTypes\n"); fprintf( stderr, " [ \"MAY\" oids ] ; AttributeTypes\n"); fprintf( stderr, "whsp \")\"\n"); - exit( 1 ); + exit( EXIT_FAILURE ); } static void @@ -181,7 +193,7 @@ oc_usage_old( void ) fprintf( stderr, " ::= objectclass \n" ); fprintf( stderr, " [ requires ]\n" ); fprintf( stderr, " [ allows ]\n" ); - exit( 1 ); + exit( EXIT_FAILURE ); } static void @@ -207,7 +219,7 @@ at_usage( void ) fprintf( stderr, " ; distributedOperation\n"); fprintf( stderr, " ; dSAOperation\n"); fprintf( stderr, "whsp \")\"\n"); - exit( 1 ); + exit( EXIT_FAILURE ); } void @@ -219,7 +231,7 @@ parse_at( { LDAP_ATTRIBUTE_TYPE *at; int code; - char *err; + const char *err; at = ldap_str2attributetype(line,&code,&err); if ( !at ) { @@ -231,7 +243,7 @@ parse_at( if ( code ) { fprintf( stderr, "%s: line %d: %s %s\n", fname, lineno, scherr2str(code), err); - exit( 1 ); + exit( EXIT_FAILURE ); } ldap_memfree(at); }