mirror of https://github.com/FreeRDP/FreeRDP
Replaced getlogin with getlogin_r
This commit is contained in:
parent
240fdd07b1
commit
36478d3d0b
|
@ -598,7 +598,10 @@ static BOOL isAutomountLocation(const char* path)
|
|||
size_t x;
|
||||
char buffer[MAX_PATH];
|
||||
uid_t uid = getuid();
|
||||
const char* uname = getlogin();
|
||||
const char uname[MAX_PATH] = { 0 };
|
||||
|
||||
if (getlogin_r(uname, sizeof(uname)) != 0)
|
||||
return FALSE;
|
||||
|
||||
if (!path)
|
||||
return FALSE;
|
||||
|
|
|
@ -1181,9 +1181,9 @@ static BOOL xf_pre_connect(freerdp* instance)
|
|||
|
||||
if (!settings->Username && !settings->CredentialsFromStdin && !settings->SmartcardLogon)
|
||||
{
|
||||
char* login_name = getlogin();
|
||||
char login_name[MAX_PATH] = { 0 };
|
||||
|
||||
if (login_name)
|
||||
if (getlogin_r(login_name, sizeof(login_name)) == 0)
|
||||
{
|
||||
settings->Username = _strdup(login_name);
|
||||
|
||||
|
|
|
@ -201,18 +201,19 @@ BOOL LogonUserExW(LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword
|
|||
BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize)
|
||||
{
|
||||
size_t length;
|
||||
char* login;
|
||||
char login[MAX_PATH];
|
||||
|
||||
switch (NameFormat)
|
||||
{
|
||||
case NameSamCompatible:
|
||||
login = getlogin();
|
||||
if (getlogin_r(login, sizeof(login)) != 0)
|
||||
return FALSE;
|
||||
length = strlen(login);
|
||||
|
||||
if (*nSize >= length)
|
||||
{
|
||||
CopyMemory(lpNameBuffer, login, length + 1);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -235,7 +236,7 @@ BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG
|
|||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL GetUserNameExW(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
|
||||
|
|
Loading…
Reference in New Issue