# include <stddef.h>
#endif
+#ifndef LDAP_REL_ENG
+#if (LDAP_VENDOR_VERSION == 000000) && !defined(LDAP_DEVEL)
+#define LDAP_DEVEL
+#endif
#if defined(LDAP_DEVEL) && !defined(LDAP_TEST)
#define LDAP_TEST
#endif
#if defined(LDAP_TEST) && !defined(LDAP_DEBUG)
#define LDAP_DEBUG
#endif
+#endif
#ifdef HAVE_EBCDIC
/* ASCII/EBCDIC converting replacements for stdio funcs
" -b basedn base dn for search\n"
" -E [!]<ctrl>[=<ctrlparam>] search controls (! indicates criticality)\n"
" [!]mv=<filter> (matched values filter)\n"
+#ifdef LDAP_CONTROL_PAGEDRESULTS
" [!]pr=<size> (paged results)\n"
+#endif
#ifdef LDAP_CONTROL_SUBENTRIES
" [!]subentries[=true|false] (subentries)\n"
#endif
static int sync_slimit = -1;
#endif
+#ifdef LDAP_CONTROL_PAGEDRESULTS
static int pagedResults = 0;
static ber_int_t pageSize = 0;
static ber_int_t entriesLeft = 0;
LDAP *ld,
LDAPMessage *result,
struct berval *cookie );
+#endif
static void
urlize(char *url)
vrFilter = cvalue;
protocol = LDAP_VERSION3;
+#ifdef LDAP_CONTROL_PAGEDRESULTS
} else if ( strcasecmp( control, "pr" ) == 0 ) {
int num, tmp;
/* PagedResults control */
pageSize = (ber_int_t) tmp;
pagedResults = 1 + crit;
+#endif
#ifdef LDAP_CONTROL_SUBENTRIES
} else if ( strcasecmp( control, "subentries" ) == 0 ) {
if( subentries ) {
struct berval *syncbvalp = NULL;
#endif
+#ifdef LDAP_CONTROL_PAGEDRESULTS
npagedresponses = npagedentries = npagedreferences =
npagedextended = npagedpartial = 0;
+#endif
prog = lutil_progname( "ldapsearch", argc, argv );
tool_bind( ld );
getNextPage:
- if ( manageDSAit || noop || subentries
- || valuesReturnFilter || pageSize
+ if ( manageDSAit || noop || subentries || valuesReturnFilter
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+ || pageSize
+#endif
#ifdef LDAP_CLIENT_UPDATE
|| lcup
#endif
i++;
}
+#ifdef LDAP_CONTROL_PAGEDRESULTS
if ( pagedResults ) {
if (( prber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
return EXIT_FAILURE;
c[i].ldctl_iscritical = pagedResults > 1;
i++;
}
+#endif
tool_server_controls( ld, c, i );
printf("\n# with valuesReturnFilter %scontrol: %s",
valuesReturnFilter > 1 ? "critical " : "", vrFilter );
}
+#ifdef LDAP_CONTROL_PAGEDRESULTS
if ( pageSize ) {
printf("\n# with pagedResults %scontrol: size=%d",
(pagedResults > 1) ? "critical " : "",
pageSize );
}
+#endif
printf( "\n#\n\n" );
}
}
}
- if ( ( pageSize != 0 ) && ( morePagedResults != 0 ) ) {
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+ if ( ( pageSize != 0 ) && ( morePagedResults != 0 ) ) {
char buf[6];
int i, moreEntries, tmpSize;
goto getNextPage;
}
+#endif
ldap_unbind( ld );
return( rc );
case LDAP_RES_SEARCH_RESULT:
rc = print_result( ld, msg, 1 );
+#ifdef LDAP_CONTROL_PAGEDRESULTS
if ( pageSize != 0 ) {
rc = parse_page_control( ld, msg, &cookie );
}
+#endif
#ifdef LDAP_CLIENT_UPDATE
if ( lcup == LDAP_CUP_PERSIST_ONLY ||
}
done:
+#ifdef LDAP_CONTROL_PAGEDRESULTS
if ( pageSize != 0 ) {
npagedresponses = npagedresponses + nresponses;
npagedentries = npagedentries + nentries;
if( npartial ) printf( "# numPartial: %d\n", npagedpartial );
if( nreferences ) printf( "# numReferences: %d\n", npagedreferences );
}
- } else if ( ldif < 2 ) {
+ } else
+#endif
+ if ( ldif < 2 ) {
printf( "\n# numResponses: %d\n", nresponses );
if( nentries ) printf( "# numEntries: %d\n", nentries );
if( nextended ) printf( "# numExtended: %d\n", nextended );
}
+#ifdef LDAP_CONTROL_PAGEDRESULTS
static int
parse_page_control(
LDAP *ld,
ber_tag_t tag;
struct berval servercookie = { 0, NULL };
-
rc = ldap_parse_result( ld, result,
&err, NULL, NULL, NULL, &ctrl, 0 );
* size INTEGER (0..maxInt),
* -- result set size estimate from server - unused
* cookie OCTET STRING
+ * }
*/
ctrlp = *ctrl;
ber = ber_init( &ctrlp->ldctl_value );
(void) ber_free( ber, 1 );
if( tag == LBER_ERROR ) {
- fprintf( stderr, "Paged results response control could not be decoded.\n" );
+ fprintf( stderr,
+ "Paged results response control could not be decoded.\n" );
return EXIT_FAILURE;
}
if( entriesLeft < 0 ) {
- fprintf( stderr, "Invalid entries estimate in paged results response.\n" );
+ fprintf( stderr,
+ "Invalid entries estimate in paged results response.\n" );
return EXIT_FAILURE;
}
-
ldap_controls_free( ctrl );
+
} else {
morePagedResults = 0;
}
return err;
}
+#endif
#define LDAP_OPT_X_SASL_SSF_MAX 0x6108
#define LDAP_OPT_X_SASL_MAXBUFSIZE 0x6109
-
/* on/off values */
#define LDAP_OPT_ON ((void *) 1)
#define LDAP_OPT_OFF ((void *) 0)
} LDAPControl;
/* LDAP Controls */
-
-#if 0
- /* chase referrals client control (not yet implemented) */
-#define LDAP_CONTROL_REFERRALS "1.2.840.113666.1.4.616"
-#define LDAP_CHASE_SUBORDINATE_REFERRALS 0x0020U
-#define LDAP_CHASE_EXTERNAL_REFERRALS 0x0040U
-#endif
-
-#define LDAP_CONTROL_PROXY_AUTHZ "2.16.840.1.113730.3.4.18"
-#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2"
+#define LDAP_CONTROL_VALUESRETURNFILTER "1.2.826.0.1.334810.2.3"
#define LDAP_CONTROL_SUBENTRIES "1.3.6.1.4.1.4203.1.10.1"
#define LDAP_CONTROL_NOOP "1.3.6.1.4.1.4203.1.10.2"
+#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2"
+#define LDAP_CONTROL_PROXY_AUTHZ "2.16.840.1.113730.3.4.18"
#if 0
#define LDAP_CONTROL_DUPENT_REQUEST "2.16.840.1.113719.1.27.101.1"
#define LDAP_CONTROL_DUPENT LDAP_CONTROL_DUPENT_REQUEST
#endif
+#ifdef LDAP_DEVEL
#define LDAP_CONTROL_PAGEDRESULTS "1.2.840.113556.1.4.319"
+#endif
-/*
+#ifdef LDAP_DEVEL
#define LDAP_CLIENT_UPDATE 1
#define LDAP_SYNC 2
-*/
+#endif
#ifdef LDAP_CLIENT_UPDATE
#define LDAP_CONTROL_CLIENT_UPDATE "1.3.6.1.4.1.4203.666.5.3"
#define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9"
#define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10"
-#define LDAP_CONTROL_VALUESRETURNFILTER "1.2.826.0.1.334810.2.3"
-
+#ifdef LDAP_DEVEL
#define LDAP_CONTROL_PERMITMODIFY "1.2.840.113556.1.4.1413"
#define LDAP_CONTROL_NOREFERRALS "1.2.840.113556.1.4.1339"
+#endif
/* LDAP Unsolicited Notifications */
#define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036"
#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW ((ber_tag_t) 0x82U)
#define LDAP_TAG_EXOP_MODIFY_PASSWD_GEN ((ber_tag_t) 0x80U)
+#ifdef LDAP_DEVEL
#define LDAP_EXOP_X_CANCEL "1.3.6.1.4.1.4203.666.6.3"
+#endif
#define LDAP_EXOP_X_WHO_AM_I "1.3.6.1.4.1.4203.1.11.3"
/* LDAP Features */
#define LDAP_TAG_MESSAGE ((ber_tag_t) 0x30U) /* constructed + 16 */
#define LDAP_TAG_MSGID ((ber_tag_t) 0x02U) /* integer */
-#ifdef LDAP_CLIENT_UPDATE
-#define LDAP_TAG_INTERVAL ((ber_tag_t) 0x02U) /* integer */
-#endif /* LDAP_CLIENT_UPDATE */
-
#define LDAP_TAG_LDAPDN ((ber_tag_t) 0x04U) /* octet string */
#define LDAP_TAG_LDAPCRED ((ber_tag_t) 0x04U) /* octet string */
-#ifdef LDAP_CLIENT_UPDATE
-#define LDAP_LCUP_TAG_COOKIE ((ber_tag_t) 0x30U) /* sequence */
-#endif
-
-#ifdef LDAP_SYNC
-#define LDAP_SYNC_TAG_COOKIE ((ber_tag_t) 0x04U) /* octet string */
-#endif
-
#define LDAP_TAG_CONTROLS ((ber_tag_t) 0xa0U) /* context specific + constructed + 0 */
#define LDAP_TAG_REFERRAL ((ber_tag_t) 0xa3U) /* context specific + constructed + 3 */
#define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U) /* context specific + primitive */
+#ifdef LDAP_CLIENT_UPDATE
+#define LDAP_TAG_INTERVAL ((ber_tag_t) 0x02U) /* integer */
+#define LDAP_LCUP_TAG_COOKIE ((ber_tag_t) 0x30U) /* sequence */
+#endif
+
+#ifdef LDAP_SYNC
+#define LDAP_SYNC_TAG_COOKIE ((ber_tag_t) 0x04U) /* octet string */
+#endif
+
/* possible operations a client can invoke */
#define LDAP_REQ_BIND ((ber_tag_t) 0x60U) /* application + constructed */
#define LDAP_RES_COMPARE ((ber_tag_t) 0x6fU) /* application + constructed */
#define LDAP_RES_EXTENDED ((ber_tag_t) 0x78U) /* V3: application + constructed */
#define LDAP_RES_EXTENDED_PARTIAL ((ber_tag_t) 0x79U) /* V3+: application + constructed */
+#ifdef LDAP_DEVEL
#define LDAP_RES_INTERMEDIATE_RESP ((ber_tag_t) 0x7aU)
+#endif
#define LDAP_RES_ANY (-1)
#define LDAP_RES_UNSOLICITED (0)
#ifdef LDAP_CLIENT_UPDATE
/* resultCode for LCUP */
-#define LDAP_CUP_RESOURCES_EXHAUSTED 0x62
-#define LDAP_CUP_SECURITY_VIOLATION 0x63
-#define LDAP_CUP_INVALID_COOKIE 0x64
-#define LDAP_CUP_UNSUPPORTED_SCHEME 0x65
-#define LDAP_CUP_CLIENT_DISCONNECT 0x66
-#define LDAP_CUP_RELOAD_REQUIRED 0x67
+#define LDAP_CUP_RESOURCES_EXHAUSTED 0x100
+#define LDAP_CUP_SECURITY_VIOLATION 0x101
+#define LDAP_CUP_INVALID_COOKIE 0x102
+#define LDAP_CUP_UNSUPPORTED_SCHEME 0x103
+#define LDAP_CUP_CLIENT_DISCONNECT 0x104
+#define LDAP_CUP_RELOAD_REQUIRED 0x105
#endif
+#ifdef LDAP_EXOP_X_CANCEL
/* resultCode for Cancel Response */
-#define LDAP_CANCELLED 0x68
-#define LDAP_NO_SUCH_OPERATION 0x69
-#define LDAP_TOO_LATE 0x6a
-#define LDAP_CANNOT_CANCEL 0x6b
-
-#define LDAP_CANCEL_NONE 0x00
-#define LDAP_CANCEL_REQ 0x01
-#define LDAP_CANCEL_ACK 0x02
-#define LDAP_CANCEL_DONE 0x03
+#define LDAP_CANCELLED 0x110
+#define LDAP_NO_SUCH_OPERATION 0x111
+#define LDAP_TOO_LATE 0x112
+#define LDAP_CANNOT_CANCEL 0x113
+
+#define LDAP_CANCEL_NONE 0x00
+#define LDAP_CANCEL_REQ 0x01
+#define LDAP_CANCEL_ACK 0x02
+#define LDAP_CANCEL_DONE 0x03
+#endif
#ifdef LDAP_CLIENT_UPDATE
/* LCUP update type */
-#define LDAP_CUP_NONE 0x00
-#define LDAP_CUP_SYNC_ONLY 0x01
-#define LDAP_CUP_PERSIST_ONLY 0x02
-#define LDAP_CUP_SYNC_AND_PERSIST 0x03
+#define LDAP_CUP_NONE 0x00
+#define LDAP_CUP_SYNC_ONLY 0x01
+#define LDAP_CUP_PERSIST_ONLY 0x02
+#define LDAP_CUP_SYNC_AND_PERSIST 0x03
/* LCUP default cookie interval */
#define LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL 0x01
/* LDAP SYNC request type */
#ifdef LDAP_SYNC
-#define LDAP_SYNC_NONE 0x00
-#define LDAP_SYNC_REFRESH_ONLY 0x01
+#define LDAP_SYNC_NONE 0x00
+#define LDAP_SYNC_REFRESH_ONLY 0x01
#define LDAP_SYNC_REFRESH_AND_PERSIST 0x03
#endif
struct berval la_attr;
struct berval la_value;
unsigned la_flags;
-#define LDAP_AVA_STRING 0x0000U
-#define LDAP_AVA_BINARY 0x0001U
-#define LDAP_AVA_NONPRINTABLE 0x0002U
+#define LDAP_AVA_STRING 0x0000U
+#define LDAP_AVA_BINARY 0x0001U
+#define LDAP_AVA_NONPRINTABLE 0x0002U
void *la_private;
} LDAPAVA;
typedef LDAPRDN** LDAPDN;
/* DN formats */
-#define LDAP_DN_FORMAT_LDAP 0x0000U
+#define LDAP_DN_FORMAT_LDAP 0x0000U
#define LDAP_DN_FORMAT_LDAPV3 0x0010U
#define LDAP_DN_FORMAT_LDAPV2 0x0020U
-#define LDAP_DN_FORMAT_DCE 0x0030U
-#define LDAP_DN_FORMAT_UFN 0x0040U /* dn2str only */
+#define LDAP_DN_FORMAT_DCE 0x0030U
+#define LDAP_DN_FORMAT_UFN 0x0040U /* dn2str only */
#define LDAP_DN_FORMAT_AD_CANONICAL 0x0050U /* dn2str only */
-#define LDAP_DN_FORMAT_LBER 0x00F0U /* for testing only */
-#define LDAP_DN_FORMAT_MASK 0x00F0U
+#define LDAP_DN_FORMAT_LBER 0x00F0U /* for testing only */
+#define LDAP_DN_FORMAT_MASK 0x00F0U
/* DN flags */
-#define LDAP_DN_PRETTY 0x0100U
-#define LDAP_DN_SKIP 0x0200U
+#define LDAP_DN_PRETTY 0x0100U
+#define LDAP_DN_SKIP 0x0200U
#define LDAP_DN_P_NOLEADTRAILSPACES 0x1000U
#define LDAP_DN_P_NOSPACEAFTERRDN 0x2000U
-#define LDAP_DN_PEDANTIC 0xF000U
+#define LDAP_DN_PEDANTIC 0xF000U
-LDAP_F( void )
-ldap_avafree LDAP_P(( LDAPAVA *ava ));
-LDAP_F( void )
-ldap_rdnfree LDAP_P(( LDAPRDN *rdn ));
-LDAP_F( void )
-ldap_dnfree LDAP_P(( LDAPDN *dn ));
+LDAP_F( void ) ldap_avafree LDAP_P(( LDAPAVA *ava ));
+LDAP_F( void ) ldap_rdnfree LDAP_P(( LDAPRDN *rdn ));
+LDAP_F( void ) ldap_dnfree LDAP_P(( LDAPDN *dn ));
LDAP_F( int )
ldap_bv2dn LDAP_P((
# include <stddef.h>
#endif
+#ifndef LDAP_REL_ENG
+#if (LDAP_VENDOR_VERSION == 000000) && !defined(LDAP_DEVEL)
+#define LDAP_DEVEL
+#endif
#if defined(LDAP_DEVEL) && !defined(LDAP_TEST)
#define LDAP_TEST
#endif
#if defined(LDAP_TEST) && !defined(LDAP_DEBUG)
#define LDAP_DEBUG
#endif
+#endif
#ifdef HAVE_EBCDIC
/* ASCII/EBCDIC converting replacements for stdio funcs
#include "ldap-int.h"
#include "ldap_log.h"
+#ifdef LDAP_EXOP_X_CANCEL
+
int
ldap_cancel(
LDAP *ld,
ber_free( cancelidber, 1 );
return rc;
}
+
+#endif /* LDAP_EXOP_X_CANCEL */
{LDAP_MORE_RESULTS_TO_RETURN, "More results to return" },
{LDAP_CLIENT_LOOP, "Client Loop" },
{LDAP_REFERRAL_LIMIT_EXCEEDED, "Referral Limit Exceeded" },
+
#ifdef LDAP_CLIENT_UPDATE
- {LDAP_CUP_RESOURCES_EXHAUSTED, "LDAP Client Update Resource Exhausted" },
- {LDAP_CUP_SECURITY_VIOLATION, "LDAP Client Update Security Violation" },
- {LDAP_CUP_INVALID_COOKIE, "LDAP Client Update Invalid Cookie" },
- {LDAP_CUP_UNSUPPORTED_SCHEME, "LDAP Client Update Unsupported Scheme" },
- {LDAP_CUP_CLIENT_DISCONNECT, "LDAP Client Update Client Disconnect" },
- {LDAP_CUP_RELOAD_REQUIRED, "LDAP Client Update Reload Required" },
+ {LDAP_CUP_RESOURCES_EXHAUSTED, "Client Update Resource Exhausted" },
+ {LDAP_CUP_SECURITY_VIOLATION, "Client Update Security Violation" },
+ {LDAP_CUP_INVALID_COOKIE, "Client Update Invalid Cookie" },
+ {LDAP_CUP_UNSUPPORTED_SCHEME, "Client Update Unsupported Scheme" },
+ {LDAP_CUP_CLIENT_DISCONNECT, "Client Update Client Disconnect" },
+ {LDAP_CUP_RELOAD_REQUIRED, "Client Update Reload Required" },
+#endif
+
+#ifdef LDAP_EXOP_X_CANCEL
+ {LDAP_CANCELLED, "Cancelled" },
+ {LDAP_NO_SUCH_OPERATION, "No Operation to Cancel" },
+ {LDAP_TOO_LATE, "Too Late to Cancel" },
+ {LDAP_CANNOT_CANCEL, "Cannot Cancel" },
#endif
- {LDAP_CANCELLED, "LDAP Cancelled" },
- {LDAP_NO_SUCH_OPERATION, "LDAP No Operation to Cancel" },
- {LDAP_TOO_LATE, "LDAP Too Late to Cancel" },
- {LDAP_CANNOT_CANCEL, "LDAP Cannot Cancel" },
{-1, NULL}
};
return LDAP_SUCCESS;
}
+#ifdef LDAP_RES_INTERMEDIATE_RESP
/* Parse an intermediate response result */
int
ldap_parse_intermediate_resp_result (
return LDAP_SUCCESS;
}
+#endif
* go through the following code. This code also chases V2 referrals
* and checks if all referrals have been chased.
*/
- if ( (tag != LDAP_RES_SEARCH_ENTRY) && (v3ref > -1) &&
- (tag != LDAP_RES_INTERMEDIATE_RESP ) ) {
+ if ( (tag != LDAP_RES_SEARCH_ENTRY) && (v3ref > -1)
+#ifdef LDAP_RES_INTERMEDIATE_RESP
+ && (tag != LDAP_RES_INTERMEDIATE_RESP )
+#endif
+ ) {
/* For a v3 search referral/reference, only come here if already chased it */
if ( ld->ld_version >= LDAP_VERSION2 &&
( lr->lr_parent != NULL ||
static char *controls[] = {
LDAP_CONTROL_MANAGEDSAIT,
LDAP_CONTROL_NOOP,
+#ifdef LDAP_CONTROL_PAGEDRESULTS
LDAP_CONTROL_PAGEDRESULTS,
+#endif
LDAP_CONTROL_VALUESRETURNFILTER,
#ifdef LDAP_CONTROL_SUBENTRIES
LDAP_CONTROL_SUBENTRIES,
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: add\n", 0, 0, 0);
#endif
- err = modify_add_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
+ err = modify_add_values( e, mod, get_permitmodify(op),
+ text, textbuf, textlen );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR,
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: delete\n", 0, 0, 0);
#endif
- err = modify_delete_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
+ err = modify_delete_values( e, mod, get_permitmodify(op),
+ text, textbuf, textlen );
assert( err != LDAP_TYPE_OR_VALUE_EXISTS );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: replace\n", 0, 0, 0);
#endif
- err = modify_replace_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
+ err = modify_replace_values( e, mod, get_permitmodify(op),
+ text, textbuf, textlen );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR,
*/
mod->sm_op = LDAP_MOD_ADD;
- err = modify_add_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
+ err = modify_add_values( e, mod, get_permitmodify(op),
+ text, textbuf, textlen );
if ( err == LDAP_TYPE_OR_VALUE_EXISTS ) {
err = LDAP_SUCCESS;
}
struct berval realbase = { 0, NULL };
int nentries = 0;
int manageDSAit;
- int pagedresults;
int tentries = 0;
ID lastid = NOID;
manageDSAit = get_manageDSAit( op );
- pagedresults = get_pagedresults( op );
rc = LOCK_ID (bdb->bi_dbenv, &locker );
/* if no limit is required, use soft limit */
if ( slimit <= 0 ) {
- if ( pagedresults && limit->lms_s_pr != 0 ) {
+ if ( get_pagedresults(op) && limit->lms_s_pr != 0 ) {
slimit = limit->lms_s_pr;
} else {
slimit = limit->lms_s_soft;
tentries = BDB_IDL_N(candidates);
}
- if ( pagedresults ) {
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+ if ( get_pagedresults(op) ) {
if ( op->o_pagedresults_state.ps_cookie == 0 ) {
id = 0;
} else {
}
goto loop_begin;
}
+#endif
#ifdef LDAP_CLIENT_UPDATE
if ( op->o_clientupdate_type & SLAP_LCUP_SYNC ) {
goto done;
}
+#ifdef LDAP_EXOP_X_CANCEL
if ( op->o_cancel ) {
assert( op->o_cancel == LDAP_CANCEL_REQ );
rc = 0;
op->o_cancel = LDAP_CANCEL_ACK;
goto done;
}
+#endif
/* check time limit */
if ( tlimit != -1 && slap_get_time() > stoptime ) {
goto done;
}
- if ( pagedresults ) {
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+ if ( get_pagedresults(op) ) {
if ( nentries >= op->o_pagedresults_size ) {
- send_pagerequest_response( conn, op, lastid, nentries, tentries );
+ send_pagerequest_response( conn, op,
+ lastid, nentries, tentries );
goto done;
}
lastid = id;
}
+#endif
if (e) {
int result;
return rc;
}
+#ifdef LDAP_CONTROL_PAGEDRESULTS
static void
send_pagerequest_response(
Connection *conn,
done:
(void) ber_free_buf( ber );
}
+#endif
#ifdef LDAP_CLIENT_UPDATE
int
}
}
+#ifdef LDAP_EXOP_X_CANCEL
{
struct berval bv = BER_BVC( LDAP_EXOP_X_CANCEL );
if ( bvmatch( opdata, &bv ) ) {
break;
}
}
+#endif
/* treat everything else as a modify */
opflag = SLAP_RESTRICT_OP_MODIFY;
#include "slap.h"
+#ifdef LDAP_EXOP_X_CANCEL
+
#include <lber_pvt.h>
#include <lutil.h>
return rc;
}
+#endif /* LDAP_EXOP_X_CANCEL */
c->c_send_search_result = slap_send_search_result;
c->c_send_search_reference = slap_send_search_reference;
c->c_send_ldap_extended = slap_send_ldap_extended;
+#ifdef LDAP_RES_INTERMEDIATE_RESP
c->c_send_ldap_intermediate_resp = slap_send_ldap_intermediate_resp;
+#endif
c->c_authmech.bv_val = NULL;
c->c_authmech.bv_len = 0;
#endif /* SLAPD_MONITOR */
ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
- if ( arg->co_op->o_cancel == LDAP_CANCEL_REQ )
+#ifdef LDAP_EXOP_X_CANCEL
+ if ( arg->co_op->o_cancel == LDAP_CANCEL_REQ ) {
arg->co_op->o_cancel = LDAP_TOO_LATE;
+ }
while ( arg->co_op->o_cancel != LDAP_CANCEL_NONE &&
- arg->co_op->o_cancel != LDAP_CANCEL_DONE ) {
- ldap_pvt_thread_yield();
+ arg->co_op->o_cancel != LDAP_CANCEL_DONE )
+ {
+ ldap_pvt_thread_yield();
}
+#endif
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
op->o_conn = conn;
op->vrFilter = NULL;
+#ifdef LDAP_CONTROL_PAGEDRESULTS
op->o_pagedresults_state = conn->c_pagedresults_state;
+#endif
#ifdef LDAP_CONNECTIONLESS
op->o_peeraddr = peeraddr;
if (cdn ) {
NULL
};
+/*
+ * all known request control OIDs should be added to this list
+ */
+char *slap_known_controls[] = {
+ LDAP_CONTROL_MANAGEDSAIT,
+ LDAP_CONTROL_PROXY_AUTHZ,
+
+#ifdef LDAP_CONTROL_SUBENTRIES
+ LDAP_CONTROL_SUBENTRIES,
+#endif /* LDAP_CONTROL_SUBENTRIES */
+
+ LDAP_CONTROL_NOOP,
+
+#ifdef LDAP_CONTROL_DUPENT_REQUEST
+ LDAP_CONTROL_DUPENT_REQUEST,
+#endif /* LDAP_CONTROL_DUPENT_REQUEST */
+
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+ LDAP_CONTROL_PAGEDRESULTS,
+#endif
+
+#ifdef LDAP_CONTROL_SORTREQUEST
+ LDAP_CONTROL_SORTREQUEST,
+#endif /* LDAP_CONTROL_SORTREQUEST */
+
+#ifdef LDAP_CONTROL_VLVREQUEST
+ LDAP_CONTROL_VLVREQUEST,
+#endif /* LDAP_CONTROL_VLVREQUEST */
+
+ LDAP_CONTROL_VALUESRETURNFILTER,
+ NULL
+};
+
static struct slap_control {
char *sc_oid;
slap_mask_t sc_mask;
SLAP_CTRL_PARSE_FN *sc_parse;
} supportedControls[] = {
- { LDAP_CONTROL_PROXY_AUTHZ,
- SLAP_CTRL_FRONTEND|SLAP_CTRL_ACCESS, proxy_authz_extops,
- parseProxyAuthz },
- { LDAP_CONTROL_MANAGEDSAIT,
- SLAP_CTRL_ACCESS, NULL,
- parseManageDSAit },
- { LDAP_CONTROL_NOOP,
- SLAP_CTRL_ACCESS, NULL,
- parseNoOp },
- { LDAP_CONTROL_PAGEDRESULTS,
- SLAP_CTRL_SEARCH, NULL,
- parsePagedResults },
{ LDAP_CONTROL_VALUESRETURNFILTER,
SLAP_CTRL_SEARCH, NULL,
parseValuesReturnFilter },
SLAP_CTRL_SEARCH, NULL,
parseSubentries },
#endif
+ { LDAP_CONTROL_NOOP,
+ SLAP_CTRL_ACCESS, NULL,
+ parseNoOp },
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+ { LDAP_CONTROL_PAGEDRESULTS,
+ SLAP_CTRL_SEARCH, NULL,
+ parsePagedResults },
+#endif
+ { LDAP_CONTROL_MANAGEDSAIT,
+ SLAP_CTRL_ACCESS, NULL,
+ parseManageDSAit },
+ { LDAP_CONTROL_PROXY_AUTHZ,
+ SLAP_CTRL_FRONTEND|SLAP_CTRL_ACCESS, proxy_authz_extops,
+ parseProxyAuthz },
#ifdef LDAP_CONTROL_PERMITMODIFY
{ LDAP_CONTROL_PERMITMODIFY,
SLAP_CTRL_UPDATE, NULL,
return LDAP_SUCCESS;
}
+#ifdef LDAP_CONTROL_PAGEDRESULTS
static int parsePagedResults (
Connection *conn,
Operation *op,
* -- requested page size from client
* -- result set size estimate from server
* cookie OCTET STRING
+ * }
*/
ber = ber_init( &ctrl->ldctl_value );
if( ber == NULL ) {
return LDAP_SUCCESS;
}
+#endif
int parseValuesReturnFilter (
Connection *conn,
struct berval oid;
SLAP_EXTOP_MAIN_FN *ext_main;
} builtin_extops[] = {
+ { BVC(LDAP_EXOP_X_WHO_AM_I), whoami_extop },
+ { BVC(LDAP_EXOP_MODIFY_PASSWD), passwd_extop },
+#ifdef LDAP_EXOP_X_CANCEL
+ { BVC(LDAP_EXOP_X_CANCEL), cancel_extop },
+#endif
#ifdef HAVE_TLS
{ BVC(LDAP_EXOP_START_TLS), starttls_extop },
#endif
- { BVC(LDAP_EXOP_MODIFY_PASSWD), passwd_extop },
- { BVC(LDAP_EXOP_X_WHO_AM_I), whoami_extop },
- { BVC(LDAP_EXOP_X_CANCEL), cancel_extop },
{ {0,NULL}, NULL }
};
goto done;
}
-#if !defined(LDAP_SLAPI)
- if( !(ext = find_extop(supp_ext_list, &reqoid)) ) {
-#else /* defined(LDAP_SLAPI) */
- /* Netscape extended operation */
- getPluginFunc( &reqoid, &funcAddr );
+ if( !(ext = find_extop(supp_ext_list, &reqoid))
+#ifdef LDAP_SLAPI
+ && !(funcAddr)
+#endif
+ ) {
+#ifdef LDAP_SLAPI
+ /* Netscape extended operation */
+ getPluginFunc( &reqoid, &funcAddr );
+#endif
- if( !(ext = find_extop(supp_ext_list, &reqoid)) && !(funcAddr) ) {
-#endif /* defined(LDAP_SLAPI) */
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"do_extended: conn %d unsupported operation \"%s\"\n",
static const char* slap_name = NULL;
int slapMode = SLAP_UNDEFINED_MODE;
-/*
- * all known control OIDs should be added to this list
- */
-char *slap_known_controls[] = {
-#ifdef LDAP_CONTROL_REFERRALS
- LDAP_CONTROL_REFERRALS,
-#endif /* LDAP_CONTROL_REFERRALS */
-
- LDAP_CONTROL_MANAGEDSAIT,
-
-#ifdef LDAP_CONTROL_SUBENTRIES
- LDAP_CONTROL_SUBENTRIES,
-#endif /* LDAP_CONTROL_SUBENTRIES */
-
- LDAP_CONTROL_NOOP,
-
-#ifdef LDAP_CONTROL_DUPENT_REQUEST
- LDAP_CONTROL_DUPENT_REQUEST,
-#endif /* LDAP_CONTROL_DUPENT_REQUEST */
-
-#ifdef LDAP_CONTROL_DUPENT_RESPONSE
- LDAP_CONTROL_DUPENT_RESPONSE,
-#endif /* LDAP_CONTROL_DUPENT_RESPONSE */
-
-#ifdef LDAP_CONTROL_DUPENT_ENTRY
- LDAP_CONTROL_DUPENT_ENTRY,
-#endif /* LDAP_CONTROL_DUPENT_ENTRY */
-
- LDAP_CONTROL_PAGEDRESULTS,
-
-#ifdef LDAP_CONTROL_SORTREQUEST
- LDAP_CONTROL_SORTREQUEST,
-#endif /* LDAP_CONTROL_SORTREQUEST */
-
-#ifdef LDAP_CONTROL_SORTRESPONSE
- LDAP_CONTROL_SORTRESPONSE,
-#endif /* LDAP_CONTROL_SORTRESPONSE */
-
-#ifdef LDAP_CONTROL_VLVREQUEST
- LDAP_CONTROL_VLVREQUEST,
-#endif /* LDAP_CONTROL_VLVREQUEST */
-
-#ifdef LDAP_CONTROL_VLVRESPONSE
- LDAP_CONTROL_VLVRESPONSE,
-#endif /* LDAP_CONTROL_VLVRESPONSE */
-
- LDAP_CONTROL_VALUESRETURNFILTER,
- NULL
-};
-
int
slap_init( int mode, const char *name )
{
assert( err != LDAP_PARTIAL_RESULTS );
if ( err == LDAP_REFERRAL ) {
+#ifdef LDAP_CONTROL_NOREFERRALS
if( op->o_noreferrals ) {
ref = NULL;
}
+#endif
if( ref == NULL ) {
err = LDAP_NO_SUCH_OBJECT;
} else if ( op->o_protocol < LDAP_VERSION3 ) {
rspoid, rspdata, NULL, ctrls );
}
+#ifdef LDAP_RES_INTERMEDIATE_RESP
void
slap_send_ldap_intermediate_resp(
Connection *conn,
err, matched, text, refs,
rspoid, rspdata, NULL, ctrls );
}
+#endif
void
slap_send_search_result(
return( 1 );
}
+#ifdef LDAP_CONTROL_NOREFERRALS
if( op->o_noreferrals ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
return( 0 );
}
+#endif
if( refs == NULL ) {
#ifdef NEW_LOGGING
#include <ldif.h>
#include "lber_pvt.h"
-struct berval *ns_get_supported_extop (int);
-
static struct berval supportedFeatures[] = {
BER_BVC(LDAP_FEATURE_ALL_OPERATIONAL_ATTRS), /* all Operational Attributes ("+") */
BER_BVC(LDAP_FEATURE_OBJECTCLASS_ATTRS), /* OCs in Attributes List */
return LDAP_OTHER;
}
-#if defined( LDAP_SLAPI )
+#ifdef LDAP_SLAPI
/* netscape supportedExtension */
for ( i = 0; (bv = ns_get_supported_extop(i)) != NULL; i++ ) {
vals[0] = *bv;
attr_merge( e, ad_supportedExtension, vals );
}
-#endif /* defined( LDAP_SLAPI ) */
+#endif /* LDAP_SLAPI */
/* supportedFeatures */
if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
slap_ssf_t sss_simple_bind;
} slap_ssf_set_t;
-
/* Flags for telling slap_sasl_getdn() what type of identity is being passed */
#define SLAP_GETDN_AUTHCID 2
#define SLAP_GETDN_AUTHZID 4
#define SLAP_NONCRITICAL_CONTROL 1
#define SLAP_CRITICAL_CONTROL 2
char o_managedsait;
+#define get_manageDSAit(op) ((int)(op)->o_managedsait)
+
char o_noop;
char o_proxy_authz;
+
char o_subentries;
+#define get_subentries(op) ((int)(op)->o_subentries)
char o_subentries_visibility;
+#define get_subentries_visibility(op) ((int)(op)->o_subentries_visibility)
+
char o_valuesreturnfilter;
+#ifdef LDAP_CONTROL_PERMITMODIFY
char o_permitmodify;
+#define get_permitmodify(op) ((int)(op)->o_permitmodify)
+#else
+#define get_permitmodify(op) (0)
+#endif
+
+#ifdef LDAP_CONTROL_NOREFERRALS
char o_noreferrals;
+#endif
+
+#ifdef LDAP_CONTROL_PAGEDRESULTS
char o_pagedresults;
+#define get_pagedresults(op) ((int)(op)->o_pagedresults)
ber_int_t o_pagedresults_size;
PagedResultsState o_pagedresults_state;
+#else
+#define get_pagedresults(op) (0)
+#endif
#ifdef LDAP_CLIENT_UPDATE
char o_clientupdate;
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
ValuesReturnFilter *vrFilter; /* Structure represents ValuesReturnFilter */
- void *o_pb; /* Netscape plugin */
-
+#ifdef LDAP_SLAPI
+ void *o_pb; /* NS-SLAPI plugin */
+#endif
} Operation;
-#define get_manageDSAit(op) ((int)(op)->o_managedsait)
-#define get_subentries(op) ((int)(op)->o_subentries)
-#define get_subentries_visibility(op) ((int)(op)->o_subentries_visibility)
-#define get_pagedresults(op) ((int)(op)->o_pagedresults)
-
-
-
typedef void (*SEND_LDAP_RESULT)(
struct slap_conn *conn,
struct slap_op *op,
SEND_SEARCH_RESULT c_send_search_result;
SEND_SEARCH_REFERENCE c_send_search_reference;
SEND_LDAP_EXTENDED c_send_ldap_extended;
+#ifdef LDAP_RES_INTERMEDIATE_RESP
SEND_LDAP_INTERMEDIATE_RESP c_send_ldap_intermediate_resp;
+#endif
} Connection;