static SLAP_CTRL_PARSE_FN parseModifyIncrement;
static SLAP_CTRL_PARSE_FN parseNoOp;
static SLAP_CTRL_PARSE_FN parsePagedResults;
+#ifdef LDAP_DEVEL
+static SLAP_CTRL_PARSE_FN parseSortedResults;
+#endif
static SLAP_CTRL_PARSE_FN parseValuesReturnFilter;
static SLAP_CTRL_PARSE_FN parsePermissiveModify;
static SLAP_CTRL_PARSE_FN parseDomainScope;
(int)offsetof(struct slap_control_ids, sc_pagedResults),
SLAP_CTRL_SEARCH, NULL,
parsePagedResults, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#ifdef LDAP_DEVEL
+ { LDAP_CONTROL_SORTREQUEST,
+ (int)offsetof(struct slap_control_ids, sc_sortedResults),
+ SLAP_CTRL_GLOBAL|SLAP_CTRL_SEARCH|SLAP_CTRL_HIDE, NULL,
+ parseSortedResults, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif
#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
{ LDAP_CONTROL_X_DOMAIN_SCOPE,
(int)offsetof(struct slap_control_ids, sc_domainScope),
return rc;
}
+#ifdef LDAP_DEVEL
+static int parseSortedResults (
+ Operation *op,
+ SlapReply *rs,
+ LDAPControl *ctrl )
+{
+ int rc = LDAP_SUCCESS;
+
+ if ( op->o_sortedresults != SLAP_CONTROL_NONE ) {
+ rs->sr_text = "sorted results control specified multiple times";
+ return LDAP_PROTOCOL_ERROR;
+ }
+
+ if ( BER_BVISEMPTY( &ctrl->ldctl_value ) ) {
+ rs->sr_text = "sorted results control value is empty (or absent)";
+ return LDAP_PROTOCOL_ERROR;
+ }
+
+ /* blow off parsing the value */
+
+ op->o_sortedresults = ctrl->ldctl_iscritical
+ ? SLAP_CONTROL_CRITICAL
+ : SLAP_CONTROL_NONCRITICAL;
+
+ return rc;
+}
+#endif
+
static int parseAssert (
Operation *op,
SlapReply *rs,
* plugin.
*/
- if ( o->o_pb && slapi_pblock_get( o->o_pb, SLAPI_RESCONTROLS, &sctrls ) != 0 ) {
+ if ( o->o_pb &&
+ slapi_pblock_get( o->o_pb, SLAPI_RESCONTROLS, &sctrls ) != 0 )
+ {
sctrls = NULL;
}
#ifdef LDAP_SLAPI
if ( c != NULL )
#endif /* LDAP_SLAPI */
- for( ; *c != NULL; c++) {
- rc = send_ldap_control( ber, *c );
+ {
+ for( ; *c != NULL; c++) {
+ rc = send_ldap_control( ber, *c );
+ if( rc == -1 ) return rc;
+ }
+ }
+
+#ifdef LDAP_DEVEL
+ /* this is a hack to avoid having to modify op->s_ctrls */
+ if( o->o_sortedresults ) {
+ BerElementBuffer berbuf;
+ BerElement *sber = (BerElement *) &berbuf;
+ LDAPControl sorted;
+ BER_BVZERO( &sorted.ldctl_value );
+ sorted.ldctl_oid = LDAP_CONTROL_SORTRESPONSE;
+ sorted.ldctl_iscritical = 0;
+
+ ber_init2( sber, NULL, LBER_USE_DER );
+
+ ber_printf( sber, "{i}", LDAP_UNWILLING_TO_PERFORM );
+
+ if( ber_flatten2( ber, &sorted.ldctl_value, 0 ) == -1 ) {
+ return LBER_ERROR;
+ }
+
+ (void) ber_free_buf( ber );
+
+ rc = send_ldap_control( ber, &sorted );
if( rc == -1 ) return rc;
}
+#endif
#ifdef LDAP_SLAPI
if ( sctrls != NULL ) {
char *s,
int *code,
char **matched,
- char **info
-)
+ char **info )
{
int rc;
char *c;
flags |= ( SLAP_OPATTRS_NO | SLAP_USERATTRS_YES );
} else {
- flags |= an_find( an, &AllOper ) ? SLAP_OPATTRS_YES : SLAP_OPATTRS_NO;
- flags |= an_find( an, &AllUser ) ? SLAP_USERATTRS_YES : SLAP_USERATTRS_NO;
+ flags |= an_find( an, &AllOper )
+ ? SLAP_OPATTRS_YES : SLAP_OPATTRS_NO;
+ flags |= an_find( an, &AllUser )
+ ? SLAP_USERATTRS_YES : SLAP_USERATTRS_NO;
}
return flags;
int sc_modifyIncrement;
int sc_noOp;
int sc_pagedResults;
+#ifdef LDAP_DEVEL
+ int sc_sortedResults;
+#endif
int sc_valuesReturnFilter;
int sc_permissiveModify;
int sc_domainScope;
#define o_pagedresults o_ctrlflag[slap_cids.sc_pagedResults]
#define o_pagedresults_state o_controls[slap_cids.sc_pagedResults]
+#define get_pagedresults(op) ((int)(op)->o_pagedresults)
-#define o_sync o_ctrlflag[slap_cids.sc_LDAPsync]
+#ifdef LDAP_DEVEL
+#define o_sortedresults o_ctrlflag[slap_cids.sc_sortedResults]
+#endif
-#define get_pagedresults(op) ((int)(op)->o_pagedresults)
+#define o_sync o_ctrlflag[slap_cids.sc_LDAPsync]
AuthorizationInformation o_authz;