]> git.sur5r.net Git - openldap/commitdiff
Import collective, obsolete and misc minor changes from HEAD
authorKurt Zeilenga <kurt@openldap.org>
Fri, 18 May 2001 01:18:02 +0000 (01:18 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 18 May 2001 01:18:02 +0000 (01:18 +0000)
servers/slapd/at.c
servers/slapd/config.c
servers/slapd/modify.c
servers/slapd/proto-slap.h
servers/slapd/schemaparse.c
servers/slapd/slap.h

index 5a618ae2969db99d2441b2866ef52de92988353b..63eda95ad2137590f397e81e165f22cfc67106d7 100644 (file)
@@ -246,6 +246,11 @@ at_add(
                cname = "";
                return SLAP_SCHERR_ATTR_INCOMPLETE;
        }
+
+       if ( at->at_collective ) {
+               return SLAP_SCHERR_NOT_SUPPORTED;
+       }
+
        sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
        AC_MEMCPY( &sat->sat_atype, at, sizeof(LDAPAttributeType));
 
@@ -323,7 +328,6 @@ at_add(
        }
 
        code = at_insert(sat,err);
-       return code;
 }
 
 #ifdef LDAP_DEBUG
index 79b59d846b9be18b99a037e83c7b726db0ea78d4..5d6b253e23d1cb67fd876b7dfcbbaa5b1fed79a5 100644 (file)
@@ -804,14 +804,17 @@ read_config( const char *fname )
 
                /* specify an Object Identifier macro */
                } else if ( strcasecmp( cargv[0], "objectidentifier" ) == 0 ) {
-                       parse_oidm( fname, lineno, cargc, cargv );
+                       rc = parse_oidm( fname, lineno, cargc, cargv );
+                       if( rc ) return rc;
 
                /* specify an objectclass */
                } else if ( strcasecmp( cargv[0], "objectclass" ) == 0 ) {
                        if ( *cargv[1] == '(' ) {
                                char * p;
                                p = strchr(saveline,'(');
-                               parse_oc( fname, lineno, p, cargv );
+                               rc = parse_oc( fname, lineno, p, cargv );
+                               if( rc ) return rc;
+
                        } else {
                                Debug( LDAP_DEBUG_ANY,
     "%s: line %d: old objectclass format not supported.\n",
@@ -825,7 +828,9 @@ read_config( const char *fname )
                        if ( *cargv[1] == '(' ) {
                                char * p;
                                p = strchr(saveline,'(');
-                               parse_at( fname, lineno, p, cargv );
+                               rc = parse_at( fname, lineno, p, cargv );
+                               if( rc ) return rc;
+
                        } else {
                                Debug( LDAP_DEBUG_ANY,
     "%s: line %d: old attribute type format not supported.\n",
index 35f334077c0074eb5e26efb6b88bd840bb228b46..245ce2f5d0077147d8662d154ef7b86d3015de3d 100644 (file)
@@ -350,6 +350,21 @@ int slap_modlist2mods(
                        return LDAP_CONSTRAINT_VIOLATION;
                }
 
+               if ( is_at_obsolete( ad->ad_type ) &&
+                       ( mod->sml_op == LDAP_MOD_ADD || ml->ml_bvalues != NULL ) )
+               {
+                       /*
+                        * attribute is obsolete,
+                        * only allow replace/delete with no values
+                        */
+                       slap_mods_free( mod );
+                       snprintf( textbuf, textlen,
+                               "%s: attribute is obsolete",
+                               ml->ml_type );
+                       *text = textbuf;
+                       return LDAP_CONSTRAINT_VIOLATION;
+               }
+
                /*
                 * check values
                 */
@@ -359,9 +374,6 @@ int slap_modlist2mods(
                                ad->ad_type->sat_syntax->ssyn_validate;
 
                        if( !validate ) {
-                               Debug( LDAP_DEBUG_TRACE,
-                                       "modlist2mods: no validator for syntax %s\n",
-                                       ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
                                slap_mods_free( mod );
                                *text = "no validator for syntax";
                                snprintf( textbuf, textlen,
index 8c11f6aac49fb067d7211fb2fb2ecd3c450d1a8b..dd1c6beaed34d1379db8737f8a77c3d605a93c65 100644 (file)
@@ -654,12 +654,17 @@ LDAP_SLAPD_F (int) schema_prep LDAP_P((void));
  * schemaparse.c
  */
 
-LDAP_SLAPD_F (void) parse_oc_old LDAP_P(( Backend *be, const char *fname, int lineno, int argc, char **argv ));
-LDAP_SLAPD_F (void) parse_oc LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
-LDAP_SLAPD_F (void) parse_at LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
-LDAP_SLAPD_F (void) parse_oidm LDAP_P(( const char *fname, int lineno, int argc, char **argv ));
+LDAP_SLAPD_F (int) parse_oc_old LDAP_P((
+       Backend *be, const char *fname, int lineno, int argc, char **argv ));
+LDAP_SLAPD_F (int) parse_oc LDAP_P((
+       const char *fname, int lineno, char *line, char **argv ));
+LDAP_SLAPD_F (int) parse_at LDAP_P((
+       const char *fname, int lineno, char *line, char **argv ));
+LDAP_SLAPD_F (int) parse_oidm LDAP_P((
+       const char *fname, int lineno, int argc, char **argv ));
 LDAP_SLAPD_F (char *) scherr2str LDAP_P((int code)) LDAP_GCCATTR((const));
-LDAP_SLAPD_F (int) dscompare LDAP_P(( const char *s1, const char *s2del, char delim ));
+LDAP_SLAPD_F (int) dscompare LDAP_P(( const char *s1, const char *s2del,
+       char delim ));
 
 
 /*
index 6b377f608de21e34fa69c83e676c994119e948b2..5370bf644b1df094cc4f5c81946e10584d9f3629 100644 (file)
@@ -18,8 +18,8 @@
 
 int    global_schemacheck = 1; /* schemacheck on is default */
 
-static void            oc_usage(void)     LDAP_GCCATTR((noreturn));
-static void            at_usage(void)     LDAP_GCCATTR((noreturn));
+static void            oc_usage(void)
+static void            at_usage(void);
 
 static char *const err2text[] = {
        "Success",
@@ -36,7 +36,8 @@ static char *const err2text[] = {
        "SYNTAX or SUPerior required",
        "MatchingRule not found",
        "Syntax not found",
-       "Syntax required"
+       "Syntax required",
+       "Qualifier not supported"
 };
 
 char *
@@ -112,7 +113,7 @@ find_oidm(char *oid)
        return NULL;
 }
 
-void
+int
 parse_oidm(
     const char *fname,
     int                lineno,
@@ -127,7 +128,7 @@ parse_oidm(
                fprintf( stderr, "%s: line %d: too many arguments\n",
                        fname, lineno );
 usage: fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
-               exit( EXIT_FAILURE );
+               return 1;
        }
 
        oid = find_oidm( argv[1] );
@@ -136,7 +137,7 @@ usage:      fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
                        "%s: line %d: "
                        "ObjectIdentifier \"%s\" previously defined \"%s\"",
                        fname, lineno, argv[1], oid );
-               exit( EXIT_FAILURE );
+               return 1;
        }
 
        om = (OidMacro *) ch_malloc( sizeof(OidMacro) );
@@ -158,9 +159,11 @@ usage:     fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
        om->som_oid.bv_len = strlen( om->som_oid.bv_val );
        om->som_next = om_list;
        om_list = om;
+
+       return 0;
 }
 
-void
+int
 parse_oc(
     const char *fname,
     int                lineno,
@@ -178,7 +181,9 @@ parse_oc(
                fprintf( stderr, "%s: line %d: %s before %s\n",
                         fname, lineno, ldap_scherr2str(code), err );
                oc_usage();
+               return 1;
        }
+
        if ( oc->oc_oid ) {
                if ( !OID_LEADCHAR( oc->oc_oid[0] )) {
                        /* Expand OID macros */
@@ -187,7 +192,7 @@ parse_oc(
                                fprintf(stderr,
                                        "%s: line %d: OID %s not recognized\n",
                                        fname, lineno, oc->oc_oid);
-                               exit( EXIT_FAILURE );
+                               return 1;
                        }
                        if ( oid != oc->oc_oid ) {
                                ldap_memfree( oc->oc_oid );
@@ -195,14 +200,17 @@ parse_oc(
                        }
                }
        }
+
        /* oc->oc_oid == NULL will be an error someday */
        code = oc_add(oc,&err);
        if ( code ) {
                fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
                         fname, lineno, scherr2str(code), err);
-               exit( EXIT_FAILURE );
+               return 1;
        }
+
        ldap_memfree(oc);
+       return 0;
 }
 
 static void
@@ -220,7 +228,6 @@ oc_usage( void )
                "  [ \"MUST\" oids ]               ; AttributeTypes\n"
                "  [ \"MAY\" oids ]                ; AttributeTypes\n"
                "  whsp \")\"\n" );
-       exit( EXIT_FAILURE );
 }
 
 
@@ -248,10 +255,9 @@ at_usage( void )
                "                                   ; distributedOperation\n"
                "                                   ; dSAOperation\n"
                "  whsp \")\"\n");
-       exit( EXIT_FAILURE );
 }
 
-void
+int
 parse_at(
     const char *fname,
     int                lineno,
@@ -284,7 +290,7 @@ parse_at(
                        {
                            fprintf(stderr, "%s: line %d: OID %s not found\n",
                                fname, lineno, argv[4]);
-                           exit( EXIT_FAILURE );
+                               return 1;
                        }
                        memset(strstr(line, argv[4]), '0', slen);
                        soid = ch_strdup(syn->ssyn_syn.syn_oid );
@@ -296,6 +302,7 @@ parse_at(
                fprintf( stderr, "%s: line %d: %s before %s\n",
                         fname, lineno, ldap_scherr2str(code), err );
                at_usage();
+               return 1;
        }
        if ( at->at_oid ) {
                if ( !OID_LEADCHAR( at->at_oid[0] )) {
@@ -305,7 +312,7 @@ parse_at(
                                fprintf(stderr,
                                        "%s: line %d: OID %s not recognized\n",
                                        fname, lineno, at->at_oid);
-                               exit( EXIT_FAILURE );
+                               return 1;
                        }
                        if ( oid != at->at_oid ) {
                                ldap_memfree( at->at_oid );
@@ -322,7 +329,8 @@ parse_at(
        if ( code ) {
                fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
                         fname, lineno, scherr2str(code), err);
-               exit( EXIT_FAILURE );
+               return 1;
        }
        ldap_memfree(at);
+       return 0;
 }
index 3f746ad7b3965a68ccd4833f261e0197223a1211..bae2b95a3c700b40da97c23ef695265b0ddb0c92 100644 (file)
@@ -108,7 +108,7 @@ LDAP_BEGIN_DECL
 #define SLAP_PRINTABLE(c)      ( ASCII_ALNUM(c) || (c) == '\'' || \
        (c) == '(' || (c) == ')' || (c) == '+' || (c) == ',' || \
        (c) == '-' || (c) == '.' || (c) == '/' || (c) == ':' || \
-       (c) == '?' || (c) == ' ' )
+       (c) == '?' || (c) == ' ' || (c) == '=' )
 #define SLAP_PRINTABLES(c)     ( SLAP_PRINTABLE(c) || (c) == '$' )
 
 /* must match in schema_init.c */
@@ -216,6 +216,7 @@ typedef struct slap_ssf_set {
 #define SLAP_SCHERR_MR_NOT_FOUND       12
 #define SLAP_SCHERR_SYN_NOT_FOUND      13
 #define SLAP_SCHERR_MR_INCOMPLETE      14
+#define SLAP_SCHERR_NOT_SUPPORTED      15
 
 typedef struct slap_oid_macro {
        struct berval som_oid;
@@ -382,6 +383,7 @@ typedef struct slap_attribute_type {
 #define is_at_operational(at)  ((at)->sat_usage)
 #define is_at_single_value(at) ((at)->sat_single_value)
 #define is_at_collective(at)   ((at)->sat_collective)
+#define is_at_obsolete(at)             ((at)->sat_obsolete)
 #define is_at_no_user_mod(at)  ((at)->sat_no_user_mod)
 
 typedef struct slap_object_class {