summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-17 10:52:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:35 -0500
commit039393d6620816789b4ebd131974b23b6420f4dc (patch)
treeb5156b61321ec5ccc2eeff649111f2b1d72f677f /source4/libcli
parent9953452d498f89152147f4408e7c1959ab2cc97b (diff)
downloadsamba-039393d6620816789b4ebd131974b23b6420f4dc.tar.gz
samba-039393d6620816789b4ebd131974b23b6420f4dc.tar.bz2
samba-039393d6620816789b4ebd131974b23b6420f4dc.zip
r8523: 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 (This used to be commit 6e81e866dc7a5dc014d2d9f2e09803c6adfd1830)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/ldap/ldap_client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index a8463f7872..97b75602aa 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -106,6 +106,11 @@ static void ldap_match_message(struct ldap_connection *conn, struct ldap_message
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 @@ struct ldap_request *ldap_request_send(struct ldap_connection *conn,
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;