[NFSD][TELNETD][LIBTIRPC][MAN] Don't hardcode C:\ReactOS (#2334)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Thu, 13 Feb 2020 17:03:35 +0000 (02:03 +0900)
committerGitHub <noreply@github.com>
Thu, 13 Feb 2020 17:03:35 +0000 (18:03 +0100)
CORE-14747

base/services/nfsd/idmap.c
base/services/nfsd/nfs41_daemon.c
base/services/telnetd/telnetd.c
dll/3rdparty/libtirpc/src/wintirpc.c
dll/3rdparty/libtirpc/tirpc/netconfig.h
modules/rosapps/applications/sysutils/man/man.cmd

index 18f44b9..838d4cf 100644 (file)
@@ -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
 
index 1a8f2df..73b54d3 100644 (file)
@@ -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");
index 927d286..180cce5 100644 (file)
@@ -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");
       }
    }
 
index 98d327f..a7845fa 100644 (file)
@@ -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)
index 8461a6b..21f2820 100644 (file)
@@ -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 {
index 1533a49..5790656 100755 (executable)
@@ -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