From d4324d5813c7de90a05ef1d3fefbe18a37cab6f8 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 4 Jan 2007 18:33:45 +0000 Subject: [PATCH] fix \& improve previous commit --- libraries/libldap/result.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index 70cabc56cf..804f5d671c 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -903,33 +903,43 @@ nextresp2: } /* try to handle unsolicited responses as appropriate */ - if ( id == 0 && msgid != LDAP_RES_UNSOLICITED ) { + if ( id == 0 && msgid > LDAP_RES_UNSOLICITED ) { int is_nod = 0; tag = ber_peek_tag( ber, &len ); /* we have a res oid */ if ( tag == LDAP_TAG_EXOP_RES_OID ) { - char *resoid = NULL; + static struct berval bv_nod = BER_BVC( LDAP_NOTICE_OF_DISCONNECTION ); + struct berval resoid = BER_BVNULL; - if ( ber_scanf( ber, "a", &resoid ) == LBER_ERROR ) { + if ( ber_scanf( ber, "m", &resoid ) == LBER_ERROR ) { ld->ld_errno = LDAP_DECODING_ERROR; ber_free( ber, 1 ); return -1; } - assert( resoid[ 0 ] != '\0' ); + assert( !BER_BVISEMPTY( &resoid ) ); - is_nod = strcmp( resoid, LDAP_NOTICE_OF_DISCONNECTION ) == 0; - LDAP_FREE( resoid ); + is_nod = ber_bvcmp( &resoid, &bv_nod ) == 0; tag = ber_peek_tag( ber, &len ); } - /* we have a res value */ +#if 0 /* don't need right now */ + /* we have res data */ if ( tag == LDAP_TAG_EXOP_RES_VALUE ) { - /* don't need right now */ + struct berval resdata; + + if ( ber_scanf( ber, "m", &resdata ) == LBER_ERROR ) { + ld->ld_errno = LDAP_DECODING_ERROR; + ber_free( ber, 0 ); + return ld->ld_errno; + } + + /* use it... */ } +#endif /* handle RFC 4511 "Notice of Disconnection" locally */ -- 2.39.5