From 78ddb88960b53624ae4d3f010237dfeb8cc9a206 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 15 Nov 2004 22:10:10 +0000 Subject: [PATCH] minor cleanup --- servers/slapd/back-sql/add.c | 23 ++++++++++++----------- servers/slapd/back-sql/api.c | 4 ---- servers/slapd/back-sql/bind.c | 4 ---- servers/slapd/back-sql/compare.c | 4 ---- servers/slapd/back-sql/config.c | 4 ---- servers/slapd/back-sql/delete.c | 4 ---- servers/slapd/back-sql/entry-id.c | 4 ---- servers/slapd/back-sql/modify.c | 4 ---- servers/slapd/back-sql/modrdn.c | 4 ---- servers/slapd/back-sql/operational.c | 4 ---- servers/slapd/back-sql/schema-map.c | 4 ---- servers/slapd/back-sql/search.c | 17 +++++++++++++---- servers/slapd/back-sql/sql-wrap.c | 4 ---- servers/slapd/back-sql/util.c | 5 ----- 14 files changed, 25 insertions(+), 64 deletions(-) diff --git a/servers/slapd/back-sql/add.c b/servers/slapd/back-sql/add.c index 19fd90ef72..fa3fc29c98 100644 --- a/servers/slapd/back-sql/add.c +++ b/servers/slapd/back-sql/add.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -31,15 +29,16 @@ /* * Skip: - * - the first occurrence of objectClass, which is used - * to determine how to build the SQL entry (FIXME ?!?) + * - null values (e.g. delete modification) + * - single occurrence of objectClass, because it is already used + * to determine how to build the SQL entry * - operational attributes - * - empty attributes (FIXME ?!?) + * - empty attributes */ -#define backsql_attr_skip(ad,vals) \ +#define backsql_attr_skip(ad, vals) \ ( \ ( (ad) == slap_schema.si_ad_objectClass \ - && BER_BVISNULL( &((vals)[ 1 ]) ) ) \ + && (vals) && BER_BVISNULL( &((vals)[ 1 ]) ) ) \ || is_at_operational( (ad)->ad_type ) \ || ( (vals) && BER_BVISNULL( &((vals)[ 0 ]) ) ) \ ) @@ -273,14 +272,14 @@ backsql_modify_internal( BerVarray sm_values; #if 0 - /* NOTE: some time we'll have to pass + /* NOTE: some day we'll have to pass * the normalized values as well */ BerVarray nvalues; #endif backsql_at_map_rec *at = NULL; struct berval *at_val; int i; - /* first parameter no, parameter order */ + /* first parameter position, parameter order */ SQLUSMALLINT pno, po; /* procedure return code */ int prc; @@ -404,6 +403,10 @@ add_only:; Debug( LDAP_DEBUG_TRACE, " backsql_modify_internal(): " "adding new values for attribute \"%s\"\n", at->bam_ad->ad_cname.bv_val, 0, 0 ); + + /* can't add a NULL val array */ + assert( sm_values != NULL ); + for ( i = 0, at_val = sm_values; !BER_BVISNULL( at_val ); i++, at_val++ ) @@ -1418,5 +1421,3 @@ done:; return ( ( rs->sr_err == LDAP_SUCCESS ) ? op->o_noop : 1 ); } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/api.c b/servers/slapd/back-sql/api.c index 3119ceb950..5eb71b8d67 100644 --- a/servers/slapd/back-sql/api.c +++ b/servers/slapd/back-sql/api.c @@ -19,8 +19,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -140,5 +138,3 @@ backsql_api_odbc2dn( Operation *op, SlapReply *rs, struct berval *dn ) return 0; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/bind.c b/servers/slapd/back-sql/bind.c index 7b9f8dcd3f..4e5bccb73b 100644 --- a/servers/slapd/back-sql/bind.c +++ b/servers/slapd/back-sql/bind.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include @@ -151,5 +149,3 @@ error_return:; return 0; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/compare.c b/servers/slapd/back-sql/compare.c index 1f64cc749c..5178e67928 100644 --- a/servers/slapd/back-sql/compare.c +++ b/servers/slapd/back-sql/compare.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include @@ -168,5 +166,3 @@ return_results:; } } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/config.c b/servers/slapd/back-sql/config.c index afc0dcf09a..0068e8269c 100644 --- a/servers/slapd/back-sql/config.c +++ b/servers/slapd/back-sql/config.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include "ac/string.h" #include @@ -652,5 +650,3 @@ create_baseObject( return 0; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/delete.c b/servers/slapd/back-sql/delete.c index f9e14f0cad..fbe4f1a869 100644 --- a/servers/slapd/back-sql/delete.c +++ b/servers/slapd/back-sql/delete.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -396,5 +394,3 @@ done:; return ( ( rs->sr_err == LDAP_SUCCESS ) ? op->o_noop : 1 ); } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/entry-id.c b/servers/slapd/back-sql/entry-id.c index 1153bd0ec7..fafde1782d 100644 --- a/servers/slapd/back-sql/entry-id.c +++ b/servers/slapd/back-sql/entry-id.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -605,5 +603,3 @@ done:; return LDAP_SUCCESS; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/modify.c b/servers/slapd/back-sql/modify.c index 168d4cc8bb..c73ba2431c 100644 --- a/servers/slapd/back-sql/modify.c +++ b/servers/slapd/back-sql/modify.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -125,5 +123,3 @@ backsql_modify( Operation *op, SlapReply *rs ) return op->o_noop; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/modrdn.c b/servers/slapd/back-sql/modrdn.c index f57d6e67e4..6e01e5aa2e 100644 --- a/servers/slapd/back-sql/modrdn.c +++ b/servers/slapd/back-sql/modrdn.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -463,5 +461,3 @@ modrdn_return:; return op->o_noop; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/operational.c b/servers/slapd/back-sql/operational.c index fec92869cf..9df0eb0c86 100644 --- a/servers/slapd/back-sql/operational.c +++ b/servers/slapd/back-sql/operational.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include @@ -227,5 +225,3 @@ backsql_operational( return rc; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/schema-map.c b/servers/slapd/back-sql/schema-map.c index a0325b37f7..7c115bd224 100644 --- a/servers/slapd/back-sql/schema-map.c +++ b/servers/slapd/back-sql/schema-map.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -928,5 +926,3 @@ backsql_destroy_schema_map( backsql_info *bi ) return 0; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/search.c b/servers/slapd/back-sql/search.c index c6e2ee5212..10af5af114 100644 --- a/servers/slapd/back-sql/search.c +++ b/servers/slapd/back-sql/search.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -673,6 +671,19 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f ) rc = 1; goto done; + } else if ( ad == slap_schema.si_ad_entryCSN ) { + /* + * TODO: introduce appropriate entryCSN filtering + * to support syncrepl as producer... + */ + if ( bsi->bsi_op->o_sync_mode != SLAP_SYNC_REFRESH ) { + /* unsupported at present... */ + bsi->bsi_status = LDAP_OTHER; + rc = -1; + goto done; + } + + } else if ( ad == slap_schema.si_ad_hasSubordinates || ad == NULL ) { /* * FIXME: this is not robust; e.g. a filter @@ -1970,5 +1981,3 @@ done:; return 0; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/sql-wrap.c b/servers/slapd/back-sql/sql-wrap.c index a7a30384e6..d5da0886a9 100644 --- a/servers/slapd/back-sql/sql-wrap.c +++ b/servers/slapd/back-sql/sql-wrap.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include "ac/string.h" #include @@ -469,5 +467,3 @@ backsql_get_db_conn( Operation *op, SQLHDBC *dbh ) return LDAP_SUCCESS; } -#endif /* SLAPD_SQL */ - diff --git a/servers/slapd/back-sql/util.c b/servers/slapd/back-sql/util.c index 0bf710427b..cc4f6ded4c 100644 --- a/servers/slapd/back-sql/util.c +++ b/servers/slapd/back-sql/util.c @@ -20,8 +20,6 @@ #include "portable.h" -#ifdef SLAPD_SQL - #include #include #include "ac/string.h" @@ -577,6 +575,3 @@ backsql_entryUUID_decode( return LDAP_SUCCESS; } - -#endif /* SLAPD_SQL */ - -- 2.39.5