mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 17:19:43 -05:00
SLAP_NVALUES: test003 now passes (with help of a substr mr hack)
This commit is contained in:
parent
eb6ccefabf
commit
16c9e81c80
10 changed files with 79 additions and 57 deletions
|
|
@ -9,8 +9,9 @@ XSRCS=version.c
|
|||
NT_SRCS = nt_svc.c
|
||||
NT_OBJS = nt_svc.o ../../libraries/liblutil/slapdmsg.res
|
||||
|
||||
SRCS = main.c daemon.c connection.c search.c filter.c add.c cr.c \
|
||||
attr.c entry.c config.c backend.c result.c operation.c \
|
||||
SRCS = main.c globals.c config.c daemon.c \
|
||||
connection.c search.c filter.c add.c cr.c \
|
||||
attr.c entry.c backend.c result.c operation.c \
|
||||
dn.c compare.c modify.c delete.c modrdn.c ch_malloc.c \
|
||||
value.c ava.c bind.c unbind.c abandon.c filterentry.c \
|
||||
phonetic.c acl.c str2filter.c aclparse.c init.c user.c \
|
||||
|
|
@ -22,8 +23,9 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c cr.c \
|
|||
limits.c backglue.c operational.c matchedValues.c cancel.c \
|
||||
$(@PLAT@_SRCS)
|
||||
|
||||
OBJS = main.o daemon.o connection.o search.o filter.o add.o cr.o \
|
||||
attr.o entry.o config.o backend.o result.o operation.o \
|
||||
OBJS = main.o globals.o config.o daemon.o \
|
||||
connection.o search.o filter.o add.o cr.o \
|
||||
attr.o entry.o backend.o result.o operation.o \
|
||||
dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o \
|
||||
value.o ava.o bind.o unbind.o abandon.o filterentry.o \
|
||||
phonetic.o acl.o str2filter.o aclparse.o init.o user.o \
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
#include "lutil.h"
|
||||
|
||||
const struct berval slap_empty_bv = { 0, "" };
|
||||
|
||||
/*
|
||||
* The DN syntax-related functions take advantage of the dn representation
|
||||
* handling functions ldap_str2dn/ldap_dn2str. The latter are not schema-
|
||||
|
|
@ -361,34 +359,20 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* dn normalize routine
|
||||
*/
|
||||
int
|
||||
#ifdef SLAP_NVALUES
|
||||
dnNormalize(
|
||||
Syntax *syntax,
|
||||
struct berval *val,
|
||||
struct berval **normalized )
|
||||
{
|
||||
struct berval *out;
|
||||
int rc;
|
||||
|
||||
assert( normalized && *normalized == NULL );
|
||||
|
||||
out = ch_malloc( sizeof( struct berval ) );
|
||||
rc = dnNormalize2( syntax, val, out );
|
||||
if ( rc != LDAP_SUCCESS )
|
||||
free( out );
|
||||
else
|
||||
*normalized = out;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
dnNormalize2(
|
||||
Syntax *syntax,
|
||||
struct berval *val,
|
||||
struct berval *out )
|
||||
slap_mask_t use,
|
||||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *val,
|
||||
struct berval *out )
|
||||
#else
|
||||
dnNormalize(
|
||||
Syntax *syntax,
|
||||
struct berval *val,
|
||||
struct berval *out )
|
||||
#endif
|
||||
{
|
||||
assert( val );
|
||||
assert( out );
|
||||
|
|
@ -437,6 +421,7 @@ dnNormalize2(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* dn "pretty"ing routine
|
||||
*/
|
||||
|
|
@ -459,6 +444,7 @@ dnPretty(
|
|||
*pretty = out;
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
dnPretty2(
|
||||
|
|
|
|||
|
|
@ -415,9 +415,9 @@ get_substring_filter(
|
|||
}
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
/* validate using equality matching rule validator! */
|
||||
/* validate/normalize using equality matching rule validator! */
|
||||
rc = asserted_value_validate_normalize(
|
||||
f->f_sub_desc, f->f_sub_desc->ad_type->sat_substr,
|
||||
f->f_sub_desc, f->f_sub_desc->ad_type->sat_equality,
|
||||
usage, &value, &bv, text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
goto return_error;
|
||||
|
|
@ -1434,9 +1434,9 @@ get_substring_vrFilter(
|
|||
}
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
/* validate using equality matching rule validator! */
|
||||
/* validate/normalize using equality matching rule validator! */
|
||||
rc = asserted_value_validate_normalize(
|
||||
vrf->vrf_sub_desc, vrf->vrf_sub_desc->ad_type->sat_substr,
|
||||
vrf->vrf_sub_desc, vrf->vrf_sub_desc->ad_type->sat_equality,
|
||||
usage, &value, &bv, text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
goto return_error;
|
||||
|
|
|
|||
20
servers/slapd/globals.c
Normal file
20
servers/slapd/globals.c
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* globals.c - various global variables */
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include "slap.h"
|
||||
|
||||
/*
|
||||
* global variables, in general, should be declared in the file
|
||||
* primarily responsible for its management. Configurable globals
|
||||
* belong in config.c. variables declared here have no other
|
||||
* sensible home.
|
||||
*/
|
||||
|
||||
const struct berval slap_empty_bv = { 0, "" };
|
||||
|
||||
|
|
@ -32,10 +32,11 @@ static RETSIGTYPE wait4child( int sig );
|
|||
#define MAIN_RETURN(x) return
|
||||
static struct sockaddr_in bind_addr;
|
||||
|
||||
void CommenceStartupProcessing( LPCTSTR serverName,
|
||||
void(*stopper)(int));
|
||||
void ReportSlapdShutdownComplete( void );
|
||||
void *getRegParam( char *svc, char *value );
|
||||
/* FIXME: no externs should appear in a .c, should be in a .h instead */
|
||||
extern void CommenceStartupProcessing( LPCTSTR serverName,
|
||||
void(*stopper)(int));
|
||||
extern void ReportSlapdShutdownComplete( void );
|
||||
extern void *getRegParam( char *svc, char *value );
|
||||
|
||||
#define SERVICE_EXIT( e, n ) do { \
|
||||
if ( is_NT_Service ) { \
|
||||
|
|
|
|||
|
|
@ -393,15 +393,21 @@ LDAP_SLAPD_F (int) dnValidate LDAP_P((
|
|||
Syntax *syntax,
|
||||
struct berval *val ));
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
LDAP_SLAPD_F (int) dnNormalize LDAP_P((
|
||||
slap_mask_t use,
|
||||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *val,
|
||||
struct berval *normalized ));
|
||||
#define dnNormalize2(s,v,n) dnNormalize(0,(s),NULL,(v),(n))
|
||||
#else
|
||||
LDAP_SLAPD_F (int) dnNormalize LDAP_P((
|
||||
Syntax *syntax,
|
||||
struct berval *val,
|
||||
struct berval **normalized ));
|
||||
|
||||
LDAP_SLAPD_F (int) dnNormalize2 LDAP_P((
|
||||
Syntax *syntax,
|
||||
struct berval *val,
|
||||
struct berval *normalized ));
|
||||
#define dnNormalize2(s,v,n) dnNormalize((s),(v),(n))
|
||||
#endif
|
||||
|
||||
LDAP_SLAPD_F (int) dnPretty LDAP_P((
|
||||
Syntax *syntax,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#define xintegerNormalize NULL
|
||||
#define xnumericStringNormalize NULL
|
||||
#define xnameUIDNormalize NULL
|
||||
#define xdnNormalize NULL
|
||||
|
||||
/* (new) normalization routines */
|
||||
#define caseExactIA5Normalize IA5StringNormalize
|
||||
|
|
@ -49,7 +50,6 @@
|
|||
#define caseExactNormalize UTF8StringNormalize
|
||||
#define caseIgnoreNormalize UTF8StringNormalize
|
||||
|
||||
#define distinguishedNameNormalize NULL
|
||||
#define integerNormalize NULL
|
||||
#define integerFirstComponentNormalize NULL
|
||||
#define numericStringNormalize NULL
|
||||
|
|
@ -60,6 +60,7 @@
|
|||
#define bitStringNormalize NULL
|
||||
#define telephoneNumberNormalize NULL
|
||||
|
||||
#define distinguishedNameNormalize dnNormalize
|
||||
#define distinguishedNameMatch dnMatch
|
||||
#define distinguishedNameIndexer octetStringIndexer
|
||||
#define distinguishedNameFilter octetStringFilter
|
||||
|
|
@ -89,7 +90,7 @@
|
|||
#define caseIgnoreIndexer octetStringIndexer
|
||||
#define caseIgnoreFilter octetStringFilter
|
||||
|
||||
#define caseIgnoreSubstringsMatch NULL
|
||||
#define caseIgnoreSubstringsMatch SubstringsMatch
|
||||
#define caseIgnoreSubstringsIndexer NULL
|
||||
#define caseIgnoreSubstringsFilter NULL
|
||||
|
||||
|
|
@ -156,6 +157,8 @@
|
|||
|
||||
#ifndef SLAP_NVALUES
|
||||
|
||||
#define xdnNormalize dnNormalize
|
||||
|
||||
/* (new) normalization routines */
|
||||
#define caseExactNormalize NULL
|
||||
#define caseExactIA5Normalize NULL
|
||||
|
|
@ -2491,7 +2494,12 @@ caseExactIA5Match(
|
|||
}
|
||||
|
||||
static int
|
||||
caseExactIA5SubstringsMatch(
|
||||
caseExactIA5SubstringsMatch
|
||||
#else
|
||||
static int
|
||||
SubstringsMatch
|
||||
#endif
|
||||
(
|
||||
int *matchp,
|
||||
slap_mask_t flags,
|
||||
Syntax *syntax,
|
||||
|
|
@ -2614,6 +2622,8 @@ done:
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef SLAP_NVALUES
|
||||
|
||||
/* Index generation function */
|
||||
static int caseExactIA5Indexer(
|
||||
slap_mask_t use,
|
||||
|
|
@ -4582,7 +4592,7 @@ static slap_syntax_defs_rec syntax_defs[] = {
|
|||
{"( 1.3.6.1.4.1.1466.115.121.1.11 DESC 'Country String' )",
|
||||
0, countryStringValidate, xIA5StringNormalize, NULL},
|
||||
{"( 1.3.6.1.4.1.1466.115.121.1.12 DESC 'Distinguished Name' )",
|
||||
0, dnValidate, dnNormalize2, dnPretty2},
|
||||
0, dnValidate, xdnNormalize, dnPretty2},
|
||||
{"( 1.3.6.1.4.1.1466.115.121.1.13 DESC 'Data Quality' )",
|
||||
0, NULL, NULL, NULL},
|
||||
{"( 1.3.6.1.4.1.1466.115.121.1.14 DESC 'Delivery Method' )",
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ PROGRAMS=slapadd slapcat slapindex slappasswd
|
|||
SRCS = mimic.c slapcommon.c \
|
||||
slapadd.c slapcat.c slapindex.c slappasswd.c
|
||||
|
||||
SLAPD_OBJS = ../config.o ../ch_malloc.o ../cr.o ../backend.o \
|
||||
SLAPD_OBJS = ../globals.o ../config.o ../ch_malloc.o ../cr.o ../backend.o \
|
||||
../module.o ../aclparse.o ../filterentry.o ../schema.o \
|
||||
../schema_check.o ../schema_init.o ../schema_prep.o \
|
||||
../schemaparse.o ../ad.o ../at.o ../mr.o ../oc.o \
|
||||
|
|
|
|||
|
|
@ -230,17 +230,17 @@ slap_tool_init(
|
|||
}
|
||||
|
||||
if( base.bv_val != NULL ) {
|
||||
struct berval *nbase = NULL;
|
||||
struct berval nbase;
|
||||
|
||||
rc = dnNormalize( NULL, &base, &nbase );
|
||||
rc = dnNormalize2( NULL, &base, &nbase );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
fprintf( stderr, "%s: slap_init invalid suffix (\"%s\")\n",
|
||||
progname, base.bv_val );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
be = select_backend( nbase, 0, 0 );
|
||||
ber_bvfree( nbase );
|
||||
be = select_backend( &nbase, 0, 0 );
|
||||
ber_bvfree( nbase.bv_val );
|
||||
|
||||
if( be == NULL ) {
|
||||
fprintf( stderr, "%s: slap_init no backend for \"%s\"\n",
|
||||
|
|
|
|||
|
|
@ -147,9 +147,6 @@ int asserted_value_validate_normalize(
|
|||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
|
||||
assert( mr->smr_syntax );
|
||||
assert( mr->smr_syntax->ssyn_validate );
|
||||
|
||||
rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue