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:
parent
aa34799600
commit
bf1c294adb
@ -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)
|
_PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials, const char *data, enum credentials_obtained obtained)
|
||||||
{
|
{
|
||||||
char *uname, *p;
|
char *uname, *p;
|
||||||
|
char *uname_free = NULL;
|
||||||
|
|
||||||
if (strcmp("%",data) == 0) {
|
if (strcmp("%",data) == 0) {
|
||||||
cli_credentials_set_anonymous(credentials);
|
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 = talloc_strdup(credentials, data);
|
||||||
|
uname_free = uname;
|
||||||
|
|
||||||
if ((p = strchr_m(uname,'%'))) {
|
if ((p = strchr_m(uname,'%'))) {
|
||||||
*p = 0;
|
*p = 0;
|
||||||
cli_credentials_set_password(credentials, p+1, obtained);
|
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);
|
cli_credentials_set_principal(credentials, uname, obtained);
|
||||||
*p = 0;
|
*p = 0;
|
||||||
cli_credentials_set_realm(credentials, p+1, obtained);
|
cli_credentials_set_realm(credentials, p+1, obtained);
|
||||||
|
TALLOC_FREE(uname_free);
|
||||||
return;
|
return;
|
||||||
} else if ((p = strchr_m(uname,'\\'))
|
} else if ((p = strchr_m(uname,'\\'))
|
||||||
|| (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;
|
credentials->principal = NULL;
|
||||||
}
|
}
|
||||||
cli_credentials_set_username(credentials, uname, obtained);
|
cli_credentials_set_username(credentials, uname, obtained);
|
||||||
|
|
||||||
|
TALLOC_FREE(uname_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user