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 {
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: "));
#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"
#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"
#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 */
#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
#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 */
*/
LDAP_F( int )
-ldap_grouping_create_operation LDAP_P((
+ldap_grouping_create LDAP_P((
LDAP *ld,
LDAP_CONST char *grpoid,
struct berval *grpdata,
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,
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,
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,
* LDAP Transactions
* in txn.c
*/
+#ifdef LDAP_GROUPING_TRANSACTION
LDAP_F( int )
ldap_parse_txn_create LDAP_P((
LDAP *ld,
int commit,
LDAPControl **sctrls,
LDAPControl **cctrls ));
+#endif
/*
* LDAP Who Am I?
#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
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 );
#include "ldap-int.h"
+#ifdef LDAP_GROUP_TRANSACTION
+
int
ldap_txn_create_s(
LDAP *ld,
{
return LDAP_NOT_SUPPORTED;
}
+
+#endif
} 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;
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;
}
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,
{
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;
{
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;
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 ) {
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;
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 {
case LDAP_SCOPE_ONELEVEL:
case LDAP_SCOPE_SUBTREE:
+#ifdef LDAP_SCOPE_SUBORDINATE
case LDAP_SCOPE_SUBORDINATE:
+#endif
/* do a search */
break;
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" );
#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 */