The branch, master has been updated
       via  37059e45182 smbtree: Align integer types
       via  67b097b8235 libsmb: Move get_ipc_connect_master_ip_bcast() to 
smbtree.c
       via  c7022803ede libsmb: Remove unused cli_NetWkstaUserLogon()
       via  9d8819b3071 smbclient: Simplify browse_host()
       via  cfd0a8a738e libsmb: Respect the full timeval for smbc_utimes()
       via  833303b8bd3 torture: Test smbc_utimes()
       via  810397f89a1 libsmbclient: Don't throw away nsec fields in stat()
       via  b22b4daeba3 libsmb: Remove unused cli_setpathinfo_basic()
       via  7b246696c89 libsmb: Call cli_setpathinfo_ext() instead of .._basic()
       via  e4aa9a970a4 libsmb: Pass "struct timespec" to SMBC_setatr()
       via  b89ab75cd6a smbtorture3: Call cli_setpathinfo_ext() instead of 
.._basic()
       via  aa1f34219d4 libsmb: Make cli_setpathinfo_ext() take structs instead 
of pointers
       via  6cb1f20f73e libsmb: Use cli_setfileinfo_send() in 
cli_ftruncate_send()
       via  b46b5a6408d libsmb: Use cli_setfilefinfo_send() in 
cli_nt_delete_on_close_send()
       via  bf61a0d7f30 libsmb: Add cli_setfileinfo_send/recv()
       via  268892f75c5 smbclient: Remove function set_remote_times()
       via  d3be1d04541 smbclient: Remove some unnecessary declarations
       via  f261d5f727f torture4: Allow DBG output in libsmbclient tests
       via  5766956277f lib: Avoid casts in ctdb_packet_dump()
       via  fbf55d124dc libsmb: Remove a typedef
       via  3ab9caae337 lib: Fix a signed/unsigned warning
      from  9918abd7324 gitlab-ci: Add runner for fips compliance testing

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 37059e4518208b05168f6732cc8d8cf4db458a67
Author: Volker Lendecke <[email protected]>
Date:   Sun Apr 5 13:02:12 2020 +0200

    smbtree: Align integer types
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>
    
    Autobuild-User(master): Ralph Böhme <[email protected]>
    Autobuild-Date(master): Wed Apr  8 16:22:17 UTC 2020 on sn-devel-184

commit 67b097b8235d8651c237bff757f9dc2067cd634c
Author: Volker Lendecke <[email protected]>
Date:   Sun Apr 5 13:01:07 2020 +0200

    libsmb: Move get_ipc_connect_master_ip_bcast() to smbtree.c
    
    ... the only user
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit c7022803edecebadacee619a18a77cb0ad1f4165
Author: Volker Lendecke <[email protected]>
Date:   Sun Apr 5 12:38:01 2020 +0200

    libsmb: Remove unused cli_NetWkstaUserLogon()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 9d8819b3071723ed82babf5e28bb67824e3ed86b
Author: Volker Lendecke <[email protected]>
Date:   Sun Apr 5 12:31:24 2020 +0200

    smbclient: Simplify browse_host()
    
    We now have the check of the real connection's prootocol, so the
    smb.conf's "client min protocol" does not really matter here
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit cfd0a8a738e39679aa7dab4580c2bcaf270c7616
Author: Volker Lendecke <[email protected]>
Date:   Mon Mar 30 21:43:51 2020 +0200

    libsmb: Respect the full timeval for smbc_utimes()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 833303b8bd38f20e835533a48a913122bbca245e
