Loading changes/bug1954_loadlib 0 → 100644 +4 −0 Original line number Diff line number Diff line o Major bugfixes - Always search the windows system directory for system DLLs, and nowhere else. Fixes bug 1954. src/common/util.c +15 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <io.h> #include <direct.h> #include <process.h> #include <tchar.h> #else #include <dirent.h> #include <pwd.h> Loading Loading @@ -2862,3 +2863,17 @@ write_pidfile(char *filename) } } #ifdef MS_WINDOWS HANDLE load_windows_system_library(const TCHAR *library_name) { TCHAR path[MAX_PATH]; unsigned n; n = GetSystemDirectory(path, MAX_PATH); if (n == 0 || n + _tcslen(library_name) + 2 >= MAX_PATH) return 0; _tcscat(path, TEXT("\\")); _tcscat(path, library_name); return LoadLibrary(path); } #endif src/common/util.h +4 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,10 @@ void start_daemon(void); void finish_daemon(const char *desired_cwd); void write_pidfile(char *filename); #ifdef MS_WINDOWS HANDLE load_windows_system_library(const TCHAR *library_name); #endif const char *libor_get_digests(void); #endif Loading src/or/eventdns.c +1 −2 Original line number Diff line number Diff line Loading @@ -3131,8 +3131,7 @@ load_nameservers_with_getnetworkparams(void) IP_ADDR_STRING *ns; GetNetworkParams_fn_t fn; /* XXXX Possibly, we should hardcode the location of this DLL. */ if (!(handle = LoadLibrary(TEXT("iphlpapi.dll")))) { if (!(handle = load_windows_system_library(TEXT("iphlpapi.dll")))) { log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll"); /* right now status = 0, doesn't that mean "good" - mikec */ status = -1; Loading src/or/ntmain.c +1 −2 Original line number Diff line number Diff line Loading @@ -138,8 +138,7 @@ nt_service_loadlibrary(void) if (service_fns.loaded) return; /* XXXX Possibly, we should hardcode the location of this DLL. */ if (!(library = LoadLibrary(TEXT("advapi32.dll")))) { if (!(library = load_windows_system_library(TEXT("advapi32.dll")))) { log_err(LD_GENERAL, "Couldn't open advapi32.dll. Are you trying to use " "NT services on Windows 98? That doesn't work."); goto err; Loading Loading
changes/bug1954_loadlib 0 → 100644 +4 −0 Original line number Diff line number Diff line o Major bugfixes - Always search the windows system directory for system DLLs, and nowhere else. Fixes bug 1954.
src/common/util.c +15 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <io.h> #include <direct.h> #include <process.h> #include <tchar.h> #else #include <dirent.h> #include <pwd.h> Loading Loading @@ -2862,3 +2863,17 @@ write_pidfile(char *filename) } } #ifdef MS_WINDOWS HANDLE load_windows_system_library(const TCHAR *library_name) { TCHAR path[MAX_PATH]; unsigned n; n = GetSystemDirectory(path, MAX_PATH); if (n == 0 || n + _tcslen(library_name) + 2 >= MAX_PATH) return 0; _tcscat(path, TEXT("\\")); _tcscat(path, library_name); return LoadLibrary(path); } #endif
src/common/util.h +4 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,10 @@ void start_daemon(void); void finish_daemon(const char *desired_cwd); void write_pidfile(char *filename); #ifdef MS_WINDOWS HANDLE load_windows_system_library(const TCHAR *library_name); #endif const char *libor_get_digests(void); #endif Loading
src/or/eventdns.c +1 −2 Original line number Diff line number Diff line Loading @@ -3131,8 +3131,7 @@ load_nameservers_with_getnetworkparams(void) IP_ADDR_STRING *ns; GetNetworkParams_fn_t fn; /* XXXX Possibly, we should hardcode the location of this DLL. */ if (!(handle = LoadLibrary(TEXT("iphlpapi.dll")))) { if (!(handle = load_windows_system_library(TEXT("iphlpapi.dll")))) { log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll"); /* right now status = 0, doesn't that mean "good" - mikec */ status = -1; Loading
src/or/ntmain.c +1 −2 Original line number Diff line number Diff line Loading @@ -138,8 +138,7 @@ nt_service_loadlibrary(void) if (service_fns.loaded) return; /* XXXX Possibly, we should hardcode the location of this DLL. */ if (!(library = LoadLibrary(TEXT("advapi32.dll")))) { if (!(library = load_windows_system_library(TEXT("advapi32.dll")))) { log_err(LD_GENERAL, "Couldn't open advapi32.dll. Are you trying to use " "NT services on Windows 98? That doesn't work."); goto err; Loading