From: Kurt Zeilenga Date: Tue, 23 May 2000 17:00:46 +0000 (+0000) Subject: SLAPD_SCHEMA_NOT_COMPAT: cleanup X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2895 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bf3a2294231de245cd5d76d0f90473521a0f1fbf;p=openldap SLAPD_SCHEMA_NOT_COMPAT: cleanup --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index ad397914d7..97b618ce27 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -110,6 +110,7 @@ do_add( Connection *conn, Operation *op ) rc = ber_scanf( ber, "{a{V}}", &mod->ml_type, &mod->ml_bvalues ); if ( rc == LBER_ERROR ) { + Debug( LDAP_DEBUG_ANY, "do_add: decoding error\n", 0, 0, 0 ); send_ldap_disconnect( conn, op, LDAP_PROTOCOL_ERROR, "decoding error" ); rc = -1; @@ -272,7 +273,7 @@ do_add( Connection *conn, Operation *op ) #endif } } else { - Debug( LDAP_DEBUG_ARGS, " do_add: HHH\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_ARGS, " do_add: no backend support\n", 0, 0, 0 ); send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM, NULL, "operation not supported within namingContext", NULL, NULL ); } @@ -310,7 +311,7 @@ static int slap_mods2entry( attr = attr_find( (*e)->e_attrs, mods->sml_desc ); if( attr != NULL ) { - *text = "Attribute provided more than once"; + *text = "attribute provided more than once"; return LDAP_OPERATIONS_ERROR; } @@ -345,19 +346,14 @@ add_created_attrs( Operation *op, Entry *e ) /* return error on any attempts by the user to add these attrs */ for ( a = e->e_attrs; a != NULL; a = a->a_next ) { -#ifdef SLAPD_SCHEMA_NOT_COMPAT - if ( is_at_no_user_mod( a->a_desc.ad_type )) -#else - if ( oc_check_op_no_usermod_attr( a->a_type ) ) -#endif - { + if ( oc_check_op_no_usermod_attr( a->a_type ) ) { return LDAP_CONSTRAINT_VIOLATION; } } if ( op->o_dn == NULL || op->o_dn[0] == '\0' ) { - bv.bv_val = ""; - bv.bv_len = sizeof("")-1; + bv.bv_val = SLAPD_ANONYMOUS; + bv.bv_len = sizeof(SLAPD_ANONYMOUS)-1; ; } else { bv.bv_val = op->o_dn; diff --git a/servers/slapd/back-bdb2/back-bdb2.h b/servers/slapd/back-bdb2/back-bdb2.h index b05e1c2eb4..3b31d8d7e3 100644 --- a/servers/slapd/back-bdb2/back-bdb2.h +++ b/servers/slapd/back-bdb2/back-bdb2.h @@ -25,10 +25,6 @@ LDAP_BEGIN_DECL #define DN_ONE_PREFIX '@' #define DN_SUBTREE_PREFIX '?' -#define SLAPD_FILTER_DN_ONE ((ber_tag_t) -2) -#define SLAPD_FILTER_DN_SUBTREE ((ber_tag_t) -3) - - #define BDB2_SUFFIX ".bdb2" diff --git a/servers/slapd/back-ldbm/back-ldbm.h b/servers/slapd/back-ldbm/back-ldbm.h index cab5bed2bf..a84c5201e1 100644 --- a/servers/slapd/back-ldbm/back-ldbm.h +++ b/servers/slapd/back-ldbm/back-ldbm.h @@ -29,9 +29,6 @@ LDAP_BEGIN_DECL #define DN_ONE_PREFIX '@' #define DN_SUBTREE_PREFIX '?' -#define SLAPD_FILTER_DN_ONE ((ber_tag_t) -2) -#define SLAPD_FILTER_DN_SUBTREE ((ber_tag_t) -3) - /* * there is a single index for each attribute. these prefixes ensure * that there is no collision among keys. diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index b00d0843b8..38f6038300 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -413,8 +413,8 @@ int slap_mods_opattrs( timestamp.bv_len = strlen(timebuf); if( op->o_dn == NULL || op->o_dn[0] == '\0' ) { - name.bv_val = ""; - name.bv_len = sizeof("")-1; + name.bv_val = SLAPD_ANONYMOUS; + name.bv_len = sizeof(SLAPD_ANONYMOUS)-1; } else { name.bv_val = op->o_dn; name.bv_len = strlen( op->o_dn ); @@ -484,8 +484,8 @@ add_modified_attrs( Operation *op, Modifications **modlist ) } if ( op->o_dn == NULL || op->o_dn[0] == '\0' ) { - bv.bv_val = ""; - bv.bv_len = sizeof("")-1; + bv.bv_val = SLAPD_ANONYMOUS; + bv.bv_len = sizeof(SLAPD_ANONYMOUS)-1; } else { bv.bv_val = op->o_dn; bv.bv_len = strlen( bv.bv_val ); diff --git a/servers/slapd/monitor.c b/servers/slapd/monitor.c index a7b042c8c1..dbe8dda1ff 100644 --- a/servers/slapd/monitor.c +++ b/servers/slapd/monitor.c @@ -148,7 +148,7 @@ monitor_info( connection_state2str( c->c_conn_state ), c->c_sasl_bind_in_progress ? "S" : "", - c->c_cdn ? c->c_cdn : "", + c->c_cdn ? c->c_cdn : SLAPD_ANONYMOUS, c->c_listener_url, c->c_peer_domain, diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 0da3b77e00..00a6b5a289 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -167,6 +167,34 @@ oidValidate( return 1; } +static int +integerValidate( + Syntax *syntax, + struct berval *val ) +{ + ber_len_t i; + + for(i=0; i < val->bv_len; i++) { + if( !isdigit(val->bv_val[i]) ) return -1; + } + + return 0; +} + +static int +printableStringValidate( + Syntax *syntax, + struct berval *val ) +{ + ber_len_t i; + + for(i=0; i < val->bv_len; i++) { + if( !isprint(val->bv_val[i]) ) return -1; + } + + return 0; +} + static int IA5StringValidate( Syntax *syntax, @@ -367,7 +395,7 @@ struct syntax_defs_rec syntax_defs[] = { {"( 1.3.6.1.4.1.1466.115.121.1.26 DESC 'IA5 String' )", 0, IA5StringValidate, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.27 DESC 'Integer' )", - 0, NULL, NULL, NULL}, + 0, integerValidate, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.28 DESC 'JPEG' " X_NOT_H_R ")", SLAP_SYNTAX_BLOB, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.29 DESC 'Master And Shadow Access Points' )", @@ -401,7 +429,7 @@ struct syntax_defs_rec syntax_defs[] = { {"( 1.3.6.1.4.1.1466.115.121.1.43 DESC 'Presentation Address' )", 0, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.44 DESC 'Printable String' )", - 0, NULL, NULL, NULL}, + 0, printableStringValidate, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.49 DESC 'Supported Algorithm' " X_BINARY X_NOT_H_R ")", SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL}, @@ -728,6 +756,11 @@ struct slap_schema_ad_map { offsetof(struct slap_internal_schema, si_ad_supportedExtension) }, { "supportedLDAPVersion", offsetof(struct slap_internal_schema, si_ad_supportedLDAPVersion) }, +#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND + { "supportedACIMechanisms", + offsetof(struct slap_internal_schema, si_ad_supportedACIMechanisms) }, + +#endif { "supportedSASLMechanisms", offsetof(struct slap_internal_schema, si_ad_supportedSASLMechanisms) }, diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 9a45878546..b300852ba2 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -40,12 +40,13 @@ LDAP_BEGIN_DECL +#define SERVICE_NAME OPENLDAP_PACKAGE "-slapd" +#define SLAPD_ANONYMOUS "" + #ifdef f_next #undef f_next /* name conflict between sys/file.h on SCO and struct filter */ #endif -#define SERVICE_NAME OPENLDAP_PACKAGE "-slapd" - /* LDAPMod.mod_op value ===> Must be kept in sync with ldap.h! * * This is a value used internally by the backends. It is needed to allow @@ -61,11 +62,12 @@ LDAP_BEGIN_DECL #define MAXREMATCHES 10 -/* psuedo error code indicating disconnect */ -#define SLAPD_DISCONNECT -1 /* psuedo error code indicating abandoned operation */ -#define SLAPD_ABANDON -2 +#define SLAPD_ABANDON (-1) + +/* psuedo error code indicating disconnect */ +#define SLAPD_DISCONNECT (-2) /* We assume "C" locale, that is US-ASCII */ @@ -340,6 +342,9 @@ struct slap_internal_schema { AttributeDescription *si_ad_supportedControl; AttributeDescription *si_ad_supportedExtension; AttributeDescription *si_ad_supportedLDAPVersion; +#ifdef SLAPD_ACI_ENABLED + AttributeDescription *si_ad_supportedACIMechanisms; +#endif AttributeDescription *si_ad_supportedSASLMechanisms; /* subschema subentry attributes */ @@ -412,7 +417,10 @@ typedef struct slap_mra { typedef struct slap_filter { ber_tag_t f_choice; /* values taken from ldap.h, plus: */ -#define SLAPD_FILTER_COMPUTED ((ber_tag_t) 0x01U) +#define SLAPD_FILTER_COMPUTED ((ber_tag_t) -1) +#define SLAPD_FILTER_DN_ONE ((ber_tag_t) -2) +#define SLAPD_FILTER_DN_SUBTREE ((ber_tag_t) -3) + union f_un_u { /* precomputed result */