s3:smbclient: add "logoff" command to close the session
authorMichael Adam <obnox@samba.org>
Fri, 22 Jul 2011 12:08:03 +0000 (14:08 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 22 Jul 2011 13:42:16 +0000 (15:42 +0200)
source3/client/client.c

index 1cf44103e939d92f7a29edcffab73cbbc97760d8..a5bee39f0a4023b73dfc438356f26a674c690521 100644 (file)
@@ -4308,6 +4308,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
@@ -4497,6 +4515,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. */