The branch, master has been updated
       via  e81ea8a s3: Make cli_session_setup_lanman2 async
       via  531628e s3: Make cli_session_setup_nt1 async
       via  40e2ee9 s3: Make plaintext session setup async
       via  ca9ac7c s3: Remove cli_write
       via  0226428 s3: Use cli_writeall instead of cli_write
       via  d018fcc s3: Add cli_writeall
      from  7a4cff8 s3:vfs use gpfs_lib_init

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


- Log -----------------------------------------------------------------
commit e81ea8a291d1a51a1b69dfeabf686e72f284689b
Author: Volker Lendecke <[email protected]>
Date:   Sun Apr 3 17:50:32 2011 +0200

    s3: Make cli_session_setup_lanman2 async
    
    Signed-off-by: Jeremy Allison <[email protected]>
    
    Autobuild-User: Jeremy Allison <[email protected]>
    Autobuild-Date: Wed Apr 27 00:25:35 CEST 2011 on sn-devel-104

commit 531628e5580b41f693a7dcaeb846fb270752e00d
Author: Volker Lendecke <[email protected]>
Date:   Sun Apr 3 11:44:35 2011 +0200

    s3: Make cli_session_setup_nt1 async
    
    Signed-off-by: Jeremy Allison <[email protected]>

commit 40e2ee9cb622edb85f6c75902f8bd152ff21c7e7
Author: Volker Lendecke <[email protected]>
Date:   Sat Apr 2 23:54:07 2011 +0200

    s3: Make plaintext session setup async
    
    Signed-off-by: Jeremy Allison <[email protected]>

commit ca9ac7c4c7adc9d726f1fc1fa2b061bd181e3d7a
Author: Volker Lendecke <[email protected]>
Date:   Sat Apr 2 16:44:40 2011 +0200

    s3: Remove cli_write
    
    Signed-off-by: Jeremy Allison <[email protected]>

commit 0226428eb9d7c6d3a4984d571622f21e9c82e408
Author: Volker Lendecke <[email protected]>
Date:   Sat Apr 2 11:46:30 2011 +0200

    s3: Use cli_writeall instead of cli_write
    
    Signed-off-by: Jeremy Allison <[email protected]>

commit d018fccb705e91f33f3211cdc5b8a4006d032f65
Author: Volker Lendecke <[email protected]>
Date:   Tue Apr 26 10:52:39 2011 -0700

    s3: Add cli_writeall
    
    Signed-off-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 source3/client/clitar.c             |    8 +-
 source3/client/smbspool.c           |   17 +-
 source3/include/proto.h             |   10 +-
 source3/libsmb/cliconnect.c         |  801 ++++++++++++++++++++++++++---------
 source3/libsmb/clientgen.c          |   45 --
 source3/libsmb/clireadwrite.c       |  212 +++-------
 source3/libsmb/libsmb_file.c        |   14 +-
 source3/torture/denytest.c          |   14 +-
 source3/torture/nbio.c              |   10 +-
 source3/torture/test_posix_append.c |   15 +-
 source3/torture/torture.c           |  180 +++++---
 source3/torture/utable.c            |    3 +-
 source3/utils/net_rpc_printer.c     |   11 +-
 13 files changed, 821 insertions(+), 519 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index b46115b..645899a 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -1045,8 +1045,12 @@ static int get_file(file_info2 finfo)
                dsize = MIN(dsize, rsize);  /* Should be only what is left */
                DEBUG(5, ("writing %i bytes, bpos = %i ...\n", dsize, bpos));
 