Author: Volker Lendecke <[email protected]>
Date:   Mon Mar 30 22:08:40 2020 +0200

    torture: Test smbc_utimes()
    
    Prove that smbc_utimes throws away the tv_nsec field
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 810397f89a101581511ed13b026340ad16f91694
Author: Volker Lendecke <[email protected]>
Date:   Tue Mar 31 11:10:55 2020 +0200

    libsmbclient: Don't throw away nsec fields in stat()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit b22b4daeba34a16079032e7d6675a7b57e263ba7
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 26 14:46:32 2020 +0100

    libsmb: Remove unused cli_setpathinfo_basic()
    
    We got beyond 1-sec timestamp resolution a while ago...
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 7b246696c89c4d3567a1861f438955dc775e82b2
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 26 14:42:39 2020 +0100

    libsmb: Call cli_setpathinfo_ext() instead of .._basic()
    
    Yes, the formatting is not according to README.Coding, but that's a
    patch for another day.
    
    Also, this is no functional change: All callers so far either set
    .tv_sec only or set .tv_nsec to SAMBA_UTIME_OMIT.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit e4aa9a970a483ea16aa5b5bc9f7bbf542a4eeecd
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 26 12:29:13 2020 +0100

    libsmb: Pass "struct timespec" to SMBC_setatr()
    
    Prepare to set higher-precision timestamps. No change in behaviour so
    far: The {.tv_nsec=SAMBA_UTIME_OMIT} implicitly sets .tv_sec=0, and
    SMBC_setatr() only looks at .tv_sec
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit b89ab75cd6a77d2c069051f7bb174882cb5d1e68
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 26 14:38:45 2020 +0100

    smbtorture3: Call cli_setpathinfo_ext() instead of .._basic()
    
    The timestamps were never looked at
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit aa1f34219d46b200f4c955232db4558e6260c8d8
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 26 14:33:58 2020 +0100

    libsmb: Make cli_setpathinfo_ext() take structs instead of pointers
    
    This simplifies the next commit: With direct (small) structs on the
    stack we don't need declared variables in the callers
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 6cb1f20f73ed79f4d3717ebf4c8923707ef62ac3
Author: Volker Lendecke <[email protected]>
Date:   Mon Mar 30 15:19:34 2020 +0200

    libsmb: Use cli_setfileinfo_send() in cli_ftruncate_send()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit b46b5a6408dfa002f6a38f3c0dcd592085ba93ac
Author: Volker Lendecke <[email protected]>
Date:   Mon Mar 30 15:16:02 2020 +0200

    libsmb: Use cli_setfilefinfo_send() in cli_nt_delete_on_close_send()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit bf61a0d7f30f85b3459be12ab58fcd3c674666e2
Author: Volker Lendecke <[email protected]>
Date:   Mon Mar 30 15:12:48 2020 +0200

    libsmb: Add cli_setfileinfo_send/recv()
    
    Encapsulate TRANSACT2_SETFILEINFO like cli_setpathinfo_send() does for
    TRANSACT2_SETPATHINFO.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 268892f75c5a481ddad7cc0a25b3212c4d3f1d6d
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 26 14:24:14 2020 +0100

    smbclient: Remove function set_remote_times()
    
    This was just a wrapper around cli_setpathinfo_ext() with just one
    caller
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit d3be1d04541eed8a0c814cd7d0090e85e68e4dd5
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 26 14:21:15 2020 +0100

    smbclient: Remove some unnecessary declarations
    
    "cmd_ptr" is a global variable in this file anyway
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit f261d5f727f52e0d951897628c55127c4410051a
Author: Volker Lendecke <[email protected]>
Date:   Tue Mar 31 08:32:10 2020 +0200

    torture4: Allow DBG output in libsmbclient tests
    
    smbc_new_context() overwrites the global DEBUGLEVEL to 0.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 5766956277fa9d16711af55818af15e4648b268c
Author: Volker Lendecke <[email protected]>
Date:   Fri Mar 20 13:27:43 2020 +0100

    lib: Avoid casts in ctdb_packet_dump()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit fbf55d124dc03b6b0bfe434bd6a121d8e2e1d562
Author: Volker Lendecke <[email protected]>
Date:   Wed Mar 25 22:06:37 2020 +0100

    libsmb: Remove a typedef
    
    No API change, this is not used publically
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 3ab9caae3379fcc37df716ef83be593bee0e8a43
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 12 13:34:43 2020 +0100

    lib: Fix a signed/unsigned warning
    
    The types are deliberately distinct, but nwritten is >0 or ==-1, so
    this should be okay.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/client/client.c                     |  52 ++--------
 source3/include/libsmb_internal.h           |  12 +--
 source3/lib/ctdbd_conn.c                    |  14 ++-
 source3/libsmb/cliconnect.c                 |  42 --------
 source3/libsmb/clifile.c                    | 154 ++++++++++++++++-----------
 source3/libsmb/clirap.c                     | 156 +++-------------------------
 source3/libsmb/clirap.h                     |  15 +--
 source3/libsmb/libsmb_dir.c                 |  43 ++++----
 source3/libsmb/libsmb_file.c                |  26 ++---
 source3/libsmb/libsmb_stat.c                |  12 +--
 source3/libsmb/libsmb_xattr.c               |  52 ++++++----
 source3/libsmb/proto.h                      |  12 ++-
 source3/torture/torture.c                   |  82 ++++++++-------
 source3/utils/smbtree.c                     |  47 ++++++++-
 source4/selftest/tests.py                   |   2 +
 source4/torture/libsmbclient/libsmbclient.c |  52 +++++++++-
 16 files changed, 360 insertions(+), 413 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/client.c b/source3/client/client.c
