Skip to content
Snippets Groups Projects
Commit 693fb942 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

unifdef -DSLAPD_SCHEMA_NOT_COMPAT -USLAPD_SCHEMA_COMPAT

parent dd00feb0
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 667 deletions
......@@ -14,12 +14,6 @@
/* end of preamble */
#if !defined(SLAPD_SCHEMA_COMPAT) && !defined(SLAPD_SCHEMA_NOT_COMPAT)
/* define SLAPD_SCHEMA_COMPAT if you want old schema codes */
#define SLAPD_SCHEMA_NOT_COMPAT 1
#endif
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
......
......@@ -16,11 +16,6 @@
/* end of preamble */
#if !defined( SLAPD_SCHEMA_COMPAT ) && !defined( SLAPD_SCHEMA_NOT_COMPAT )
/* use new schema codes */
#define SLAPD_SCHEMA_NOT_COMPAT 1
#endif
/* comment this out if you don't have Cyrus SASL */
#define HAVE_CYRUS_SASL 1
......
......@@ -19,22 +19,14 @@ static AccessControl * acl_get(
AccessControl *ac, int *count,
Backend *be, Operation *op,
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *desc,
#endif
int nmatches, regmatch_t *matches );
static slap_control_t acl_mask(
AccessControl *ac, slap_access_mask_t *mask,
Backend *be, Connection *conn, Operation *op,
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *desc,
#endif
struct berval *val,
regmatch_t *matches );
......@@ -43,11 +35,7 @@ static int aci_mask(
Backend *be,
Operation *op,
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *desc,
#endif
struct berval *val,
struct berval *aci,
regmatch_t *matches,
......@@ -83,11 +71,7 @@ access_allowed(
Connection *conn,
Operation *op,
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *desc,
#endif
struct berval *val,
slap_access_t access )
{
......@@ -99,11 +83,7 @@ access_allowed(
slap_access_mask_t mask;
slap_control_t control;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
const char *attr = desc ? desc->ad_cname->bv_val : NULL;
#else
const char *attr = desc;
#endif
regmatch_t matches[MAXREMATCHES];
......@@ -130,11 +110,7 @@ access_allowed(
* by ACL_WRITE checking as any found here are not provided
* by the user
*/
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if ( access >= ACL_WRITE && is_at_no_user_mod( desc->ad_type ) )
#else
if ( access >= ACL_WRITE && oc_check_op_no_usermod_attr( attr ) )
#endif
{
Debug( LDAP_DEBUG_ACL, "NoUserMod Operational attribute:"
" %s access granted\n",
......@@ -232,11 +208,7 @@ acl_get(
Backend *be,
Operation *op,
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *desc,
#endif
int nmatch,
regmatch_t *matches )
{
......@@ -244,11 +216,7 @@ acl_get(
assert( e != NULL );
assert( count != NULL );
#ifdef SLAPD_SCHEMA_NOT_COMPAT
attr = desc ? desc->ad_cname->bv_val : NULL;
#else
attr = desc;
#endif
if( a == NULL ) {
if( be == NULL ) {
......@@ -322,11 +290,7 @@ acl_mask(
Connection *conn,
Operation *op,
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *desc,
#endif
struct berval *val,
regmatch_t *matches
)
......@@ -336,11 +300,7 @@ acl_mask(
#ifdef LDAP_DEBUG
char accessmaskbuf[ACCESSMASK_MAXLEN];
#endif
#ifdef SLAPD_SCHEMA_NOT_COMPAT
const char *attr = desc ? desc->ad_cname->bv_val : NULL;
#else
const char *attr = desc;
#endif
assert( a != NULL );
assert( mask != NULL );
......@@ -449,13 +409,9 @@ acl_mask(
if ( b->a_dn_at != NULL && op->o_ndn != NULL ) {
Attribute *at;
struct berval bv;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
int match;
const char *text;
const char *desc = b->a_dn_at->ad_cname->bv_val;
#else
const char *desc = b->a_dn_at;
#endif
Debug( LDAP_DEBUG_ACL, "<= check a_dn_at: %s\n",
b->a_dn_at, 0, 0);
......@@ -464,7 +420,6 @@ acl_mask(
bv.bv_len = strlen( bv.bv_val );
/* see if asker is listed in dnattr */
#ifdef SLAPD_SCHEMA_NOT_COMPAT
for( at = attrs_find( e->e_attrs, b->a_dn_at );
at == NULL;
at = attrs_find( e->e_attrs->a_next, b->a_dn_at ) )
......@@ -493,24 +448,6 @@ acl_mask(
{
continue;
}
#else
/* see if asker is listed in dnattr */
if ( (at = attr_find( e->e_attrs, b->a_dn_at )) != NULL &&
value_find( at->a_vals, &bv, at->a_syntax, 3 ) == 0 )
{
if ( b->a_dn_self && (val == NULL
|| value_cmp( &bv, val, at->a_syntax, 2 ) ) )
{
continue;
}
/* asker not listed in dnattr - check for self access */
} else if ( ! b->a_dn_self || val == NULL
|| value_cmp( &bv, val, at->a_syntax, 2 ) != 0 )
{
continue;
}
#endif
}
if ( b->a_group_pat != NULL && op->o_ndn != NULL ) {
......@@ -725,21 +662,12 @@ acl_check_modlist(
* by ACL_WRITE checking as any found here are not provided
* by the user
*/
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if ( is_at_no_user_mod( mlist->sml_desc->ad_type ) ) {
Debug( LDAP_DEBUG_ACL, "acl: no-user-mod %s:"
" modify access granted\n",
mlist->sml_desc->ad_cname->bv_val, 0, 0 );
continue;
}
#else
if ( oc_check_op_no_usermod_attr( mlist->sml_type ) ) {
Debug( LDAP_DEBUG_ACL, "acl: no-user-mod %s:"
" modify access granted\n",
mlist->sml_type, 0, 0 );
continue;
}
#endif
switch ( mlist->sml_op ) {
case LDAP_MOD_REPLACE:
......@@ -1019,14 +947,9 @@ aci_group_member (
char *subjdn, *grpdn = NULL;
char *grpoc;
char *grpat;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
ObjectClass *grp_oc = NULL;
AttributeDescription *grp_ad = NULL;
char *text;
#else
char *grp_oc;
char *grp_ad;
#endif
int rc;
/* format of string is "group/objectClassValue/groupAttrName" */
......@@ -1051,15 +974,11 @@ aci_group_member (
grpat = aci_bvstrdup(&bv);
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_str2ad( grpat, &grp_ad, &text );
if( rc != LDAP_SUCCESS ) {
rc = 0;
goto done;
}
#else
grp_ad = grpat;
#endif
rc = 0;
grpdn = (char *)ch_malloc(1024);
......@@ -1071,10 +990,8 @@ aci_group_member (
}
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
done:
if( grp_ad != NULL ) ad_free( grp_ad, 1 );
#endif
ch_free(grpdn);
ch_free(grpat);
ch_free(grpoc);
......@@ -1087,11 +1004,7 @@ aci_mask(
Backend *be,
Operation *op,
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *attr,
#endif
struct berval *val,
struct berval *aci,
regmatch_t *matches,
......@@ -1102,9 +1015,7 @@ aci_mask(
struct berval bv, perms, sdn;
char *subjdn;
int rc, i;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
char *attr;
#endif
/* parse an aci of the form:
oid#scope#action;rights;attr;rights;attr$action;rights;attr;rights;attr#dnType#subjectDN
......@@ -1163,7 +1074,6 @@ aci_mask(
} else if (aci_strbvcmp( "dnattr", &bv ) == 0) {
char *dnattr = aci_bvstrdup(&sdn);
#ifdef SLAPD_SCHEMA_NOT_COMPAT
Attribute *at;
AttributeDescription *ad = NULL;
const char *text;
......@@ -1193,19 +1103,6 @@ aci_mask(
ad_free( ad, 1 );
return rc;
#else
Attribute *at;
at = attr_find( e->e_attrs, dnattr );
ch_free( dnattr );
if (at != NULL) {
bv.bv_val = op->o_ndn;
bv.bv_len = strlen( bv.bv_val );
if (value_find( at->a_vals, &bv, at->a_syntax, 3 ) == 0 )
return(1);
}
#endif
} else if (aci_strbvcmp( "group", &bv ) == 0) {
if (aci_group_member(&sdn, SLAPD_GROUP_CLASS, SLAPD_GROUP_ATTR, be, e, op, matches))
......
......@@ -95,10 +95,8 @@ parse_acl(
char *left, *right;
AccessControl *a;
Access *b;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
int rc;
const char *text;
#endif
a = NULL;
for ( i = 1; i < argc; i++ ) {
......@@ -324,7 +322,6 @@ parse_acl(
acl_usage();
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_str2ad( right, &b->a_dn_at, &text );
if( rc != LDAP_SUCCESS ) {
......@@ -346,9 +343,6 @@ parse_acl(
acl_usage();
}
#else
b->a_dn_at = ch_strdup( right );
#endif
continue;
}
......@@ -377,11 +371,7 @@ parse_acl(
b->a_group_pat = ch_strdup( right );
if (value && *value) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
b->a_group_oc = oc_find( value );
#else
b->a_group_oc = ch_strdup(value);
#endif
*--value = '/';
if( b->a_group_oc == NULL ) {
......@@ -392,7 +382,6 @@ parse_acl(
acl_usage();
}
} else {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
b->a_group_oc = oc_find(SLAPD_GROUP_CLASS);
if( b->a_group_oc == NULL ) {
......@@ -402,12 +391,8 @@ parse_acl(
fname, lineno, SLAPD_GROUP_CLASS );
acl_usage();
}
#else
b->a_group_oc = ch_strdup(SLAPD_GROUP_CLASS);
#endif
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
#if 0
if( is_object_subclass( b->a_group_oc,
slap_schema.si_oc_referral ) )
......@@ -428,11 +413,9 @@ parse_acl(
fname, lineno, value );
acl_usage();
}
#endif
#endif
if (name && *name) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_str2ad( right, &b->a_group_at, &text );
if( rc != LDAP_SUCCESS ) {
......@@ -441,12 +424,8 @@ parse_acl(
fname, lineno, right, text );
acl_usage();
}
#else
b->a_group_at = ch_strdup(name);
#endif
*--name = '/';
} else {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_str2ad( SLAPD_GROUP_ATTR, &b->a_group_at, &text );
if( rc != LDAP_SUCCESS ) {
......@@ -455,12 +434,8 @@ parse_acl(
fname, lineno, SLAPD_GROUP_ATTR, text );
acl_usage();
}
#else
b->a_group_at = ch_strdup( SLAPD_GROUP_ATTR );
#endif
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if( !is_at_syntax( b->a_group_at->ad_type,
SLAPD_DN_SYNTAX ) )
{
......@@ -494,7 +469,6 @@ parse_acl(
acl_usage();
}
}
#endif
continue;
}
......@@ -559,7 +533,6 @@ parse_acl(
acl_usage();
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if ( right != NULL && *right != '\0' ) {
rc = slap_str2ad( right, &b->a_aci_at, &text );
......@@ -591,13 +564,6 @@ parse_acl(
acl_usage();
}
#else
if ( right != NULL && *right != '\0' ) {
b->a_aci_at = ch_strdup( right );
} else {
b->a_aci_at = ch_strdup( SLAPD_ACI_ATTR );
}
#endif
continue;
}
#endif /* SLAPD_ACI_ENABLED */
......@@ -1012,11 +978,7 @@ print_access( Access *b )
}
if ( b->a_dn_at != NULL ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
fprintf( stderr, " dnattr=%s", b->a_dn_at->ad_cname->bv_val );
#else
fprintf( stderr, " dnattr=%s", b->a_dn_at );
#endif
}
if ( b->a_group_pat != NULL ) {
......@@ -1026,11 +988,7 @@ print_access( Access *b )
fprintf( stderr, " objectClass: %s", b->a_group_oc );
if ( b->a_group_at ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
fprintf( stderr, " attributeType: %s", b->a_group_at->ad_cname->bv_val );
#else
fprintf( stderr, " attributeType: %s", b->a_group_at );
#endif
}
}
}
......@@ -1053,11 +1011,7 @@ print_access( Access *b )
#ifdef SLAPD_ACI_ENABLED
if ( b->a_aci_at != NULL ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
fprintf( stderr, " aci=%s", b->a_aci_at->ad_cname->bv_val );
#else
fprintf( stderr, " aci=%s", b->a_aci_at );
#endif
}
#endif
......
......@@ -18,7 +18,6 @@
#include "ldap_pvt.h"
#include "slap.h"
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ad_dup(
AttributeDescription *desc )
{
......@@ -243,5 +242,4 @@ int ad_inlist(
return 0;
}
#endif
......@@ -26,14 +26,10 @@
#include "ldap_pvt.h"
#include "slap.h"
#ifdef SLAPD_SCHEMA_NOT_COMPAT
static int slap_mods2entry(
Modifications *mods,
Entry **e,
const char **text );
#else
static int add_created_attrs(Operation *op, Entry *e);
#endif
int
do_add( Connection *conn, Operation *op )
......@@ -44,11 +40,9 @@ do_add( Connection *conn, Operation *op )
ber_tag_t tag;
Entry *e;
Backend *be;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
LDAPModList *modlist = NULL;
LDAPModList **modtail = &modlist;
Modifications *mods = NULL;
#endif
const char *text;
int rc = LDAP_SUCCESS;
......@@ -98,12 +92,7 @@ do_add( Connection *conn, Operation *op )
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
tag = ber_next_element( ber, &len, last ) )
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
LDAPModList *mod = (LDAPModList *) ch_malloc( sizeof(LDAPModList) );
#else
LDAPModList tmpmod;
LDAPModList *mod = &tmpmod;
#endif
mod->ml_op = LDAP_MOD_ADD;
mod->ml_next = NULL;
......@@ -114,9 +103,7 @@ do_add( Connection *conn, Operation *op )
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = -1;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
free( mod );
#endif
goto done;
}
......@@ -126,21 +113,12 @@ do_add( Connection *conn, Operation *op )
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
NULL, "no values for attribute type", NULL, NULL );
free( mod->ml_type );
#ifdef SLAPD_SCHEMA_NOT_COMPAT
free( mod );
#endif
goto done;
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
*modtail = mod;
modtail = &mod->ml_next;
#else
attr_merge( e, mod->ml_type, mod->ml_bvalues );
free( mod->ml_type );
ber_bvecfree( mod->ml_bvalues );
#endif
}
if ( ber_scanf( ber, /*{*/ "}") == LBER_ERROR ) {
......@@ -156,11 +134,7 @@ do_add( Connection *conn, Operation *op )
goto done;
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if ( modlist == NULL )
#else
if ( e->e_attrs == NULL )
#endif
{
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
NULL, "no attributes provided", NULL, NULL );
......@@ -218,7 +192,6 @@ do_add( Connection *conn, Operation *op )
{
int update = be->be_update_ndn != NULL;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_modlist2mods( modlist, update, &mods, &text );
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
......@@ -226,13 +199,11 @@ do_add( Connection *conn, Operation *op )
goto done;
}
#endif
#ifndef SLAPD_MULTIMASTER
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
global_lastmod == ON)) && !update )
#endif
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
Modifications **modstail;
for( modstail = &mods;
*modstail != NULL;
......@@ -242,10 +213,6 @@ do_add( Connection *conn, Operation *op )
assert( (*modstail)->sml_desc != NULL );
}
rc = slap_mods_opattrs( op, modstail, &text );
#else
char *text = "no-user-modification attribute type";
rc = add_created_attrs( op, e );
#endif
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
......@@ -253,14 +220,12 @@ do_add( Connection *conn, Operation *op )
}
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_mods2entry( mods, &e, &text );
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
goto done;
}
#endif
if ( (*be->be_add)( be, conn, op, e ) == 0 ) {
#ifdef SLAPD_MULTIMASTER
......@@ -287,14 +252,12 @@ do_add( Connection *conn, Operation *op )
}
done:
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if( modlist != NULL ) {
slap_modlist_free( modlist );
}
if( mods != NULL ) {
slap_mods_free( mods );
}
#endif
if( e != NULL ) {
entry_free( e );
}
......@@ -302,7 +265,6 @@ done:
return rc;
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
static int slap_mods2entry(
Modifications *mods,
Entry **e,
......@@ -342,51 +304,3 @@ static int slap_mods2entry(
return LDAP_SUCCESS;
}
#else
static int
add_created_attrs( Operation *op, Entry *e )
{
char buf[22];
struct berval bv;
struct berval *bvals[2];
Attribute *a;
struct tm *ltm;
time_t currenttime;
Debug( LDAP_DEBUG_TRACE, "add_created_attrs\n", 0, 0, 0 );
bvals[0] = &bv;
bvals[1] = NULL;
/* return error on any attempts by the user to add these attrs */
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
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 = SLAPD_ANONYMOUS;
bv.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
;
} else {
bv.bv_val = op->o_dn;
bv.bv_len = strlen( bv.bv_val );
}
attr_merge( e, "creatorsname", bvals );
attr_merge( e, "modifiersname", bvals );
currenttime = slap_get_time();
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
ltm = gmtime( &currenttime );
strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
bv.bv_val = buf;
bv.bv_len = strlen( bv.bv_val );
attr_merge( e, "createtimestamp", bvals );
attr_merge( e, "modifytimestamp", bvals );
return LDAP_SUCCESS;
}
#endif
......@@ -18,160 +18,6 @@
#include "ldap_pvt.h"
#include "slap.h"
#ifndef SLAPD_SCHEMA_NOT_COMPAT
char *
at_canonical_name( const char * a_type )
{
AttributeType *atp;
atp=at_find(a_type);
if ( atp == NULL ) {
return (char *) a_type;
} else if ( atp->sat_names
&& atp->sat_names[0] && (*(atp->sat_names[0]) != '\0') )
{
return atp->sat_names[0];
} else if (atp->sat_oid && (*atp->sat_oid != '\0')) {
return atp->sat_oid;
}
return (char *) a_type;
}
#define DEFAULT_SYNTAX SYNTAX_CIS
/*
* attr_syntax - return the syntax of attribute type
*/
int
attr_syntax( const char *type )
{
AttributeType *sat;
sat = at_find(type);
if ( sat ) {
return( sat->sat_syntax_compat );
}
return( DEFAULT_SYNTAX );
}
/*
* attr_syntax_config - process an attribute syntax config line
*/
void
at_config(
const char *fname,
int lineno,
int argc,
char **argv
)
{
char *save;
LDAP_ATTRIBUTE_TYPE *at;
int lasti;
int code;
const char *err;
if ( argc < 2 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing name in \"attribute <name>+ <syntax>\" (ignored)\n",
fname, lineno, 0 );
return;
}
at = (LDAP_ATTRIBUTE_TYPE *)
ch_calloc( 1, sizeof(LDAP_ATTRIBUTE_TYPE) );
#define SYNTAX_DS_OID "1.3.6.1.4.1.1466.115.121.1.15"
#define SYNTAX_DSCE_OID "2.5.13.5"
#define SYNTAX_IA5_OID "1.3.6.1.4.1.1466.115.121.1.26"
#define SYNTAX_IA5CE_OID "1.3.6.1.4.1.1466.109.114.1"
#define SYNTAX_DN_OID "1.3.6.1.4.1.1466.115.121.1.12"
#define SYNTAX_TEL_OID "1.3.6.1.4.1.1466.115.121.1.50"
#define SYNTAX_BIN_OID "1.3.6.1.4.1.1466.115.121.1.40" /* octetString */
lasti = argc - 1;
if ( strcasecmp( argv[lasti], "caseignorestring" ) == 0 ||
strcasecmp( argv[lasti], "cis" ) == 0 ) {
at->at_syntax_oid = SYNTAX_DS_OID;
at->at_equality_oid = "2.5.13.2";
at->at_ordering_oid = "2.5.13.3";
at->at_substr_oid = "2.5.13.4";
} else if ( strcasecmp( argv[lasti], "telephone" ) == 0 ||
strcasecmp( argv[lasti], "tel" ) == 0 ) {
at->at_syntax_oid = SYNTAX_TEL_OID;
at->at_equality_oid = "2.5.13.20";
at->at_substr_oid = "2.5.13.21";
} else if ( strcasecmp( argv[lasti], "dn" ) == 0 ) {
at->at_syntax_oid = SYNTAX_DN_OID;
at->at_equality_oid = "2.5.13.1";
} else if ( strcasecmp( argv[lasti], "caseexactstring" ) == 0 ||
strcasecmp( argv[lasti], "ces" ) == 0 ) {
at->at_syntax_oid = SYNTAX_DS_OID;
at->at_equality_oid = SYNTAX_DSCE_OID;
at->at_ordering_oid = "2.5.13.6";
at->at_substr_oid = "2.5.13.7";
} else if ( strcasecmp( argv[lasti], "binary" ) == 0 ||
strcasecmp( argv[lasti], "bin" ) == 0 ) {
/* bin -> octetString, not binary! */
at->at_syntax_oid = SYNTAX_BIN_OID;
at->at_equality_oid = "2.5.13.17";
} else {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unknown syntax \"%s\" in attribute line (ignored)\n",
fname, lineno, argv[lasti] );
Debug( LDAP_DEBUG_ANY,
"possible syntaxes are \"cis\", \"ces\", \"tel\", \"dn\", or \"bin\"\n",
0, 0, 0 );
free( (AttributeType *) at );
return;
}
save = argv[lasti];
argv[lasti] = NULL;
at->at_names = charray_dup( argv );
argv[lasti] = save;
code = at_add( at, &err );
if ( code ) {
fprintf( stderr, "%s: line %d: %s %s\n",
fname, lineno, scherr2str(code), err);
exit( EXIT_FAILURE );
}
ldap_memfree(at);
}
int
at_fake_if_needed(
const char *name
)
{
char *argv[3];
if ( at_find( name ) ) {
return 0;
} else {
argv[0] = (char*) name;
argv[1] = "cis";
argv[2] = NULL;
at_config( "implicit", 0, 2, argv );
return 0;
}
}
#endif
int is_at_syntax(
AttributeType *at,
......@@ -231,19 +77,6 @@ at_find(
struct aindexrec *air;
char *tmpname;
#ifndef SLAPD_SCHEMA_NOT_COMPAT
/*
* The name may actually be an AttributeDescription, i.e. it may
* contain options.
*/
/* Treat any attribute type with option as an unknown attribute type */
char *p = strchr( name, ';' );
if ( p ) {
tmpname = ch_malloc( p-name+1 );
strncpy( tmpname, name, p-name );
tmpname[p-name] = '\0';
} else
#endif
{
tmpname = (char *)name;
}
......@@ -427,9 +260,7 @@ at_add(
sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
memcpy( &sat->sat_atype, at, sizeof(LDAP_ATTRIBUTE_TYPE));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
sat->sat_cname = cname;
#endif
if ( at->at_sup_oid ) {
AttributeType *supsat = at_find(at->at_sup_oid);
......@@ -454,9 +285,6 @@ at_add(
*/
if ( sat->sat_sup ) {
sat->sat_syntax = sat->sat_sup->sat_syntax;
#ifndef SLAPD_SCHEMA_NOT_COMPAT
sat->sat_syntax_compat = sat->sat_sup->sat_syntax_compat;
#endif
sat->sat_equality = sat->sat_sup->sat_equality;
sat->sat_ordering = sat->sat_sup->sat_ordering;
sat->sat_substr = sat->sat_sup->sat_substr;
......@@ -470,38 +298,6 @@ at_add(
return SLAP_SCHERR_SYN_NOT_FOUND;
}
#ifndef SLAPD_SCHEMA_NOT_COMPAT
if ( !strcmp(at->at_syntax_oid, SYNTAX_DS_OID) ) {
if ( at->at_equality_oid && (
!strcmp(at->at_equality_oid, SYNTAX_DSCE_OID) ) )
{
sat->sat_syntax_compat = SYNTAX_CES;
} else {
sat->sat_syntax_compat = SYNTAX_CIS;
}
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_IA5_OID) ) {
if ( at->at_equality_oid && (
!strcmp(at->at_equality_oid, SYNTAX_IA5CE_OID) ) )
{
sat->sat_syntax_compat = SYNTAX_CES;
} else {
sat->sat_syntax_compat = SYNTAX_CIS;
}
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_DN_OID ) ) {
sat->sat_syntax_compat = SYNTAX_CIS | SYNTAX_DN;
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_TEL_OID ) ) {
sat->sat_syntax_compat = SYNTAX_CIS | SYNTAX_TEL;
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_BIN_OID ) ) {
sat->sat_syntax_compat = SYNTAX_BIN;
} else {
sat->sat_syntax_compat = DEFAULT_SYNTAX;
}
#endif
} else if ( sat->sat_syntax == NULL ) {
return SLAP_SCHERR_ATTR_INCOMPLETE;
......@@ -567,11 +363,7 @@ at_schema_info( Entry *e )
struct berval *vals[2];
AttributeType *at;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ad_attributeTypes = slap_schema.si_ad_attributeTypes;
#else
char *ad_attributeTypes = "attributeTypes";
#endif
vals[0] = &val;
vals[1] = NULL;
......
......@@ -29,11 +29,7 @@ static void at_index_print( void );
void
attr_free( Attribute *a )
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
ad_free( a->a_desc, 1 );
#else
free( a->a_type );
#endif
ber_bvecfree( a->a_vals );
free( a );
}
......@@ -78,12 +74,7 @@ Attribute *attr_dup( Attribute *a )
tmp->a_vals = NULL;
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
tmp->a_desc = ad_dup( a->a_desc );
#else
tmp->a_type = ch_strdup( a->a_type );
tmp->a_syntax = a->a_syntax;
#endif
tmp->a_next = NULL;
return tmp;
......@@ -107,58 +98,6 @@ Attribute *attrs_dup( Attribute *a )
return tmp;
}
#ifndef SLAPD_SCHEMA_NOT_COMPAT
/*
* attr_normalize - normalize an attribute name (make it all lowercase)
*/
char *
attr_normalize( char *s )
{
assert( s != NULL );
return( ldap_pvt_str2lower( s ) );
}
/*
* attr_merge_fast - merge the given type and value with the list of
* attributes in attrs. called from str2entry(), where we can make some
* assumptions to make things faster.
* returns 0 everything went ok
* -1 trouble
*/
int
attr_merge_fast(
Entry *e,
const char *type,
struct berval **vals,
int nvals,
int naddvals,
int *maxvals,
Attribute ***a
)
{
if ( *a == NULL ) {
for ( *a = &e->e_attrs; **a != NULL; *a = &(**a)->a_next ) {
if ( strcasecmp( (**a)->a_type, type ) == 0 ) {
break;
}
}
}
if ( **a == NULL ) {
**a = (Attribute *) ch_malloc( sizeof(Attribute) );
(**a)->a_vals = NULL;
(**a)->a_type = attr_normalize( ch_strdup( type ) );
(**a)->a_syntax = attr_syntax( type );
(**a)->a_next = NULL;
}
return( value_add_fast( &(**a)->a_vals, vals, nvals, naddvals,
maxvals ) );
}
#endif
/*
......@@ -171,21 +110,13 @@ attr_merge_fast(
int
attr_merge(
Entry *e,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc,
#else
const char *type,
#endif
struct berval **vals )
{
Attribute **a;
for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if ( ad_cmp( (*a)->a_desc, desc ) == 0 )
#else
if ( strcasecmp( (*a)->a_type, type ) == 0 )
#endif
{
break;
}
......@@ -193,12 +124,7 @@ attr_merge(
if ( *a == NULL ) {
*a = (Attribute *) ch_malloc( sizeof(Attribute) );
#ifdef SLAPD_SCHEMA_NOT_COMPAT
(*a)->a_desc = ad_dup( desc );
#else
(*a)->a_type = attr_normalize( ch_strdup( type ) );
(*a)->a_syntax = attr_syntax( type );
#endif
(*a)->a_vals = NULL;
(*a)->a_next = NULL;
}
......@@ -206,7 +132,6 @@ attr_merge(
return( value_add( &(*a)->a_vals, vals ) );
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
/*
* attrs_find - find attribute(s) by AttributeDescription
* returns next attribute which is subtype of provided description.
......@@ -226,7 +151,6 @@ attrs_find(
return( NULL );
}
#endif
/*
* attr_find - find attribute by type
......@@ -235,19 +159,11 @@ attrs_find(
Attribute *
attr_find(
Attribute *a,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc
#else
const char *type
#endif
)
{
for ( ; a != NULL; a = a->a_next ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if ( ad_cmp( a->a_desc, desc ) == 0 )
#else
if ( strcasecmp( a->a_type, type ) == 0 )
#endif
{
return( a );
}
......@@ -266,21 +182,13 @@ attr_find(
int
attr_delete(
Attribute **attrs,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *desc
#else
const char *type
#endif
)
{
Attribute **a;
for ( a = attrs; *a != NULL; a = &(*a)->a_next ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
if ( ad_cmp( (*a)->a_desc, desc ) == 0 )
#else
if ( strcasecmp( (*a)->a_type, type ) == 0 )
#endif
{
Attribute *save = *a;
*a = (*a)->a_next;
......
......@@ -14,7 +14,6 @@
#include "slap.h"
#ifdef SLAPD_SCHEMA_NOT_COMPAT
void
ava_free(
......@@ -78,39 +77,3 @@ get_ava(
return LDAP_SUCCESS;
}
#else
void
ava_free(
Ava *ava,
int freeit
)
{
ch_free( (char *) ava->ava_type );
ch_free( (char *) ava->ava_value.bv_val );
if ( freeit ) {
ch_free( (char *) ava );
}
}
int
get_ava(
BerElement *ber,
Ava *ava,
const char **text
)
{
if ( ber_scanf( ber, "{ao}", &ava->ava_type, &ava->ava_value )
== LBER_ERROR ) {
Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 );
*text = "Error decoding attribute value assertion";
return SLAPD_DISCONNECT;
}
attr_normalize( ava->ava_type );
value_normalize( ava->ava_value.bv_val, attr_syntax( ava->ava_type ) );
return LDAP_SUCCESS;
}
#endif
......@@ -22,11 +22,7 @@ dnssrv_back_compare(
Operation *op,
const char *dn,
const char *ndn,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeAssertion *ava
#else
Ava *ava
#endif
)
{
return dnssrv_back_request( be, conn, op, dn, ndn,
......
......@@ -35,15 +35,9 @@ extern int dnssrv_back_search LDAP_P(( BackendDB *bd,
Filter *filter, const char *filterstr,
char **attrs, int attrsonly ));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
extern int dnssrv_back_compare LDAP_P((BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, AttributeAssertion *ava ));
#else
extern int dnssrv_back_compare LDAP_P((BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, Ava *ava ));
#endif
extern int dnssrv_back_modify LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
......
......@@ -131,14 +131,9 @@ dnssrv_back_request(
struct berval val;
struct berval *vals[2];
Entry *e = ch_calloc( 1, sizeof(Entry) );
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ad_objectClass
= slap_schema.si_ad_objectClass;
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
#else
const char ad_objectClass = "objectClass";
const char ad_ref = "ref";
#endif
e->e_dn = strdup( dn );
e->e_ndn = strdup( ndn );
......@@ -161,15 +156,10 @@ dnssrv_back_request(
attr_merge( e, ad_objectClass, vals );
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ad = NULL;
const char *text;
rc = slap_str2ad( "dc", &ad, &text );
#else
rc = LDAP_SUCCESS;
const char *ad = "dc";
#endif
if( rc == LDAP_SUCCESS ) {
char *p;
......@@ -191,15 +181,10 @@ dnssrv_back_request(
}
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ad = NULL;
const char *text;
rc = slap_str2ad( "associatedDomain", &ad, &text );
#else
rc = LDAP_SUCCESS;
const char *ad = "associatedDomain";
#endif
if( rc == LDAP_SUCCESS ) {
val.bv_val = domain;
......
......@@ -67,11 +67,7 @@ ldap_back_add(
for (i=0, a=e->e_attrs; a; i++, a=a->a_next) {
attrs[i] = (LDAPMod *)ch_malloc(sizeof(LDAPMod));
attrs[i]->mod_op = LDAP_MOD_BVALUES;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
attrs[i]->mod_type = a->a_desc->ad_cname->bv_val;
#else
attrs[i]->mod_type = a->a_type;
#endif
attrs[i]->mod_vals.modv_bvals = a->a_vals;
}
......
......@@ -39,11 +39,7 @@ ldap_back_compare(
Operation *op,
const char *dn,
const char *ndn,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeAssertion *ava
#else
Ava *ava
#endif
)
{
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
......@@ -59,10 +55,6 @@ ldap_back_compare(
return( -1 );
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
ldap_compare_s( lc->ld, dn, ava->aa_desc->ad_cname->bv_val, ava->aa_value->bv_val );
#else
ldap_compare_s( lc->ld, dn, ava->ava_type, ava->ava_value.bv_val );
#endif
return( ldap_back_op_result( lc, op ) );
}
......@@ -30,17 +30,10 @@ extern int ldap_back_search LDAP_P(( BackendDB *bd,
Filter *filter, const char *filterstr,
char **attrs, int attrsonly ));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
extern int ldap_back_compare LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
AttributeAssertion *ava ));
#else
extern int ldap_back_compare LDAP_P((BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
Ava *ava ));
#endif
extern int ldap_back_modify LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
......@@ -62,20 +55,12 @@ extern int ldap_back_delete LDAP_P(( BackendDB *bd,
extern int ldap_back_abandon LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, int msgid ));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
extern int ldap_back_group LDAP_P(( BackendDB *bd,
Entry *target,
const char* gr_ndn,
const char* op_ndn,
ObjectClass* group_oc,
AttributeDescription* group_at));
#else
extern int ldap_back_group LDAP_P(( BackendDB *bd,
Entry *target,
const char* gr_ndn, const char* op_ndn,
const char* group_oc,
const char* group_at));
#endif
LDAP_END_DECL
......
......@@ -145,9 +145,7 @@ ldap_send_entry(
BerElement *ber = NULL;
Attribute *attr, **attrp;
struct berval *dummy = NULL;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
char *text;
#endif
ent.e_dn = ldap_get_dn(lc->ld, e);
ent.e_ndn = ch_strdup( ent.e_dn);
......@@ -165,12 +163,7 @@ ldap_send_entry(
if (attr == NULL)
continue;
attr->a_next = 0;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
slap_str2ad(a, &attr->a_desc, &text);
#else
attr->a_type = ch_strdup(a);
attr->a_syntax = attr_syntax(a);
#endif
attr->a_vals = ldap_get_values_len(lc->ld, e, a);
if (!attr->a_vals)
attr->a_vals = &dummy;
......@@ -181,11 +174,7 @@ ldap_send_entry(
for (;ent.e_attrs;) {
attr=ent.e_attrs;
ent.e_attrs = attr->a_next;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
ad_free(attr->a_desc, 1);
#else
free(attr->a_type);
#endif
if (attr->a_vals != &dummy)
ber_bvecfree(attr->a_vals);
free(attr);
......
......@@ -30,11 +30,7 @@ ldbm_back_add(
int rootlock = 0;
int rc;
const char *text = NULL;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *children = slap_schema.si_ad_children;
#else
static const char *children = "children";
#endif
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_add: %s\n", e->e_dn, 0, 0);
......
......@@ -217,11 +217,7 @@ static char* get_alias_dn(
const char **errmsg )
{
Attribute *a;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *aliasedObjectName = slap_schema.si_ad_aliasedObjectName;
#else
static const char *aliasedObjectName = "aliasedObjectName";
#endif
a = attr_find( e->e_attrs, aliasedObjectName );
......
......@@ -138,10 +138,8 @@ attr_index_config(
for ( i = 0; attrs[i] != NULL; i++ ) {
AttrInfo *a;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ad;
const char *text;
#endif
if( strcasecmp( attrs[i], "default" ) == 0 ) {
li->li_defaultmask = mask;
......@@ -150,7 +148,6 @@ attr_index_config(
a = (AttrInfo *) ch_malloc( sizeof(AttrInfo) );
#ifdef SLAPD_SCHEMA_NOT_COMPAT
ad = NULL;
rc = slap_str2ad( attrs[i], &ad, &text );
......@@ -213,9 +210,6 @@ attr_index_config(
a->ai_desc = ch_strdup( ad->ad_cname->bv_val );
ad_free( ad, 1 );
#endif
#else
a->ai_desc = ch_strdup( attrs[i] );
#endif
a->ai_indexmask = mask;
......
......@@ -40,13 +40,8 @@ ldbm_back_bind(
AUTH_DAT ad;
#endif
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *password = slap_schema.si_ad_userPassword;
AttributeDescription *entry = slap_schema.si_ad_entry;
#else
static const char *password = "userpassword";
static const char *entry = "entry";
#endif
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_bind: dn: %s\n", dn, 0, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment