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 \
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 \
#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-
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 );
return LDAP_SUCCESS;
}
+#if 0
/*
* dn "pretty"ing routine
*/
*pretty = out;
return rc;
}
+#endif
int
dnPretty2(
}
#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;
}
#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;
--- /dev/null
+/* 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, "" };
+
#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 ) { \
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 ));
-
-LDAP_SLAPD_F (int) dnNormalize2 LDAP_P((
+ 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 ));
+#define dnNormalize2(s,v,n) dnNormalize((s),(v),(n))
+#endif
LDAP_SLAPD_F (int) dnPretty LDAP_P((
Syntax *syntax,
#define xintegerNormalize NULL
#define xnumericStringNormalize NULL
#define xnameUIDNormalize NULL
+#define xdnNormalize NULL
/* (new) normalization routines */
#define caseExactIA5Normalize IA5StringNormalize
#define caseExactNormalize UTF8StringNormalize
#define caseIgnoreNormalize UTF8StringNormalize
-#define distinguishedNameNormalize NULL
#define integerNormalize NULL
#define integerFirstComponentNormalize NULL
#define numericStringNormalize NULL
#define bitStringNormalize NULL
#define telephoneNumberNormalize NULL
+#define distinguishedNameNormalize dnNormalize
#define distinguishedNameMatch dnMatch
#define distinguishedNameIndexer octetStringIndexer
#define distinguishedNameFilter octetStringFilter
#define caseIgnoreIndexer octetStringIndexer
#define caseIgnoreFilter octetStringFilter
-#define caseIgnoreSubstringsMatch NULL
+#define caseIgnoreSubstringsMatch SubstringsMatch
#define caseIgnoreSubstringsIndexer NULL
#define caseIgnoreSubstringsFilter NULL
#ifndef SLAP_NVALUES
+#define xdnNormalize dnNormalize
+
/* (new) normalization routines */
#define caseExactNormalize NULL
#define caseExactIA5Normalize NULL
}
static int
-caseExactIA5SubstringsMatch(
+caseExactIA5SubstringsMatch
+#else
+static int
+SubstringsMatch
+#endif
+(
int *matchp,
slap_mask_t flags,
Syntax *syntax,
return LDAP_SUCCESS;
}
+#ifndef SLAP_NVALUES
+
/* Index generation function */
static int caseExactIA5Indexer(
slap_mask_t use,
{"( 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' )",
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 \
}
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",
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 ) {