]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Some WIN32 enhancements on WIN32 GetOSVersion code by Guido
authorhno <>
Sat, 17 Nov 2001 18:09:24 +0000 (18:09 +0000)
committerhno <>
Sat, 17 Nov 2001 18:09:24 +0000 (18:09 +0000)
src/defines.h
src/dns_internal.cc
src/enums.h
src/tools.cc
src/win32.cc

index aed24d92288c3f39d67254162526c178ace58f89..1edba7ace897932eab5307f06ed43f25646bc700 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.96 2001/10/08 16:55:25 hno Exp $
+ * $Id: defines.h,v 1.97 2001/11/17 11:09:24 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
 #define O_BINARY 0
 #endif
 
-/* CygWin & Windows NT Port */
-#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
-#define _WIN_OS_UNKNOWN        0
-#define _WIN_OS_WIN32S 1
-#define _WIN_OS_WIN95  2
-#define _WIN_OS_WIN98  3
-#define _WIN_OS_WINNT  4
-#define _WIN_OS_WIN2K  5
-#define _WIN_OS_WINXP  6
-#endif
-
 #endif /* SQUID_DEFINES_H */
index 91a74ce8b663b4e5aa90db7bc2257b41161c61fe..bdd897698e17fd652a490198bcfbaa8e88a26e07 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns_internal.cc,v 1.44 2001/10/24 07:45:34 hno Exp $
+ * $Id: dns_internal.cc,v 1.45 2001/11/17 11:09:24 hno Exp $
  *
  * DEBUG: section 78    DNS lookups; interacts with lib/rfc1035.c
  * AUTHOR: Duane Wessels
@@ -289,6 +289,7 @@ idnsParseWIN32Registry(void)
        break;
     case _WIN_OS_WIN95:
     case _WIN_OS_WIN98:
+    case _WIN_OS_WINME:
        /* get nameservers from the Windows 9X registry */
        if (RegOpenKey(HKEY_LOCAL_MACHINE,
                "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP",
index 6729acacfc7089b7b442e156664a17f7da81d026..fe1a80be796890ad669f7ff8baca654565307938 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.200 2001/11/16 17:02:20 hno Exp $
+ * $Id: enums.h,v 1.201 2001/11/17 11:09:24 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -729,4 +729,22 @@ enum {
     VARY_CANCEL
 };
 
+/* CygWin & Windows NT Port */
+#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
+/*
+ * Supported Windows OS types codes
+ */
+enum {
+    _WIN_OS_UNKNOWN,
+    _WIN_OS_WIN32S,
+    _WIN_OS_WIN95,
+    _WIN_OS_WIN98,
+    _WIN_OS_WINME,
+    _WIN_OS_WINNT,
+    _WIN_OS_WIN2K,
+    _WIN_OS_WINXP
+};
+
+#endif
+
 #endif /* SQUID_ENUMS_H */
index 4885139a05af0e90a12d950c8618d5feb88793c1..6106f79427d1a50eed365bd12493172b81707bd8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.212 2001/11/15 15:01:37 hno Exp $
+ * $Id: tools.cc,v 1.213 2001/11/17 11:09:25 hno Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -513,7 +513,7 @@ safeunlink(const char *s, int quiet)
 void
 leave_suid(void)
 {
-    debug(21, 3) ("leave_suid: PID %d called\n", (int)getpid());
+    debug(21, 3) ("leave_suid: PID %d called\n", (int) getpid());
     if (geteuid() != 0)
        return;
     /* Started as a root, check suid option */
@@ -525,7 +525,7 @@ leave_suid(void)
     if (setgid(Config2.effectiveGroupID) < 0)
        debug(50, 0) ("ALERT: setgid: %s\n", xstrerror());
     debug(21, 3) ("leave_suid: PID %d giving up root, becoming '%s'\n",
-       (int)getpid(), Config.effectiveUser);
+       (int) getpid(), Config.effectiveUser);
 #if HAVE_SETRESUID
     if (setresuid(Config2.effectiveUserID, Config2.effectiveUserID, 0) < 0)
        debug(50, 0) ("ALERT: setresuid: %s\n", xstrerror());
@@ -542,7 +542,7 @@ leave_suid(void)
 void
 enter_suid(void)
 {
-    debug(21, 3) ("enter_suid: PID %d taking root priveleges\n", (int)getpid());
+    debug(21, 3) ("enter_suid: PID %d taking root priveleges\n", (int) getpid());
 #if HAVE_SETRESUID
     setresuid(-1, 0, -1);
 #else
@@ -559,7 +559,7 @@ no_suid(void)
     uid_t uid;
     leave_suid();
     uid = geteuid();
-    debug(21, 3) ("leave_suid: PID %d giving up root priveleges forever\n", (int)getpid());
+    debug(21, 3) ("leave_suid: PID %d giving up root priveleges forever\n", (int) getpid());
 #if HAVE_SETRESUID
     if (setresuid(uid, uid, uid) < 0)
        debug(50, 1) ("no_suid: setresuid: %s\n", xstrerror());
@@ -1019,7 +1019,7 @@ parseEtcHosts(void)
            lt = nt + 1;
        }
        fqdncacheAddEntryFromHosts(addr, hosts);
-skip:
+      skip:
        wordlistDestroy(&hosts);
     }
 }
index fa5a8f90003549786a0c4f5979b14aeaf22d3856..4faa5ee5072d76e1b38bff6d67c6a1d27b15334e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: win32.cc,v 1.3 2001/10/19 22:34:49 hno Exp $
+ * $Id: win32.cc,v 1.4 2001/11/17 11:09:25 hno Exp $
  *
  * * * * * * * * Legal stuff * * * * * * *
  *
@@ -49,30 +49,37 @@ GetOSVersion()
            WIN32_OS_string = xstrdup("Windows NT");
            return _WIN_OS_WINNT;
        }
+       if ((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion == 0)) {
+           WIN32_OS_string = xstrdup("Windows 2000");
+           return _WIN_OS_WIN2K;
+       }
        if ((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion == 1)) {
            WIN32_OS_string = xstrdup("Windows XP");
            return _WIN_OS_WINXP;
        }
-       WIN32_OS_string = xstrdup("Windows 2000");
-       return _WIN_OS_WIN2K;
        break;
     case VER_PLATFORM_WIN32_WINDOWS:
-       if ((osvi.dwMajorVersion > 4) ||
-           ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0))) {
+       if ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion == 0)) {
+           WIN32_OS_string = xstrdup("Windows 95");
+           return _WIN_OS_WIN95;
+       }
+       if ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion == 10)) {
            WIN32_OS_string = xstrdup("Windows 98");
            return _WIN_OS_WIN98;
        }
-       WIN32_OS_string = xstrdup("Windows 95");
-       return _WIN_OS_WIN95;
+       if ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion == 90)) {
+           WIN32_OS_string = xstrdup("Windows Me");
+           return _WIN_OS_WINME;
+       }
        break;
     case VER_PLATFORM_WIN32s:
        WIN32_OS_string = xstrdup("Windows 3.1 with WIN32S");
        return _WIN_OS_WIN32S;
        break;
     default:
-       return _WIN_OS_UNKNOWN;
+       break;
     }
-    WIN32_OS_string = xstrdup("Unknown");
+    WIN32_OS_string = xstrdup("Unknown Windows system");
     return _WIN_OS_UNKNOWN;
 }