From a48b453f7672ac3d1ea040f45642e2109a4f769b 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 1c94d21d73a37830f4a11d6576531822f1b5ed93 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) (cherry picked from commit 88d0e44df340e5954b2f57c779c2a49a5fac0b11) --- source3/client/client.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 752701b..7ae0661 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4200,6 +4200,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 \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 ****************************************************************************/ @@ -4385,6 +4418,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 b985459d5219c6584d984026259686da25d0a162 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 7ae0661..66dde36 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4232,6 +4232,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 @@ -4419,6 +4437,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 783563fa7b546aa951ce6a31febaa1ddc06e5902 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 "tdis" command to view and change the tree id (tid). This low level command can be used to switch between tree connects in one session. (cherry picked from commit d67a91b9556a81318fd36d7f17ce327e5f6d44e0) --- source3/client/client.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 66dde36..f3e83d5 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4251,6 +4251,30 @@ 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_state_has_tcon(cli)) { + d_printf("current tid is %d\n", cli_state_get_tid(cli)); + } else { + d_printf("no tcon currently\n"); + } + } else { + uint16_t tid = atoi(tid_str); + cli_state_set_tid(cli, tid); + } + + return 0; +} + + /**************************************************************************** list active connections ****************************************************************************/ @@ -4438,6 +4462,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 3ec5ca9062fe260b7e85e56b20a5526f4991aa8a 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 0a0364e8982f2a2a09260bd48662aa606bcd61e6 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 2e5634f83681c9dd4544fa671f1a47d49a336c75 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 5ab32708d5e0cb3d5754cc5c5b9fac2d354336b0 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