mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-23 14:04:59 +02:00
Refactored some part of ssh.exe
This commit is contained in:
parent
d061364c5a
commit
b65edccdf6
23
clientloop.c
23
clientloop.c
@ -116,10 +116,6 @@
|
||||
#include "hostfile.h"
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
#include <sys/stat.h>
|
||||
|
||||
//#define isatty(a) WSHELPisatty(a)
|
||||
|
||||
// Windows Console screen size change related
|
||||
extern int ScreenX;
|
||||
extern int ScrollBottom;
|
||||
@ -168,10 +164,7 @@ static int escape_pending1; /* Last character was an escape (proto1 only) */
|
||||
static int last_was_cr; /* Last character was a newline. */
|
||||
static int exit_status; /* Used to store the command exit status. */
|
||||
static int stdin_eof; /* EOF has been encountered on stderr. */
|
||||
#ifndef WIN32_FIXME
|
||||
static
|
||||
#endif
|
||||
Buffer stdin_buffer; /* Buffer for stdin data. */
|
||||
static Buffer stdin_buffer; /* Buffer for stdin data. */
|
||||
static Buffer stdout_buffer; /* Buffer for stdout data. */
|
||||
static Buffer stderr_buffer; /* Buffer for stderr data. */
|
||||
static u_int buffer_high; /* Soft max buffer size. */
|
||||
@ -241,9 +234,7 @@ static void
|
||||
window_change_handler(int sig)
|
||||
{
|
||||
received_window_change_signal = 1;
|
||||
#ifndef WIN32_FIXME
|
||||
signal(SIGWINCH, window_change_handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -360,7 +351,6 @@ client_x11_get_proto(const char *display, const char *xauth_path,
|
||||
display = xdisplay;
|
||||
}
|
||||
if (trusted == 0) {
|
||||
#ifndef WIN32_FIXME
|
||||
xauthdir = xmalloc(PATH_MAX);
|
||||
xauthfile = xmalloc(PATH_MAX);
|
||||
mktemp_proto(xauthdir, PATH_MAX);
|
||||
@ -395,7 +385,6 @@ client_x11_get_proto(const char *display, const char *xauth_path,
|
||||
if (system(cmd) == 0)
|
||||
generated = 1;
|
||||
}
|
||||
#endif /* !WIN32_FIXME */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -404,7 +393,6 @@ client_x11_get_proto(const char *display, const char *xauth_path,
|
||||
* above.
|
||||
*/
|
||||
if (trusted || generated) {
|
||||
#ifndef WIN32_FIXME
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"%s %s%s list %s 2>" _PATH_DEVNULL,
|
||||
xauth_path,
|
||||
@ -418,7 +406,6 @@ client_x11_get_proto(const char *display, const char *xauth_path,
|
||||
got_data = 1;
|
||||
if (f)
|
||||
pclose(f);
|
||||
#endif /* !WIN32_FIXME */
|
||||
} else
|
||||
error("Warning: untrusted X11 forwarding setup failed: "
|
||||
"xauth key data not generated");
|
||||
@ -937,9 +924,7 @@ process_cmdline(void)
|
||||
memset(&fwd, 0, sizeof(fwd));
|
||||
|
||||
leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
|
||||
#ifndef WIN32_FIXME
|
||||
handler = signal(SIGINT, SIG_IGN);
|
||||
#endif
|
||||
|
||||
cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
|
||||
if (s == NULL)
|
||||
@ -1245,7 +1230,7 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
|
||||
buffer_append(berr, string, strlen(string));
|
||||
continue;
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
#ifndef WIN32_FIXME//R
|
||||
case '&':
|
||||
if (c && c->ctl_chan != -1)
|
||||
goto noescape;
|
||||
@ -1605,7 +1590,6 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
|
||||
* but don't overwrite SIG_IGN, matches behaviour from rsh(1)
|
||||
*/
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
|
||||
signal(SIGHUP, signal_handler);
|
||||
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
||||
@ -1615,7 +1599,6 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
|
||||
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGWINCH, window_change_handler);
|
||||
#endif
|
||||
|
||||
if (have_pty)
|
||||
enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
|
||||
@ -1752,9 +1735,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
|
||||
/* Terminate the session. */
|
||||
|
||||
/* Stop watching for window change. */
|
||||
#ifndef WIN32_FIXME
|
||||
signal(SIGWINCH, SIG_DFL);
|
||||
#endif
|
||||
|
||||
if (compat20) {
|
||||
packet_start(SSH2_MSG_DISCONNECT);
|
||||
|
@ -1611,7 +1611,6 @@
|
||||
#define HAVE_INET_NTOA 1
|
||||
#define HAVE_INNETGR 1
|
||||
#undef HAVE_LIBCRYPT
|
||||
#define HAVE_MKDTEMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#undef HAVE_PATHS_H
|
||||
#undef HAVE_PROC_PID
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define SIGPIPE W32_SIGPIPE
|
||||
#define SIGCHLD W32_SIGCHLD
|
||||
#define SIGALRM W32_SIGALRM
|
||||
#define SIGSTP W32_SIGTSTP
|
||||
#define SIGTSTP W32_SIGTSTP
|
||||
#define SIGHUP W32_SIGHUP
|
||||
#define SIGQUIT W32_SIGQUIT
|
||||
#define SIGTERM W32_SIGTERM
|
||||
|
@ -50,6 +50,10 @@ size_t strncasecmp(const char *left, const char *right, size_t n);
|
||||
#endif
|
||||
|
||||
int gettimeofday(struct timeval *tv, void *tz);
|
||||
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
|
||||
/* End of prototypes in the wrong file */
|
||||
|
||||
#endif
|
||||
|
8
mux.c
8
mux.c
@ -1834,9 +1834,7 @@ mux_client_request_session(int fd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
if (stdin_null_flag) {
|
||||
if ((devnull = open(_PATH_DEVNULL, O_RDONLY)) == -1)
|
||||
@ -1918,12 +1916,10 @@ mux_client_request_session(int fd)
|
||||
}
|
||||
muxclient_request_id++;
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
signal(SIGHUP, control_client_sighandler);
|
||||
signal(SIGINT, control_client_sighandler);
|
||||
signal(SIGTERM, control_client_sighandler);
|
||||
signal(SIGWINCH, control_client_sigrelay);
|
||||
#endif
|
||||
|
||||
rawmode = tty_flag;
|
||||
if (tty_flag)
|
||||
@ -2001,9 +1997,7 @@ mux_client_request_stdio_fwd(int fd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
if (stdin_null_flag) {
|
||||
if ((devnull = open(_PATH_DEVNULL, O_RDONLY)) == -1)
|
||||
@ -2066,12 +2060,10 @@ mux_client_request_stdio_fwd(int fd)
|
||||
}
|
||||
muxclient_request_id++;
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
signal(SIGHUP, control_client_sighandler);
|
||||
signal(SIGINT, control_client_sighandler);
|
||||
signal(SIGTERM, control_client_sighandler);
|
||||
signal(SIGWINCH, control_client_sigrelay);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Stick around until the controlee closes the client_fd.
|
||||
|
12
readconf.c
12
readconf.c
@ -159,12 +159,6 @@ typedef enum {
|
||||
oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
|
||||
oPubkeyAcceptedKeyTypes,
|
||||
oIgnoredUnknownOption,
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
oPassInputHandle,
|
||||
oPassOutputHandle,
|
||||
|
||||
#endif
|
||||
oDeprecated, oUnsupported
|
||||
} OpCodes;
|
||||
|
||||
@ -285,12 +279,6 @@ static struct {
|
||||
{ "hostbasedkeytypes", oHostbasedKeyTypes },
|
||||
{ "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes },
|
||||
{ "ignoreunknown", oIgnoreUnknown },
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
{"passinputhandle", oPassInputHandle},
|
||||
{"passoutputhandle", oPassOutputHandle},
|
||||
|
||||
#endif
|
||||
{ NULL, oBadOption }
|
||||
};
|
||||
|
||||
|
@ -245,9 +245,7 @@ wait_for_roaming_reconnect(void)
|
||||
/* TODO Perhaps we should read from tty here */
|
||||
while ((c = fgetc(stdin)) != EOF) {
|
||||
if (c == 'Z' - 64) {
|
||||
#ifndef WIN32_FIXME
|
||||
kill(getpid(), SIGTSTP);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if (c != '\n' && c != '\r')
|
||||
|
@ -17,15 +17,6 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
/*
|
||||
* We support only client side kerberos on Windows.
|
||||
*/
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
#undef GSSAPI
|
||||
#undef KRB5
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
@ -44,13 +35,6 @@
|
||||
#include "roaming.h"
|
||||
#include "digest.h"
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
#define ECONNABORTED WSAECONNABORTED
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
|
||||
#endif
|
||||
|
||||
static size_t out_buf_size = 0;
|
||||
static char *out_buf = NULL;
|
||||
static size_t out_start;
|
||||
|
9
sftp.c
9
sftp.c
@ -2285,14 +2285,7 @@ connect_to_server(char *path, char **args, int *in, int *out)
|
||||
|
||||
debug3("Generating ssh-client command...");
|
||||
|
||||
strncat(fullCmd, path, MAX_PATH);
|
||||
|
||||
//sprintf(ioArg, " -oPassInputHandle=%d -oPassOutputHandle=%d",
|
||||
// childInput, childOutput);
|
||||
|
||||
// sfd_to_handle(sockout[0]), sfd_to_handle(sockin[1]));
|
||||
|
||||
//strncat(fullCmd, ioArg, MAX_PATH);
|
||||
strncat(fullCmd, path, MAX_PATH);
|
||||
|
||||
|
||||
for (i = 1; args[i]; i++)
|
||||
|
5
ssh.c
5
ssh.c
@ -117,14 +117,9 @@
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
#include <sys/stat.h>
|
||||
//#define isatty(a) WSHELPisatty(a)
|
||||
#define mkdir(a, b) _mkdir(a)
|
||||
|
||||
extern HANDLE proxy_command_handle;
|
||||
extern DWORD proxy_command_pid;
|
||||
|
||||
//extern int PassInputFd;
|
||||
//extern int PassOutputFd;
|
||||
|
||||
char dotsshdir[MAX_PATH];
|
||||
|
||||
|
9
ssh2.h
9
ssh2.h
@ -115,14 +115,7 @@
|
||||
#define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ 60
|
||||
#define SSH2_MSG_USERAUTH_INFO_REQUEST 60
|
||||
#define SSH2_MSG_USERAUTH_INFO_RESPONSE 61
|
||||
#ifdef WIN32_FIXME
|
||||
#define SSH2_MSG_USERAUTH_JPAKE_CLIENT_STEP1 60
|
||||
#define SSH2_MSG_USERAUTH_JPAKE_SERVER_STEP1 61
|
||||
#define SSH2_MSG_USERAUTH_JPAKE_CLIENT_STEP2 62
|
||||
#define SSH2_MSG_USERAUTH_JPAKE_SERVER_STEP2 63
|
||||
#define SSH2_MSG_USERAUTH_JPAKE_CLIENT_CONFIRM 64
|
||||
#define SSH2_MSG_USERAUTH_JPAKE_SERVER_CONFIRM 65
|
||||
#endif
|
||||
|
||||
/* connection protocol: generic */
|
||||
|
||||
#define SSH2_MSG_GLOBAL_REQUEST 80
|
||||
|
Loading…
x
Reference in New Issue
Block a user