summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-02-10 22:16:41 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-02-10 22:16:41 +0000
commit03df5bde9c6ae82168098b9be5775b42d02ad8e5 (patch)
tree57c7d91f0b6203c25eaf1d7e15d3f334855d9c77 /sshconnect2.c
parent8fd10b0f1346e21286f026adde95b553bba84752 (diff)
- markus@cvs.openbsd.org 2001/02/06 22:26:17
[sshconnect2.c] do not ask for passphrase in batch mode; report from ejb@ql.org - itojun@cvs.opebsd.org 2001/02/08 10:47:05 [sshconnect2.c] %.30s is too short for IPv6 numeric address. use %.128s for now. markus ok - markus@cvs.openbsd.org 2001/02/09 12:28:35 [sshconnect2.c] do not free twice, thanks to /etc/malloc.conf - markus@cvs.openbsd.org 2001/02/09 17:10:53 [sshconnect2.c] partial success: debug->log; "Permission denied" if no more auth methods - markus@cvs.openbsd.org 2001/02/10 12:09:21 [sshconnect2.c] remove some lines
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c36
1 files changed, 16 insertions, 20 deletions
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"
26RCSID("$OpenBSD: sshconnect2.c,v 1.41 2001/02/04 15:32:26 stevesk Exp $"); 26RCSID("$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
757userauth_pubkey_identity(Authctxt *authctxt, char *filename) 757userauth_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 */
885void 887void
886input_userauth_info_req(int type, int plen, void *ctxt) 888input_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;