s4-libcli: use GUID_to_ndr_blob()
authorAndrew Tridgell <tridge@samba.org>
Thu, 10 Dec 2009 03:32:15 +0000 (14:32 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 10 Dec 2009 06:51:28 +0000 (17:51 +1100)
source4/libcli/raw/rawrequest.c
source4/libcli/smb2/negprot.c

index 723e3d909cc3ef4a8fa789802edcb9ce7ccf600f..52b9bf74bfca74e38c876e10ad7b18e00c12baab 100644 (file)
@@ -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;
 }
index 16dcd1571f8d9dd3762aa24db1a1e3c96a8b5e2f..1ff4193499a3b029a84059a82ed1d01305f2d2e8 100644 (file)
@@ -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;
        }