index 8d329216d58..f2cb3c8a337 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4915,10 +4915,6 @@ static bool browse_host(bool sort)
                return true;
        }
 
-       if (lp_client_min_protocol() > PROTOCOL_NT1) {
-               return false;
-       }
-
        if (smbXcli_conn_protocol(cli->conn) > PROTOCOL_NT1) {
                return false;
        }
@@ -5180,41 +5176,6 @@ static int cmd_show_connect( void )
        return 0;
 }
 
-/**
- * set_remote_times - set times of a remote file
- * @filename: path to the file name
- * @create_time: New create time
- * @access_time: New access time
- * @write_time: New write time
- * @change_time: New metadata change time
- *
- * Update the file times with the ones provided.
- */
-static int set_remote_times(const char *filename,
-                           struct timespec *create_time,
-                           struct timespec *access_time,
-                           struct timespec *write_time,
-                           struct timespec *change_time)
-{
-       extern struct cli_state *cli;
-       NTSTATUS status;
-
-       status = cli_setpathinfo_ext(cli,
-                               filename,
-                               create_time,
-                               access_time,
-                               write_time,
-                               change_time,
-                               -1);
-       if (!NT_STATUS_IS_OK(status)) {
-               d_printf("cli_setpathinfo_basic failed: %s\n",
-                        nt_errstr(status));
-               return 1;
-       }
-
-       return 0;
-}
-
 /**
  * cmd_utimes - interactive command to set the four times
  *
@@ -5223,7 +5184,6 @@ static int set_remote_times(const char *filename,
  */
 static int cmd_utimes(void)
 {
-       const extern char *cmd_ptr;
        char *buf;
        char *fname = NULL;
        struct timespec times[4] = {{0}};
@@ -5232,6 +5192,8 @@ static int cmd_utimes(void)
        int err = 0;
        bool ok;
        TALLOC_CTX *ctx = talloc_new(NULL);
+       NTSTATUS status;
+
        if (ctx == NULL) {
                return 1;
        }
@@ -5308,7 +5270,14 @@ static int cmd_utimes(void)
                   timespec_string_buf(&times[2], false, &tbuf[2]),
                   timespec_string_buf(&times[3], false, &tbuf[3])));
 
-       set_remote_times(fname, &times[0], &times[1], &times[2], &times[3]);
+       status = cli_setpathinfo_ext(
+               cli, fname, times[0], times[1], times[2], times[3], -1);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("cli_setpathinfo_ext failed: %s\n",
+                        nt_errstr(status));
+               err = 1;
+               goto out;
+       }
 out:
        talloc_free(ctx);
        return err;
