Skip to content

Commit 601c2b6

Browse files
committed
cleaned up do_exec on Windows
1 parent 1f3c6ff commit 601c2b6

File tree

4 files changed

+8
-38
lines changed

4 files changed

+8
-38
lines changed

contrib/win32/win32compat/console.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4
4747
#endif
4848

49-
HANDLE hInputConsole = NULL;
5049
HANDLE hOutputConsole = NULL;
5150
DWORD dwSavedAttributes = 0;
5251
WORD wStartingAttributes = 0;

session.c

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ FIXME: GFPZR: Function stat() may be undeclared.
112112
#include <Userenv.h>
113113
#include <shlobj.h>
114114

115-
#ifdef WIN32_PRAGMA_REMCON
116-
#include <shlwapi.h>
117-
#endif
118115
extern char HomeDirLsaW[MAX_PATH];
119116

120117
#endif
@@ -498,24 +495,6 @@ int do_exec_windows(Session *s, const char *command, int pty) {
498495
wchar_t* pw_dir_utf16 = utf8_to_utf16(s->pw->pw_dir);
499496
extern int debug_flag;
500497

501-
if (s->is_subsystem == SUBSYSTEM_INT_SFTP_ERROR)
502-
{
503-
printf("This service allows sftp connections only.\n");
504-
fflush(NULL);
505-
exit(1);
506-
}
507-
else if (s->is_subsystem == SUBSYSTEM_INT_SFTP)
508-
{
509-
u_int i;
510-
for (i = 0; i < options.num_subsystems; i++)
511-
{
512-
if (strcmp("sftp", options.subsystem_name[i]) == 0)
513-
{
514-
command = options.subsystem_args[i];
515-
}
516-
}
517-
}
518-
519498
PROCESS_INFORMATION pi;
520499
STARTUPINFOW si;
521500

@@ -532,9 +511,14 @@ int do_exec_windows(Session *s, const char *command, int pty) {
532511
char *exec_command;
533512
char *laddr;
534513
char buf[256];
535-
#ifdef WIN32_PRAGMA_REMCON
536-
char exec_command_str[512];
537-
#endif
514+
515+
if (s->is_subsystem >= SUBSYSTEM_INT_SFTP_ERROR)
516+
{
517+
error("sub system not supported, exiting\n");
518+
fflush(NULL);
519+
exit(1);
520+
}
521+
538522

539523
if (!command)
540524
{
@@ -555,12 +539,6 @@ int do_exec_windows(Session *s, const char *command, int pty) {
555539
int retcode = -1;
556540
if ((!s->is_subsystem) && (s->ttyfd != -1))
557541
{
558-
extern HANDLE hInputConsole;
559-
extern HANDLE hOutputConsole;
560-
hInputConsole = GetConsoleInputHandle();
561-
hOutputConsole = GetConsoleOutputHandle();
562-
ConSetScreenSize(s->col, s->row);
563-
s->ptyfd = pipein[1]; // hConsole; // the pty is the Windows console output handle in our Win32 port
564542
}
565543

566544
debug3("sockin[0]: %d sockin[1]: %d", pipein[0], pipein[1]);
@@ -2539,19 +2517,15 @@ session_pty_req(Session *s)
25392517
/* for SSH1 the tty modes length is not given */
25402518
if (!compat20)
25412519
n_bytes = packet_remaining();
2542-
#ifndef WIN32_PRAGMA_REMCON
25432520
tty_parse_modes(s->ttyfd, &n_bytes);
2544-
#endif
25452521

25462522
if (!use_privsep)
25472523
pty_setowner(s->pw, s->tty);
25482524

25492525
/* Set window size from the packet. */
25502526
pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel);
25512527

2552-
#ifndef WIN32_PRAGMA_REMCON
25532528
packet_check_eom();
2554-
#endif
25552529
session_proctitle(s);
25562530
return 1;
25572531
}

ssh.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@
118118
#include <sys/stat.h>
119119

120120
char dotsshdir[MAX_PATH];
121-
extern HANDLE hInputConsole;
122121

123122
#endif /* WIN32_FIXME */
124123

@@ -1393,7 +1392,6 @@ main(int ac, char **av)
13931392
if (tty_flag) {
13941393
//AllocConsole();
13951394
ConInputInitParams(); // init the Console input side with global parameters
1396-
hInputConsole = GetStdHandle(STD_INPUT_HANDLE);
13971395
ConInit(STD_OUTPUT_HANDLE, TRUE); //init the output console surface for us to write
13981396
ConClearScreen();
13991397
}

sshpty.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#ifdef WIN32_FIXME
2222
#undef GSSAPI
2323
#undef KRB5
24-
//#define WIN32_PRAGMA_REMCON
2524
#endif
2625

2726
#include <sys/types.h>

0 commit comments

Comments
 (0)