x509_get_default_name tries to get FQDN before hostname now.
This commit is contained in:
parent
1abd652530
commit
d557690426
@ -306,9 +306,25 @@ char* x509_name_parse(char* name, char* txt, int* length)
|
||||
|
||||
char* x509_get_default_name()
|
||||
{
|
||||
CHAR* computerName;
|
||||
CHAR* computerName = NULL;
|
||||
DWORD nSize = 0;
|
||||
|
||||
if (GetComputerNameExA(ComputerNamePhysicalDnsFullyQualified, NULL, &nSize) ||
|
||||
GetLastError() != ERROR_MORE_DATA)
|
||||
goto fallback;
|
||||
|
||||
computerName = (CHAR*)calloc(nSize, 1);
|
||||
if (!computerName)
|
||||
goto fallback;
|
||||
|
||||
if (!GetComputerNameExA(ComputerNamePhysicalDnsFullyQualified, computerName, &nSize))
|
||||
goto fallback;
|
||||
|
||||
return computerName;
|
||||
|
||||
fallback:
|
||||
free(computerName);
|
||||
|
||||
if (GetComputerNameExA(ComputerNamePhysicalNetBIOS, NULL, &nSize) ||
|
||||
GetLastError() != ERROR_MORE_DATA)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user