-               if (cli_write(cli, fnum, 0, buffer_p + bpos, pos, dsize) != 
dsize) {
-                       DEBUG(0, ("Error writing remote file\n"));
+               status = cli_writeall(cli, fnum, 0,
+                                     (uint8_t *)(buffer_p + bpos), pos,
+                                     dsize, NULL);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("Error writing remote file: %s\n",
+                                 nt_errstr(status)));
                        return 0;
                }
 
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 98c350d..5a736c4 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -595,14 +595,19 @@ smb_print(struct cli_state * cli, /* I - SMB connection */
        tbytes = 0;
 
        while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0) {
-               if (cli_write(cli, fnum, 0, buffer, tbytes, nbytes) != nbytes) {
-                       int status = get_exit_code(cli, cli_nt_error(cli));
-
-                       fprintf(stderr, "ERROR: Error writing spool: %s\n", 
cli_errstr(cli));
-                       fprintf(stderr, "DEBUG: Returning status %d...\n", 
status);
+               NTSTATUS status;
+
+               status = cli_writeall(cli, fnum, 0, (uint8_t *)buffer,
+                                     tbytes, nbytes, NULL);
+               if (!NT_STATUS_IS_OK(status)) {
+                       int ret = get_exit_code(cli, status);
+                       fprintf(stderr, "ERROR: Error writing spool: %s\n",
+                               nt_errstr(status));
+                       fprintf(stderr, "DEBUG: Returning status %d...\n",
+                               ret);
                        cli_close(cli, fnum);
 
-                       return (status);
+                       return (ret);
                }
                tbytes += nbytes;
        }
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 69672cf..2a1e138 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1191,9 +1191,6 @@ bool cli_state_seqnum_remove(struct cli_state *cli,
                             uint16_t mid);
 bool cli_receive_smb(struct cli_state *cli);
 bool cli_send_smb(struct cli_state *cli);
-bool cli_send_smb_direct_writeX(struct cli_state *cli,
-                               const char *p,
-                               size_t extradata);
 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
 void cli_setup_packet(struct cli_state *cli);
 void cli_setup_bcc(struct cli_state *cli, void *p);
@@ -1753,9 +1750,6 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
                  void *priv, SMB_OFF_T *received);
 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
                 off_t offset, size_t size);
-ssize_t cli_write(struct cli_state *cli,
-                uint16_t fnum, uint16 write_mode,
-                const char *buf, off_t offset, size_t size);
 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
                      off_t offset, size_t size1, size_t *ptotal);
 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
@@ -1773,6 +1767,10 @@ struct tevent_req *cli_write_andx_send(TALLOC_CTX 
*mem_ctx,
                                       off_t offset, size_t size);
 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
 
+NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
+                     const uint8_t *buf, off_t offset, size_t size,
+                     size_t *pwritten);
+
 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
                                 struct cli_state *cli,
                                 uint16_t fnum, uint16_t mode,
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index e3d97b6..0fc532d 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -63,86 +63,234 @@ static void cli_set_session_key (struct cli_state *cli, 
const DATA_BLOB session_
  Do an old lanman2 style session setup.
 ****************************************************************************/
 
-static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli,
-                                         const char *user, 
-                                         const char *pass, size_t passlen,
-                                         const char *workgroup)
+struct cli_session_setup_lanman2_state {
+       struct cli_state *cli;
+       uint16_t vwv[10];
+       const char *user;
+};
+
+static void cli_session_setup_lanman2_done(struct tevent_req *subreq);
+
+static struct tevent_req *cli_session_setup_lanman2_send(
+       TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+       struct cli_state *cli, const char *user,
+       const char *pass, size_t passlen,
+       const char *workgroup)
 {
+       struct tevent_req *req, *subreq;
+       struct cli_session_setup_lanman2_state *state;
        DATA_BLOB lm_response = data_blob_null;
-       NTSTATUS status;
-       fstring pword;
-       char *p;
+       uint16_t *vwv;
+       uint8_t *bytes;
+       char *tmp;
 
-       if (passlen > sizeof(pword)-1) {
-               return NT_STATUS_INVALID_PARAMETER;
+       req = tevent_req_create(mem_ctx, &state,
+                               struct cli_session_setup_lanman2_state);
+       if (req == NULL) {
+               return NULL;
        }
+       state->cli = cli;
+       state->user = user;
+       vwv = state->vwv;
 
-       /* LANMAN servers predate NT status codes and Unicode and ignore those 
-          smb flags so we must disable the corresponding default capabilities  
-          that would otherwise cause the Unicode and NT Status flags to be
-          set (and even returned by the server) */
+       /*
+        * LANMAN servers predate NT status codes and Unicode and
+        * ignore those smb flags so we must disable the corresponding
+        * default capabilities that would otherwise cause the Unicode
+        * and NT Status flags to be set (and even returned by the
+        * server)
+        */
 
        cli->capabilities &= ~(CAP_UNICODE | CAP_STATUS32);
 
-       /* if in share level security then don't send a password now */
-       if (!(cli->sec_mode & NEGOTIATE_SECURITY_USER_LEVEL))
+       /*
+        * if in share level security then don't send a password now
+        */
+       if (!(cli->sec_mode & NEGOTIATE_SECURITY_USER_LEVEL)) {
                passlen = 0;
+       }
 
-       if (passlen > 0 && (cli->sec_mode & 
NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) && passlen != 24) {
-               /* Encrypted mode needed, and non encrypted password supplied. 
*/
+       if (passlen > 0
+           && (cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE)
+           && passlen != 24) {
+               /*
+                * Encrypted mode needed, and non encrypted password
+                * supplied.
+                */
                lm_response = data_blob(NULL, 24);
-               if (!SMBencrypt(pass, cli->secblob.data,(uchar 
*)lm_response.data)) {
-                       DEBUG(1, ("Password is > 14 chars in length, and is 
therefore incompatible with Lanman authentication\n"));
-                       return NT_STATUS_ACCESS_DENIED;
+               if (tevent_req_nomem(lm_response.data, req)) {
+                       return tevent_req_post(req, ev);
                }
-       } else if ((cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) && 
passlen == 24) {
-               /* Encrypted mode needed, and encrypted password supplied. */
+
+               if (!SMBencrypt(pass, cli->secblob.data,
+                               (uint8_t *)lm_response.data)) {
+                       DEBUG(1, ("Password is > 14 chars in length, and is "
+                                 "therefore incompatible with Lanman "
+                                 "authentication\n"));
+                       tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
+                       return tevent_req_post(req, ev);
+               }
+       } else if ((cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE)
+                  && passlen == 24) {
+               /*
+                * Encrypted mode needed, and encrypted password
+                * supplied.
+                */
                lm_response = data_blob(pass, passlen);
+               if (tevent_req_nomem(lm_response.data, req)) {
+                       return tevent_req_post(req, ev);
+               }
        } else if (passlen > 0) {
-               /* Plaintext mode needed, assume plaintext supplied. */
-               passlen = clistr_push(cli, pword, pass, sizeof(pword), 
STR_TERMINATE);
+               uint8_t *buf;
+               size_t converted_size;
+               /*
+                * Plaintext mode needed, assume plaintext supplied.
+                */
+               buf = talloc_array(talloc_tos(), uint8_t, 0);
+               buf = smb_bytes_push_str(buf, cli_ucs2(cli), pass, passlen+1,
+                                        &converted_size);
+               if (tevent_req_nomem(buf, req)) {
+                       return tevent_req_post(req, ev);
+               }
                lm_response = data_blob(pass, passlen);
+               TALLOC_FREE(buf);
+               if (tevent_req_nomem(lm_response.data, req)) {
+                       return tevent_req_post(req, ev);
+               }
        }
 
-       /* send a session setup command */
-       memset(cli->outbuf,'\0',smb_size);
-       cli_set_message(cli->outbuf,10, 0, True);
-       SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
-       cli_setup_packet(cli);
+       SCVAL(vwv+0, 0, 0xff);
+       SCVAL(vwv+0, 1, 0);
+       SSVAL(vwv+1, 0, 0);
+       SSVAL(vwv+2, 0, CLI_BUFFER_SIZE);
+       SSVAL(vwv+3, 0, 2);
+       SSVAL(vwv+4, 0, 1);
+       SIVAL(vwv+5, 0, cli->sesskey);
+       SSVAL(vwv+7, 0, lm_response.length);
 
-       SCVAL(cli->outbuf,smb_vwv0,0xFF);
-       SSVAL(cli->outbuf,smb_vwv2,cli->max_xmit);
-       SSVAL(cli->outbuf,smb_vwv3,2);
-       SSVAL(cli->outbuf,smb_vwv4,1);
-       SIVAL(cli->outbuf,smb_vwv5,cli->sesskey);
-       SSVAL(cli->outbuf,smb_vwv7,lm_response.length);
+       bytes = talloc_array(state, uint8_t, lm_response.length);
+       if (tevent_req_nomem(bytes, req)) {
+               return tevent_req_post(req, ev);
+       }
+       if (lm_response.length != 0) {
+               memcpy(bytes, lm_response.data, lm_response.length);
+       }
+       data_blob_free(&lm_response);
 
-       p = smb_buf(cli->outbuf);
-       memcpy(p,lm_response.data,lm_response.length);
-       p += lm_response.length;
-       p += clistr_push(cli, p, user, -1, STR_TERMINATE|STR_UPPER);
-       p += clistr_push(cli, p, workgroup, -1, STR_TERMINATE|STR_UPPER);
-       p += clistr_push(cli, p, "Unix", -1, STR_TERMINATE);
-       p += clistr_push(cli, p, "Samba", -1, STR_TERMINATE);
-       cli_setup_bcc(cli, p);
+       tmp = talloc_strdup_upper(talloc_tos(), user);
+       if (tevent_req_nomem(tmp, req)) {
+               return tevent_req_post(req, ev);
+       }
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), tmp, strlen(tmp)+1,
+                                  NULL);
+       TALLOC_FREE(tmp);
 
-       if (!cli_send_smb(cli) || !cli_receive_smb(cli)) {
-               return cli_nt_error(cli);
+       tmp = talloc_strdup_upper(talloc_tos(), workgroup);
+       if (tevent_req_nomem(tmp, req)) {
+               return tevent_req_post(req, ev);
        }
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), tmp, strlen(tmp)+1,
+                                  NULL);
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Unix", 5, NULL);
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Samba", 6, NULL);
 
-       show_msg(cli->inbuf);
+       if (tevent_req_nomem(bytes, req)) {
+               return tevent_req_post(req, ev);
+       }
 
-       if (cli_is_error(cli)) {
-               return cli_nt_error(cli);
+       subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 10, vwv,
+                             talloc_get_size(bytes), bytes);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
        }
+       tevent_req_set_callback(subreq, cli_session_setup_lanman2_done, req);
+       return req;
+}
 
-       /* use the returned vuid from now on */
-       cli->vuid = SVAL(cli->inbuf,smb_uid);   
-       status = cli_set_username(cli, user);
+static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
+{
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct cli_session_setup_lanman2_state *state = tevent_req_data(
+               req, struct cli_session_setup_lanman2_state);
+       struct cli_state *cli = state->cli;
+       uint32_t num_bytes;
+       uint8_t *in;
+       char *inbuf;
+       uint8_t *bytes;
+       uint8_t *p;
+       NTSTATUS status;
+
+       status = cli_smb_recv(subreq, state, &in, 0, NULL, NULL,
+                             &num_bytes, &bytes);
+       TALLOC_FREE(subreq);
        if (!NT_STATUS_IS_OK(status)) {
-               return status;
+               tevent_req_nterror(req, status);
+               return;
        }
-       return NT_STATUS_OK;
+
+       inbuf = (char *)in;
+       p = bytes;
+
+       cli->vuid = SVAL(inbuf, smb_uid);
+
+       p += clistr_pull(inbuf, cli->server_os, (char *)p, sizeof(fstring),
+                        bytes+num_bytes-p, STR_TERMINATE);
+       p += clistr_pull(inbuf, cli->server_type, (char *)p, sizeof(fstring),
+                        bytes+num_bytes-p, STR_TERMINATE);
+       p += clistr_pull(inbuf, cli->server_domain, (char *)p, sizeof(fstring),
+                        bytes+num_bytes-p, STR_TERMINATE);
+
+       if (strstr(cli->server_type, "Samba")) {
+               cli->is_samba = True;
+       }
+       status = cli_set_username(cli, state->user);
+       if (tevent_req_nterror(req, status)) {
+               return;
+       }
+       tevent_req_done(req);
+}
+
+static NTSTATUS cli_session_setup_lanman2_recv(struct tevent_req *req)
+{
+       return tevent_req_simple_recv_ntstatus(req);
+}
+
+static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli, const char 
*user,
+                                         const char *pass, size_t passlen,
+                                         const char *workgroup)
+{
+       TALLOC_CTX *frame = talloc_stackframe();
+       struct event_context *ev;
+       struct tevent_req *req;
+       NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+       if (cli_has_async_calls(cli)) {
+               /*
+                * Can't use sync call while an async call is in flight
+                */
+               status = NT_STATUS_INVALID_PARAMETER;
+               goto fail;
+       }
+       ev = event_context_init(frame);
+       if (ev == NULL) {
+               goto fail;
+       }
+       req = cli_session_setup_lanman2_send(frame, ev, cli, user, pass, 
passlen,
+                                            workgroup);
+       if (req == NULL) {
+               goto fail;
+       }
+       if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+               goto fail;
+       }
+       status = cli_session_setup_lanman2_recv(req);
+ fail:
+       TALLOC_FREE(frame);
+       if (!NT_STATUS_IS_OK(status)) {
+               cli_set_error(cli, status);
+       }
+       return status;
 }
 
 /****************************************************************************
@@ -350,82 +498,168 @@ static NTSTATUS cli_session_setup_guest(struct cli_state 
*cli)
  Do a NT1 plaintext session setup.
 ****************************************************************************/
 
