s3:smbclient: add a "tid" command to view and change the tree id (tid).
authorMichael Adam <obnox@samba.org>
Fri, 22 Jul 2011 12:12:13 +0000 (14:12 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 27 Jul 2011 14:19:55 +0000 (16:19 +0200)
This low level command can be used to switch between tree connects in one
session.

source3/client/client.c

index c0ce0855e5f629e809fad3146482f6761f3a1cba..5507039c87d0d3f8c605e35063b76430c01bcb05 100644 (file)
@@ -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 != UINT16_MAX) {
+                       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}},