mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Attempt to report the error condition right when an SCP connection
with a pre-supplied password fails to authenticate. [originally from svn r1114]
This commit is contained in:
parent
5723ec04de
commit
e45f75a2be
33
scp.c
33
scp.c
@ -46,6 +46,7 @@
|
|||||||
#define WM_RET_ERR_CNT ( WM_APP_BASE+406 )
|
#define WM_RET_ERR_CNT ( WM_APP_BASE+406 )
|
||||||
#define WM_LS_RET_ERR_CNT ( WM_APP_BASE+407 )
|
#define WM_LS_RET_ERR_CNT ( WM_APP_BASE+407 )
|
||||||
|
|
||||||
|
static int list = 0;
|
||||||
static int verbose = 0;
|
static int verbose = 0;
|
||||||
static int recursive = 0;
|
static int recursive = 0;
|
||||||
static int preserve = 0;
|
static int preserve = 0;
|
||||||
@ -239,6 +240,16 @@ void fatalbox(char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
strcat(str, "\n");
|
strcat(str, "\n");
|
||||||
tell_str(stderr, str);
|
tell_str(stderr, str);
|
||||||
|
errs++;
|
||||||
|
|
||||||
|
if (gui_mode) {
|
||||||
|
unsigned int msg_id = WM_RET_ERR_CNT;
|
||||||
|
if (list)
|
||||||
|
msg_id = WM_LS_RET_ERR_CNT;
|
||||||
|
while (!PostMessage
|
||||||
|
((HWND) atoi(gui_hwnd), msg_id, (WPARAM) errs,
|
||||||
|
0 /*lParam */ ))SleepEx(1000, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -252,6 +263,16 @@ void connection_fatal(char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
strcat(str, "\n");
|
strcat(str, "\n");
|
||||||
tell_str(stderr, str);
|
tell_str(stderr, str);
|
||||||
|
errs++;
|
||||||
|
|
||||||
|
if (gui_mode) {
|
||||||
|
unsigned int msg_id = WM_RET_ERR_CNT;
|
||||||
|
if (list)
|
||||||
|
msg_id = WM_LS_RET_ERR_CNT;
|
||||||
|
while (!PostMessage
|
||||||
|
((HWND) atoi(gui_hwnd), msg_id, (WPARAM) errs,
|
||||||
|
0 /*lParam */ ))SleepEx(1000, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -398,12 +419,23 @@ static void bump(char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
strcat(str, "\n");
|
strcat(str, "\n");
|
||||||
tell_str(stderr, str);
|
tell_str(stderr, str);
|
||||||
|
errs++;
|
||||||
|
|
||||||
if (back != NULL && back->socket() != NULL) {
|
if (back != NULL && back->socket() != NULL) {
|
||||||
char ch;
|
char ch;
|
||||||
back->special(TS_EOF);
|
back->special(TS_EOF);
|
||||||
ssh_scp_recv(&ch, 1);
|
ssh_scp_recv(&ch, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gui_mode) {
|
||||||
|
unsigned int msg_id = WM_RET_ERR_CNT;
|
||||||
|
if (list)
|
||||||
|
msg_id = WM_LS_RET_ERR_CNT;
|
||||||
|
while (!PostMessage
|
||||||
|
((HWND) atoi(gui_hwnd), msg_id, (WPARAM) errs,
|
||||||
|
0 /*lParam */ ))SleepEx(1000, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1236,7 +1268,6 @@ static void usage(void)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int list = 0;
|
|
||||||
|
|
||||||
default_protocol = PROT_TELNET;
|
default_protocol = PROT_TELNET;
|
||||||
|
|
||||||
|
13
ssh.c
13
ssh.c
@ -2018,7 +2018,10 @@ static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
|
|||||||
* because one was supplied on the command line
|
* because one was supplied on the command line
|
||||||
* which has already failed to work). Terminate.
|
* which has already failed to work). Terminate.
|
||||||
*/
|
*/
|
||||||
logevent("No more passwords to try");
|
send_packet(SSH1_MSG_DISCONNECT,
|
||||||
|
PKT_STR, "No more passwords available to try",
|
||||||
|
PKT_END);
|
||||||
|
connection_fatal("Unable to authenticate");
|
||||||
ssh_state = SSH_STATE_CLOSED;
|
ssh_state = SSH_STATE_CLOSED;
|
||||||
crReturn(1);
|
crReturn(1);
|
||||||
}
|
}
|
||||||
@ -3537,7 +3540,13 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
|
|||||||
* command line which has already failed to
|
* command line which has already failed to
|
||||||
* work). Terminate.
|
* work). Terminate.
|
||||||
*/
|
*/
|
||||||
logevent("No more passwords to try");
|
ssh2_pkt_init(SSH2_MSG_DISCONNECT);
|
||||||
|
ssh2_pkt_adduint32(SSH2_DISCONNECT_BY_APPLICATION);
|
||||||
|
ssh2_pkt_addstring
|
||||||
|
("No more passwords available to try");
|
||||||
|
ssh2_pkt_addstring("en"); /* language tag */
|
||||||
|
ssh2_pkt_send();
|
||||||
|
connection_fatal("Unable to authenticate");
|
||||||
ssh_state = SSH_STATE_CLOSED;
|
ssh_state = SSH_STATE_CLOSED;
|
||||||
crReturnV;
|
crReturnV;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user