diff options
author | Richard Sharpe <sharpe@samba.org> | 2004-02-13 16:55:25 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@samba.org> | 2004-02-13 16:55:25 +0000 |
commit | 608c737cdf45ff2b6e61de97f6f19dde8fea21d2 (patch) | |
tree | f77394a7e156ff7f233390fc7db9e6b06114fad8 /source3/client | |
parent | 4c5152b8fe2637ab067111ab23753f683ad692ac (diff) | |
download | samba-608c737cdf45ff2b6e61de97f6f19dde8fea21d2.tar.gz samba-608c737cdf45ff2b6e61de97f6f19dde8fea21d2.tar.bz2 samba-608c737cdf45ff2b6e61de97f6f19dde8fea21d2.zip |
Apply the multiple login stuff to smbclient ...
(This used to be commit 83213742dcd61ff4d30954158a5523ee0bdd850d)
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index fdc6d0d4e1..d4ad5fa1fe 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -2069,6 +2069,61 @@ static BOOL list_servers(const char *wk_grp) return True; } +/**************************************************************************** + Print or set current VUID +****************************************************************************/ + +static int cmd_vuid(void) +{ + fstring buf; + + if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) { + d_printf("Current VUID is %d\n", cli->vuid); + return 0; + } + + cli->vuid = atoi(buf); + return 0; +} + +/**************************************************************************** + Setup a new VUID, by issuing a session setup +****************************************************************************/ + +static int cmd_logon(void) +{ + pstring l_username, l_password; + fstring buf,buf2; + + if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) { + d_printf("logon <username> [<password>]\n"); + return 0; + } + + pstrcpy(l_username, buf); + + if (!next_token_nr(NULL,buf2,NULL,sizeof(buf))) { + char *pass = getpass("Password: "); + if (pass) { + pstrcpy(l_password, pass); + got_pass = 1; + } + } else { + pstrcpy(l_password, buf2); + } + + if (!cli_session_setup(cli, l_username, + l_password, strlen(l_password), + l_password, strlen(l_password), + lp_workgroup())) { + d_printf("session setup failed: %s\n", cli_errstr(cli)); + return -1; + } + + d_printf("Current VUID is %d\n", cli->vuid); + return 0; +} + /* Some constants for completing filename arguments */ #define COMPL_NONE 0 /* No completions */ @@ -2134,6 +2189,8 @@ static struct {"tar",cmd_tar,"tar <c|x>[IXFqbgNan] current directory to/from <file name>",{COMPL_NONE,COMPL_NONE}}, {"tarmode",cmd_tarmode,"<full|inc|reset|noreset> tar's behaviour towards archive bits",{COMPL_NONE,COMPL_NONE}}, {"translate",cmd_translate,"toggle text translation for printing",{COMPL_NONE,COMPL_NONE}}, + {"vuid",cmd_vuid,"change current vuid",{COMPL_NONE,COMPL_NONE}}, + {"logon",cmd_logon,"establish new logon",{COMPL_NONE,COMPL_NONE}}, /* Yes, this must be here, see crh's comment above. */ {"!",NULL,"run a shell command on the local system",{COMPL_NONE,COMPL_NONE}}, @@ -2615,7 +2672,6 @@ static struct cli_state *do_connect(const char *server, const char *share) DEBUG(1,("OS=[%s] Server=[%s]\n", c->server_os,c->server_type)); } - DEBUG(4,(" session setup ok\n")); if (!cli_send_tconX(c, sharename, "?????", |