]> git.sur5r.net Git - openldap/commitdiff
Add LDAP_CONTROL_VALSORT
authorHoward Chu <hyc@openldap.org>
Wed, 24 Aug 2005 02:07:43 +0000 (02:07 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 24 Aug 2005 02:07:43 +0000 (02:07 +0000)
include/ldap.h
servers/slapd/overlays/valsort.c

index 64c8d0b77e6dcf4c5e72db99dda1c739e107b62d..05eb052df4942ed28a554d6f6ca2ab867af8f69d 100644 (file)
@@ -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"
index 268d35e5b6d0106e82f605ecfd3700836ea70586..0428157732a9e2846974447f531c3e71024bdd45 100644 (file)
@@ -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 );