}
}
+/*
+ * Ask whether the selected cipher is acceptable (since it was
+ * below the configured 'warn' threshold).
+ * cs: 0 = both ways, 1 = client->server, 2 = server->client
+ */
+void askcipher(char *ciphername, int cs)
+{
+ HANDLE hin;
+ DWORD savemode, i;
+
+ static const char msg[] =
+ "The first %scipher supported by the server is\n"
+ "%s, which is below the configured warning threshold.\n"
+ "Continue with connection? (y/n) ";
+ static const char abandoned[] = "Connection abandoned.\n";
+
+ char line[32];
+
+ fprintf(stderr, msg,
+ (cs == 0) ? "" :
+ (cs == 1) ? "client-to-server " :
+ "server-to-client ",
+ ciphername);
+ fflush(stderr);
+
+ hin = GetStdHandle(STD_INPUT_HANDLE);
+ GetConsoleMode(hin, &savemode);
+ SetConsoleMode(hin, (savemode | ENABLE_ECHO_INPUT |
+ ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT));
+ ReadFile(hin, line, sizeof(line) - 1, &i, NULL);
+ SetConsoleMode(hin, savemode);
+
+ if (line[0] == 'y' || line[0] == 'Y') {
+ return;
+ } else {
+ fprintf(stderr, abandoned);
+ exit(0);
+ }
+}
+
HANDLE inhandle, outhandle, errhandle;
DWORD orig_console_mode;
int from_backend(int is_stderr, char *data, int len)
{
- int pos;
- DWORD ret;
HANDLE h = (is_stderr ? errhandle : outhandle);
- void *writedata;
- int writelen;
int osize, esize;
if (is_stderr) {
{
int events;
if (startup) {
- events = FD_READ | FD_WRITE | FD_OOB | FD_CLOSE | FD_ACCEPT;
+ events = (FD_CONNECT | FD_READ | FD_WRITE |
+ FD_OOB | FD_CLOSE | FD_ACCEPT);
} else {
events = 0;
}
command[cmdlen++] = d;
} while (c != EOF);
cfg.remote_cmd_ptr = command;
+ cfg.remote_cmd_ptr2 = NULL;
cfg.nopty = TRUE; /* command => no terminal */
} else if (!strcmp(p, "-P") && argc > 1) {
--argc, portnumber = atoi(*++argv);
if (!WSAEnumNetworkEvents(socket, NULL, &things)) {
noise_ultralight(socket);
noise_ultralight(things.lNetworkEvents);
+ if (things.lNetworkEvents & FD_CONNECT)
+ connopen &= select_result(wp, (LPARAM) FD_CONNECT);
if (things.lNetworkEvents & FD_READ)
connopen &= select_result(wp, (LPARAM) FD_READ);
if (things.lNetworkEvents & FD_CLOSE)