-static NTSTATUS cli_session_setup_plaintext(struct cli_state *cli,
-                                           const char *user, const char *pass,
-                                           const char *workgroup)
+struct cli_session_setup_plain_state {
+       struct cli_state *cli;
+       uint16_t vwv[13];
+       const char *user;
+};
+
+static void cli_session_setup_plain_done(struct tevent_req *subreq);
+
+static struct tevent_req *cli_session_setup_plain_send(
+       TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+       struct cli_state *cli,
+       const char *user, const char *pass, const char *workgroup)
 {
-       uint32 capabilities = cli_session_setup_capabilities(cli);
-       char *p;
-       NTSTATUS status;
-       fstring lanman;
-
-       fstr_sprintf( lanman, "Samba %s", samba_version_string());
-
-       memset(cli->outbuf, '\0', smb_size);
-       cli_set_message(cli->outbuf,13,0,True);
-       SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
-       cli_setup_packet(cli);
-
-       SCVAL(cli->outbuf,smb_vwv0,0xFF);
-       SSVAL(cli->outbuf,smb_vwv2,CLI_BUFFER_SIZE);
-       SSVAL(cli->outbuf,smb_vwv3,2);
-       SSVAL(cli->outbuf,smb_vwv4,cli->pid);
-       SIVAL(cli->outbuf,smb_vwv5,cli->sesskey);
-       SSVAL(cli->outbuf,smb_vwv8,0);
-       SIVAL(cli->outbuf,smb_vwv11,capabilities); 
-       p = smb_buf(cli->outbuf);
-
-       /* check wether to send the ASCII or UNICODE version of the password */
-
-       if ( (capabilities & CAP_UNICODE) == 0 ) {
-               p += clistr_push(cli, p, pass, -1, STR_TERMINATE); /* password 
*/
-               SSVAL(cli->outbuf,smb_vwv7,PTR_DIFF(p, smb_buf(cli->outbuf)));
-       }
-       else {
-               /* For ucs2 passwords clistr_push calls ucs2_align, which causes
-                * the space taken by the unicode password to be one byte too
-                * long (as we're on an odd byte boundary here). Reduce the
-                * count by 1 to cope with this. Fixes smbclient against NetApp
-                * servers which can't cope. Fix from
-                * [email protected] in bug #3840.
-                */
-               p += clistr_push(cli, p, pass, -1, STR_UNICODE|STR_TERMINATE); 
/* unicode password */
-               SSVAL(cli->outbuf,smb_vwv8,PTR_DIFF(p, 
smb_buf(cli->outbuf))-1);        
+       struct tevent_req *req, *subreq;
+       struct cli_session_setup_plain_state *state;
+       uint16_t *vwv;
+       uint8_t *bytes;
+       size_t passlen;
+       char *version;
+
+       req = tevent_req_create(mem_ctx, &state,
+                               struct cli_session_setup_plain_state);
+       if (req == NULL) {
+               return NULL;
        }
+       state->cli = cli;
+       state->user = user;
+       vwv = state->vwv;
 
-       p += clistr_push(cli, p, user, -1, STR_TERMINATE); /* username */
-       p += clistr_push(cli, p, workgroup, -1, STR_TERMINATE); /* workgroup */
-       p += clistr_push(cli, p, "Unix", -1, STR_TERMINATE);
-       p += clistr_push(cli, p, lanman, -1, STR_TERMINATE);
-       cli_setup_bcc(cli, p);
+       SCVAL(vwv+0, 0, 0xff);
+       SCVAL(vwv+0, 1, 0);
+       SSVAL(vwv+1, 0, 0);
+       SSVAL(vwv+2, 0, CLI_BUFFER_SIZE);
+       SSVAL(vwv+3, 0, 2);
+       SSVAL(vwv+4, 0, cli->pid);
+       SIVAL(vwv+5, 0, cli->sesskey);
+       SSVAL(vwv+7, 0, 0);
+       SSVAL(vwv+8, 0, 0);
+       SSVAL(vwv+9, 0, 0);
+       SSVAL(vwv+10, 0, 0);
+       SIVAL(vwv+11, 0, cli_session_setup_capabilities(cli));
 
-       if (!cli_send_smb(cli) || !cli_receive_smb(cli)) {
-               return cli_nt_error(cli);
+       bytes = talloc_array(state, uint8_t, 0);
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), pass, strlen(pass)+1,
+                                  &passlen);
+       if (tevent_req_nomem(bytes, req)) {
+               return tevent_req_post(req, ev);
        }
+       SSVAL(vwv + (cli_ucs2(cli) ? 8 : 7), 0, passlen);
 
-       show_msg(cli->inbuf);
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+                                  user, strlen(user)+1, NULL);
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+                                  workgroup, strlen(workgroup)+1, NULL);
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+                                  "Unix", 5, NULL);
 
-       if (cli_is_error(cli)) {
-               return cli_nt_error(cli);
+       version = talloc_asprintf(talloc_tos(), "Samba %s",
+                                 samba_version_string());
+       if (tevent_req_nomem(version, req)){
+               return tevent_req_post(req, ev);
        }
+       bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+                                  version, strlen(version)+1, NULL);
+       TALLOC_FREE(version);
 
-       cli->vuid = SVAL(cli->inbuf,smb_uid);
-       p = smb_buf(cli->inbuf);
-       p += clistr_pull(cli->inbuf, cli->server_os, p, sizeof(fstring),
-                        -1, STR_TERMINATE);


-- 
Samba Shared Repository

Reply via email to