projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
In SSH-1, don't attempt password authentication unless the server has
[u/mdw/putty]
/
windows
/
window.c
diff --git
a/windows/window.c
b/windows/window.c
index
f49e3da
..
033cfa5
100644
(file)
--- a/
windows/window.c
+++ b/
windows/window.c
@@
-10,6
+10,10
@@
#include <limits.h>
#include <assert.h>
#include <limits.h>
#include <assert.h>
+#ifndef NO_MULTIMON
+#define COMPILE_MULTIMON_STUBS
+#endif
+
#define PUTTY_DO_GLOBALS /* actually _define_ globals */
#include "putty.h"
#include "terminal.h"
#define PUTTY_DO_GLOBALS /* actually _define_ globals */
#include "putty.h"
#include "terminal.h"
@@
-17,11
+21,8
@@
#include "win_res.h"
#ifndef NO_MULTIMON
#include "win_res.h"
#ifndef NO_MULTIMON
-#if WINVER < 0x0500
-#define COMPILE_MULTIMON_STUBS
#include <multimon.h>
#endif
#include <multimon.h>
#endif
-#endif
#include <imm.h>
#include <commctrl.h>
#include <imm.h>
#include <commctrl.h>
@@
-218,12
+219,7
@@
static void start_backend(void)
* Select protocol. This is farmed out into a table in a
* separate file to enable an ssh-free variant.
*/
* Select protocol. This is farmed out into a table in a
* separate file to enable an ssh-free variant.
*/
- back = NULL;
- for (i = 0; backends[i].backend != NULL; i++)
- if (backends[i].protocol == cfg.protocol) {
- back = backends[i].backend;
- break;
- }
+ back = backend_from_proto(cfg.protocol);
if (back == NULL) {
char *str = dupprintf("%s Internal Error", appname);
MessageBox(NULL, "Unsupported protocol number found",
if (back == NULL) {
char *str = dupprintf("%s Internal Error", appname);
MessageBox(NULL, "Unsupported protocol number found",
@@
-298,6
+294,7
@@
static void close_session(void)
back->free(backhandle);
backhandle = NULL;
back = NULL;
back->free(backhandle);
backhandle = NULL;
back = NULL;
+ term_provide_resize_fn(term, NULL, NULL);
update_specials_menu(NULL);
}
update_specials_menu(NULL);
}
@@
-359,17
+356,18
@@
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
{
char *p;
int got_host = 0;
{
char *p;
int got_host = 0;
+ /* By default, we bring up the config dialog, rather than launching
+ * a session. This gets set to TRUE if something happens to change
+ * that (e.g., a hostname is specified on the command-line). */
+ int allow_launch = FALSE;
default_protocol = be_default_protocol;
/* Find the appropriate default port. */
{
default_protocol = be_default_protocol;
/* Find the appropriate default port. */
{
-
int i
;
+
Backend *b = backend_from_proto(default_protocol)
;
default_port = 0; /* illegal */
default_port = 0; /* illegal */
- for (i = 0; backends[i].backend != NULL; i++)
- if (backends[i].protocol == default_protocol) {
- default_port = backends[i].backend->default_port;
- break;
- }
+ if (b)
+ default_port = b->default_port;
}
cfg.logtype = LGTYP_NONE;
}
cfg.logtype = LGTYP_NONE;
@@
-395,6
+393,7
@@
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
if (!cfg_launchable(&cfg) && !do_config()) {
cleanup_exit(0);
}
if (!cfg_launchable(&cfg) && !do_config()) {
cleanup_exit(0);
}
+ allow_launch = TRUE; /* allow it to be launched directly */
} else if (*p == '&') {
/*
* An initial & means we've been given a command line
} else if (*p == '&') {
/*
* An initial & means we've been given a command line
@@
-413,6
+412,7
@@
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
} else if (!do_config()) {
cleanup_exit(0);
}
} else if (!do_config()) {
cleanup_exit(0);
}
+ allow_launch = TRUE;
} else {
/*
* Otherwise, break up the command line and deal with
} else {
/*
* Otherwise, break up the command line and deal with
@@
-537,7
+537,10
@@
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
cmdline_run_saved(&cfg);
cmdline_run_saved(&cfg);
- if (!cfg_launchable(&cfg) && !do_config()) {
+ if (loaded_session || got_host)
+ allow_launch = TRUE;
+
+ if ((!allow_launch || !cfg_launchable(&cfg)) && !do_config()) {
cleanup_exit(0);
}
cleanup_exit(0);
}
@@
-594,15
+597,6
@@
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
}
}
}
}
- /* Check for invalid Port number (i.e. zero) */
- if (cfg.port == 0) {
- char *str = dupprintf("%s Internal Error", appname);
- MessageBox(NULL, "Invalid Port Number",
- str, MB_OK | MB_ICONEXCLAMATION);
- sfree(str);
- cleanup_exit(1);
- }
-
if (!prev) {
wndclass.style = 0;
wndclass.lpfnWndProc = WndProc;
if (!prev) {
wndclass.style = 0;
wndclass.lpfnWndProc = WndProc;
@@
-814,9
+808,8
@@
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
sfree(handles);
if (must_close_session)
close_session();
sfree(handles);
if (must_close_session)
close_session();
- }
-
- sfree(handles);
+ } else
+ sfree(handles);
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT)
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT)
@@
-3562,8
+3555,9
@@
int char_width(Context ctx, int uc) {
/*
* Translate a WM_(SYS)?KEY(UP|DOWN) message into a string of ASCII
/*
* Translate a WM_(SYS)?KEY(UP|DOWN) message into a string of ASCII
- * codes. Returns number of bytes used or zero to drop the message
- * or -1 to forward the message to windows.
+ * codes. Returns number of bytes used, zero to drop the message,
+ * -1 to forward the message to Windows, or another negative number
+ * to indicate a NUL-terminated "special" string.
*/
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *output)
*/
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *output)
@@
-3983,9
+3977,9
@@
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
return p - output;
}
if (wParam == VK_CANCEL && shift_state == 2) { /* Ctrl-Break */
return p - output;
}
if (wParam == VK_CANCEL && shift_state == 2) { /* Ctrl-Break */
- *p++ = 3;
-
*p++ = 0
;
- return
-2
;
+ if (back)
+
back->special(backhandle, TS_BRK)
;
+ return
0
;
}
if (wParam == VK_PAUSE) { /* Break/Pause */
*p++ = 26;
}
if (wParam == VK_PAUSE) { /* Break/Pause */
*p++ = 26;