]> git.sur5r.net Git - openldap/commitdiff
Update (and rename) Sort and VLV parse routines to expect actual
authorKurt Zeilenga <kurt@openldap.org>
Sun, 8 Jan 2006 19:34:01 +0000 (19:34 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 8 Jan 2006 19:34:01 +0000 (19:34 +0000)
control to be directly passed in.

include/ldap.h
libraries/libldap/sortctrl.c
libraries/libldap/vlvctrl.c

index e34b5576cac018e898206ea12528c7ae4a671836..24133f614f215ba90162d1ba9182be8ecd7f8e11 100644 (file)
@@ -1940,7 +1940,7 @@ ldap_turn_s LDAP_P(( LDAP *ld,
  * LDAP Server Side Sort
  *     in sortctrl.c
  */
-#define LDAP_API_FEATURE_SERVER_SIDE_SORT 1000
+#define LDAP_API_FEATURE_SERVER_SIDE_SORT 2000
 
 /* structure for a sort-key */
 typedef struct ldapsortkey {
@@ -1962,11 +1962,11 @@ LDAP_F( int )
 ldap_create_sort_control LDAP_P((
        LDAP *ld,
        LDAPSortKey **keyList,
-       int ctl_iscritical,
+       int iscritical,
        LDAPControl **ctrlp ));
 
 LDAP_F( int )
-ldap_parse_sort_control LDAP_P((
+ldap_parse_sortresult_control LDAP_P((
        LDAP           *ld,
        LDAPControl    **ctrlp,
        unsigned long  *result,
@@ -1977,7 +1977,7 @@ ldap_parse_sort_control LDAP_P((
  * LDAP Virtual List View
  *     in vlvctrl.c
  */
-#define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 1000
+#define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 2000
 
 /* structure for virtual list */
 typedef struct ldapvlvinfo {
@@ -1998,9 +1998,9 @@ ldap_create_vlv_control LDAP_P((
        LDAPControl **ctrlp ));
 
 LDAP_F( int )
-ldap_parse_vlv_control LDAP_P((
+ldap_parse_vlvresponse_control LDAP_P((
        LDAP          *ld,
-       LDAPControl   **ctrls,
+       LDAPControl   *ctrls,
        unsigned long *target_posp,
        unsigned long *list_countp,
        struct berval **contextp,
index 63ccb283c26b825eccad026c2b46a622a06c7ed6..0c14a133b36683c0728a6c72c86dabd62c23e3b9 100644 (file)
@@ -356,16 +356,14 @@ exit:
 
 
 /* ---------------------------------------------------------------------------
-   ldap_parse_sort_control
+   ldap_parse_sortedresult_control
    
    Decode the server-side sort control return information.
 
    ld          (IN) An LDAP session handle, as obtained from a call to
                                        ldap_init().
 
-   ctrls       (IN) The address of a NULL-terminated array of LDAPControl
-                                       structures, typically obtained by a call to
-                                       ldap_parse_result().
+   ctrl        (IN) The address of the LDAP Control Structure.
                                  
    returnCode (OUT) This result parameter is filled in with the sort control
                                        result code.  This parameter MUST not be NULL.
@@ -405,9 +403,9 @@ exit:
    ---------------------------------------------------------------------------*/
 
 int
-ldap_parse_sort_control(
+ldap_parse_sortedresult_control(
        LDAP           *ld,
-       LDAPControl    **ctrls,
+       LDAPControl    *ctrl,
        unsigned long  *returnCode,
        char           **attribute )
 {
@@ -422,8 +420,8 @@ ldap_parse_sort_control(
                return(ld->ld_errno);
        }
 
-       if (ctrls == NULL) {
-               ld->ld_errno =  LDAP_CONTROL_NOT_FOUND;
+       if (ctrl == NULL) {
+               ld->ld_errno =  LDAP_PARAM_ERROR;
                return(ld->ld_errno);
        }
 
@@ -431,20 +429,14 @@ ldap_parse_sort_control(
                *attribute = NULL;
        }
 
-       /* Search the list of control responses for a sort control. */
-       for (i=0; ctrls[i]; i++) {
-               pControl = ctrls[i];
-               if (!strcmp(LDAP_CONTROL_SORTRESPONSE, pControl->ldctl_oid))
-                       goto foundSortControl;
+       if ( strcmp(LDAP_CONTROL_SORTRESPONSE, ctrl->ldctl_oid) != 0 ) {
+               /* Not sort result control */
+               ld->ld_errno = LDAP_CONTROL_NOT_FOUND;
+               return(ld->ld_errno);
        }
 
-       /* No sort control was found. */
-       ld->ld_errno = LDAP_CONTROL_NOT_FOUND;
-       return(ld->ld_errno);
-
-foundSortControl:
        /* Create a BerElement from the berval returned in the control. */
-       ber = ber_init(&pControl->ldctl_value);
+       ber = ber_init(&ctrl->ldctl_value);
 
        if (ber == NULL) {
                ld->ld_errno = LDAP_NO_MEMORY;
index 53967800111dc25f47dbab2e6ec0f461f752edef..c8896d420370884d005ce680c458d803a06ec535 100644 (file)
@@ -147,15 +147,13 @@ exit:
 
 
 /*---
-   ldap_parse_vlv_control
+   ldap_parse_vlvresponse_control
    
    Decode the Virtual List View control return information.
 
    ld           (IN)   An LDAP session handle.
    
-   ctrls        (IN)   The address of a NULL-terminated array of 
-                                          LDAPControl structures, typically obtained 
-                                          by a call to ldap_parse_result().
+   ctrl         (IN)   The address of the LDAPControl structure.
    
    target_posp (OUT)  This result parameter is filled in with the list
                                           index of the target entry.  If this parameter is
@@ -203,9 +201,9 @@ exit:
 ---*/
 
 int
-ldap_parse_vlv_control(
+ldap_parse_vlvresponse_control(
        LDAP           *ld,
-       LDAPControl    **ctrls,
+       LDAPControl    *ctrl,
        unsigned long  *target_posp,
        unsigned long  *list_countp,
        struct berval  **contextp,
@@ -225,25 +223,19 @@ ldap_parse_vlv_control(
                *contextp = NULL;        /* Make sure we return a NULL if error occurs. */
        }
 
-       if (ctrls == NULL) {
-               ld->ld_errno = LDAP_CONTROL_NOT_FOUND;
+       if (ctrl == NULL) {
+               ld->ld_errno = LDAP_PARAM_ERROR;
                return(ld->ld_errno);
        }
 
-       /* Search the list of control responses for a VLV control. */
-       for (i=0; ctrls[i]; i++) {
-               pControl = ctrls[i];
-               if (!strcmp(LDAP_CONTROL_VLVRESPONSE, pControl->ldctl_oid))
-                       goto foundVLVControl;
+       if (strcmp(LDAP_CONTROL_VLVRESPONSE, ctrl->ldctl_oid) != 0) {
+               /* Not VLV Response control */
+               ld->ld_errno = LDAP_CONTROL_NOT_FOUND;
+               return(ld->ld_errno);
        }
 
-       /* No sort control was found. */
-       ld->ld_errno = LDAP_CONTROL_NOT_FOUND;
-       return(ld->ld_errno);
-
-foundVLVControl:
        /* Create a BerElement from the berval returned in the control. */
-       ber = ber_init(&pControl->ldctl_value);
+       ber = ber_init(&ctrl->ldctl_value);
 
        if (ber == NULL) {
                ld->ld_errno = LDAP_NO_MEMORY;