From b4ea96ecd9bab32d06599d872f091576e31e12f8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Dec 2009 14:32:15 +1100 Subject: s4-libcli: use GUID_to_ndr_blob() --- source4/libcli/raw/rawrequest.c | 14 ++++++-------- source4/libcli/smb2/negprot.c | 6 +++--- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'source4') diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 723e3d909c..52b9bf74bf 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -1007,19 +1007,17 @@ NTSTATUS smbcli_pull_guid(void *base, uint16_t offset, /* push a guid onto the wire. The buffer must hold 16 bytes */ -enum ndr_err_code smbcli_push_guid(void *base, uint16_t offset, - const struct GUID *guid) +NTSTATUS smbcli_push_guid(void *base, uint16_t offset, const struct GUID *guid) { TALLOC_CTX *tmp_ctx = talloc_new(NULL); - enum ndr_err_code ndr_err; + NTSTATUS status; DATA_BLOB blob; - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, NULL, - guid, (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err) || blob.length != 16) { + status = GUID_to_ndr_blob(guid, tmp_ctx, &blob); + if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); - return ndr_err; + return status; } memcpy(offset + (uint8_t *)base, blob.data, blob.length); talloc_free(tmp_ctx); - return ndr_err; + return NT_STATUS_OK; } diff --git a/source4/libcli/smb2/negprot.c b/source4/libcli/smb2/negprot.c index 16dcd1571f..1ff4193499 100644 --- a/source4/libcli/smb2/negprot.c +++ b/source4/libcli/smb2/negprot.c @@ -34,8 +34,8 @@ struct smb2_request *smb2_negprot_send(struct smb2_transport *transport, { struct smb2_request *req; uint16_t size = 0x24 + io->in.dialect_count*2; - enum ndr_err_code ndr_err; int i; + NTSTATUS status; req = smb2_request_init(transport, SMB2_OP_NEGPROT, size, false, 0); if (req == NULL) return NULL; @@ -46,8 +46,8 @@ struct smb2_request *smb2_negprot_send(struct smb2_transport *transport, SSVAL(req->out.body, 0x04, io->in.security_mode); SSVAL(req->out.body, 0x06, io->in.reserved); SIVAL(req->out.body, 0x08, io->in.capabilities); - ndr_err = smbcli_push_guid(req->out.body, 0x0C, &io->in.client_guid); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + status = smbcli_push_guid(req->out.body, 0x0C, &io->in.client_guid); + if (!NT_STATUS_IS_OK(status)) { talloc_free(req); return NULL; } -- cgit