https://git.reactos.org/?p=reactos.git;a=commitdiff;h=214a9cb660b375c4629b1…
commit 214a9cb660b375c4629b1e6816686308f34dd6f5
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Feb 14 02:03:35 2020 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Feb 13 18:03:35 2020 +0100
[NFSD][TELNETD][LIBTIRPC][MAN] Don't hardcode C:\ReactOS (#2334)
CORE-14747
---
base/services/nfsd/idmap.c | 4 +++-
base/services/nfsd/nfs41_daemon.c | 3 ++-
base/services/telnetd/telnetd.c | 2 +-
dll/3rdparty/libtirpc/src/wintirpc.c | 9 +++++++++
dll/3rdparty/libtirpc/tirpc/netconfig.h | 5 +++++
modules/rosapps/applications/sysutils/man/man.cmd | 2 +-
6 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/base/services/nfsd/idmap.c b/base/services/nfsd/idmap.c
index 18f44b94278..838d4cfc95b 100644
--- a/base/services/nfsd/idmap.c
+++ b/base/services/nfsd/idmap.c
@@ -381,7 +381,9 @@ static int config_init(
}
else
{
- StringCchCopyA(config_path, ARRAYSIZE(config_path),
"C:\\ReactOS\\system32\\drivers\\etc\\ms-nfs41-idmap.conf");
+ status = GetLastError();
+ eprintf("GetSystemDirectoryA failed with %ld\n", GetLastError());
+ goto out;
}
#endif
diff --git a/base/services/nfsd/nfs41_daemon.c b/base/services/nfsd/nfs41_daemon.c
index 1a8f2dfbbe2..73b54d31d59 100644
--- a/base/services/nfsd/nfs41_daemon.c
+++ b/base/services/nfsd/nfs41_daemon.c
@@ -177,7 +177,8 @@ static bool_t check_for_files()
}
else
{
- StringCchCopyA(config_path, ARRAYSIZE(config_path),
"C:\\ReactOS\\system32\\drivers\\etc\\netconfig");
+ eprintf("GetSystemDirectoryA failed with error %ld\n",
GetLastError());
+ return FALSE;
}
fd = fopen(config_path, "r");
diff --git a/base/services/telnetd/telnetd.c b/base/services/telnetd/telnetd.c
index 927d2862ade..180cce5dce4 100644
--- a/base/services/telnetd/telnetd.c
+++ b/base/services/telnetd/telnetd.c
@@ -377,7 +377,7 @@ static void RunShell(client_t *client)
}
else
{
- StringCchCopyA(cmd_path, ARRAYSIZE(cmd_path),
"C:\\ReactOS\\system32\\cmd.exe");
+ ErrorExit("GetSystemDirectoryA failed\n");
}
}
diff --git a/dll/3rdparty/libtirpc/src/wintirpc.c b/dll/3rdparty/libtirpc/src/wintirpc.c
index 98d327f461e..a7845fa1d55 100644
--- a/dll/3rdparty/libtirpc/src/wintirpc.c
+++ b/dll/3rdparty/libtirpc/src/wintirpc.c
@@ -93,6 +93,9 @@ BOOL winsock_fini(void)
return TRUE;
}
+#ifdef __REACTOS__
+char NETCONFIG[MAX_PATH] = "";
+#endif
BOOL WINAPI DllMain/*tirpc_main*/(HINSTANCE hinstDLL, // DLL module handle
DWORD fdwReason, // reason called
LPVOID lpvReserved) // reserved
@@ -109,6 +112,12 @@ BOOL WINAPI DllMain/*tirpc_main*/(HINSTANCE hinstDLL, // DLL module
handle
// The DLL is loading due to process
// initialization or a call to LoadLibrary.
case DLL_PROCESS_ATTACH:
+#ifdef __REACTOS__
+ if (!GetSystemDirectoryA(NETCONFIG, ARRAYSIZE(NETCONFIG)))
+ return FALSE;
+
+ lstrcatA(NETCONFIG, "\\drivers\\etc\\netconfig");
+#endif
// Initialize socket library
if (winsock_init() == FALSE)
diff --git a/dll/3rdparty/libtirpc/tirpc/netconfig.h
b/dll/3rdparty/libtirpc/tirpc/netconfig.h
index 8461a6b0621..21f2820ae29 100644
--- a/dll/3rdparty/libtirpc/tirpc/netconfig.h
+++ b/dll/3rdparty/libtirpc/tirpc/netconfig.h
@@ -3,8 +3,13 @@
//#include <features.h>
+#ifdef __REACTOS__
+ #undef NETCONFIG
+ extern char NETCONFIG[];
+#else
// XXX Should be in, or come from, the registry!!!
#define NETCONFIG "C:\\ReactOS\\System32\\drivers\\etc\\netconfig"
+#endif
#define NETPATH "NETPATH"
struct netconfig {
diff --git a/modules/rosapps/applications/sysutils/man/man.cmd
b/modules/rosapps/applications/sysutils/man/man.cmd
index 1533a49d32d..5790656e9aa 100755
--- a/modules/rosapps/applications/sysutils/man/man.cmd
+++ b/modules/rosapps/applications/sysutils/man/man.cmd
@@ -13,7 +13,7 @@ rem []------------------------------------[]
rem []==[Config area]==[]
set MANED=edit
set MANMORE=cat
-set MAN=c:\ReactOS\man
+set MAN=%WINDIR%\man
rem []==[End of config area]==[]
goto chk_param