s4-libcli: use new GUID functions in libcli
authorAndrew Tridgell <tridge@samba.org>
Thu, 10 Dec 2009 00:24:54 +0000 (11:24 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 10 Dec 2009 06:51:26 +0000 (17:51 +1100)
source4/libcli/raw/rawfsinfo.c
source4/libcli/raw/rawrequest.c
source4/libcli/smb2/negprot.c

index 43a0919e382d0c640e959c9f8511f1cefc5bee51..4c79ba066c6318fac9f5404b07fd17a805a28ad6 100644 (file)
@@ -159,7 +159,6 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx,
                                       union smb_fsinfo *fsinfo)
 {
        NTSTATUS status = NT_STATUS_OK;
-       enum ndr_err_code ndr_err;
        int i;
 
        /* parse the results */
@@ -217,11 +216,8 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx,
 
        case RAW_QFS_OBJECTID_INFORMATION:
                QFS_CHECK_SIZE(64);
-               ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, &fsinfo->objectid_information.out.guid,
-                                              (ndr_pull_flags_fn_t)ndr_pull_GUID);
-               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-                       status = ndr_map_error2ntstatus(ndr_err);
-               }
+               status = GUID_from_ndr_blob(&blob, &fsinfo->objectid_information.out.guid);
+               NT_STATUS_NOT_OK_RETURN(status);
                for (i=0;i<6;i++) {
                        fsinfo->objectid_information.out.unknown[i] = BVAL(blob.data, 16 + i*8);
                }
index 0f04190a8bf252a9496c7090004f9aa575993f39..723e3d909cc3ef4a8fa789802edcb9ce7ccf600f 100644 (file)
@@ -991,21 +991,17 @@ size_t smbcli_blob_append_string(struct smbcli_session *session,
   pull a GUID structure from the wire. The buffer must be at least 16
   bytes long
  */
-enum ndr_err_code smbcli_pull_guid(void *base, uint16_t offset, 
-                                  struct GUID *guid)
+NTSTATUS smbcli_pull_guid(void *base, uint16_t offset,
+                         struct GUID *guid)
 {
        DATA_BLOB blob;
-       TALLOC_CTX *tmp_ctx = talloc_new(NULL);
-       enum ndr_err_code ndr_err;
 
        ZERO_STRUCTP(guid);
 
        blob.data       = offset + (uint8_t *)base;
        blob.length     = 16;
-       ndr_err = ndr_pull_struct_blob(&blob, tmp_ctx, NULL, guid, 
-                                      (ndr_pull_flags_fn_t)ndr_pull_GUID);
-       talloc_free(tmp_ctx);
-       return ndr_err;
+
+       return GUID_from_ndr_blob(&blob, guid);
 }
 
 /*
index c1f0cf0b2424d40cac0ba9033dfbd4e5bd890a16..16dcd1571f8d9dd3762aa24db1a1e3c96a8b5e2f 100644 (file)
@@ -68,7 +68,6 @@ NTSTATUS smb2_negprot_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
                           struct smb2_negprot *io)
 {
        NTSTATUS status;
-       enum ndr_err_code ndr_err;
 
        if (!smb2_request_receive(req) ||
            smb2_request_is_error(req)) {
@@ -80,10 +79,10 @@ NTSTATUS smb2_negprot_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
        io->out.security_mode      = SVAL(req->in.body, 0x02);
        io->out.dialect_revision   = SVAL(req->in.body, 0x04);
        io->out.reserved           = SVAL(req->in.body, 0x06);
-       ndr_err = smbcli_pull_guid(req->in.body, 0x08, &io->in.client_guid);
-       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+       status = smbcli_pull_guid(req->in.body, 0x08, &io->in.client_guid);
+       if (!NT_STATUS_IS_OK(status)) {
                smb2_request_destroy(req);
-               return NT_STATUS_INTERNAL_ERROR;
+               return status;
        }
        io->out.capabilities       = IVAL(req->in.body, 0x18);
        io->out.max_transact_size  = IVAL(req->in.body, 0x1C);