From: Howard Chu Date: Mon, 7 Oct 2002 19:58:10 +0000 (+0000) Subject: Fix ldap_int_get_controls for optional values X-Git-Tag: NO_SLAP_OP_BLOCKS~922 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e37ccca9aa6a0cf5ea521adbf110901c9b8f229c;p=openldap Fix ldap_int_get_controls for optional values --- diff --git a/libraries/libldap/controls.c b/libraries/libldap/controls.c index f3af141e1e..3d9f3a5ac5 100644 --- a/libraries/libldap/controls.c +++ b/libraries/libldap/controls.c @@ -187,33 +187,27 @@ int ldap_int_get_controls( tag = ber_scanf( ber, "{a" /*}*/, &tctrl->ldctl_oid ); - if( tag != LBER_ERROR ) { - tag = ber_peek_tag( ber, &len ); + if( tag == LBER_ERROR ) { + *ctrls = NULL; + ldap_controls_free( tctrls ); + return LDAP_DECODING_ERROR; } + tag = ber_peek_tag( ber, &len ); + if( tag == LBER_BOOLEAN ) { ber_int_t crit; tag = ber_scanf( ber, "b", &crit ); tctrl->ldctl_iscritical = crit ? (char) 0 : (char) ~0; - } - - if( tag != LBER_ERROR ) { tag = ber_peek_tag( ber, &len ); } if( tag == LBER_OCTETSTRING ) { tag = ber_scanf( ber, "o", &tctrl->ldctl_value ); - } else { tctrl->ldctl_value.bv_val = NULL; } - if( tag == LBER_ERROR ) { - *ctrls = NULL; - ldap_controls_free( tctrls ); - return LDAP_DECODING_ERROR; - } - *ctrls = tctrls; }