summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-03-27 18:03:24 +0200
committerVolker Lendecke <vlendec@samba.org>2011-03-27 19:50:21 +0200
commit592c669d9ddeb3a39ed8472c633c7deace33a269 (patch)
tree0c8cb696864279030f0c8df635c8f8c43887c280 /source3/libsmb
parent13c1c8ef3da5385cb8d0130bdf9c9abe0e43b49f (diff)
downloadsamba-592c669d9ddeb3a39ed8472c633c7deace33a269.tar.gz
samba-592c669d9ddeb3a39ed8472c633c7deace33a269.tar.bz2
samba-592c669d9ddeb3a39ed8472c633c7deace33a269.zip
s3: Convert cli_raw_tcon to cli_smb
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Mar 27 19:50:21 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 6334f6b587..2fa9e8a2c5 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2708,7 +2708,10 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli,
const char *service, const char *pass, const char *dev,
uint16 *max_xmit, uint16 *tid)
{
- char *p;
+ struct tevent_req *req;
+ uint16_t *ret_vwv;
+ uint8_t *bytes;
+ NTSTATUS status;
if (!lp_client_plaintext_auth() && (*pass)) {
DEBUG(1, ("Server requested plaintext password but 'client "
@@ -2716,31 +2719,26 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli,
return NT_STATUS_ACCESS_DENIED;
}
- memset(cli->outbuf,'\0',smb_size);
- memset(cli->inbuf,'\0',smb_size);
-
- cli_set_message(cli->outbuf, 0, 0, True);
- SCVAL(cli->outbuf,smb_com,SMBtcon);
- cli_setup_packet(cli);
-
- p = smb_buf(cli->outbuf);
- *p++ = 4; p += clistr_push(cli, p, service, -1, STR_TERMINATE | STR_NOALIGN);
- *p++ = 4; p += clistr_push(cli, p, pass, -1, STR_TERMINATE | STR_NOALIGN);
- *p++ = 4; p += clistr_push(cli, p, dev, -1, STR_TERMINATE | STR_NOALIGN);
-
- cli_setup_bcc(cli, p);
-
- cli_send_smb(cli);
- if (!cli_receive_smb(cli)) {
- return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
- }
-
- if (cli_is_error(cli)) {
- return cli_nt_error(cli);
+ bytes = talloc_array(talloc_tos(), uint8_t, 0);
+ bytes = smb_bytes_push_bytes(bytes, 4, NULL, 0);
+ bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ service, strlen(service)+1, NULL);
+ bytes = smb_bytes_push_bytes(bytes, 4, NULL, 0);
+ bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ pass, strlen(pass)+1, NULL);
+ bytes = smb_bytes_push_bytes(bytes, 4, NULL, 0);
+ bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ dev, strlen(dev)+1, NULL);
+
+ status = cli_smb(talloc_tos(), cli, SMBtcon, 0, 0, NULL,
+ talloc_get_size(bytes), bytes, &req,
+ 2, NULL, &ret_vwv, NULL, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
- *max_xmit = SVAL(cli->inbuf, smb_vwv0);
- *tid = SVAL(cli->inbuf, smb_vwv1);
+ *max_xmit = SVAL(ret_vwv + 0, 0);
+ *tid = SVAL(ret_vwv + 1, 0);
return NT_STATUS_OK;
}