Author: tridge
Date: 2005-07-17 10:52:31 +0000 (Sun, 17 Jul 2005)
New Revision: 8523

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8523

Log:
match a zero message id in ldap replies to the last request sent. Thanks to simo
for noticing that this is needed to catch the server sending a "can't decode 
request"
error reply

Modified:
   branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c 2005-07-17 10:38:59 UTC 
(rev 8522)
+++ branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c 2005-07-17 10:52:31 UTC 
(rev 8523)
@@ -106,6 +106,11 @@
        for (req=conn->pending; req; req=req->next) {
                if (req->messageid == msg->messageid) break;
        }
+       /* match a zero message id to the last request sent.
+          It seems that servers send 0 if unable to parse */
+       if (req == NULL && msg->messageid == 0) {
+               req = conn->pending;
+       }
        if (req == NULL) {
                DEBUG(0,("ldap: no matching message id for %u\n",
                         msg->messageid));
@@ -480,6 +485,9 @@
        req->state       = LDAP_REQUEST_SEND;
        req->conn        = conn;
        req->messageid   = conn->next_messageid++;
+       if (conn->next_messageid == 0) {
+               conn->next_messageid = 1;
+       }
        req->type        = msg->type;
        if (req->messageid == -1) {
                goto failed;

Reply via email to