]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/vlvctrl.c
Fix assignment of <char/int>* to unsigned <char/int>* and vice versa.
[openldap] / libraries / libldap / vlvctrl.c
index 40785e95341d117692e6c5ffdb31b16348e7cb66..a4b10cec056912bee721151084ca7efd3d11397b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Adapted for inclusion into OpenLDAP by Kurt D. Zeilenga */
  * PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
  * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
  *---*/
+/* Note: A verbatim copy of version 2.0.1 of the OpenLDAP Public License
+ * can be found in the file "build/LICENSE-2.0.1" in this distribution
+ * of OpenLDAP Software.
+ */
 
 #include "portable.h"
 
@@ -22,7 +26,6 @@
 #include <ac/stdlib.h>
 #include <ac/string.h>
 #include <ac/time.h>
-#include <ac/ctype.h>
 
 #include "ldap-int.h"
 
@@ -80,10 +83,10 @@ ldap_create_vlv_control( LDAP *ld,
        ber_tag_t tag;
        BerElement *ber;
 
-       if ( (ld==NULL) || (vlvinfop==NULL) || (ctrlp == NULL) ) {
-               ld->ld_errno =  LDAP_PARAM_ERROR;
-               return(ld->ld_errno);
-       }
+       assert( ld != NULL );
+       assert( LDAP_VALID( ld ) );
+       assert( vlvinfop != NULL );
+       assert( ctrlp != NULL );
 
        if ((ber = ldap_alloc_ber_with_options(ld)) == NULL) {
                ld->ld_errno = LDAP_NO_MEMORY;
@@ -96,7 +99,7 @@ ldap_create_vlv_control( LDAP *ld,
        if( tag == LBER_ERROR ) goto exit;
 
        if (vlvinfop->ldvlv_attrvalue == NULL) {
-               tag = ber_printf(ber, "t{ii}",
+               tag = ber_printf(ber, "t{iiN}",
                        LDAP_VLVBYINDEX_IDENTIFIER,
                        vlvinfop->ldvlv_offset,
                        vlvinfop->ldvlv_count);
@@ -116,11 +119,11 @@ ldap_create_vlv_control( LDAP *ld,
                if( tag == LBER_ERROR ) goto exit;
        }
 
-       tag = ber_printf(ber, /*{*/ "}"); 
+       tag = ber_printf(ber, /*{*/ "N}"); 
        if( tag == LBER_ERROR ) goto exit;
 
-       ld->ld_errno = ldap_int_create_control(
-               LDAP_CONTROL_VLVREQUEST, ber, 1, ctrlp);
+       ld->ld_errno = ldap_create_control(     LDAP_CONTROL_VLVREQUEST,
+               ber, 1, ctrlp);
 
        ber_free(ber, 1);
        return(ld->ld_errno);
@@ -204,15 +207,13 @@ ldap_parse_vlv_control(
        ber_tag_t tag, berTag;
        ber_len_t berLen;
 
+       assert( ld != NULL );
+       assert( LDAP_VALID( ld ) );
+
        if (contextp) {
                *contextp = NULL;        /* Make sure we return a NULL if error occurs. */
        }
 
-       if (ld == NULL) {
-               ld->ld_errno = LDAP_PARAM_ERROR;
-               return(ld->ld_errno);
-       }
-
        if (ctrls == NULL) {
                ld->ld_errno = LDAP_CONTROL_NOT_FOUND;
                return(ld->ld_errno);