Author: metze Date: 2004-08-13 06:27:02 +0000 (Fri, 13 Aug 2004) New Revision: 1803 WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1803&nolog=1 Log: more progress on sasl binds, but decoding the response still fails
metze Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap.c branches/SAMBA_4_0/source/libcli/ldap/ldap.h Changeset: Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap.c =================================================================== --- branches/SAMBA_4_0/source/libcli/ldap/ldap.c 2004-08-13 05:26:38 UTC (rev 1802) +++ branches/SAMBA_4_0/source/libcli/ldap/ldap.c 2004-08-13 06:27:02 UTC (rev 1803) @@ -1066,6 +1066,26 @@ asn1_end_tag(data); } +static void ldap_decode_BindResponse(TALLOC_CTX *mem_ctx, + ASN1_DATA *data, + enum ldap_request_tag tag, + struct ldap_BindResponse *BindResp) +{ + asn1_start_tag(data, ASN1_APPLICATION(tag)); + asn1_read_enumerated(data, &BindResp->response.resultcode); + asn1_read_OctetString_talloc(mem_ctx, data, &BindResp->response.dn); + asn1_read_OctetString_talloc(mem_ctx, data, &BindResp->response.errormessage); + if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { + DATA_BLOB tmp_blob = data_blob(NULL, 0); + asn1_read_OctetString(data, &tmp_blob); + BindResp->SASL.secblob = data_blob_talloc(mem_ctx, tmp_blob.data, tmp_blob.length); + data_blob_free(&tmp_blob); + } else { + BindResp->SASL.secblob = data_blob(NULL, 0); + } + asn1_end_tag(data); +} + static BOOL add_attrib_to_array_talloc(TALLOC_CTX *mem_ctx, const struct ldap_attribute *attrib, struct ldap_attribute **attribs, @@ -1261,9 +1281,9 @@ case ASN1_APPLICATION(LDAP_TAG_BindResponse): { struct ldap_BindResponse *r = &msg->r.BindResponse; msg->type = LDAP_TAG_BindResponse; - ldap_decode_response(msg->mem_ctx, + ldap_decode_BindResponse(msg->mem_ctx, data, LDAP_TAG_BindResponse, - &r->response); + r); break; } @@ -1866,6 +1886,10 @@ response = ldap_transaction(conn, msg); destroy_ldap_message(msg); + if (!response) { + goto done; + } + result = response->r.BindResponse.response.resultcode; if (result != LDAP_SUCCESS && result != LDAP_SASL_BIND_IN_PROGRESS) { @@ -1873,7 +1897,7 @@ } status = gensec_update(conn->gensec, mem_ctx, - response->r.BindResponse.SASL.creds, + response->r.BindResponse.SASL.secblob, &output); destroy_ldap_message(response); Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap.h =================================================================== --- branches/SAMBA_4_0/source/libcli/ldap/ldap.h 2004-08-13 05:26:38 UTC (rev 1802) +++ branches/SAMBA_4_0/source/libcli/ldap/ldap.h 2004-08-13 06:27:02 UTC (rev 1803) @@ -85,7 +85,7 @@ struct ldap_BindResponse { struct ldap_Result response; union { - DATA_BLOB creds; + DATA_BLOB secblob; } SASL; };