summaryrefslogtreecommitdiff
path: root/source3/libsmb/cliconnect.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-03-09 09:53:42 +0100
committerJeremy Allison <jra@samba.org>2013-04-11 14:25:49 -0700
commite2e0449a587ed98b67bfc7382fa1f46347987ce7 (patch)
tree8ca718c89c68b34ff24218b72538c956baccf181 /source3/libsmb/cliconnect.c
parent0008d9e1c5151fe841b11651e7bb62c1feb93769 (diff)
downloadsamba-e2e0449a587ed98b67bfc7382fa1f46347987ce7.tar.gz
libsmbclient: Factor out cli_session_setup_get_account
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libsmb/cliconnect.c')
-rw-r--r--source3/libsmb/cliconnect.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 253cc70154e..212cc3e0a7a 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1902,6 +1902,22 @@ static char *cli_session_setup_get_principal(
}
#endif
+static char *cli_session_setup_get_account(TALLOC_CTX *mem_ctx,
+ const char *principal)
+{
+ char *account, *p;
+
+ account = talloc_strdup(mem_ctx, principal);
+ if (account == NULL) {
+ return NULL;
+ }
+ p = strchr_m(account, '@');
+ if (p != NULL) {
+ *p = '\0';
+ }
+ return account;
+}
+
/****************************************************************************
Do a spnego encrypted session setup.
@@ -1919,7 +1935,6 @@ static ADS_STATUS cli_session_setup_spnego(struct cli_state *cli,
char *OIDs[ASN1_MAX_OIDS];
int i;
const DATA_BLOB *server_blob;
- char *p;
char *account = NULL;
NTSTATUS status;
@@ -2012,18 +2027,11 @@ static ADS_STATUS cli_session_setup_spnego(struct cli_state *cli,
ntlmssp:
- account = talloc_strdup(talloc_tos(), user);
+ account = cli_session_setup_get_account(talloc_tos(), user);
if (!account) {
return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
}
- /* when falling back to ntlmssp while authenticating with a machine
- * account strip off the realm - gd */
-
- if ((p = strchr_m(account, '@')) != NULL) {
- *p = '\0';
- }
-
status = cli_session_setup_ntlmssp(cli, account, pass, user_domain);
TALLOC_FREE(account);
return ADS_ERROR_NT(status);