X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fvlvctrl.c;h=033adcf143734db7d9b6fded87741b14143fc610;hb=6f632af4132d81e2c70466b539349b19c5d46f69;hp=04b5526a65f6cc6f8f55ecd72a0bf312ba892b14;hpb=c6e4ad6c1216bf976b5977076d1ef72462509b42;p=openldap diff --git a/libraries/libldap/vlvctrl.c b/libraries/libldap/vlvctrl.c index 04b5526a65..033adcf143 100644 --- a/libraries/libldap/vlvctrl.c +++ b/libraries/libldap/vlvctrl.c @@ -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 */ @@ -15,6 +15,14 @@ * 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. + */ +/* + * Portions Copyright (C) The Internet Society (1997) + * ASN.1 fragments are from RFC 2251; see RFC for full legal notices. + */ #include "portable.h" @@ -22,7 +30,6 @@ #include #include #include -#include #include "ldap-int.h" @@ -72,7 +79,7 @@ ---*/ -LIBLDAP_F( int ) +int ldap_create_vlv_control( LDAP *ld, LDAPVLVInfo *vlvinfop, LDAPControl **ctrlp ) @@ -80,10 +87,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 +103,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 +123,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); @@ -188,7 +195,7 @@ exit: ---*/ -LIBLDAP_F( int ) +int ldap_parse_vlv_control( LDAP *ld, LDAPControl **ctrls, @@ -204,15 +211,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);