summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-07-22 14:10:38 +0200
committerMichael Adam <obnox@samba.org>2011-07-22 15:42:16 +0200
commit88d0e44df340e5954b2f57c779c2a49a5fac0b11 (patch)
tree0ad17e5ce1e5f22aba432b052ae2182e249f787c /source3
parent281c6d02bdcc9988c0f1660a3c77ba4b3db3dc6d (diff)
downloadsamba-88d0e44df340e5954b2f57c779c2a49a5fac0b11.tar.gz
samba-88d0e44df340e5954b2f57c779c2a49a5fac0b11.tar.bz2
samba-88d0e44df340e5954b2f57c779c2a49a5fac0b11.zip
s3:smbclient: add a "tcon" command to do a tree connect (connect to a share)
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index a5bee39f0a..e3a7204118 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4327,6 +4327,39 @@ static int cmd_logoff(void)
}
+/**
+ * tree connect (connect to a share)
+ */
+
+static int cmd_tcon(void)
+{
+ TALLOC_CTX *ctx = talloc_tos();
+ char *sharename;
+ NTSTATUS status;
+
+ if (!next_token_talloc(ctx, &cmd_ptr, &sharename, NULL)) {
+ d_printf("tcon <sharename>\n");
+ return 0;
+ }
+
+ if (!sharename) {
+ return 1;
+ }
+
+ status = cli_tcon_andx(cli, sharename, "?????", "", 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("tcon failed: %s\n", nt_errstr(status));
+ return -1;
+ }
+
+ talloc_free(sharename);
+
+ d_printf("tcon to %s successful, tid: %u\n", sharename,
+ cli_state_get_tid(cli));
+ return 0;
+}
+
+
/****************************************************************************
list active connections
****************************************************************************/
@@ -4515,6 +4548,7 @@ static struct {
{"logon",cmd_logon,"establish new logon",{COMPL_NONE,COMPL_NONE}},
{"listconnect",cmd_list_connect,"list open connections",{COMPL_NONE,COMPL_NONE}},
{"showconnect",cmd_show_connect,"display the current active connection",{COMPL_NONE,COMPL_NONE}},
+ {"tcon",cmd_tcon,"connect to a share" ,{COMPL_NONE,COMPL_NONE}},
{"logoff",cmd_logoff,"log off (close the session)",{COMPL_NONE,COMPL_NONE}},
{"..",cmd_cd_oneup,"change the remote directory (up one level)",{COMPL_REMOTE,COMPL_NONE}},