@@ -5357,7 +5326,6 @@ int set_remote_attr(const char *filename, uint16_t 
new_attr, int mode)
  */
 int cmd_setmode(void)
 {
-       const extern char *cmd_ptr;
        char *buf;
        char *fname = NULL;
        uint16_t attr[2] = {0};
diff --git a/source3/include/libsmb_internal.h 
b/source3/include/libsmb_internal.h
index feedddd0877..be88e8e300d 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -38,7 +38,7 @@
 /*
  * DOS Attribute values (used internally)
  */
-typedef struct DOS_ATTR_DESC {
+struct DOS_ATTR_DESC {
        int mode;
        off_t size;
        time_t create_time;
@@ -46,7 +46,7 @@ typedef struct DOS_ATTR_DESC {
        time_t write_time;
        time_t change_time;
        SMB_INO_T inode;
-} DOS_ATTR_DESC;
+};
 
 /*
  * Extension of libsmbclient.h's #defines
@@ -411,10 +411,10 @@ SMBC_getatr(SMBCCTX * context,
 
 bool
 SMBC_setatr(SMBCCTX * context, SMBCSRV *srv, char *path,
-            time_t create_time,
-            time_t access_time,
-            time_t write_time,
-            time_t change_time,
+            struct timespec create_time,
+            struct timespec access_time,
+            struct timespec write_time,
+            struct timespec change_time,
             uint16_t mode);
 
 off_t
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index e968ec5e491..498f477a3be 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -134,10 +134,14 @@ static void ctdb_packet_dump(struct ctdb_req_header *hdr)
        if (DEBUGLEVEL < 11) {
                return;
        }
-       DEBUGADD(11, ("len=%d, magic=%x, vers=%d, gen=%d, op=%d, reqid=%d\n",
-                     (int)hdr->length, (int)hdr->ctdb_magic,
-                     (int)hdr->ctdb_version, (int)hdr->generation,
-                     (int)hdr->operation, (int)hdr->reqid));
+       DEBUGADD(11, ("len=%"PRIu32", magic=%"PRIu32", vers=%"PRIu32", "
+                     "gen=%"PRIu32", op=%"PRIu32", reqid=%"PRIu32"\n",
+                     hdr->length,
+                     hdr->ctdb_magic,
+                     hdr->ctdb_version,
+                     hdr->generation,
+                     hdr->operation,
+                     hdr->reqid));
 }
 
 /*
@@ -1380,7 +1384,7 @@ static struct tevent_req *ctdb_pkt_send_send(TALLOC_CTX 
*mem_ctx,
         */
 
        nwritten = writev(conn->fd, state->iov, state->iovcnt);
-       if (nwritten == state->packet_len) {
+       if ((size_t)nwritten == state->packet_len) {
                DBG_DEBUG("Finished sending reqid [%" PRIu32 "]\n", reqid);
 
                *req_state = DBWRAP_REQ_DISPATCHED;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 13d035a8d41..b87287fa24d 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3873,45 +3873,3 @@ struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX 
*ctx,
 
        return cli;
 }
-
-/*
- * Return the IP address and workgroup of a master browser on the network, and
- * connect to it.
- */
-
-struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
-                                       const struct user_auth_info *user_info,
-                                       char **pp_workgroup_out)
-{
-       struct sockaddr_storage *ip_list;
-       struct cli_state *cli;
-       int i, count;
-       NTSTATUS status;
-
-       *pp_workgroup_out = NULL;
-
-        DEBUG(99, ("Do broadcast lookup for workgroups on local network\n"));
-
-        /* Go looking for workgroups by broadcasting on the local network */
-
-       status = name_resolve_bcast(MSBROWSE, 1, talloc_tos(),
-                                   &ip_list, &count);
-        if (!NT_STATUS_IS_OK(status)) {
-                DEBUG(99, ("No master browsers responded: %s\n",
-                          nt_errstr(status)));
-                return NULL;
-        }
-
-       for (i = 0; i < count; i++) {
-               char addr[INET6_ADDRSTRLEN];
-               print_sockaddr(addr, sizeof(addr), &ip_list[i]);
-               DEBUG(99, ("Found master browser %s\n", addr));
-
-               cli = get_ipc_connect_master_ip(ctx, &ip_list[i],
-                               user_info, pp_workgroup_out);
-               if (cli)
-                       return(cli);
-       }
-
-       return NULL;
-}
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index dd08b0e30f3..28d85d1a9f8 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -149,6 +149,83 @@ NTSTATUS cli_setpathinfo(struct cli_state *cli,
        return status;
 }
 
+struct cli_setfileinfo_state {
+       uint16_t setup;
+       uint8_t param[6];
+};
+
+static void cli_setfileinfo_done(struct tevent_req *subreq);
+
+struct tevent_req *cli_setfileinfo_send(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct cli_state *cli,
+       uint16_t fnum,
+       uint16_t level,
+       uint8_t *data,
+       size_t data_len)
+{
+       struct tevent_req *req = NULL, *subreq = NULL;
+       struct cli_setfileinfo_state *state = NULL;
+
+       req = tevent_req_create(mem_ctx, &state, struct cli_setfileinfo_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       PUSH_LE_U16(&state->setup, 0, TRANSACT2_SETFILEINFO);
+
+       PUSH_LE_U16(state->param, 0, fnum);
+       PUSH_LE_U16(state->param, 2, level);
+
+       subreq = cli_trans_send(state,          /* mem ctx. */
+                               ev,             /* event ctx. */
+                               cli,            /* cli_state. */
+                               0,              /* additional_flags2 */
+                               SMBtrans2,      /* cmd. */
+                               NULL,           /* pipe name. */
+                               -1,             /* fid. */
+                               0,              /* function. */
+                               0,              /* flags. */
+                               &state->setup,  /* setup. */
+                               1,              /* num setup uint16_t words. */
+                               0,              /* max returned setup. */
+                               state->param,   /* param. */
+                               6,              /* num param. */
+                               2,              /* max returned param. */
+                               data,           /* data. */
+                               data_len,       /* num data. */
+                               0);             /* max returned data. */
+
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, cli_setfileinfo_done, req);
+       return req;
+}
+
+static void cli_setfileinfo_done(struct tevent_req *subreq)
+{
+       NTSTATUS status = cli_trans_recv(
+               subreq,         /* req */
+               NULL,           /* mem_ctx */
+               NULL,           /* recv_flags2 */
+               NULL,           /* setup */
+               0,              /* min_setup */
+               NULL,           /* num_setup */
+               NULL,           /* param */
+               0,              /* min_param */
+               NULL,           /* num_param */
+               NULL,           /* data */
+               0,              /* min_data */
+               NULL);          /* num_data */
+       tevent_req_simple_finish_ntstatus(subreq, status);
+}
+
+NTSTATUS cli_setfileinfo_recv(struct tevent_req *req)
+{
+       return tevent_req_simple_recv_ntstatus(req);
+}
+
 /****************************************************************************
  Hard/Symlink a file (UNIX extensions).
  Creates new name (sym)linked to link_target.
@@ -2129,8 +2206,6 @@ NTSTATUS cli_rmdir(struct cli_state *cli, const char 
*dname)
 ****************************************************************************/
 
 struct doc_state {
-       uint16_t setup;
-       uint8_t param[6];
        uint8_t data[1];
 };
 
@@ -2163,34 +2238,17 @@ struct tevent_req 
*cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
                return req;
        }
 
-       /* Setup setup word. */
-       SSVAL(&state->setup, 0, TRANSACT2_SETFILEINFO);
-
-       /* Setup param array. */
-       SSVAL(state->param,0,fnum);
-       SSVAL(state->param,2,SMB_SET_FILE_DISPOSITION_INFO);
-
        /* Setup data array. */
        SCVAL(&state->data[0], 0, flag ? 1 : 0);
 
-       subreq = cli_trans_send(state,                  /* mem ctx. */
-                               ev,                     /* event ctx. */
-                               cli,                    /* cli_state. */
-                               0,                      /* additional_flags2 */
-                               SMBtrans2,              /* cmd. */
-                               NULL,                   /* pipe name. */
-                               -1,                     /* fid. */
-                               0,                      /* function. */
-                               0,                      /* flags. */
-                               &state->setup,          /* setup. */
-                               1,                      /* num setup uint16_t 
words. */
-                               0,                      /* max returned setup. 
*/
-                               state->param,           /* param. */
-                               6,                      /* num param. */
-                               2,                      /* max returned param. 
*/
-                               state->data,            /* data. */
-                               1,                      /* num data. */
-                               0);                     /* max returned data. */
+       subreq = cli_setfileinfo_send(
+               state,
+               ev,
+               cli,
+               fnum,
+               SMB_SET_FILE_DISPOSITION_INFO,
+               state->data,
+               sizeof(state->data));
 
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -2203,8 +2261,7 @@ struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX 
*mem_ctx,
 
 static void cli_nt_delete_on_close_smb1_done(struct tevent_req *subreq)
 {
-       NTSTATUS status = cli_trans_recv(subreq, NULL, NULL, NULL, 0, NULL,
-                                        NULL, 0, NULL, NULL, 0, NULL);
+       NTSTATUS status = cli_setfileinfo_recv(subreq);
        tevent_req_simple_finish_ntstatus(subreq, status);
 }
 
@@ -3289,15 +3346,12 @@ NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum)
 ****************************************************************************/
 
 struct ftrunc_state {
-       uint16_t setup;
-       uint8_t param[6];
        uint8_t data[8];
 };
 
 static void cli_ftruncate_done(struct tevent_req *subreq)
 {
-       NTSTATUS status = cli_trans_recv(subreq, NULL, NULL, NULL, 0, NULL,
-                                        NULL, 0, NULL, NULL, 0, NULL);
+       NTSTATUS status = cli_setfileinfo_recv(subreq);
        tevent_req_simple_finish_ntstatus(subreq, status);
 }
 
