Improve sshd Pluggable remote console enhancements

pluggable binaries are to reside in the same directory where sshd.exe is
located
This commit is contained in:
quamrulmina 2016-02-02 02:02:56 -06:00
parent 9f47848ee6
commit f3c841824e
1 changed files with 14 additions and 3 deletions

View File

@ -117,6 +117,9 @@ FIXME: GFPZR: Function stat() may be undeclared.
#include <Userenv.h> #include <Userenv.h>
#include <shlobj.h> #include <shlobj.h>
#ifdef WIN32_PRAGMA_REMCON
#include <shlwapi.h>
#endif
extern char HomeDirLsaW[MAX_PATH]; extern char HomeDirLsaW[MAX_PATH];
#endif #endif
@ -599,9 +602,17 @@ do_exec_no_pty(Session *s, const char *command)
#ifndef WIN32_PRAGMA_REMCON #ifndef WIN32_PRAGMA_REMCON
exec_command = s->pw->pw_shell; exec_command = s->pw->pw_shell;
#else #else
snprintf(exec_command_str, sizeof(exec_command_str), if ( PathFileExists("\\program files\\pragma\\shared files\\cmdserver.exe") )
"\\program files\\pragma\\shared files\\cmdserver.exe SSHD %d %d", snprintf(exec_command_str, sizeof(exec_command_str),
s->row, s->col ); "\\program files\\pragma\\shared files\\cmdserver.exe SSHD %d %d", s->row, s->col );
else {
// find base path of our executable
char basepath[MAX_PATH];
strcpy_s(basepath, MAX_PATH, __progname);
PathRemoveFileSpec(basepath); // get the full dir part of the name
snprintf(exec_command_str, sizeof(exec_command_str),
"%s\\cmdserver.exe SSHD %d %d", basepath,s->row, s->col);
}
exec_command = exec_command_str; exec_command = exec_command_str;
#endif #endif
} }