From: Howard Chu Date: Wed, 24 Aug 2005 02:07:43 +0000 (+0000) Subject: Add LDAP_CONTROL_VALSORT X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~592 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c9c1ee10b30ac76648de04bb7d1c7ac0637df8b1;p=openldap Add LDAP_CONTROL_VALSORT --- diff --git a/include/ldap.h b/include/ldap.h index 64c8d0b77e..05eb052df4 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -223,6 +223,7 @@ typedef struct ldapcontrol { #define LDAP_CONTROL_NO_SUBORDINATES "1.3.6.1.4.1.4203.666.5.11" #define LDAP_CONTROL_MANAGEDIT "1.3.6.1.4.1.4203.666.5.12" #define LDAP_CONTROL_SLURP "1.3.6.1.4.1.4203.666.5.13" +#define LDAP_CONTROL_VALSORT "1.3.6.1.4.1.4203.666.5.14" /* LDAP Duplicated Entry Control Extension *//* not implemented in slapd(8) */ #define LDAP_CONTROL_DUPENT_REQUEST "2.16.840.1.113719.1.27.101.1" diff --git a/servers/slapd/overlays/valsort.c b/servers/slapd/overlays/valsort.c index 268d35e5b6..0428157732 100644 --- a/servers/slapd/overlays/valsort.c +++ b/servers/slapd/overlays/valsort.c @@ -51,6 +51,8 @@ typedef struct valsort_info { slap_mask_t vi_sort; } valsort_info; +static int valsort_cid; + static ConfigDriver valsort_cf_func; static ConfigTable valsort_cfats[] = { @@ -481,6 +483,22 @@ valsort_destroy( return 0; } +static int +valsort_parseCtrl( + Operation *op, + SlapReply *rs, + LDAPControl *ctrl ) +{ + if ( ctrl->ldctl_value.bv_len ) { + rs->sr_text = "valSort control value not empty"; + return LDAP_PROTOCOL_ERROR; + } + op->o_ctrlflag[valsort_cid] = ctrl->ldctl_iscritical ? + SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL; + + return LDAP_SUCCESS; +} + static slap_overinst valsort; int valsort_init() @@ -497,6 +515,14 @@ int valsort_init() valsort.on_bi.bi_cf_ocs = valsort_cfocs; + rc = register_supported_control( LDAP_CONTROL_VALSORT, + SLAP_CTRL_SEARCH | SLAP_CTRL_HIDE, NULL, valsort_parseCtrl, + &valsort_cid ); + if ( rc != LDAP_SUCCESS ) { + fprintf( stderr, "Failed to register control %d\n", rc ); + return rc; + } + syn_numericString = syn_find( "1.3.6.1.4.1.1466.115.121.1.36" ); rc = config_register_schema( valsort_cfats, valsort_cfocs );