Mercurial > dropbear
comparison cli-kex.c @ 170:a62cb364f615
Read "y/n" response for fingerprints from /dev/tty directly so that dbclient
will work with scp.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 11 Jan 2005 16:17:03 +0000 |
parents | 0cfba3034be5 |
children | 740e782679be 9916350d7d8b |
comparison
equal
deleted
inserted
replaced
169:21e99b6190dd | 170:a62cb364f615 |
---|---|
113 } | 113 } |
114 | 114 |
115 static void ask_to_confirm(unsigned char* keyblob, unsigned int keybloblen) { | 115 static void ask_to_confirm(unsigned char* keyblob, unsigned int keybloblen) { |
116 | 116 |
117 char* fp = NULL; | 117 char* fp = NULL; |
118 FILE *tty = NULL; | |
119 char response = 'z'; | |
118 | 120 |
119 fp = sign_key_fingerprint(keyblob, keybloblen); | 121 fp = sign_key_fingerprint(keyblob, keybloblen); |
120 fprintf(stderr, "\nHost '%s' is not in the trusted hosts file.\n(fingerprint %s)\nDo you want to continue connecting? (y/n)\n", | 122 fprintf(stderr, "\nHost '%s' is not in the trusted hosts file.\n(fingerprint %s)\nDo you want to continue connecting? (y/n)\n", |
121 cli_opts.remotehost, | 123 cli_opts.remotehost, |
122 fp); | 124 fp); |
123 | 125 |
124 if (getc(stdin) == 'y') { | 126 tty = fopen(_PATH_TTY, "r"); |
127 if (tty) { | |
128 response = getc(tty); | |
129 fclose(tty); | |
130 } else { | |
131 response = getc(stdin); | |
132 } | |
133 | |
134 if (response == 'y') { | |
125 m_free(fp); | 135 m_free(fp); |
126 return; | 136 return; |
127 } | 137 } |
128 | 138 |
129 dropbear_exit("Didn't validate host key"); | 139 dropbear_exit("Didn't validate host key"); |