1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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
This commit is contained in:
Andreas Schneider 2021-03-22 18:11:33 +01:00 committed by Andrew Bartlett
parent aa34799600
commit bf1c294adb

View File

@ -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);
}
/**