From 0e15b0f108b92a38707ef80dafd66440dc3d19b3 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 4 Sep 2001 00:20:44 +0000 Subject: [PATCH] Add support dn.base="" --- servers/slapd/aclparse.c | 4 +-- servers/slapd/schema_init.c | 63 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index e54db75c96..a7df30bd8e 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -136,9 +136,9 @@ parse_acl( split( argv[i], '=', &left, &right ); split( left, '.', &left, &style ); - if ( right == NULL || *right == '\0' ) { + if ( right == NULL ) { fprintf( stderr, - "%s: line %d: missing \"=\" in (or value after) \"%s\" in to clause\n", + "%s: line %d: missing \"=\" in \"%s\" in to clause\n", fname, lineno, left ); acl_usage(); } diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 3e874d532b..8b7e41beb9 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -3315,6 +3316,54 @@ objectIdentifierFirstComponentMatch( return rc; } +static int +integerBitAndMatch( + int *matchp, + slap_mask_t flags, + Syntax *syntax, + MatchingRule *mr, + struct berval *value, + void *assertedValue ) +{ + long lValue, lAssertedValue; + + /* safe to assume integers are NUL terminated? */ + lValue = strtoul(value->bv_val, NULL, 10); + if(( lValue == LONG_MIN || lValue == LONG_MAX) && errno == ERANGE ) + return LDAP_CONSTRAINT_VIOLATION; + + lAssertedValue = strtol(((struct berval *)assertedValue)->bv_val, NULL, 10); + if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) && errno == ERANGE ) + return LDAP_CONSTRAINT_VIOLATION; + + *matchp = (lValue & lAssertedValue); + return LDAP_SUCCESS; +} + +static int +integerBitOrMatch( + int *matchp, + slap_mask_t flags, + Syntax *syntax, + MatchingRule *mr, + struct berval *value, + void *assertedValue ) +{ + long lValue, lAssertedValue; + + /* safe to assume integers are NUL terminated? */ + lValue = strtoul(value->bv_val, NULL, 10); + if(( lValue == LONG_MIN || lValue == LONG_MAX) && errno == ERANGE ) + return LDAP_CONSTRAINT_VIOLATION; + + lAssertedValue = strtol(((struct berval *)assertedValue)->bv_val, NULL, 10); + if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) && errno == ERANGE ) + return LDAP_CONSTRAINT_VIOLATION; + + *matchp = (lValue | lAssertedValue); + return LDAP_SUCCESS; +} + static int check_time_syntax (struct berval *val, int start, @@ -4115,6 +4164,20 @@ struct mrule_defs_rec mrule_defs[] = { OpenLDAPaciMatch, NULL, NULL, NULL}, + {"( 1.2.840.113556.1.4.803 NAME 'integerBitAndMatch' " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )", + SLAP_MR_EXT, + NULL, NULL, + integerBitAndMatch, NULL, NULL, + NULL}, + + {"( 1.2.840.113556.1.4.804 NAME 'integerBitOrMatch' " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )", + SLAP_MR_EXT, + NULL, NULL, + integerBitOrMatch, NULL, NULL, + NULL}, + {NULL, SLAP_MR_NONE, NULL, NULL, NULL, NULL} }; -- 2.39.2