summaryrefslogtreecommitdiff
path: root/source4/libcli/cliconnect.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-03-21 23:35:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:09 -0500
commit13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a (patch)
tree8eddfcb0dd18a9cee4c1de4fbd3ee98f05cd27e6 /source4/libcli/cliconnect.c
parent05bc2d7b2c11a3583a6d1221cfbd618eb6730518 (diff)
downloadsamba-13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a.tar.gz
samba-13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a.tar.bz2
samba-13b0776f60f6a0f35a4afc2b3d3c6b5ec9c1ca6a.zip
r5929: Use cli_credentials for the SMB functions as well.
Fix a couple of bugs in the new cli_credentials code (This used to be commit 4ad481cfe5cde514d2ef9646147239f3faaa6173)
Diffstat (limited to 'source4/libcli/cliconnect.c')
-rw-r--r--source4/libcli/cliconnect.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index f391b6bc0d..3834d49e49 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -63,9 +63,7 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli)
/* wrapper around smb_raw_session_setup() */
NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
- const char *user,
- const char *password,
- const char *domain)
+ struct cli_credentials *credentials)
{
struct smb_composite_sesssetup setup;
NTSTATUS status;
@@ -79,19 +77,19 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
- if (!user || !user[0]) {
+ if (cli_credentials_is_anonymous(credentials)) {
setup.in.password = NULL;
setup.in.user = "";
setup.in.domain = "";
setup.in.capabilities &= ~CAP_EXTENDED_SECURITY;
} else {
if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) {
- setup.in.password = password;
+ setup.in.password = cli_credentials_get_password(credentials);
} else {
setup.in.password = NULL;
}
- setup.in.user = user;
- setup.in.domain = domain;
+ setup.in.user = cli_credentials_get_username(credentials);
+ setup.in.domain = cli_credentials_get_domain(credentials);
}
status = smb_composite_sesssetup(cli->session, &setup);
@@ -155,29 +153,19 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
const char *host,
const char *sharename,
const char *devtype,
- const char *username,
- const char *domain,
- const char *password)
+ struct cli_credentials *credentials)
{
struct smbcli_tree *tree;
NTSTATUS status;
- char *p;
TALLOC_CTX *mem_ctx;
mem_ctx = talloc_init("smbcli_full_connection");
*ret_cli = NULL;
- /* if the username is of the form DOMAIN\username then split out the domain */
- p = strpbrk(username, "\\/");
- if (p) {
- domain = talloc_strndup(mem_ctx, username, PTR_DIFF(p, username));
- username = talloc_strdup(mem_ctx, p+1);
- }
-
status = smbcli_tree_full_connection(parent_ctx,
&tree, myname, host, 0, sharename, devtype,
- username, domain, password);
+ credentials);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}