(AVL_DUP) avl_dup_error ) ) {
*err = sat->sat_oid;
ldap_memfree(air);
- return SLAP_SCHERR_DUP_ATTR;
+ return SLAP_SCHERR_ATTR_DUP;
}
/* FIX: temporal consistency check */
at_bvfind(&air->air_name);
(AVL_DUP) avl_dup_error ) ) {
*err = *names;
ldap_memfree(air);
- return SLAP_SCHERR_DUP_ATTR;
+ return SLAP_SCHERR_ATTR_DUP;
}
/* FIX: temporal consistency check */
at_bvfind(&air->air_name);
/* subtypes must have same usage as their SUP */
return SLAP_SCHERR_ATTR_BAD_USAGE;
}
+
+ if ( sat->sat_flags & SLAP_AT_FINAL ) {
+ /* cannot subtype a "final" attribute type */
+ return SLAP_SCHERR_ATTR_BAD_SUP;
+ }
}
/*
(AVL_DUP) avl_dup_error ) ) {
*err = smr->smr_oid;
ldap_memfree(mir);
- return SLAP_SCHERR_DUP_RULE;
+ return SLAP_SCHERR_MR_DUP;
}
/* FIX: temporal consistency check */
mr_bvfind(&mir->mir_name);
(AVL_DUP) avl_dup_error ) ) {
*err = *names;
ldap_memfree(mir);
- return SLAP_SCHERR_DUP_RULE;
+ return SLAP_SCHERR_MR_DUP;
}
/* FIX: temporal consistency check */
mr_bvfind(&mir->mir_name);
{
*err = soc->soc_oid;
ldap_memfree(oir);
- return SLAP_SCHERR_DUP_CLASS;
+ return SLAP_SCHERR_CLASS_DUP;
}
/* FIX: temporal consistency check */
{
*err = *names;
ldap_memfree(oir);
- return SLAP_SCHERR_DUP_CLASS;
+ return SLAP_SCHERR_CLASS_DUP;
}
/* FIX: temporal consistency check */
code = oc_create_allowed( soc, soc->soc_at_oids_may, &op, err );
if ( code != 0 ) return code;
- if( user && op ) return SLAP_SCHERR_CLASS_OPERATIONAL;
+ if( user && op ) return SLAP_SCHERR_CLASS_BAD_SUP;
code = oc_insert(soc,err);
return code;
"DESC 'RFC2256: object classes of the entity' "
"EQUALITY objectIdentifierMatch "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
- NULL, 0, objectClassMatch, NULL, NULL,
+ NULL, SLAP_AT_FINAL, objectClassMatch, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_objectClass) },
/* user entry operational attributes */
"DESC 'RFC2256: name of aliased object' "
"EQUALITY distinguishedNameMatch "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )",
- aliasAttribute, 0, NULL, NULL, NULL,
+ aliasAttribute, SLAP_AT_FINAL, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_aliasedObjectName) },
{ "ref", "( 2.16.840.1.113730.3.1.34 NAME 'ref' "
"DESC 'namedref: subordinate referral URL' "
"DESC 'RFC2256: common supertype of DN attributes' "
"EQUALITY distinguishedNameMatch "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
- NULL, 0, NULL, NULL, NULL,
+ NULL, SLAP_AT_ABSTRACT, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_distinguishedName) },
{ "name", "( 2.5.4.41 NAME 'name' "
"DESC 'RFC2256: common supertype of name attributes' "
"EQUALITY caseIgnoreMatch "
"SUBSTR caseIgnoreSubstringsMatch "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )",
- NULL, 0, NULL, NULL, NULL,
+ NULL, SLAP_AT_ABSTRACT, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_name) },
{ "cn", "( 2.5.4.3 NAME ( 'cn' 'commonName' ) "
"DESC 'RFC2256: common name(s) for which the entity is known by' "
"DESC 'RFC2256/2307: password of user' "
"EQUALITY octetStringMatch "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )",
- NULL, 0, NULL, NULL, NULL,
+ NULL, SLAP_AT_FINAL, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_userPassword) },
#ifdef SLAPD_AUTHPASSWD
"DESC 'RFC3112: authentication password attribute' "
"EQUALITY 1.3.6.1.4.1.4203.1.2.2 "
"SYNTAX 1.3.6.1.4.1.4203.1.1.2 )",
- NULL, 0,
+ NULL, SLAP_AT_FINAL,
NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_authPassword) },
{ "supportedAuthPasswordSchemes", "( 1.3.6.1.4.1.4203.1.3.3 "
#endif
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
{ "krbName", NULL,
- NULL, 0, NULL, NULL, NULL,
+ NULL, SLAP_AT_FINAL, NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_krbName) },
#endif
NULL, /* subtypes */
NULL, NULL, NULL, NULL, /* matching rules */
NULL, /* syntax (this may need to be defined) */
- (AttributeTypeSchemaCheckFN *) 0, 0, /* schema check function/mask */
+ (AttributeTypeSchemaCheckFN *) 0, /* schema check function */
+ SLAP_AT_ABSTRACT|SLAP_AT_FINAL, /* mask */
NULL, /* next */
NULL /* attribute description */
/* mutex (don't know how to initialize it :) */
static void oc_usage(void);
static void at_usage(void);
-static char *const err2text[SLAP_SCHERR_LAST+1] = {
- "Success",
+static char *const err2text[] = {
"Out of memory",
"ObjectClass not found",
"ObjectClass inappropriate SUPerior",
"ObjectClass operational",
+ "Duplicate objectClass",
"AttributeType not found",
"AttributeType inappropriate USAGE",
- "Duplicate objectClass",
+ "AttributeType inappropriate SUPerior",
+ "AttributeType SYNTAX or SUPerior required",
"Duplicate attributeType",
- "Duplicate ldapSyntax",
- "Duplicate matchingRule",
- "OID or name required",
- "SYNTAX or SUPerior required",
"MatchingRule not found",
+ "Duplicate matchingRule",
"Syntax not found",
"Syntax required",
+ "Duplicate ldapSyntax",
+ "OID or name required",
"Qualifier not supported",
"Invalid NAME",
"OID could not be expanded"
char *
scherr2str(int code)
{
- if ( code < 0 || code >= (int)(sizeof(err2text)/sizeof(char *)) ) {
+ if ( code < 0 || SLAP_SCHERR_LAST < code ) {
return "Unknown error";
} else {
return err2text[code];
/*
* represents schema information for a database
*/
-#define SLAP_SCHERR_OUTOFMEM 1
-#define SLAP_SCHERR_CLASS_NOT_FOUND 2
-#define SLAP_SCHERR_CLASS_BAD_USAGE 3
-#define SLAP_SCHERR_CLASS_OPERATIONAL 4
-#define SLAP_SCHERR_ATTR_NOT_FOUND 5
-#define SLAP_SCHERR_ATTR_BAD_USAGE 6
-#define SLAP_SCHERR_DUP_CLASS 7
-#define SLAP_SCHERR_DUP_ATTR 8
-#define SLAP_SCHERR_DUP_SYNTAX 9
-#define SLAP_SCHERR_DUP_RULE 10
-#define SLAP_SCHERR_NO_NAME 11
-#define SLAP_SCHERR_ATTR_INCOMPLETE 12
-#define SLAP_SCHERR_MR_NOT_FOUND 13
-#define SLAP_SCHERR_SYN_NOT_FOUND 14
-#define SLAP_SCHERR_MR_INCOMPLETE 15
-#define SLAP_SCHERR_NOT_SUPPORTED 16
-#define SLAP_SCHERR_BAD_DESCR 17
-#define SLAP_SCHERR_OIDM 18
-#define SLAP_SCHERR_LAST SLAP_SCHERR_OIDM
+#define SLAP_SCHERR_OUTOFMEM 1
+#define SLAP_SCHERR_CLASS_NOT_FOUND 2
+#define SLAP_SCHERR_CLASS_BAD_USAGE 3
+#define SLAP_SCHERR_CLASS_BAD_SUP 4
+#define SLAP_SCHERR_CLASS_DUP 5
+#define SLAP_SCHERR_ATTR_NOT_FOUND 6
+#define SLAP_SCHERR_ATTR_BAD_USAGE 7
+#define SLAP_SCHERR_ATTR_BAD_SUP 8
+#define SLAP_SCHERR_ATTR_INCOMPLETE 9
+#define SLAP_SCHERR_ATTR_DUP 10
+#define SLAP_SCHERR_MR_NOT_FOUND 11
+#define SLAP_SCHERR_MR_INCOMPLETE 12
+#define SLAP_SCHERR_MR_DUP 13
+#define SLAP_SCHERR_SYN_NOT_FOUND 14
+#define SLAP_SCHERR_SYN_DUP 15
+#define SLAP_SCHERR_NO_NAME 16
+#define SLAP_SCHERR_NOT_SUPPORTED 17
+#define SLAP_SCHERR_BAD_DESCR 18
+#define SLAP_SCHERR_OIDM 19
+#define SLAP_SCHERR_LAST SLAP_SCHERR_OIDM
typedef union slap_sockaddr {
struct sockaddr sa_addr;
AttributeTypeSchemaCheckFN *sat_check;
-#define SLAP_AT_NONE 0x0000U
-#define SLAP_AT_HIDE 0x0001U /* hide attribute */
+#define SLAP_AT_NONE 0x0000U
+#define SLAP_AT_ABSTRACT 0x0100U /* cannot be instantiated */
+#define SLAP_AT_FINAL 0x0200U /* cannot be subtyped */
+#define SLAP_AT_HIDE 0x8000U /* hide attribute */
slap_mask_t sat_flags;
struct slap_attribute_type *sat_next;
(AVL_DUP) avl_dup_error ) ) {
*err = ssyn->ssyn_oid;
ldap_memfree(sir);
- return SLAP_SCHERR_DUP_SYNTAX;
+ return SLAP_SCHERR_SYN_DUP;
}
/* FIX: temporal consistency check */
syn_find(sir->sir_name);