From: Kurt Zeilenga Date: Thu, 18 Mar 2004 01:06:39 +0000 (+0000) Subject: cleanup for release engineering X-Git-Tag: OPENLDAP_REL_ENG_2_2_BP~220 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e323437c6aa2cc7791dfc14c31fe0439b71c56e2;p=openldap cleanup for release engineering --- diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 633170c73d..84dddea57e 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -443,10 +443,12 @@ handle_private_option( int i ) scope = LDAP_SCOPE_BASE; } else if ( strncasecmp( optarg, "one", sizeof("one")-1 ) == 0 ) { scope = LDAP_SCOPE_ONELEVEL; +#ifdef LDAP_SCOPE_SUBORDINATE } else if (( strcasecmp( optarg, "subordinate" ) == 0 ) || ( strcasecmp( optarg, "children" ) == 0 )) { scope = LDAP_SCOPE_SUBORDINATE; +#endif } else if ( strncasecmp( optarg, "sub", sizeof("sub")-1 ) == 0 ) { scope = LDAP_SCOPE_SUBTREE; } else { @@ -764,8 +766,14 @@ getNextPage: base ? base : "", ((scope == LDAP_SCOPE_BASE) ? "baseObject" : ((scope == LDAP_SCOPE_ONELEVEL) ? "oneLevel" +#ifdef LDAP_SCOPE_SUBORDINATE : ((scope == LDAP_SCOPE_SUBORDINATE) ? "children" - : "subtree")))); +#endif + : "subtree" +#ifdef LDAP_SCOPE_SUBORDINATE + ) +#endif + ))); printf(_("# filter%s: %s\n"), infile != NULL ? _(" pattern") : "", filtpattern); printf(_("# requesting: ")); diff --git a/include/ldap.h b/include/ldap.h index f5f2a334e6..3ac129ead4 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -223,8 +223,10 @@ typedef struct ldapcontrol { #define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10" /* Password policy Controls *//* work in progress */ +#ifdef LDAP_DEVEL #define LDAP_CONTROL_PASSWORDPOLICYREQUEST "1.3.6.1.4.1.42.2.27.8.5.1" #define LDAP_CONTROL_PASSWORDPOLICYRESPONSE "1.3.6.1.4.1.42.2.27.8.5.1" +#endif /* LDAP Sync -- draft-zeilenga-ldup-sync *//* submitted for publication */ #define LDAP_SYNC_OID "1.3.6.1.4.1.4203.1.9.1" @@ -282,6 +284,7 @@ typedef struct ldapcontrol { #define LDAP_EXOP_X_CANCEL "1.3.6.1.4.1.4203.666.6.3" /* LDAP Grouping of Related Operations *//* a work in progress */ +#ifdef LDAP_DEVEL #define LDAP_X_GROUPING_BASE "1.3.6.1.4.1.4203.666.10.3" #define LDAP_EXOP_GROUPING_CREATE LDAP_X_GROUPING_BASE ".1" #define LDAP_EXOP_GROUPING_END LDAP_X_GROUPING_BASE ".2" @@ -289,9 +292,12 @@ typedef struct ldapcontrol { #define LDAP_EXOP_GROUPING_ACTION LDAP_X_GROUPING_BASE ".4" #define LDAP_NOTICE_GROUPING_INFO LDAP_X_GROUPING_BASE ".5" #define LDAP_CONTROL_GROUPING LDAP_X_GROUPING_BASE ".6" +#endif /* LDAP Grouping Types *//* a work in progress */ +#ifdef LDAP_DEVEL #define LDAP_GROUP_TRANSACTION "1.3.6.1.4.1.4203.666.10.4" +#endif /* LDAP Features */ #define LDAP_FEATURE_ALL_OP_ATTRS "1.3.6.1.4.1.4203.1.5.1" /* RFC 3673 */ @@ -301,10 +307,12 @@ typedef struct ldapcontrol { #define LDAP_FEATURE_LANGUAGE_TAG_OPTIONS "1.3.6.1.4.1.4203.1.5.4" #define LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS "1.3.6.1.4.1.4203.1.5.5" +#ifdef LDAP_DEVEL #define LDAP_FEATURE_SUBORDINATE_SCOPE \ "1.3.6.1.4.1.4203.666.8.1" /* "children" */ #define LDAP_FEATURE_CHILDREN_SCOPE LDAP_FEATURE_SUBORDINATE_SCOPE #define LDAP_FEATURE_MODIFY_INCREMENT "1.3.6.1.4.1.4203.666.8.2" +#endif /* * specific LDAP instantiations of BER types we know about @@ -424,8 +432,10 @@ typedef struct ldapcontrol { #define LDAP_SCOPE_ONE LDAP_SCOPE_ONELEVEL #define LDAP_SCOPE_SUBTREE ((ber_int_t) 0x0002) #define LDAP_SCOPE_SUB LDAP_SCOPE_SUBTREE +#ifdef LDAP_DEVEL #define LDAP_SCOPE_SUBORDINATE ((ber_int_t) 0x0003) /* OpenLDAP extension */ #define LDAP_SCOPE_CHILDREN LDAP_SCOPE_SUBORDINATE +#endif /* substring filter component types */ #define LDAP_SUBSTRING_INITIAL ((ber_tag_t) 0x80U) /* context specific */ @@ -744,7 +754,7 @@ ldap_parse_intermediate LDAP_P(( */ LDAP_F( int ) -ldap_grouping_create_operation LDAP_P(( +ldap_grouping_create LDAP_P(( LDAP *ld, LDAP_CONST char *grpoid, struct berval *grpdata, @@ -753,7 +763,7 @@ ldap_grouping_create_operation LDAP_P(( int *msgidp )); LDAP_F( int ) -ldap_grouping_create_operation_s LDAP_P(( +ldap_grouping_create_s LDAP_P(( LDAP *ld, LDAP_CONST char *grpoid, struct berval *grpdata, @@ -772,7 +782,7 @@ ldap_parse_grouping_create_result LDAP_P(( int freeit )); LDAP_F( int ) -ldap_grouping_end_operation LDAP_P(( +ldap_grouping_end LDAP_P(( LDAP *ld, LDAP_CONST char *grpoid, struct berval *grpdata, @@ -781,7 +791,7 @@ ldap_grouping_end_operation LDAP_P(( int *msgidp )); LDAP_F( int ) -ldap_grouping_end_operation_s LDAP_P(( +ldap_grouping_end_s LDAP_P(( LDAP *ld, LDAP_CONST char *grpoid, struct berval *grpdata, @@ -1844,6 +1854,7 @@ ldap_parse_vlv_control LDAP_P(( * LDAP Transactions * in txn.c */ +#ifdef LDAP_GROUPING_TRANSACTION LDAP_F( int ) ldap_parse_txn_create LDAP_P(( LDAP *ld, @@ -1880,6 +1891,7 @@ ldap_txn_end_s LDAP_P(( int commit, LDAPControl **sctrls, LDAPControl **cctrls )); +#endif /* * LDAP Who Am I? diff --git a/libraries/libldap/groupings.c b/libraries/libldap/groupings.c index 42f6e9528e..001b30c6b4 100644 --- a/libraries/libldap/groupings.c +++ b/libraries/libldap/groupings.c @@ -26,5 +26,126 @@ #include "ldap-int.h" +#ifdef LDAP_EXOP_GROUPING_CREATE +int ldap_grouping_create( + LDAP *ld, + LDAP_CONST char *grpoid, + struct berval *grpdata, + LDAPControl **sctrls, + LDAPControl **cctrls, + int *msgidp ) +{ + int rc; + BerElement *ber = NULL; + struct berval bv = {0, NULL}; +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ENTRY, "ldap_grouping_create\n", 0,0,0 ); +#else + Debug( LDAP_DEBUG_TRACE, "ldap_grouping_create\n", 0, 0, 0 ); +#endif + + assert( ld != NULL ); + assert( LDAP_VALID( ld ) ); + assert( grpoid != NULL || *grpoid == '\0' ); + assert( msgidp != NULL ); + + /* build the create grouping exop */ + ber = ber_alloc_t( LBER_USE_DER ); + if( ber == NULL ) { + ld->ld_errno = LDAP_NO_MEMORY; + return( ld->ld_errno ); + } + + if ( grpdata != NULL ) { + ber_printf( ber, "{sON}", grpoid, grpdata ); + } else { + ber_printf( ber, "{sN}", grpoid ); + } + + rc = ber_flatten2( ber, &bv, 0 ); + + if( rc < 0 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + return( ld->ld_errno ); + } + + rc = ldap_extended_operation( ld, LDAP_EXOP_GROUPING_CREATE, + &bv, sctrls, cctrls, msgidp ); + + ber_free( ber, 1 ); + return rc; +} + +int ldap_grouping_create_s( + LDAP *ld, + LDAP_CONST char *grpoid, + struct berval *grpdata, + LDAPControl **sctrls, + LDAPControl **cctrls, + struct berval **retgrpcookiep, + struct berval **retgrpdatap ) +{ + int rc; + int msgid; + LDAPMessage *res; + +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, ENTRY, "ldap_grouping_create_s\n", 0,0,0 ); +#else + Debug( LDAP_DEBUG_TRACE, "ldap_grouping_create_s\n", 0, 0, 0 ); +#endif + + assert( ld != NULL ); + assert( LDAP_VALID( ld ) ); + assert( grpoid != NULL || *grpoid == '\0' ); + + rc = ldap_grouping_create( ld, grpoid, grpdata, + sctrls, cctrls, &msgid ); + if ( rc != LDAP_SUCCESS ) { + return rc; + } + + if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) { + return ld->ld_errno; + } + + if ( retgrpcookiep != NULL ) *retgrpcookiep = NULL; + if ( retgrpdatap != NULL ) *retgrpdatap = NULL; + +#if 0 + rc = ldap_parse_extended_result( ld, res, retoidp, retdatap, 0 ); +#else + rc = LDAP_NOT_SUPPORTED; +#endif + + if( rc != LDAP_SUCCESS ) { + ldap_msgfree( res ); + return rc; + } + + return( ldap_result2error( ld, res, 1 ) ); +} + +int ldap_grouping_end( + LDAP *ld, + LDAP_CONST char *grpoid, + struct berval *grpdata, + LDAPControl **sctrls, + LDAPControl **cctrls, + int *msgidp ) +{ +} + +int ldap_grouping_end_s( + LDAP *ld, + LDAP_CONST char *grpoid, + struct berval *grpdata, + LDAPControl **sctrls, + LDAPControl **cctrls, + struct berval **retgrpdatap ) +{ +} + +#endif diff --git a/libraries/libldap/test.c b/libraries/libldap/test.c index 3d24fb099a..67b7461636 100644 --- a/libraries/libldap/test.c +++ b/libraries/libldap/test.c @@ -640,7 +640,9 @@ main( int argc, char **argv ) ludp->lud_scope == LDAP_SCOPE_BASE ? "baseObject" : ludp->lud_scope == LDAP_SCOPE_ONELEVEL ? "oneLevel" : ludp->lud_scope == LDAP_SCOPE_SUBTREE ? "subtree" +#ifdef LDAP_SCOPE_SUBORDINATE : ludp->lud_scope == LDAP_SCOPE_SUBORDINATE ? "children" +#endif : "**invalid**" ); printf( "\tfilter: <%s>\n", ludp->lud_filter ); ldap_free_urldesc( ludp ); diff --git a/libraries/libldap/txn.c b/libraries/libldap/txn.c index 575eb49bb5..3f40599d8b 100644 --- a/libraries/libldap/txn.c +++ b/libraries/libldap/txn.c @@ -26,6 +26,8 @@ #include "ldap-int.h" +#ifdef LDAP_GROUP_TRANSACTION + int ldap_txn_create_s( LDAP *ld, @@ -46,3 +48,5 @@ ldap_txn_end_s( { return LDAP_NOT_SUPPORTED; } + +#endif diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 19da2df6f9..640218c7dc 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -246,7 +246,7 @@ static int str2scope( const char *p ) } else if ( strcasecmp( p, "subtree" ) == 0 ) { return LDAP_SCOPE_SUBTREE; -#ifdef LDAP_FEATURE_SUBORDINATE_SCOPE +#ifdef LDAP_SCOPE_SUBORDINATE } else if ( strcasecmp( p, "subordinate" ) == 0 ) { return LDAP_SCOPE_SUBORDINATE; diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 1260cf54ab..97da998b23 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -969,9 +969,11 @@ id2entry_retry: if ( ei->bei_parent->bei_id == base.e_id ) scopeok = 1; break; +#ifdef LDAP_SCOPE_CHILDREN case LDAP_SCOPE_CHILDREN: if ( id == base.e_id ) break; /* Fall-thru */ +#endif case LDAP_SCOPE_SUBTREE: { EntryInfo *tmp; for (tmp = BEI(e); tmp->bei_parent; diff --git a/servers/slapd/back-ldbm/filterindex.c b/servers/slapd/back-ldbm/filterindex.c index 8758db0d0c..1b5d86b1cc 100644 --- a/servers/slapd/back-ldbm/filterindex.c +++ b/servers/slapd/back-ldbm/filterindex.c @@ -89,8 +89,10 @@ filter_candidates( } break; +#ifdef SLAPD_FILTER_DN_CHILDREN case SLAPD_FILTER_DN_CHILDREN: sub = "CHILDREN"; +#endif case SLAPD_FILTER_DN_SUBTREE: #ifdef NEW_LOGGING LDAP_LOG( FILTER, DETAIL1, diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 4aaaa8a458..acebe63641 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -347,11 +347,13 @@ searchit: { scopeok = dnIsSuffix( &e->e_nname, &realbase ); +#ifdef LDAP_SCOPE_SUBORDINATE } else if ( !scopeok && op->ors_scope == LDAP_SCOPE_SUBORDINATE ) { scopeok = !dn_match( &e->e_nname, &realbase ) && dnIsSuffix( &e->e_nname, &realbase ); +#endif } else { scopeok = 1; @@ -409,11 +411,13 @@ searchit: { scopeok = dnIsSuffix( &e->e_nname, &realbase ); +#ifdef LDAP_SCOPE_SUBORDINATE } else if ( !scopeok && op->ors_scope == LDAP_SCOPE_SUBORDINATE ) { scopeok = !dn_match( &e->e_nname, &realbase ) && dnIsSuffix( &e->e_nname, &realbase ); +#endif } else { scopeok = 1; diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 344ba73545..21dd29003f 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -1289,12 +1289,14 @@ backend_group( case LDAP_SCOPE_SUBTREE: if ( !dnIsSuffix( op_ndn, &nbase )) goto loopit; break; +#ifdef LDAP_SCOPE_SUBORDINATE case LDAP_SCOPE_SUBORDINATE: if ( dn_match( &nbase, op_ndn ) && !dnIsSuffix(op_ndn, &nbase )) { goto loopit; } +#endif } filter = str2filter_x( op, ludp->lud_filter ); if ( filter ) { diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index d8c13e9690..d76154743a 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -281,7 +281,9 @@ glue_back_search ( Operation *op, SlapReply *rs ) case LDAP_SCOPE_ONELEVEL: case LDAP_SCOPE_SUBTREE: +#ifdef LDAP_SCOPE_SUBORDINATE case LDAP_SCOPE_SUBORDINATE: /* FIXME */ +#endif op->o_callback = &cb; rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM; scope0 = op->ors_scope; diff --git a/servers/slapd/config.c b/servers/slapd/config.c index d161180a17..aa75227507 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -3100,10 +3100,12 @@ parse_syncrepl_line( si->si_scope = LDAP_SCOPE_BASE; } else if ( !strncasecmp( val, "one", sizeof( "one" ) - 1 )) { si->si_scope = LDAP_SCOPE_ONELEVEL; +#ifdef LDAP_SCOPE_SUBORDINATE } else if ( !strcasecmp( val, "subordinate" ) || !strcasecmp( val, "children" )) { si->si_scope = LDAP_SCOPE_SUBORDINATE; +#endif } else if ( !strncasecmp( val, "sub", sizeof( "sub" ) - 1 )) { si->si_scope = LDAP_SCOPE_SUBTREE; } else { diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 725f4de074..50d9d297dd 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -898,7 +898,9 @@ void slap_sasl2dn( Operation *opx, case LDAP_SCOPE_ONELEVEL: case LDAP_SCOPE_SUBTREE: +#ifdef LDAP_SCOPE_SUBORDINATE case LDAP_SCOPE_SUBORDINATE: +#endif /* do a search */ break; diff --git a/servers/slapd/search.c b/servers/slapd/search.c index ee168664bb..91dcdb2b2f 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -102,7 +102,9 @@ do_search( case LDAP_SCOPE_BASE: case LDAP_SCOPE_ONELEVEL: case LDAP_SCOPE_SUBTREE: +#ifdef LDAP_SCOPE_SUBORDINATE case LDAP_SCOPE_SUBORDINATE: +#endif break; default: send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "invalid scope" ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 0112072d57..52fdceeb50 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -875,7 +875,9 @@ typedef struct slap_filter { #define SLAPD_FILTER_COMPUTED ((ber_tag_t) -1) #define SLAPD_FILTER_DN_ONE ((ber_tag_t) -2) #define SLAPD_FILTER_DN_SUBTREE ((ber_tag_t) -3) +#ifdef LDAP_SCOPE_SUBORDINATE #define SLAPD_FILTER_DN_CHILDREN ((ber_tag_t) -4) +#endif union f_un_u { /* precomputed result */