@@ -3315,35 +3369,17 @@ struct tevent_req *cli_ftruncate_send(TALLOC_CTX 
*mem_ctx,
                return NULL;
        }
 
-       /* Setup setup word. */
-       SSVAL(&state->setup, 0, TRANSACT2_SETFILEINFO);
-
-       /* Setup param array. */
-       SSVAL(state->param,0,fnum);
-       SSVAL(state->param,2,SMB_SET_FILE_END_OF_FILE_INFO);
-       SSVAL(state->param,4,0);
-
        /* Setup data array. */
         SBVAL(state->data, 0, size);
 
-       subreq = cli_trans_send(state,                  /* mem ctx. */
-                               ev,                     /* event ctx. */
-                               cli,                    /* cli_state. */
-                               0,                      /* additional_flags2 */
-                               SMBtrans2,              /* cmd. */
-                               NULL,                   /* pipe name. */
-                               -1,                     /* fid. */
-                               0,                      /* function. */
-                               0,                      /* flags. */
-                               &state->setup,          /* setup. */
-                               1,                      /* num setup uint16_t 
words. */
-                               0,                      /* max returned setup. 
*/
-                               state->param,           /* param. */
-                               6,                      /* num param. */
-                               2,                      /* max returned param. 
*/
-                               state->data,            /* data. */
-                               8,                      /* num data. */
-                               0);                     /* max returned data. */
+       subreq = cli_setfileinfo_send(
+               state,
+               ev,
+               cli,
+               fnum,
+               SMB_SET_FILE_END_OF_FILE_INFO,
+               state->data,
+               sizeof(state->data));
 
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 71c7b97ad54..f76f11e00aa 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -95,74 +95,6 @@ fail:
        return false;
 }
 
