We don't support collective attributes (yet).
Remove exit() calls from scheme parsers. Need to do same for acl parser.
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));
}
code = at_insert(sat,err);
- return code;
}
#ifdef LDAP_DEBUG
lutil_set_debug_level( cargv[1], level );
/* 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 {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_INFO,
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 {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_INFO,
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
*/
ad->ad_type->sat_syntax->ssyn_validate;
if( !validate ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "modlist2mods: %s: no validator for syntax %s\n",
- ml->ml_type, ad->ad_type->sat_syntax->ssyn_oid ));
-#else
- Debug( LDAP_DEBUG_TRACE,
- "modlist2mods: %s: no validator for syntax %s\n",
- ml->ml_type, ad->ad_type->sat_syntax->ssyn_oid, 0 );
-#endif
-
slap_mods_free( mod );
*text = "no validator for syntax";
snprintf( textbuf, textlen,
* 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 ));
/*
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",
"SYNTAX or SUPerior required",
"MatchingRule not found",
"Syntax not found",
- "Syntax required"
+ "Syntax required",
+ "Qualifier not supported"
};
char *
return NULL;
}
-void
+int
parse_oidm(
const char *fname,
int lineno,
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] );
"%s: line %d: "
"ObjectIdentifier \"%s\" previously defined \"%s\"",
fname, lineno, argv[1], oid );
- exit( EXIT_FAILURE );
+ return 1;
}
om = (OidMacro *) ch_malloc( sizeof(OidMacro) );
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,
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 */
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 );
}
}
}
+
/* 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
" [ \"MUST\" oids ] ; AttributeTypes\n"
" [ \"MAY\" oids ] ; AttributeTypes\n"
" whsp \")\"\n" );
- exit( EXIT_FAILURE );
}
" ; distributedOperation\n"
" ; dSAOperation\n"
" whsp \")\"\n");
- exit( EXIT_FAILURE );
}
-void
+int
parse_at(
const char *fname,
int lineno,
{
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 );
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] )) {
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 );
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;
}
#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;
#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 {