From b316bfe5ba2068ba91da02205be5f5fbf7de1a1d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Jul 2011 14:08:03 +0200 Subject: [PATCH 1/8] s3:smbclient: add "logoff" command to close the session (cherry picked from commit 281c6d02bdcc9988c0f1660a3c77ba4b3db3dc6d) --- source3/client/client.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index b94893d..752701b 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4181,6 +4181,24 @@ static int cmd_logon(void) return 0; } +/** + * close the session + */ + +static int cmd_logoff(void) +{ + NTSTATUS status; + + status = cli_ulogoff(cli); + if (!NT_STATUS_IS_OK(status)) { + d_printf("logoff failed: %s\n", nt_errstr(status)); + return -1; + } + + d_printf("logoff successful\n"); + return 0; +} + /**************************************************************************** list active connections @@ -4367,6 +4385,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}}, + {"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}}, /* Yes, this must be here, see crh's comment above. */ -- 1.7.1 From a4a71f8bb0d84b70c14181aeddf074f50654e43e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Jul 2011 14:10:38 +0200 Subject: [PATCH 2/8] s3:smbclient: add a "tcon" command to do a tree connect (connect to a share) --- source3/client/client.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 752701b..41f37bb 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4200,6 +4200,38 @@ 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 \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->cnum); + return 0; +} + + /**************************************************************************** list active connections ****************************************************************************/ @@ -4385,6 +4417,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}}, -- 1.7.1 From 8878bc04aae6f5ed9edf2ee92ddcb8cfefd99236 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Jul 2011 14:11:34 +0200 Subject: [PATCH 3/8] s3:smbclient: add a "tdis" command to do a tree disconnect (close a connection to a share) (cherry picked from commit 7327bde81acecf4ae0c09f80cebe21a1312aeb3a) --- source3/client/client.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 41f37bb..c0ce085 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4231,6 +4231,24 @@ static int cmd_tcon(void) return 0; } +/** + * tree disconnect (disconnect from a share) + */ + +static int cmd_tdis(void) +{ + NTSTATUS status; + + status = cli_tdis(cli); + if (!NT_STATUS_IS_OK(status)) { + d_printf("tdis failed: %s\n", nt_errstr(status)); + return -1; + } + + d_printf("tdis successful\n"); + return 0; +} + /**************************************************************************** list active connections @@ -4418,6 +4436,7 @@ static struct { {"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}}, + {"tdis",cmd_tdis,"disconnect from 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}}, -- 1.7.1 From 5777ba5a907e1a37e41d8934745521d50d55b6d2 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Jul 2011 14:12:13 +0200 Subject: [PATCH 4/8] s3:smbclient: add a "tid" command to view and change the tree id (tid). This low level command can be used to switch between tree connects in one session. --- source3/client/client.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index c0ce085..8396ca6 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4250,6 +4250,29 @@ static int cmd_tdis(void) } +/** + * get or set tid + */ + +static int cmd_tid(void) +{ + TALLOC_CTX *ctx = talloc_tos(); + char *tid_str; + + if (!next_token_talloc(ctx, &cmd_ptr, &tid_str, NULL)) { + if (cli->cnum != -1) { + d_printf("current tid is %d\n", (int)(cli->cnum)); + } else { + d_printf("no tcon currently\n"); + } + } else { + cli->cnum = (uint16_t)atoi(tid_str); + } + + return 0; +} + + /**************************************************************************** list active connections ****************************************************************************/ @@ -4437,6 +4460,7 @@ static struct { {"showconnect",cmd_show_connect,"display the current active connection",{COMPL_NONE,COMPL_NONE}}, {"tcon",cmd_tcon,"connect to a share" ,{COMPL_NONE,COMPL_NONE}}, {"tdis",cmd_tdis,"disconnect from a share",{COMPL_NONE,COMPL_NONE}}, + {"tid",cmd_tid,"show or set the current tid (tree-id)",{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}}, -- 1.7.1 From 0c3530058430be075fb26ef66b60a6eaba1a1b90 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 25 Jul 2011 11:39:04 +0200 Subject: [PATCH 5/8] s3:docs: document the smbclient "logoff" command (cherry picked from commit 9724fe303d5f9a3e37a881d025937285668e2dbe) --- docs-xml/manpages-3/smbclient.1.xml | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/docs-xml/manpages-3/smbclient.1.xml b/docs-xml/manpages-3/smbclient.1.xml index ae11e8a..a8f8055 100644 --- a/docs-xml/manpages-3/smbclient.1.xml +++ b/docs-xml/manpages-3/smbclient.1.xml @@ -735,6 +735,13 @@ + logoff + Loggs the user off the server, closing the session. + Used for internal Samba testing purposes. + + + + lowercase Toggle lowercasing of filenames for the get and mget commands. -- 1.7.1 From 6175350cd01637b6d6f1566d430db2c9ff25674b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 25 Jul 2011 11:42:00 +0200 Subject: [PATCH 6/8] s3:docs: document the smbclient "tcon" command (cherry picked from commit 5ecfcf6cb998f5670895f998c2c917afc86aacfd) --- docs-xml/manpages-3/smbclient.1.xml | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/docs-xml/manpages-3/smbclient.1.xml b/docs-xml/manpages-3/smbclient.1.xml index a8f8055..918f268 100644 --- a/docs-xml/manpages-3/smbclient.1.xml +++ b/docs-xml/manpages-3/smbclient.1.xml @@ -1051,6 +1051,14 @@ + + tcon <sharename> + Establishes a new tree connect (connection to a share). + Replaces the current tree connect. Prints the new tid (tree id). + Used for internal Samba testing purposes. + + + -- 1.7.1 From 32669c420911a6a212dd1bbd9d9a5047f1e76c86 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 25 Jul 2011 11:44:39 +0200 Subject: [PATCH 7/8] s3:docs: document the smbclient "tdis" command (cherry picked from commit a8d0e4ddb8730dc176e0589674ec4eaea307119a) --- docs-xml/manpages-3/smbclient.1.xml | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/docs-xml/manpages-3/smbclient.1.xml b/docs-xml/manpages-3/smbclient.1.xml index 918f268..730fc7a 100644 --- a/docs-xml/manpages-3/smbclient.1.xml +++ b/docs-xml/manpages-3/smbclient.1.xml @@ -1059,6 +1059,13 @@ + + tdis + Close the current share connection (tree disconnect). + Used for internal Samba testing purposes. + + + -- 1.7.1 From 4e537415432d0a0a042396db597dbad3189c73d7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 25 Jul 2011 11:46:33 +0200 Subject: [PATCH 8/8] s3:docs: document the smbclient "tid" command Autobuild-User: Michael Adam Autobuild-Date: Mon Jul 25 13:14:57 CEST 2011 on sn-devel-104 (cherry picked from commit 233ba37416551a0b64dcfeb5cd405aadede5418c) --- docs-xml/manpages-3/smbclient.1.xml | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/docs-xml/manpages-3/smbclient.1.xml b/docs-xml/manpages-3/smbclient.1.xml index 730fc7a..337b0e4 100644 --- a/docs-xml/manpages-3/smbclient.1.xml +++ b/docs-xml/manpages-3/smbclient.1.xml @@ -1066,6 +1066,15 @@ + + tid <number> + Changes the current tree id (tid) in the + protocol to a new arbitrary number. Without an argument, it + prints out the tid currently used. + Used for internal Samba testing purposes. + + + -- 1.7.1