Fixed issue with starting sshd in debug mode with a "./" (./sshd.exe -d)
PowerShell/Win32-OpenSSH#1045
This commit is contained in:
parent
df28da5586
commit
fcead5ed76
|
@ -1460,6 +1460,9 @@ int
|
||||||
is_absolute_path(char *path)
|
is_absolute_path(char *path)
|
||||||
{
|
{
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
|
if(*path == '\"') /* skip double quote if path is "c:\abc" */
|
||||||
|
path++;
|
||||||
|
|
||||||
if (*path == '/' || *path == '\\' || (*path != '\0' && isalpha(*path) && path[1] == ':') ||
|
if (*path == '/' || *path == '\\' || (*path != '\0' && isalpha(*path) && path[1] == ':') ||
|
||||||
((strlen(path) >= strlen(PROGRAM_DATA)) && (memcmp(path, PROGRAM_DATA, strlen(PROGRAM_DATA)) == 0)))
|
((strlen(path) >= strlen(PROGRAM_DATA)) && (memcmp(path, PROGRAM_DATA, strlen(PROGRAM_DATA)) == 0)))
|
||||||
retVal = 1;
|
retVal = 1;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "inc\fcntl.h"
|
#include "inc\fcntl.h"
|
||||||
#include "inc\sys\un.h"
|
#include "inc\sys\un.h"
|
||||||
#include "inc\utf.h"
|
#include "inc\utf.h"
|
||||||
|
#include "inc\stdio.h"
|
||||||
|
|
||||||
#include "w32fd.h"
|
#include "w32fd.h"
|
||||||
#include "signal_internal.h"
|
#include "signal_internal.h"
|
||||||
|
@ -953,16 +954,14 @@ spawn_child_internal(char* cmd, char *const argv[], HANDLE in, HANDLE out, HANDL
|
||||||
int add_module_path = 0, ret = -1;
|
int add_module_path = 0, ret = -1;
|
||||||
|
|
||||||
/* should module path be added */
|
/* should module path be added */
|
||||||
do {
|
if (!cmd) {
|
||||||
if (!cmd)
|
error("%s invalid argument cmd:%s", __func__, cmd);
|
||||||
break;
|
return -1;
|
||||||
t = cmd;
|
}
|
||||||
if (*t == '\"')
|
|
||||||
t++;
|
t = cmd;
|
||||||
if (t[0] == '\0' || t[0] == '\\' || t[0] == '.' || t[1] == ':')
|
if (!is_absolute_path(t))
|
||||||
break;
|
|
||||||
add_module_path = 1;
|
add_module_path = 1;
|
||||||
} while (0);
|
|
||||||
|
|
||||||
/* compute total cmdline len*/
|
/* compute total cmdline len*/
|
||||||
if (add_module_path)
|
if (add_module_path)
|
||||||
|
|
Loading…
Reference in New Issue