commit 66f944f79b9ae0d7383f9bf55c8d8cd4bdacf216 Merge: 155b0f552 2fbc58cf0 Author: teor teor@torproject.org Date: Thu Mar 14 06:53:17 2019 +1000
Merge branch 'bug28096-029-squashed' into bug28096-034-squashed
Merge the new code, and preserve the #else macro comment from 0.3.4.
changes/bug28096 | 13 ++++++++ src/common/compat.c | 95 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 77 insertions(+), 31 deletions(-)
diff --cc src/common/compat.c index 6fdd6ecf0,975875112..f8c4bdb4d --- a/src/common/compat.c +++ b/src/common/compat.c @@@ -2755,13 -2761,26 +2775,26 @@@ get_uname,(void) "Unrecognized version of Windows [major=%d,minor=%d]", (int)info.dwMajorVersion,(int)info.dwMinorVersion); } - #ifdef VER_NT_SERVER - if (info.wProductType == VER_NT_SERVER || - info.wProductType == VER_NT_DOMAIN_CONTROLLER) { - strlcat(uname_result, " [server]", sizeof(uname_result)); - } - #endif /* defined(VER_NT_SERVER) */ + /* Now append extra information to the name. + * + * Microsoft's API documentation says that on Windows 8.1 and later, + * GetVersionEx returns Windows 8 (6.2) for applications without an + * app compatibility manifest (including tor's default build). + * + * But in our testing, we have seen the actual Windows version on + * Windows Server 2012 R2, even without a manifest. */ + if (info.dwMajorVersion > 6 || + (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2)) { + /* When GetVersionEx() returns Windows 8, the actual OS may be any + * later version. */ + strlcat(uname_result, " [or later]", sizeof(uname_result)); + } + /* When we don't know if the OS is a client or server version, we use + * the client version, and this qualifier. */ + if (!is_server && !is_client) { + strlcat(uname_result, " [client or server]", sizeof(uname_result)); + } -#else +#else /* !(defined(_WIN32)) */ /* LCOV_EXCL_START -- can't provoke uname failure */ strlcpy(uname_result, "Unknown platform", sizeof(uname_result)); /* LCOV_EXCL_STOP */