From 3f91cffa15f3167a53df560e8cb8de2b9342a83c Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 22 Jul 1999 05:06:41 +0000 Subject: [PATCH] Fix unknown critical extensions. --- servers/slapd/controls.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 09267a8bb2..b4d76d73fb 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -26,7 +26,7 @@ int get_ctrls( Operation *op, int sendres ) { - int nctrls; + int nctrls = 0; ber_tag_t tag; ber_len_t len; char *opaque; @@ -40,7 +40,7 @@ int get_ctrls( if( len == 0) { /* no controls */ rc = LDAP_SUCCESS; - goto return_results; + return rc; } if(( tag = ber_peek_tag( ber, &len )) != LDAP_TAG_CONTROLS ) { @@ -61,7 +61,6 @@ int get_ctrls( } /* set through each element */ - nctrls = 0; *ctrls = ch_malloc( 1 * sizeof(LDAPControl *) ); #if 0 @@ -123,9 +122,6 @@ int get_ctrls( goto return_results; } - Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: %s\n", - tctrl->ldctl_oid, 0, 0 ); - tag = ber_peek_tag( ber, &len ); if( tag == LBER_BOOLEAN ) { @@ -142,10 +138,15 @@ int get_ctrls( goto return_results; } - tctrl->ldctl_iscritical = crit ? (char) 0 : (char) ~0; + tctrl->ldctl_iscritical = (crit != 0); tag = ber_peek_tag( ber, &len ); } + Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: oid=\"%s\" (%scritical)\n", + tctrl->ldctl_oid, + tctrl->ldctl_iscritical ? "" : "non", + 0 ); + if( tag == LBER_OCTETSTRING ) { tag = ber_scanf( ber, "o", &tctrl->ldctl_value ); -- 2.39.5