summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2021-03-22 18:11:33 +0100
committerAndrew Bartlett <abartlet@samba.org>2021-03-24 03:13:05 +0000
commitbf1c294adb7ef623d0da1dd9b43d3b3fab58fa26 (patch)
tree34a3697138745d18e0c8ba8a3ccd175721e765d2 /auth
parentaa34799600bc95758d01bc9d7b3dd58f251d71ad (diff)
downloadsamba-bf1c294adb7ef623d0da1dd9b43d3b3fab58fa26.tar.gz
auth:creds: Free the uname pointer in cli_credentials_parse_string()
The data is duplicated and we don't need it anymore. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Mar 24 03:13:05 UTC 2021 on sn-devel-184
Diffstat (limited to 'auth')
-rw-r--r--auth/credentials/credentials.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index 6596a227bee..d851951c9ed 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -824,6 +824,7 @@ bool cli_credentials_set_workstation_callback(struct cli_credentials *cred,
_PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials, const char *data, enum credentials_obtained obtained)
{
char *uname, *p;
+ char *uname_free = NULL;
if (strcmp("%",data) == 0) {
cli_credentials_set_anonymous(credentials);
@@ -831,6 +832,8 @@ _PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials,
}
uname = talloc_strdup(credentials, data);
+ uname_free = uname;
+
if ((p = strchr_m(uname,'%'))) {
*p = 0;
cli_credentials_set_password(credentials, p+1, obtained);
@@ -848,6 +851,7 @@ _PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials,
cli_credentials_set_principal(credentials, uname, obtained);
*p = 0;
cli_credentials_set_realm(credentials, p+1, obtained);
+ TALLOC_FREE(uname_free);
return;
} else if ((p = strchr_m(uname,'\\'))
|| (p = strchr_m(uname, '/'))
@@ -889,6 +893,8 @@ _PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials,
credentials->principal = NULL;
}
cli_credentials_set_username(credentials, uname, obtained);
+
+ TALLOC_FREE(uname_free);
}
/**