diff options
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | sshconnect2.c | 36 |
2 files changed, 33 insertions, 21 deletions
@@ -27,6 +27,22 @@ | |||
27 | - markus@cvs.openbsd.org 2001/02/10 1:46:28 | 27 | - markus@cvs.openbsd.org 2001/02/10 1:46:28 |
28 | [ssh.c] | 28 | [ssh.c] |
29 | remove mapping of argv[0] -> hostname | 29 | remove mapping of argv[0] -> hostname |
30 | - markus@cvs.openbsd.org 2001/02/06 22:26:17 | ||
31 | [sshconnect2.c] | ||
32 | do not ask for passphrase in batch mode; report from ejb@ql.org | ||
33 | - itojun@cvs.opebsd.org 2001/02/08 10:47:05 | ||
34 | [sshconnect2.c] | ||
35 | %.30s is too short for IPv6 numeric address. use %.128s for now. | ||
36 | markus ok | ||
37 | - markus@cvs.openbsd.org 2001/02/09 12:28:35 | ||
38 | [sshconnect2.c] | ||
39 | do not free twice, thanks to /etc/malloc.conf | ||
40 | - markus@cvs.openbsd.org 2001/02/09 17:10:53 | ||
41 | [sshconnect2.c] | ||
42 | partial success: debug->log; "Permission denied" if no more auth methods | ||
43 | - markus@cvs.openbsd.org 2001/02/10 12:09:21 | ||
44 | [sshconnect2.c] | ||
45 | remove some lines | ||
30 | - (bal) Minor correction to sftp-client.c I made. Should return 'status' | 46 | - (bal) Minor correction to sftp-client.c I made. Should return 'status' |
31 | instead of '0' (from the OpenBSD tree) | 47 | instead of '0' (from the OpenBSD tree) |
32 | - (bal) Synced ssh.1 w/ OpenBSD | 48 | - (bal) Synced ssh.1 w/ OpenBSD |
@@ -3813,4 +3829,4 @@ | |||
3813 | - Wrote replacements for strlcpy and mkdtemp | 3829 | - Wrote replacements for strlcpy and mkdtemp |
3814 | - Released 1.0pre1 | 3830 | - Released 1.0pre1 |
3815 | 3831 | ||
3816 | $Id: ChangeLog,v 1.722 2001/02/10 22:11:13 mouring Exp $ | 3832 | $Id: ChangeLog,v 1.723 2001/02/10 22:16:41 mouring Exp $ |
diff --git a/sshconnect2.c b/sshconnect2.c index 8614b0b5b..031f719ba 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: sshconnect2.c,v 1.41 2001/02/04 15:32:26 stevesk Exp $"); | 26 | RCSID("$OpenBSD: sshconnect2.c,v 1.46 2001/02/10 12:09:21 markus Exp $"); |
27 | 27 | ||
28 | #include <openssl/bn.h> | 28 | #include <openssl/bn.h> |
29 | #include <openssl/md5.h> | 29 | #include <openssl/md5.h> |
@@ -601,13 +601,13 @@ input_userauth_failure(int type, int plen, void *ctxt) | |||
601 | packet_done(); | 601 | packet_done(); |
602 | 602 | ||
603 | if (partial != 0) | 603 | if (partial != 0) |
604 | debug("partial success"); | 604 | log("Authenticated with partial success."); |
605 | debug("authentications that can continue: %s", authlist); | 605 | debug("authentications that can continue: %s", authlist); |
606 | 606 | ||
607 | for (;;) { | 607 | for (;;) { |
608 | method = authmethod_get(authlist); | 608 | method = authmethod_get(authlist); |
609 | if (method == NULL) | 609 | if (method == NULL) |
610 | fatal("Unable to find an authentication method"); | 610 | fatal("Permission denied (%s).", authlist); |
611 | authctxt->method = method; | 611 | authctxt->method = method; |
612 | if (method->userauth(authctxt) != 0) { | 612 | if (method->userauth(authctxt) != 0) { |
613 | debug2("we sent a %s packet, wait for reply", method->name); | 613 | debug2("we sent a %s packet, wait for reply", method->name); |
@@ -646,7 +646,7 @@ userauth_passwd(Authctxt *authctxt) | |||
646 | if(attempt != 1) | 646 | if(attempt != 1) |
647 | error("Permission denied, please try again."); | 647 | error("Permission denied, please try again."); |
648 | 648 | ||
649 | snprintf(prompt, sizeof(prompt), "%.30s@%.40s's password: ", | 649 | snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", |
650 | authctxt->server_user, authctxt->host); | 650 | authctxt->server_user, authctxt->host); |
651 | password = read_passphrase(prompt, 0); | 651 | password = read_passphrase(prompt, 0); |
652 | packet_start(SSH2_MSG_USERAUTH_REQUEST); | 652 | packet_start(SSH2_MSG_USERAUTH_REQUEST); |
@@ -757,8 +757,10 @@ int | |||
757 | userauth_pubkey_identity(Authctxt *authctxt, char *filename) | 757 | userauth_pubkey_identity(Authctxt *authctxt, char *filename) |
758 | { | 758 | { |
759 | Key *k; | 759 | Key *k; |
760 | int i, ret, try_next; | 760 | int i, ret, try_next, success = 0; |
761 | struct stat st; | 761 | struct stat st; |
762 | char *passphrase; | ||
763 | char prompt[300]; | ||
762 | 764 | ||
763 | if (stat(filename, &st) != 0) { | 765 | if (stat(filename, &st) != 0) { |
764 | debug("key does not exist: %s", filename); | 766 | debug("key does not exist: %s", filename); |
@@ -768,9 +770,10 @@ userauth_pubkey_identity(Authctxt *authctxt, char *filename) | |||
768 | 770 | ||
769 | k = key_new(KEY_UNSPEC); | 771 | k = key_new(KEY_UNSPEC); |
770 | if (!load_private_key(filename, "", k, NULL)) { | 772 | if (!load_private_key(filename, "", k, NULL)) { |
771 | int success = 0; | 773 | if (options.batch_mode) { |
772 | char *passphrase; | 774 | key_free(k); |
773 | char prompt[300]; | 775 | return 0; |
776 | } | ||
774 | snprintf(prompt, sizeof prompt, | 777 | snprintf(prompt, sizeof prompt, |
775 | "Enter passphrase for key '%.100s': ", filename); | 778 | "Enter passphrase for key '%.100s': ", filename); |
776 | for (i = 0; i < options.number_of_password_prompts; i++) { | 779 | for (i = 0; i < options.number_of_password_prompts; i++) { |
@@ -879,18 +882,13 @@ userauth_kbdint(Authctxt *authctxt) | |||
879 | } | 882 | } |
880 | 883 | ||
881 | /* | 884 | /* |
882 | * parse SSH2_MSG_USERAUTH_INFO_REQUEST, prompt user and send | 885 | * parse INFO_REQUEST, prompt user and send INFO_RESPONSE |
883 | * SSH2_MSG_USERAUTH_INFO_RESPONSE | ||
884 | */ | 886 | */ |
885 | void | 887 | void |
886 | input_userauth_info_req(int type, int plen, void *ctxt) | 888 | input_userauth_info_req(int type, int plen, void *ctxt) |
887 | { | 889 | { |
888 | Authctxt *authctxt = ctxt; | 890 | Authctxt *authctxt = ctxt; |
889 | char *name = NULL; | 891 | char *name, *inst, *lang, *prompt, *response; |
890 | char *inst = NULL; | ||
891 | char *lang = NULL; | ||
892 | char *prompt = NULL; | ||
893 | char *response = NULL; | ||
894 | u_int num_prompts, i; | 892 | u_int num_prompts, i; |
895 | int echo = 0; | 893 | int echo = 0; |
896 | 894 | ||
@@ -902,15 +900,13 @@ input_userauth_info_req(int type, int plen, void *ctxt) | |||
902 | name = packet_get_string(NULL); | 900 | name = packet_get_string(NULL); |
903 | inst = packet_get_string(NULL); | 901 | inst = packet_get_string(NULL); |
904 | lang = packet_get_string(NULL); | 902 | lang = packet_get_string(NULL); |
905 | |||
906 | if (strlen(name) > 0) | 903 | if (strlen(name) > 0) |
907 | cli_mesg(name); | 904 | cli_mesg(name); |
908 | xfree(name); | ||
909 | |||
910 | if (strlen(inst) > 0) | 905 | if (strlen(inst) > 0) |
911 | cli_mesg(inst); | 906 | cli_mesg(inst); |
907 | xfree(name); | ||
912 | xfree(inst); | 908 | xfree(inst); |
913 | xfree(lang); /* unused */ | 909 | xfree(lang); |
914 | 910 | ||
915 | num_prompts = packet_get_int(); | 911 | num_prompts = packet_get_int(); |
916 | /* | 912 | /* |
@@ -967,7 +963,7 @@ authmethod_clear(void) | |||
967 | } | 963 | } |
968 | if (authname_current != NULL) { | 964 | if (authname_current != NULL) { |
969 | xfree(authname_current); | 965 | xfree(authname_current); |
970 | authlist_state = NULL; | 966 | authname_current = NULL; |
971 | } | 967 | } |
972 | if (authlist_state != NULL) | 968 | if (authlist_state != NULL) |
973 | authlist_state = NULL; | 969 | authlist_state = NULL; |