Commit bf3a2294 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

SLAPD_SCHEMA_NOT_COMPAT: cleanup

parent 34c05b51
......@@ -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 = "<anonymous>";
bv.bv_len = sizeof("<anonymous>")-1;
bv.bv_val = SLAPD_ANONYMOUS;
bv.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
;
} else {
bv.bv_val = op->o_dn;
......
......@@ -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"
......
......@@ -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.
......
......@@ -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 = "<anonymous>";
name.bv_len = sizeof("<anonymous>")-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 = "<anonymous>";
bv.bv_len = sizeof("<anonymous>")-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 );
......
......@@ -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 : "<anonymous>",
c->c_cdn ? c->c_cdn : SLAPD_ANONYMOUS,
c->c_listener_url,
c->c_peer_domain,
......
......@@ -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) },
......
......@@ -40,12 +40,13 @@
LDAP_BEGIN_DECL
#define SERVICE_NAME OPENLDAP_PACKAGE "-slapd"
#define SLAPD_ANONYMOUS "<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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment