Author: metze
Date: 2006-11-16 10:42:07 +0000 (Thu, 16 Nov 2006)
New Revision: 19735

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

Log:
report the LDAP error code in the CLDAP replies to the caller

metze
Modified:
   branches/SAMBA_4_0/source/libcli/cldap/cldap.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/cldap/cldap.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/cldap/cldap.c      2006-11-16 10:37:21 UTC 
(rev 19734)
+++ branches/SAMBA_4_0/source/libcli/cldap/cldap.c      2006-11-16 10:42:07 UTC 
(rev 19735)
@@ -450,7 +450,7 @@
 
        if (!ldap_decode(&req->asn1, ldap_msg)) {
                talloc_free(req);
-               return NT_STATUS_INVALID_PARAMETER;
+               return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
        }
 
        ZERO_STRUCT(io->out);
@@ -464,13 +464,13 @@
                /* decode the 2nd part */
                if (!ldap_decode(&req->asn1, ldap_msg)) {
                        talloc_free(req);
-                       return NT_STATUS_INVALID_PARAMETER;
+                       return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
                }
        }
 
        if (ldap_msg->type != LDAP_TAG_SearchResultDone) {
                talloc_free(req);
-               return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
+               return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
        }
 
        io->out.result = talloc(mem_ctx, struct ldap_Result);
@@ -478,6 +478,10 @@
        *io->out.result = ldap_msg->r.SearchResultDone;
 
        talloc_free(req);
+
+       if (io->out.result->resultcode != LDAP_SUCCESS) {
+               return NT_STATUS_LDAP(io->out.result->resultcode);
+       }
        return NT_STATUS_OK;
 }
 

Reply via email to