Skip to content

Commit c174b10

Browse files
committed
Setting module directory as working directory of sshd deamon and forked processes
Doing so will allow sshd.exe to be launched from any directory - thereby enabling sshd to be launched from SCM. With this change - following works: - sshd.exe install - net start sshd - net stop sshd - sshd.exe uninstall
1 parent 264509c commit c174b10

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

sshd.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ FIXME: GFPZR: Function stat() may be undeclared.
192192
#include <tlhelp32.h>
193193

194194
char *fake_fork_args;
195-
char *start_dir;
196195

197196
extern int logfd;
198197
extern int sfd_start;
@@ -1727,7 +1726,7 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
17271726
*/
17281727

17291728
b = CreateProcess(NULL, fake_fork_args, NULL, NULL, TRUE,
1730-
CREATE_NEW_PROCESS_GROUP, NULL, start_dir,
1729+
CREATE_NEW_PROCESS_GROUP, NULL, NULL,
17311730
&si, &pi);
17321731
if (!b)
17331732
{
@@ -2013,14 +2012,6 @@ main(int ac, char **av)
20132012

20142013
fake_fork_args = create_fake_fork_args(ac, av);
20152014

2016-
{
2017-
int start_dir_len = GetCurrentDirectory(0, NULL);
2018-
2019-
start_dir = xmalloc(start_dir_len + 1);
2020-
2021-
GetCurrentDirectory(start_dir_len, start_dir);
2022-
}
2023-
20242015
#endif /* WIN32_FIXME */
20252016

20262017
#ifndef HAVE_SETPROCTITLE
@@ -2316,6 +2307,10 @@ main(int ac, char **av)
23162307

23172308
if (GetCurrentModulePath(basePath, PATH_SIZE) == 0)
23182309
{
2310+
2311+
#ifdef WIN32_FIXME
2312+
chdir(basePath);
2313+
#endif
23192314
/*
23202315
* Try './sshd_config' first.
23212316
*/

0 commit comments

Comments
 (0)