]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10060 Return tag of last message if all=LDAP_MSG_ALL
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 21 Jun 2023 09:34:32 +0000 (10:34 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 19 Jul 2023 14:53:47 +0000 (14:53 +0000)
libraries/libldap/result.c

index 40ff1c1722d2a3934fb30c4b47179b032bcd3ce0..f5a58688607b314daf3dc0aaa73b25c0d4cc1d80 100644 (file)
@@ -295,7 +295,11 @@ wait4msg(
 #endif /* LDAP_DEBUG */
 
                if ( ( *result = chkResponseList( ld, msgid, all ) ) != NULL ) {
-                       rc = (*result)->lm_msgtype;
+                       if ( all == LDAP_MSG_ALL && (*result)->lm_chain ) {
+                               rc = (*result)->lm_chain_tail->lm_msgtype;
+                       } else {
+                               rc = (*result)->lm_msgtype;
+                       }
 
                } else {
                        int lc_ready = 0;
@@ -1082,7 +1086,7 @@ nextresp2:
                        chain_head->lm_chain_tail = newmsg;
                        *result = chkResponseList( ld, msgid, all );
                        ld->ld_errno = LDAP_SUCCESS;
-                       return( (*result)->lm_msgtype );
+                       return( (*result)->lm_chain_tail->lm_msgtype );
                }
        }
 #endif /* LDAP_CONNECTIONLESS */