summaryrefslogtreecommitdiff
path: root/source4/client
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-03-21 02:08:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:08 -0500
commit02075be0bbc2095073f8898350fded64a7c97c79 (patch)
tree28ea2820f79dfc766b745515848c840bf98b2a88 /source4/client
parent105660d3f9b537fa47fe6e33c0418a1d8f85e0e9 (diff)
downloadsamba-02075be0bbc2095073f8898350fded64a7c97c79.tar.gz
samba-02075be0bbc2095073f8898350fded64a7c97c79.tar.bz2
samba-02075be0bbc2095073f8898350fded64a7c97c79.zip
r5917: First step in using the new cli_credentials structure. This patch
puts support for it into popt_common, adds a few utility functions (in lib/credentials.c) and the callback functions for the command-line (lib/cmdline/credentials.c). Comments are welcome :-) (This used to be commit 1d49b57c50fe8c2683ea23e9df41ce8ad774db98)
Diffstat (limited to 'source4/client')
-rw-r--r--source4/client/client.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index 0ebebf747e..fd5be73607 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -45,9 +45,6 @@ pstring cur_dir = "\\";
static pstring cd_path = "";
static pstring service;
static pstring desthost;
-static pstring username;
-static pstring domain;
-static pstring password;
static char *cmdstr = NULL;
static int io_bufsize = 64512;
@@ -103,7 +100,7 @@ static double dir_total;
#define USENMB
/* some forward declarations */
-static struct smbcli_state *do_connect(const char *server, const char *share);
+static struct smbcli_state *do_connect(const char *server, const char *share, struct cli_credentials *cred);
/*******************************************************************
@@ -202,7 +199,7 @@ static void send_message(void)
int total_len = 0;
int grp_id;
- if (!smbcli_message_start(cli->tree, desthost, username, &grp_id)) {
+ if (!smbcli_message_start(cli->tree, desthost, cli_credentials_get_username(cmdline_credentials), &grp_id)) {
d_printf("message start: %s\n", smbcli_errstr(cli->tree));
return;
}
@@ -2559,8 +2556,9 @@ static BOOL browse_host(const char *query_host)
DCERPC_SRVSVC_UUID,
DCERPC_SRVSVC_VERSION,
lp_netbios_name(),
- domain,
- username, password);
+ cli_credentials_get_domain(cmdline_credentials),
+ cli_credentials_get_username(cmdline_credentials),
+ cli_credentials_get_password(cmdline_credentials));
if (!NT_STATUS_IS_OK(status)) {
d_printf("Failed to connect to %s - %s\n",
binding, nt_errstr(status));
@@ -2753,7 +2751,7 @@ static int process_command_string(char *cmd)
/* establish the connection if not already */
if (!cli) {
- cli = do_connect(desthost, service);
+ cli = do_connect(desthost, service, cmdline_credentials);
if (!cli)
return 0;
}
@@ -3039,7 +3037,7 @@ static void process_stdin(void)
/*****************************************************
return a connection to a server
*******************************************************/
-static struct smbcli_state *do_connect(const char *server, const char *share)
+static struct smbcli_state *do_connect(const char *server, const char *share, struct cli_credentials *cred)
{
struct smbcli_state *c;
NTSTATUS status;
@@ -3050,7 +3048,9 @@ static struct smbcli_state *do_connect(const char *server, const char *share)
}
status = smbcli_full_connection(NULL, &c, lp_netbios_name(), server,
- share, NULL, username, domain, password);
+ share, NULL, cli_credentials_get_username(cred),
+ cli_credentials_get_domain(cred),
+ cli_credentials_get_password(cred));
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
server, share, nt_errstr(status));
@@ -3068,7 +3068,7 @@ static int process(char *base_directory)
{
int rc = 0;
- cli = do_connect(desthost, service);
+ cli = do_connect(desthost, service, cmdline_credentials);
if (!cli) {
return 1;
}
@@ -3261,7 +3261,7 @@ static void remember_query_host(const char *arg,
}
if (poptPeekArg(pc)) {
- cmdline_set_userpassword(poptGetArg(pc));
+ cli_credentials_set_password(cmdline_credentials, poptGetArg(pc), CRED_SPECIFIED);
}
/*init_names(); */
@@ -3273,10 +3273,6 @@ static void remember_query_host(const char *arg,
poptFreeContext(pc);
- pstrcpy(username, cmdline_get_username());
- pstrcpy(domain, cmdline_get_userdomain());
- pstrcpy(password, cmdline_get_userpassword());
-
DEBUG( 3, ( "Client started (version %s).\n", SAMBA_VERSION_STRING ) );
talloc_free(mem_ctx);