From 62f4745bfca51b0ee29916396d5559745f5c3d63 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 21 Sep 2006 20:02:55 +0000 Subject: [PATCH] ITS#4679 cleanup Note: the caller is expected to pass in a valid LDAP handle. If not, the assert will trigger to let him know his code is broken. --- libraries/libldap/sortctrl.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libraries/libldap/sortctrl.c b/libraries/libldap/sortctrl.c index b4e1f8591e..1850461672 100644 --- a/libraries/libldap/sortctrl.c +++ b/libraries/libldap/sortctrl.c @@ -296,14 +296,15 @@ ldap_create_sort_control_value( BerElement *ber = NULL; ber_tag_t tag; - if ( ld == NULL || keyList == NULL || value == NULL ) { - if ( ld ) - ld->ld_errno = LDAP_PARAM_ERROR; + assert( ld != NULL ); + assert( LDAP_VALID( ld ) ); + + if ( ld == NULL ) return LDAP_PARAM_ERROR; + if ( keyList == NULL || value == NULL ) { + ld->ld_errno = LDAP_PARAM_ERROR; return LDAP_PARAM_ERROR; } - assert( LDAP_VALID( ld ) ); - value->bv_val = NULL; value->bv_len = 0; @@ -412,6 +413,10 @@ ldap_create_sort_control( struct berval value; BerElement *ber; + assert( ld != NULL ); + assert( LDAP_VALID( ld ) ); + + if ( ld == NULL ) return LDAP_PARAM_ERROR; if ( ctrlp == NULL ) { ld->ld_errno = LDAP_PARAM_ERROR; return ld->ld_errno; @@ -496,6 +501,9 @@ ldap_parse_sortresponse_control( ber_tag_t tag, berTag; ber_len_t berLen; + assert( ld != NULL ); + assert( LDAP_VALID( ld ) ); + if (ld == NULL) { return LDAP_PARAM_ERROR; } -- 2.39.5