From fba9235d0fcbf399564114ba6f8980f3bfa22763 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 21 Mar 2005 00:22:54 +0000 Subject: [PATCH] Add HARDCODE schema flags --- servers/slapd/at.c | 4 ++++ servers/slapd/back-monitor/init.c | 2 +- servers/slapd/bconfig.c | 4 ++-- servers/slapd/config.c | 2 +- servers/slapd/oidm.c | 5 ++++- servers/slapd/overlays/lastmod.c | 2 +- servers/slapd/overlays/pcache.c | 2 +- servers/slapd/overlays/ppolicy.c | 2 +- servers/slapd/proto-slap.h | 4 ++-- servers/slapd/schema_prep.c | 2 +- servers/slapd/schemaparse.c | 2 +- servers/slapd/slap.h | 4 ++++ 12 files changed, 23 insertions(+), 12 deletions(-) diff --git a/servers/slapd/at.c b/servers/slapd/at.c index c6f363b690..190ecf86b9 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -313,6 +313,7 @@ at_insert( int at_add( LDAPAttributeType *at, + int user, const char **err ) { AttributeType *sat; @@ -451,6 +452,9 @@ at_add( } } + if ( !user ) + sat->sat_flags |= SLAP_AT_HARDCODE; + if ( at->at_syntax_oid ) { syn = syn_find(sat->sat_syntax_oid); if ( syn == NULL ) { diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index 6fed315d2f..20335f602e 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -1035,7 +1035,7 @@ monitor_back_db_init( return -1; } - code = at_add(at, &err); + code = at_add(at, 0, &err); if ( code ) { Debug( LDAP_DEBUG_ANY, "monitor_back_db_init: " "%s in attributeType \"%s\"\n", diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 63869515a6..a62876af53 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -899,7 +899,7 @@ config_generic(ConfigArgs *c) { break; case CFG_OID: - if(parse_oidm(c->fname, c->lineno, c->argc, c->argv)) return(0); + if(parse_oidm(c->fname, c->lineno, c->argc, c->argv, 1)) return(0); break; case CFG_OC: @@ -3547,7 +3547,7 @@ config_back_initialize( BackendInfo *bi ) for (i=0; OidMacros[i].name; i++ ) { argv[1] = OidMacros[i].name; argv[2] = OidMacros[i].oid; - parse_oidm( "slapd", i, 3, argv ); + parse_oidm( "slapd", i, 3, argv, 0 ); } bi->bi_cf_table = ct; diff --git a/servers/slapd/config.c b/servers/slapd/config.c index a3cd4f37fe..4ca60728b6 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -404,7 +404,7 @@ init_config_attrs(ConfigTable *ct) { ct[i].attribute, ldap_scherr2str(code), err ); return code; } - code = at_add( at, &err ); + code = at_add( at, 0, &err ); if ( code && code != SLAP_SCHERR_ATTR_DUP ) { fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n", ct[i].attribute, scherr2str(code), err ); diff --git a/servers/slapd/oidm.c b/servers/slapd/oidm.c index 6a2e62c078..3a20fcde43 100644 --- a/servers/slapd/oidm.c +++ b/servers/slapd/oidm.c @@ -95,7 +95,8 @@ parse_oidm( const char *fname, int lineno, int argc, - char **argv ) + char **argv, + int user ) { char *oid; OidMacro *om; @@ -143,6 +144,8 @@ usage: fprintf( stderr, "\tObjectIdentifier \n"); } om->som_oid.bv_len = strlen( om->som_oid.bv_val ); + if ( !user ) + om->som_flags |= SLAP_OM_HARDCODE; LDAP_SLIST_INSERT_HEAD( &om_list, om, som_next ); return 0; diff --git a/servers/slapd/overlays/lastmod.c b/servers/slapd/overlays/lastmod.c index 454239c0bc..714a2d10fa 100644 --- a/servers/slapd/overlays/lastmod.c +++ b/servers/slapd/overlays/lastmod.c @@ -781,7 +781,7 @@ lastmod_db_init( return -1; } - code = at_add(at, &err); + code = at_add(at, 0, &err); if ( code ) { Debug( LDAP_DEBUG_ANY, "lastmod_init: " "%s in attributeType '%s'\n", diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index b078908da5..7c9054a2df 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -1925,7 +1925,7 @@ int pcache_init() ldap_scherr2str(code), err ); return code; } - code = at_add( at, &err ); + code = at_add( at, 0, &err ); if ( !code ) { slap_str2ad( at->at_names[0], &ad_queryid, &err ); } diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index f572875fef..44ff4f9bde 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -1797,7 +1797,7 @@ int ppolicy_init() ldap_scherr2str(code), err ); return code; } - code = at_add( at, &err ); + code = at_add( at, 0, &err ); if ( !code ) { slap_str2ad( at->at_names[0], pwd_OpSchema[i].ad, &err ); } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index bedbb5a36e..ed1f1be62b 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -161,7 +161,7 @@ LDAP_SLAPD_F (int) at_delete_from_list LDAP_P(( int pos, AttributeType ***listp )); LDAP_SLAPD_F (int) at_schema_info LDAP_P(( Entry *e )); LDAP_SLAPD_F (int) at_add LDAP_P(( - LDAPAttributeType *at, const char **err )); + LDAPAttributeType *at, int user, const char **err )); LDAP_SLAPD_F (void) at_destroy LDAP_P(( void )); LDAP_SLAPD_F (int) is_at_subtype LDAP_P(( @@ -1008,7 +1008,7 @@ LDAP_SLAPD_F(char *) oidm_find(char *oid); LDAP_SLAPD_F (void) oidm_destroy LDAP_P(( void )); LDAP_SLAPD_F (void) oidm_unparse LDAP_P(( BerVarray *bva )); LDAP_SLAPD_F (int) parse_oidm LDAP_P(( - const char *fname, int lineno, int argc, char **argv )); + const char *fname, int lineno, int argc, char **argv, int user )); /* * operation.c diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 2b11d0ff34..b64f76751c 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -1124,7 +1124,7 @@ slap_schema_load( void ) return LDAP_OTHER; } - code = at_add( at, &err ); + code = at_add( at, 0, &err ); if ( code ) { fprintf( stderr, "slap_schema_load: AttributeType " "\"%s\": %s: \"%s\"\n", diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index a1c6f34f12..c1e7195ba2 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -274,7 +274,7 @@ parse_at( return 1; } - code = at_add(at,&err); + code = at_add(at,1,&err); if ( code ) { fprintf( stderr, "%s: line %d: %s: \"%s\"\n", fname, lineno, scherr2str(code), err); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 1b65ad116c..163971107a 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -323,6 +323,8 @@ typedef struct slap_oid_macro { struct berval som_oid; BerVarray som_names; BerVarray som_subs; +#define SLAP_OM_HARDCODE 0x10000U /* This is hardcoded schema */ + int som_flags; LDAP_SLIST_ENTRY(slap_oid_macro) som_next; } OidMacro; @@ -649,6 +651,7 @@ typedef struct slap_attribute_type { #define SLAP_AT_DYNAMIC 0x0400U /* dynamically generated */ #define SLAP_AT_ORDERED 0x0001U /* values are ordered */ +#define SLAP_AT_HARDCODE 0x10000U /* This is hardcoded schema */ slap_mask_t sat_flags; @@ -725,6 +728,7 @@ typedef struct slap_object_class { #else #define SLAP_OC_HIDE 0x8000 #endif +#define SLAP_OC_HARDCODE 0x10000U /* This is hardcoded schema */ /* * DIT content rule -- 2.39.5