-/****************************************************************************
- Perform a NetWkstaUserLogon.
-****************************************************************************/
-
-bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation)
-{
-       char *rparam = NULL;
-       char *rdata = NULL;
-       char *p;
-       unsigned int rdrcnt,rprcnt;
-       char param[1024];
-
-       memset(param, 0, sizeof(param));
-
-       /* send a SMBtrans command with api NetWkstaUserLogon */
-       p = param;
-       SSVAL(p,0,132); /* api number */
-       p += 2;
-       strlcpy(p,"OOWb54WrLh",sizeof(param)-PTR_DIFF(p,param));
-       p = skip_string(param,sizeof(param),p);
-       strlcpy(p,"WB21BWDWWDDDDDDDzzzD",sizeof(param)-PTR_DIFF(p,param));
-       p = skip_string(param,sizeof(param),p);
-       SSVAL(p,0,1);
-       p += 2;
-       strlcpy(p,user,sizeof(param)-PTR_DIFF(p,param));
-       if (!strupper_m(p)) {
-               return false;
-       }
-       p += 21;
-       p++;
-       p += 15;
-       p++;
-       strlcpy(p, workstation,sizeof(param)-PTR_DIFF(p,param));
-       if (!strupper_m(p)) {
-               return false;
-       }
-       p += 16;
-       SSVAL(p, 0, CLI_BUFFER_SIZE);
-       p += 2;
-       SSVAL(p, 0, CLI_BUFFER_SIZE);
-       p += 2;
-
-       if (cli_api(cli,
-                    param, PTR_DIFF(p,param),1024,  /* param, length, max */
-                    NULL, 0, CLI_BUFFER_SIZE,           /* data, length, max */
-                    &rparam, &rprcnt,               /* return params, return 
size */
-                    &rdata, &rdrcnt                 /* return data, return 
size */
-                   )) {
-               cli->rap_error = rparam? SVAL(rparam,0) : -1;
-
-               if (cli->rap_error == 0) {
-                       DEBUG(4,("NetWkstaUserLogon success\n"));
-                       /*
-                        * The cli->privileges = SVAL(p, 24); field was set here
-                        * but it was not use anywhere else.
-                        */
-                       /* The cli->eff_name field used to be set here
-                          but it wasn't used anywhere else. */
-               } else {
-                       DEBUG(1,("NetwkstaUserLogon gave error %d\n", 
cli->rap_error));
-               }
-       }
-
-       SAFE_FREE(rparam);


-- 
Samba Shared Repository

Reply via email to