Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | extern char *client_version_string; | - |
23 | extern char *server_version_string; | - |
24 | extern Options options; | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | u_char *session_id2 = | - |
31 | ((void *)0) | - |
32 | ; | - |
33 | u_int session_id2_len = 0; | - |
34 | | - |
35 | char *xxx_host; | - |
36 | struct sockaddr *xxx_hostaddr; | - |
37 | | - |
38 | static int | - |
39 | verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh) | - |
40 | { | - |
41 | if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
42 | fatal("Host key verification failed."); never executed: fatal("Host key verification failed."); | 0 |
43 | return never executed: return 0; 0;never executed: return 0; | 0 |
44 | } | - |
45 | | - |
46 | static char * | - |
47 | order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) | - |
48 | { | - |
49 | char *oavail, *avail, *first, *last, *alg, *hostname, *ret; | - |
50 | size_t maxlen; | - |
51 | struct hostkeys *hostkeys; | - |
52 | int ktype; | - |
53 | u_int i; | - |
54 | | - |
55 | | - |
56 | get_hostfile_hostname_ipaddr(host, hostaddr, port, &hostname, | - |
57 | ((void *)0) | - |
58 | ); | - |
59 | hostkeys = init_hostkeys(); | - |
60 | for (i = 0; i < options.num_user_hostfilesTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
61 | load_hostkeys(hostkeys, hostname, options.user_hostfiles[i]); never executed: load_hostkeys(hostkeys, hostname, options.user_hostfiles[i]); | 0 |
62 | for (i = 0; i < options.num_system_hostfilesTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
63 | load_hostkeys(hostkeys, hostname, options.system_hostfiles[i]); never executed: load_hostkeys(hostkeys, hostname, options.system_hostfiles[i]); | 0 |
64 | | - |
65 | oavail = avail = xstrdup("ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "ssh-ed25519-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-rsa-cert-v01@openssh.com," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "ssh-ed25519," "rsa-sha2-512," "rsa-sha2-256," "ssh-rsa"); | - |
66 | maxlen = strlen(avail) + 1; | - |
67 | first = xmalloc(maxlen); | - |
68 | last = xmalloc(maxlen); | - |
69 | *first = *last = '\0'; | - |
70 | while ((TRUE | never evaluated | FALSE | never evaluated |
alg = TRUE | never evaluated | FALSE | never evaluated |
| 0 |
71 | __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
72 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
73 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
74 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
75 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
76 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
77 | ) == 1) && (__r0 = ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
78 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
79 | ))[0], ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
80 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
81 | ))[0] != '\0') ? ((__r1 = ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
82 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
83 | ))[1], ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
84 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
85 | ))[1] == '\0') ? __strsep_1c (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
86 | &availTRUE | never evaluated | FALSE | never evaluated |
| 0 |
87 | , __r0) : ((__r2 = ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
88 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
89 | ))[2], __r2 == '\0') ? __strsep_2c (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
90 | &availTRUE | never evaluated | FALSE | never evaluated |
| 0 |
91 | , __r0, __r1) : (((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
92 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
93 | ))[3] == '\0' ? __strsep_3c (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
94 | &availTRUE | never evaluated | FALSE | never evaluated |
| 0 |
95 | , __r0, __r1, __r2) : __strsep_g (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
96 | &availTRUE | never evaluated | FALSE | never evaluated |
| 0 |
97 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
98 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
99 | )))) : __strsep_g (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
100 | &availTRUE | never evaluated | FALSE | never evaluated |
| 0 |
101 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
102 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
103 | )); })TRUE | never evaluated | FALSE | never evaluated |
| 0 |
104 | )TRUE | never evaluated | FALSE | never evaluated |
&& *TRUE | never evaluated | FALSE | never evaluated |
alg != '\0'TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
105 | if ((TRUE | never evaluated | FALSE | never evaluated |
ktype = sshkey_type_from_name(alg)) == KEY_UNSPECTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
106 | fatal("%s: unknown alg %s", __func__, alg); never executed: fatal("%s: unknown alg %s", __func__, alg); | 0 |
107 | if (lookup_key_in_hostkeys_by_type(hostkeys,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
108 | sshkey_type_plain(ktype), TRUE | never evaluated | FALSE | never evaluated |
| 0 |
109 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
110 | )TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
111 | do { if (*TRUE | never evaluated | FALSE | never evaluated |
first != '\0'TRUE | never evaluated | FALSE | never evaluated |
) strlcat(first, ",", maxlen);never executed: strlcat(first, ",", maxlen); strlcat(first, alg, maxlen); }never executed: end of block while (0); | 0 |
112 | else | - |
113 | do { if (*TRUE | never evaluated | FALSE | never evaluated |
last != '\0'TRUE | never evaluated | FALSE | never evaluated |
) strlcat(last, ",", maxlen);never executed: strlcat(last, ",", maxlen); strlcat(last, alg, maxlen); }never executed: end of block while (0); | 0 |
114 | } | - |
115 | | - |
116 | xasprintf(&ret, "%s%s%s", first, | - |
117 | (*first == '\0' || *last == '\0') ? "" : ",", last); | - |
118 | if (*TRUE | never evaluated | FALSE | never evaluated |
first != '\0'TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
119 | debug3("%s: prefer hostkeyalgs: %s", __func__, first); never executed: debug3("%s: prefer hostkeyalgs: %s", __func__, first); | 0 |
120 | | - |
121 | free(first); | - |
122 | free(last); | - |
123 | free(hostname); | - |
124 | free(oavail); | - |
125 | free_hostkeys(hostkeys); | - |
126 | | - |
127 | return never executed: return ret; ret;never executed: return ret; | 0 |
128 | } | - |
129 | | - |
130 | void | - |
131 | ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) | - |
132 | { | - |
133 | char *myproposal[PROPOSAL_MAX] = { "curve25519-sha256," "curve25519-sha256@libssh.org," "ecdh-sha2-nistp256," "ecdh-sha2-nistp384," "ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256," "diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512," "diffie-hellman-group-exchange-sha1," "diffie-hellman-group14-sha256," "diffie-hellman-group14-sha1", "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "ssh-ed25519-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-rsa-cert-v01@openssh.com," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "ssh-ed25519," "rsa-sha2-512," "rsa-sha2-256," "ssh-rsa", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr" ",aes128-gcm@openssh.com,aes256-gcm@openssh.com", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr" ",aes128-gcm@openssh.com,aes256-gcm@openssh.com", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "none,zlib@openssh.com", "none,zlib@openssh.com", "", "" }; | - |
134 | char *s, *all_key; | - |
135 | struct kex *kex; | - |
136 | int r; | - |
137 | | - |
138 | xxx_host = host; | - |
139 | xxx_hostaddr = hostaddr; | - |
140 | | - |
141 | if ((TRUE | never evaluated | FALSE | never evaluated |
s = kex_names_cat(options.kex_algorithms, "ext-info-c")) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
142 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
143 | ) | - |
144 | fatal("%s: kex_names_cat", __func__); never executed: fatal("%s: kex_names_cat", __func__); | 0 |
145 | myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(s); | - |
146 | myproposal[PROPOSAL_ENC_ALGS_CTOS] = | - |
147 | compat_cipher_proposal(options.ciphers); | - |
148 | myproposal[PROPOSAL_ENC_ALGS_STOC] = | - |
149 | compat_cipher_proposal(options.ciphers); | - |
150 | myproposal[PROPOSAL_COMP_ALGS_CTOS] = | - |
151 | myproposal[PROPOSAL_COMP_ALGS_STOC] = options.compressionTRUE | never evaluated | FALSE | never evaluated |
? | 0 |
152 | "zlib@openssh.com,zlib,none" : "none,zlib@openssh.com,zlib"; | - |
153 | myproposal[PROPOSAL_MAC_ALGS_CTOS] = | - |
154 | myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs; | - |
155 | if (options.hostkeyalgorithms != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
156 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
157 | ) { | - |
158 | all_key = sshkey_alg_list(0, 0, 1, ','); | - |
159 | if (kex_assemble_names(&options.hostkeyalgorithms,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
160 | "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "ssh-ed25519-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-rsa-cert-v01@openssh.com," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "ssh-ed25519," "rsa-sha2-512," "rsa-sha2-256," "ssh-rsa", all_key) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
161 | fatal("%s: kex_assemble_namelist", __func__); never executed: fatal("%s: kex_assemble_namelist", __func__); | 0 |
162 | free(all_key); | - |
163 | myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = | - |
164 | compat_pkalg_proposal(options.hostkeyalgorithms); | - |
165 | } never executed: end of block else { | 0 |
166 | | - |
167 | options.hostkeyalgorithms = xstrdup("ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "ssh-ed25519-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-rsa-cert-v01@openssh.com," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "ssh-ed25519," "rsa-sha2-512," "rsa-sha2-256," "ssh-rsa"); | - |
168 | | - |
169 | myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = | - |
170 | compat_pkalg_proposal( | - |
171 | order_hostkeyalgs(host, hostaddr, port)); | - |
172 | } never executed: end of block | 0 |
173 | | - |
174 | if (options.rekey_limitTRUE | never evaluated | FALSE | never evaluated |
|| options.rekey_intervalTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
175 | ssh_packet_set_rekey_limits(active_state, options.rekey_limit, options.rekey_interval) never executed: ssh_packet_set_rekey_limits(active_state, options.rekey_limit, options.rekey_interval) ; | 0 |
176 | ; never executed: ssh_packet_set_rekey_limits(active_state, options.rekey_limit, options.rekey_interval) ; | 0 |
177 | | - |
178 | | - |
179 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = kex_setup(active_state, myproposal)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
180 | fatal("kex_setup: %s", ssh_err(r)); never executed: fatal("kex_setup: %s", ssh_err(r)); | 0 |
181 | kex = active_state->kex; | - |
182 | | - |
183 | kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; | - |
184 | kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; | - |
185 | kex->kex[KEX_DH_GRP14_SHA256] = kexdh_client; | - |
186 | kex->kex[KEX_DH_GRP16_SHA512] = kexdh_client; | - |
187 | kex->kex[KEX_DH_GRP18_SHA512] = kexdh_client; | - |
188 | kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; | - |
189 | kex->kex[KEX_DH_GEX_SHA256] = kexgex_client; | - |
190 | | - |
191 | kex->kex[KEX_ECDH_SHA2] = kexecdh_client; | - |
192 | | - |
193 | | - |
194 | kex->kex[KEX_C25519_SHA256] = kexc25519_client; | - |
195 | kex->client_version_string=client_version_string; | - |
196 | kex->server_version_string=server_version_string; | - |
197 | kex->verify_host_key=&verify_host_key_callback; | - |
198 | | - |
199 | ssh_dispatch_run_fatal(active_state, DISPATCH_BLOCK, &kex->done); | - |
200 | | - |
201 | | - |
202 | myproposal[PROPOSAL_KEX_ALGS] = | - |
203 | compat_kex_proposal(options.kex_algorithms); | - |
204 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = kex_prop2buf(kex->my, myproposal)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
205 | fatal("kex_prop2buf: %s", ssh_err(r)); never executed: fatal("kex_prop2buf: %s", ssh_err(r)); | 0 |
206 | | - |
207 | session_id2 = kex->session_id; | - |
208 | session_id2_len = kex->session_id_len; | - |
209 | } never executed: end of block | 0 |
210 | | - |
211 | | - |
212 | | - |
213 | | - |
214 | | - |
215 | typedef struct cauthctxt Authctxt; | - |
216 | typedef struct cauthmethod Authmethod; | - |
217 | typedef struct identity Identity; | - |
218 | typedef struct idlist Idlist; | - |
219 | | - |
220 | struct identity { | - |
221 | struct { struct identity *tqe_next; struct identity **tqe_prev; } next; | - |
222 | int agent_fd; | - |
223 | struct sshkey *key; | - |
224 | char *filename; | - |
225 | int tried; | - |
226 | int isprivate; | - |
227 | int userprovided; | - |
228 | }; | - |
229 | struct idlist { struct identity *tqh_first; struct identity **tqh_last; }; | - |
230 | | - |
231 | struct cauthctxt { | - |
232 | const char *server_user; | - |
233 | const char *local_user; | - |
234 | const char *host; | - |
235 | const char *service; | - |
236 | struct cauthmethod *method; | - |
237 | sig_atomic_t success; | - |
238 | char *authlist; | - |
239 | int attempt; | - |
240 | | - |
241 | struct idlist keys; | - |
242 | int agent_fd; | - |
243 | | - |
244 | Sensitive *sensitive; | - |
245 | char *oktypes, *ktypes; | - |
246 | const char *active_ktype; | - |
247 | | - |
248 | int info_req_seen; | - |
249 | | - |
250 | void *methoddata; | - |
251 | }; | - |
252 | | - |
253 | struct cauthmethod { | - |
254 | char *name; | - |
255 | int (*userauth)(Authctxt *authctxt); | - |
256 | void (*cleanup)(Authctxt *authctxt); | - |
257 | int *enabled; | - |
258 | int *batch_flag; | - |
259 | }; | - |
260 | | - |
261 | int input_userauth_service_accept(int, u_int32_t, struct ssh *); | - |
262 | int input_userauth_ext_info(int, u_int32_t, struct ssh *); | - |
263 | int input_userauth_success(int, u_int32_t, struct ssh *); | - |
264 | int input_userauth_success_unexpected(int, u_int32_t, struct ssh *); | - |
265 | int input_userauth_failure(int, u_int32_t, struct ssh *); | - |
266 | int input_userauth_banner(int, u_int32_t, struct ssh *); | - |
267 | int input_userauth_error(int, u_int32_t, struct ssh *); | - |
268 | int input_userauth_info_req(int, u_int32_t, struct ssh *); | - |
269 | int input_userauth_pk_ok(int, u_int32_t, struct ssh *); | - |
270 | int input_userauth_passwd_changereq(int, u_int32_t, struct ssh *); | - |
271 | | - |
272 | int userauth_none(Authctxt *); | - |
273 | int userauth_pubkey(Authctxt *); | - |
274 | int userauth_passwd(Authctxt *); | - |
275 | int userauth_kbdint(Authctxt *); | - |
276 | int userauth_hostbased(Authctxt *); | - |
277 | void userauth(Authctxt *, char *); | - |
278 | | - |
279 | static int sign_and_send_pubkey(struct ssh *ssh, Authctxt *, Identity *); | - |
280 | static void pubkey_prepare(Authctxt *); | - |
281 | static void pubkey_cleanup(Authctxt *); | - |
282 | static void pubkey_reset(Authctxt *); | - |
283 | static struct sshkey *load_identity_file(Identity *); | - |
284 | | - |
285 | static Authmethod *authmethod_get(char *authlist); | - |
286 | static Authmethod *authmethod_lookup(const char *name); | - |
287 | static char *authmethods_get(void); | - |
288 | | - |
289 | Authmethod authmethods[] = { | - |
290 | | - |
291 | | - |
292 | | - |
293 | | - |
294 | | - |
295 | | - |
296 | | - |
297 | {"hostbased", | - |
298 | userauth_hostbased, | - |
299 | | - |
300 | ((void *)0) | - |
301 | , | - |
302 | &options.hostbased_authentication, | - |
303 | | - |
304 | ((void *)0) | - |
305 | }, | - |
306 | {"publickey", | - |
307 | userauth_pubkey, | - |
308 | | - |
309 | ((void *)0) | - |
310 | , | - |
311 | &options.pubkey_authentication, | - |
312 | | - |
313 | ((void *)0) | - |
314 | }, | - |
315 | {"keyboard-interactive", | - |
316 | userauth_kbdint, | - |
317 | | - |
318 | ((void *)0) | - |
319 | , | - |
320 | &options.kbd_interactive_authentication, | - |
321 | &options.batch_mode}, | - |
322 | {"password", | - |
323 | userauth_passwd, | - |
324 | | - |
325 | ((void *)0) | - |
326 | , | - |
327 | &options.password_authentication, | - |
328 | &options.batch_mode}, | - |
329 | {"none", | - |
330 | userauth_none, | - |
331 | | - |
332 | ((void *)0) | - |
333 | , | - |
334 | | - |
335 | ((void *)0) | - |
336 | , | - |
337 | | - |
338 | ((void *)0) | - |
339 | }, | - |
340 | { | - |
341 | ((void *)0) | - |
342 | , | - |
343 | ((void *)0) | - |
344 | , | - |
345 | ((void *)0) | - |
346 | , | - |
347 | ((void *)0) | - |
348 | , | - |
349 | ((void *)0) | - |
350 | } | - |
351 | }; | - |
352 | | - |
353 | void | - |
354 | ssh_userauth2(const char *local_user, const char *server_user, char *host, | - |
355 | Sensitive *sensitive) | - |
356 | { | - |
357 | struct ssh *ssh = active_state; | - |
358 | Authctxt authctxt; | - |
359 | int r; | - |
360 | | - |
361 | if (options.challenge_response_authenticationTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
362 | options.kbd_interactive_authentication = 1; never executed: options.kbd_interactive_authentication = 1; | 0 |
363 | if (options.preferred_authentications == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
364 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
365 | ) | - |
366 | options.preferred_authentications = authmethods_get(); never executed: options.preferred_authentications = authmethods_get(); | 0 |
367 | | - |
368 | | - |
369 | memset(&authctxt, 0, sizeof(authctxt)); | - |
370 | pubkey_prepare(&authctxt); | - |
371 | authctxt.server_user = server_user; | - |
372 | authctxt.local_user = local_user; | - |
373 | authctxt.host = host; | - |
374 | authctxt.service = "ssh-connection"; | - |
375 | authctxt.success = 0; | - |
376 | authctxt.method = authmethod_lookup("none"); | - |
377 | authctxt.authlist = | - |
378 | ((void *)0) | - |
379 | ; | - |
380 | authctxt.methoddata = | - |
381 | ((void *)0) | - |
382 | ; | - |
383 | authctxt.sensitive = sensitive; | - |
384 | authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = | - |
385 | ((void *)0) | - |
386 | ; | - |
387 | authctxt.info_req_seen = 0; | - |
388 | authctxt.agent_fd = -1; | - |
389 | if (authctxt.method == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
390 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
391 | ) | - |
392 | fatal("ssh_userauth2: internal error: cannot send userauth none request"); never executed: fatal("ssh_userauth2: internal error: cannot send userauth none request"); | 0 |
393 | | - |
394 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, 5)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
395 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, "ssh-userauth")) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
396 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
397 | fatal("%s: %s", __func__, ssh_err(r)); never executed: fatal("%s: %s", __func__, ssh_err(r)); | 0 |
398 | | - |
399 | ssh->authctxt = &authctxt; | - |
400 | ssh_dispatch_init(ssh, &input_userauth_error); | - |
401 | ssh_dispatch_set(ssh, 7, &input_userauth_ext_info); | - |
402 | ssh_dispatch_set(ssh, 6, &input_userauth_service_accept); | - |
403 | ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt.success); | - |
404 | ssh->authctxt = | - |
405 | ((void *)0) | - |
406 | ; | - |
407 | | - |
408 | pubkey_cleanup(&authctxt); | - |
409 | ssh_dispatch_range(ssh, 50, 79, | - |
410 | ((void *)0) | - |
411 | ); | - |
412 | | - |
413 | if (!authctxt.successTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
414 | fatal("Authentication failed."); never executed: fatal("Authentication failed."); | 0 |
415 | debug("Authentication succeeded (%s).", authctxt.method->name); | - |
416 | } never executed: end of block | 0 |
417 | | - |
418 | | - |
419 | int | - |
420 | input_userauth_service_accept(int type, u_int32_t seq, struct ssh *ssh) | - |
421 | { | - |
422 | Authctxt *authctxt = ssh->authctxt; | - |
423 | int r; | - |
424 | | - |
425 | if (ssh_packet_remaining(ssh) > 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
426 | char *reply; | - |
427 | | - |
428 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_cstring(ssh, &reply, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
429 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
430 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
431 | goto never executed: goto out; out;never executed: goto out; | 0 |
432 | debug2("service_accept: %s", reply); | - |
433 | free(reply); | - |
434 | } never executed: end of block else { | 0 |
435 | debug2("buggy server: service_accept w/o service"); | - |
436 | } never executed: end of block | 0 |
437 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_end(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
438 | goto never executed: goto out; out;never executed: goto out; | 0 |
439 | debug("SSH2_MSG_SERVICE_ACCEPT received"); | - |
440 | | - |
441 | | - |
442 | userauth_none(authctxt); | - |
443 | | - |
444 | ssh_dispatch_set(ssh, 7, &input_userauth_error); | - |
445 | ssh_dispatch_set(ssh, 52, &input_userauth_success); | - |
446 | ssh_dispatch_set(ssh, 51, &input_userauth_failure); | - |
447 | ssh_dispatch_set(ssh, 53, &input_userauth_banner); | - |
448 | r = 0; | - |
449 | out: code before this statement never executed: out: | 0 |
450 | return never executed: return r; r;never executed: return r; | 0 |
451 | } | - |
452 | | - |
453 | | - |
454 | int | - |
455 | input_userauth_ext_info(int type, u_int32_t seqnr, struct ssh *ssh) | - |
456 | { | - |
457 | return never executed: return kex_input_ext_info(type, seqnr, ssh); kex_input_ext_info(type, seqnr, ssh);never executed: return kex_input_ext_info(type, seqnr, ssh); | 0 |
458 | } | - |
459 | | - |
460 | void | - |
461 | userauth(Authctxt *authctxt, char *authlist) | - |
462 | { | - |
463 | struct ssh *ssh = active_state; | - |
464 | | - |
465 | if (authctxt->method != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
466 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
467 | && authctxt->method->cleanup != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
468 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
469 | ) | - |
470 | authctxt->method->cleanup(authctxt); never executed: authctxt->method->cleanup(authctxt); | 0 |
471 | | - |
472 | free(authctxt->methoddata); | - |
473 | authctxt->methoddata = | - |
474 | ((void *)0) | - |
475 | ; | - |
476 | if (authlist == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
477 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
478 | ) { | - |
479 | authlist = authctxt->authlist; | - |
480 | } never executed: end of block else { | 0 |
481 | free(authctxt->authlist); | - |
482 | authctxt->authlist = authlist; | - |
483 | } never executed: end of block | 0 |
484 | for (;;) { | - |
485 | Authmethod *method = authmethod_get(authlist); | - |
486 | if (method == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
487 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
488 | ) | - |
489 | fatal("%s@%s: Permission denied (%s).", never executed: fatal("%s@%s: Permission denied (%s).", authctxt->server_user, authctxt->host, authlist); | 0 |
490 | authctxt->server_user, authctxt->host, authlist); never executed: fatal("%s@%s: Permission denied (%s).", authctxt->server_user, authctxt->host, authlist); | 0 |
491 | authctxt->method = method; | - |
492 | | - |
493 | | - |
494 | ssh_dispatch_range(ssh, 60, | - |
495 | 79, | - |
496 | ((void *)0) | - |
497 | ); | - |
498 | | - |
499 | | - |
500 | if (method->userauth(authctxt) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
501 | debug2("we sent a %s packet, wait for reply", method->name); | - |
502 | break; never executed: break; | 0 |
503 | } else { | - |
504 | debug2("we did not send a packet, disable method"); | - |
505 | method->enabled = | - |
506 | ((void *)0) | - |
507 | ; | - |
508 | } never executed: end of block | 0 |
509 | } | - |
510 | } never executed: end of block | 0 |
511 | | - |
512 | | - |
513 | int | - |
514 | input_userauth_error(int type, u_int32_t seq, struct ssh *ssh) | - |
515 | { | - |
516 | fatal("input_userauth_error: bad message during authentication: " | - |
517 | "type %d", type); | - |
518 | return never executed: return 0; 0;never executed: return 0; | 0 |
519 | } | - |
520 | | - |
521 | | - |
522 | int | - |
523 | input_userauth_banner(int type, u_int32_t seq, struct ssh *ssh) | - |
524 | { | - |
525 | char *msg, *lang; | - |
526 | u_int len; | - |
527 | | - |
528 | debug3("%s", __func__); | - |
529 | msg = ssh_packet_get_string(active_state, (&len)); | - |
530 | lang = ssh_packet_get_string(active_state, ( | - |
531 | ((void *)0) | - |
532 | )); | - |
533 | if (len > 0TRUE | never evaluated | FALSE | never evaluated |
&& options.log_level >= SYSLOG_LEVEL_INFOTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
534 | fmprintf( never executed: fmprintf( stderr , "%s", msg); | 0 |
535 | stderr never executed: fmprintf( stderr , "%s", msg); | 0 |
536 | , "%s", msg); never executed: fmprintf( stderr , "%s", msg); | 0 |
537 | free(msg); | - |
538 | free(lang); | - |
539 | return never executed: return 0; 0;never executed: return 0; | 0 |
540 | } | - |
541 | | - |
542 | | - |
543 | int | - |
544 | input_userauth_success(int type, u_int32_t seq, struct ssh *ssh) | - |
545 | { | - |
546 | Authctxt *authctxt = ssh->authctxt; | - |
547 | | - |
548 | if (authctxt == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
549 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
550 | ) | - |
551 | fatal("input_userauth_success: no authentication context"); never executed: fatal("input_userauth_success: no authentication context"); | 0 |
552 | free(authctxt->authlist); | - |
553 | authctxt->authlist = | - |
554 | ((void *)0) | - |
555 | ; | - |
556 | if (authctxt->method != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
557 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
558 | && authctxt->method->cleanup != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
559 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
560 | ) | - |
561 | authctxt->method->cleanup(authctxt); never executed: authctxt->method->cleanup(authctxt); | 0 |
562 | free(authctxt->methoddata); | - |
563 | authctxt->methoddata = | - |
564 | ((void *)0) | - |
565 | ; | - |
566 | authctxt->success = 1; | - |
567 | return never executed: return 0; 0;never executed: return 0; | 0 |
568 | } | - |
569 | | - |
570 | int | - |
571 | input_userauth_success_unexpected(int type, u_int32_t seq, struct ssh *ssh) | - |
572 | { | - |
573 | Authctxt *authctxt = ssh->authctxt; | - |
574 | | - |
575 | if (authctxt == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
576 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
577 | ) | - |
578 | fatal("%s: no authentication context", __func__); never executed: fatal("%s: no authentication context", __func__); | 0 |
579 | | - |
580 | fatal("Unexpected authentication success during %s.", | - |
581 | authctxt->method->name); | - |
582 | return never executed: return 0; 0;never executed: return 0; | 0 |
583 | } | - |
584 | | - |
585 | | - |
586 | int | - |
587 | input_userauth_failure(int type, u_int32_t seq, struct ssh *ssh) | - |
588 | { | - |
589 | Authctxt *authctxt = ssh->authctxt; | - |
590 | char *authlist = | - |
591 | ((void *)0) | - |
592 | ; | - |
593 | u_char partial; | - |
594 | int r; | - |
595 | | - |
596 | if (authctxt == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
597 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
598 | ) | - |
599 | fatal("input_userauth_failure: no authentication context"); never executed: fatal("input_userauth_failure: no authentication context"); | 0 |
600 | | - |
601 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_cstring(ssh, &authlist, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
602 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
603 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
604 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_u8(ssh, &partial)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
605 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_end(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
606 | goto never executed: goto out; out;never executed: goto out; | 0 |
607 | | - |
608 | if (partialTRUE | never evaluated | FALSE | never evaluated |
!= 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
609 | verbose("Authenticated with partial success."); | - |
610 | | - |
611 | pubkey_reset(authctxt); | - |
612 | } never executed: end of block | 0 |
613 | debug("Authentications that can continue: %s", authlist); | - |
614 | | - |
615 | userauth(authctxt, authlist); | - |
616 | authlist = | - |
617 | ((void *)0) | - |
618 | ; | - |
619 | out: code before this statement never executed: out: | 0 |
620 | free(authlist); | - |
621 | return never executed: return 0; 0;never executed: return 0; | 0 |
622 | } | - |
623 | | - |
624 | | - |
625 | | - |
626 | | - |
627 | | - |
628 | static char * | - |
629 | format_identity(Identity *id) | - |
630 | { | - |
631 | char *fp = | - |
632 | ((void *)0) | - |
633 | , *ret = | - |
634 | ((void *)0) | - |
635 | ; | - |
636 | | - |
637 | if (id->key != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
638 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
639 | ) { | - |
640 | fp = sshkey_fingerprint(id->key, options.fingerprint_hash, | - |
641 | SSH_FP_DEFAULT); | - |
642 | } never executed: end of block | 0 |
643 | xasprintf(&ret, "%s %s%s%s%s%s%s", | - |
644 | id->filename, | - |
645 | id->key ? sshkey_type(id->key) : "", id->key ? " " : "", | - |
646 | fp ? fp : "", | - |
647 | id->userprovided ? " explicit" : "", | - |
648 | (id->key && (id->key->flags & 0x0001)) ? " token" : "", | - |
649 | id->agent_fd != -1 ? " agent" : ""); | - |
650 | free(fp); | - |
651 | return never executed: return ret; ret;never executed: return ret; | 0 |
652 | } | - |
653 | | - |
654 | | - |
655 | int | - |
656 | input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh) | - |
657 | { | - |
658 | Authctxt *authctxt = ssh->authctxt; | - |
659 | struct sshkey *key = | - |
660 | ((void *)0) | - |
661 | ; | - |
662 | Identity *id = | - |
663 | ((void *)0) | - |
664 | ; | - |
665 | int pktype, found = 0, sent = 0; | - |
666 | size_t blen; | - |
667 | char *pkalg = | - |
668 | ((void *)0) | - |
669 | , *fp = | - |
670 | ((void *)0) | - |
671 | , *ident = | - |
672 | ((void *)0) | - |
673 | ; | - |
674 | u_char *pkblob = | - |
675 | ((void *)0) | - |
676 | ; | - |
677 | int r; | - |
678 | | - |
679 | if (authctxt == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
680 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
681 | ) | - |
682 | fatal("input_userauth_pk_ok: no authentication context"); never executed: fatal("input_userauth_pk_ok: no authentication context"); | 0 |
683 | | - |
684 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_cstring(ssh, &pkalg, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
685 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
686 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
687 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
688 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_end(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
689 | goto never executed: goto done; done;never executed: goto done; | 0 |
690 | | - |
691 | if ((TRUE | never evaluated | FALSE | never evaluated |
pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPECTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
692 | debug("%s: server sent unknown pkalg %s", __func__, pkalg); | - |
693 | goto never executed: goto done; done;never executed: goto done; | 0 |
694 | } | - |
695 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshkey_from_blob(pkblob, blen, &key)) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
696 | debug("no key from blob. pkalg %s: %s", pkalg, ssh_err(r)); | - |
697 | goto never executed: goto done; done;never executed: goto done; | 0 |
698 | } | - |
699 | if (key->type != pktypeTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
700 | error("input_userauth_pk_ok: type mismatch " | - |
701 | "for decoded key (received %d, expected %d)", | - |
702 | key->type, pktype); | - |
703 | goto never executed: goto done; done;never executed: goto done; | 0 |
704 | } | - |
705 | | - |
706 | | - |
707 | | - |
708 | | - |
709 | | - |
710 | | - |
711 | for((id) = (*(((struct idlist *)((&authctxt->keys)->tqh_last))->tqh_last)); (TRUE | never evaluated | FALSE | never evaluated |
id) != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
712 | ((TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
713 | ; (id) = (*(((struct idlist *)((id)->next.tqe_prev))->tqh_last))) { | - |
714 | if (sshkey_equal(key, id->key)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
715 | found = 1; | - |
716 | break; never executed: break; | 0 |
717 | } | - |
718 | } never executed: end of block | 0 |
719 | if (!foundTRUE | never evaluated | FALSE | never evaluated |
|| id == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
720 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
721 | ) { | - |
722 | fp = sshkey_fingerprint(key, options.fingerprint_hash, | - |
723 | SSH_FP_DEFAULT); | - |
724 | error("%s: server replied with unknown key: %s %s", __func__, | - |
725 | sshkey_type(key), fp == | - |
726 | ((void *)0) | - |
727 | ? "<ERROR>" : fp); | - |
728 | goto never executed: goto done; done;never executed: goto done; | 0 |
729 | } | - |
730 | ident = format_identity(id); | - |
731 | debug("Server accepts key: %s", ident); | - |
732 | sent = sign_and_send_pubkey(ssh, authctxt, id); | - |
733 | r = 0; | - |
734 | done: code before this statement never executed: done: | 0 |
735 | sshkey_free(key); | - |
736 | free(ident); | - |
737 | free(fp); | - |
738 | free(pkalg); | - |
739 | free(pkblob); | - |
740 | | - |
741 | | - |
742 | if (r == 0TRUE | never evaluated | FALSE | never evaluated |
&& sent == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
743 | userauth(authctxt, never executed: userauth(authctxt, ((void *)0) ); | 0 |
744 | ((void *)0) never executed: userauth(authctxt, ((void *)0) ); | 0 |
745 | ); never executed: userauth(authctxt, ((void *)0) ); | 0 |
746 | return never executed: return r; r;never executed: return r; | 0 |
747 | } | - |
748 | int | - |
749 | userauth_none(Authctxt *authctxt) | - |
750 | { | - |
751 | struct ssh *ssh = active_state; | - |
752 | int r; | - |
753 | | - |
754 | | - |
755 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, 50)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
756 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
757 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->service)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
758 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
759 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
760 | fatal("%s: %s", __func__, ssh_err(r)); never executed: fatal("%s: %s", __func__, ssh_err(r)); | 0 |
761 | return never executed: return 1; 1;never executed: return 1; | 0 |
762 | } | - |
763 | | - |
764 | int | - |
765 | userauth_passwd(Authctxt *authctxt) | - |
766 | { | - |
767 | struct ssh *ssh = active_state; | - |
768 | static int attempt = 0; | - |
769 | char prompt[256]; | - |
770 | char *password; | - |
771 | const char *host = options.host_key_aliasTRUE | never evaluated | FALSE | never evaluated |
? options.host_key_alias : | 0 |
772 | authctxt->host; | - |
773 | int r; | - |
774 | | - |
775 | if (attempt++ >= options.number_of_password_promptsTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
776 | return never executed: return 0; 0;never executed: return 0; | 0 |
777 | | - |
778 | if (attempt != 1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
779 | error("Permission denied, please try again."); never executed: error("Permission denied, please try again."); | 0 |
780 | | - |
781 | snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", | - |
782 | authctxt->server_user, host); | - |
783 | password = read_passphrase(prompt, 0); | - |
784 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, 50)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
785 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
786 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->service)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
787 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
788 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_u8(ssh, 0)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
789 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, password)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
790 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_add_padding(ssh, 64)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
791 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
792 | fatal("%s: %s", __func__, ssh_err(r)); never executed: fatal("%s: %s", __func__, ssh_err(r)); | 0 |
793 | | - |
794 | if (passwordTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
795 | freezero(password, strlen(password)); never executed: freezero(password, strlen(password)); | 0 |
796 | | - |
797 | ssh_dispatch_set(ssh, 60, | - |
798 | &input_userauth_passwd_changereq); | - |
799 | | - |
800 | return never executed: return 1; 1;never executed: return 1; | 0 |
801 | } | - |
802 | | - |
803 | | - |
804 | | - |
805 | | - |
806 | | - |
807 | int | - |
808 | input_userauth_passwd_changereq(int type, u_int32_t seqnr, struct ssh *ssh) | - |
809 | { | - |
810 | Authctxt *authctxt = ssh->authctxt; | - |
811 | char *info = | - |
812 | ((void *)0) | - |
813 | , *lang = | - |
814 | ((void *)0) | - |
815 | , *password = | - |
816 | ((void *)0) | - |
817 | , *retype = | - |
818 | ((void *)0) | - |
819 | ; | - |
820 | char prompt[256]; | - |
821 | const char *host; | - |
822 | int r; | - |
823 | | - |
824 | debug2("input_userauth_passwd_changereq"); | - |
825 | | - |
826 | if (authctxt == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
827 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
828 | ) | - |
829 | fatal("input_userauth_passwd_changereq: " never executed: fatal("input_userauth_passwd_changereq: " "no authentication context"); | 0 |
830 | "no authentication context"); never executed: fatal("input_userauth_passwd_changereq: " "no authentication context"); | 0 |
831 | host = options.host_key_aliasTRUE | never evaluated | FALSE | never evaluated |
? options.host_key_alias : authctxt->host; | 0 |
832 | | - |
833 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_cstring(ssh, &info, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
834 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
835 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
836 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_get_cstring(ssh, &lang, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
837 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
838 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
839 | goto never executed: goto out; out;never executed: goto out; | 0 |
840 | if (strlen(info) > 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
841 | logit("%s", info); never executed: logit("%s", info); | 0 |
842 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, 50)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
843 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
844 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->service)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
845 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
846 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_u8(ssh, 1)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
847 | goto never executed: goto out; out;never executed: goto out; | 0 |
848 | | - |
849 | snprintf(prompt, sizeof(prompt), | - |
850 | "Enter %.30s@%.128s's old password: ", | - |
851 | authctxt->server_user, host); | - |
852 | password = read_passphrase(prompt, 0); | - |
853 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, password)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
854 | goto never executed: goto out; out;never executed: goto out; | 0 |
855 | | - |
856 | freezero(password, strlen(password)); | - |
857 | password = | - |
858 | ((void *)0) | - |
859 | ; | - |
860 | while (password == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
861 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
862 | ) { | - |
863 | snprintf(prompt, sizeof(prompt), | - |
864 | "Enter %.30s@%.128s's new password: ", | - |
865 | authctxt->server_user, host); | - |
866 | password = read_passphrase(prompt, 0x0004); | - |
867 | if (password == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
868 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
869 | ) { | - |
870 | | - |
871 | r = 0; | - |
872 | goto never executed: goto out; out;never executed: goto out; | 0 |
873 | } | - |
874 | snprintf(prompt, sizeof(prompt), | - |
875 | "Retype %.30s@%.128s's new password: ", | - |
876 | authctxt->server_user, host); | - |
877 | retype = read_passphrase(prompt, 0); | - |
878 | if ( | - |
879 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
880 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
881 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
882 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
883 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
884 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
885 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
886 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
887 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
888 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
889 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
890 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
891 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
892 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
893 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
894 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
895 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
896 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
897 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
898 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
899 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
900 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
901 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
902 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
903 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
904 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
905 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
906 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
907 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
908 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
909 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
910 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
911 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
912 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
913 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
914 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
915 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
916 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
917 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
918 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
919 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
920 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
921 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
922 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
923 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
924 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
925 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( password ))[3] - __s2[3]); | 0 |
926 | passwordTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( password ))[3] - __s2[3]); | 0 |
927 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
928 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
929 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
930 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
931 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
932 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
933 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
934 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
935 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
936 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
937 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
938 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
939 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
940 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
941 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
942 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
943 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
944 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
945 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
946 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
947 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
948 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
949 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
950 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
951 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
952 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
953 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( retype ))[3] - __s2[3]); | 0 |
954 | retypeTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( retype ))[3] - __s2[3]); | 0 |
955 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
956 | passwordTRUE | never evaluated | FALSE | never evaluated |
| 0 |
957 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
958 | retypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
959 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
960 | != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
961 | freezero(password, strlen(password)); | - |
962 | logit("Mismatch; try again, EOF to quit."); | - |
963 | password = | - |
964 | ((void *)0) | - |
965 | ; | - |
966 | } never executed: end of block | 0 |
967 | freezero(retype, strlen(retype)); | - |
968 | } never executed: end of block | 0 |
969 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, password)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
970 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_add_padding(ssh, 64)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
971 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
972 | goto never executed: goto out; out;never executed: goto out; | 0 |
973 | | - |
974 | ssh_dispatch_set(ssh, 60, | - |
975 | &input_userauth_passwd_changereq); | - |
976 | r = 0; | - |
977 | out: code before this statement never executed: out: | 0 |
978 | if (passwordTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
979 | freezero(password, strlen(password)); never executed: freezero(password, strlen(password)); | 0 |
980 | free(info); | - |
981 | free(lang); | - |
982 | return never executed: return r; r;never executed: return r; | 0 |
983 | } | - |
984 | static char * | - |
985 | key_sig_algorithm(struct ssh *ssh, const struct sshkey *key) | - |
986 | { | - |
987 | char *allowed, *oallowed, *cp, *tmp, *alg = | - |
988 | ((void *)0) | - |
989 | ; | - |
990 | | - |
991 | | - |
992 | | - |
993 | | - |
994 | | - |
995 | | - |
996 | if (ssh == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
997 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
998 | || ssh->kex->server_sig_algs == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
999 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1000 | || | - |
1001 | (key->type != KEY_RSATRUE | never evaluated | FALSE | never evaluated |
&& key->type != KEY_RSA_CERTTRUE | never evaluated | FALSE | never evaluated |
)) { | 0 |
1002 | | - |
1003 | return never executed: return match_list(sshkey_ssh_name(key), options.pubkey_key_types, ((void *)0) ); match_list(sshkey_ssh_name(key),never executed: return match_list(sshkey_ssh_name(key), options.pubkey_key_types, ((void *)0) ); | 0 |
1004 | options.pubkey_key_types, never executed: return match_list(sshkey_ssh_name(key), options.pubkey_key_types, ((void *)0) ); | 0 |
1005 | ((void *)0) never executed: return match_list(sshkey_ssh_name(key), options.pubkey_key_types, ((void *)0) ); | 0 |
1006 | ); never executed: return match_list(sshkey_ssh_name(key), options.pubkey_key_types, ((void *)0) ); | 0 |
1007 | } | - |
1008 | | - |
1009 | | - |
1010 | | - |
1011 | | - |
1012 | | - |
1013 | | - |
1014 | | - |
1015 | oallowed = allowed = xstrdup(options.pubkey_key_types); | - |
1016 | while ((TRUE | never evaluated | FALSE | never evaluated |
cp = TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1017 | __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1018 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1019 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1020 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1021 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1022 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1023 | ) == 1) && (__r0 = ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1024 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1025 | ))[0], ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1026 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1027 | ))[0] != '\0') ? ((__r1 = ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1028 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1029 | ))[1], ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1030 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1031 | ))[1] == '\0') ? __strsep_1c (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1032 | &allowedTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1033 | , __r0) : ((__r2 = ((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1034 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1035 | ))[2], __r2 == '\0') ? __strsep_2c (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1036 | &allowedTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1037 | , __r0, __r1) : (((const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1038 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1039 | ))[3] == '\0' ? __strsep_3c (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1040 | &allowedTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1041 | , __r0, __r1, __r2) : __strsep_g (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1042 | &allowedTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1043 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1044 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1045 | )))) : __strsep_g (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1046 | &allowedTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1047 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1048 | ","TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1049 | )); })TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1050 | ) != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1051 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1052 | ) { | - |
1053 | if (sshkey_type_from_name(cp) != key->typeTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1054 | continue; never executed: continue; | 0 |
1055 | tmp = match_list(sshkey_sigalg_by_name(cp), ssh->kex->server_sig_algs, | - |
1056 | ((void *)0) | - |
1057 | ); | - |
1058 | if (tmp != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1059 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1060 | ) | - |
1061 | alg = xstrdup(cp); never executed: alg = xstrdup(cp); | 0 |
1062 | free(tmp); | - |
1063 | if (alg != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1064 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1065 | ) | - |
1066 | break; never executed: break; | 0 |
1067 | } never executed: end of block | 0 |
1068 | free(oallowed); | - |
1069 | return never executed: return alg; alg;never executed: return alg; | 0 |
1070 | } | - |
1071 | | - |
1072 | static int | - |
1073 | identity_sign(struct identity *id, u_char **sigp, size_t *lenp, | - |
1074 | const u_char *data, size_t datalen, u_int compat, const char *alg) | - |
1075 | { | - |
1076 | struct sshkey *prv; | - |
1077 | int r; | - |
1078 | | - |
1079 | | - |
1080 | if (id->key != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1081 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1082 | && id->agent_fd != -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1083 | return never executed: return ssh_agent_sign(id->agent_fd, id->key, sigp, lenp, data, datalen, alg, compat); ssh_agent_sign(id->agent_fd, id->key, sigp, lenp,never executed: return ssh_agent_sign(id->agent_fd, id->key, sigp, lenp, data, datalen, alg, compat); | 0 |
1084 | data, datalen, alg, compat); never executed: return ssh_agent_sign(id->agent_fd, id->key, sigp, lenp, data, datalen, alg, compat); | 0 |
1085 | } | - |
1086 | | - |
1087 | | - |
1088 | | - |
1089 | | - |
1090 | | - |
1091 | if (id->key != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1092 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1093 | && | - |
1094 | (id->isprivateTRUE | never evaluated | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
id->key->flags & 0x0001)TRUE | never evaluated | FALSE | never evaluated |
)) { | 0 |
1095 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshkey_sign(id->key, sigp, lenp, data, datalen,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1096 | alg, compat)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1097 | return never executed: return r; r;never executed: return r; | 0 |
1098 | | - |
1099 | | - |
1100 | | - |
1101 | | - |
1102 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshkey_check_sigtype(*sigp, *lenp, alg)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1103 | return never executed: return r; r;never executed: return r; | 0 |
1104 | return never executed: return 0; 0;never executed: return 0; | 0 |
1105 | } | - |
1106 | | - |
1107 | | - |
1108 | if ((TRUE | never evaluated | FALSE | never evaluated |
prv = load_identity_file(id)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1109 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1110 | ) | - |
1111 | return never executed: return -46; -46;never executed: return -46; | 0 |
1112 | if (id->key != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1113 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1114 | && !sshkey_equal_public(prv, id->key)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1115 | error("%s: private key %s contents do not match public", | - |
1116 | __func__, id->filename); | - |
1117 | return never executed: return -46; -46;never executed: return -46; | 0 |
1118 | } | - |
1119 | r = sshkey_sign(prv, sigp, lenp, data, datalen, alg, compat); | - |
1120 | sshkey_free(prv); | - |
1121 | return never executed: return r; r;never executed: return r; | 0 |
1122 | } | - |
1123 | | - |
1124 | static int | - |
1125 | id_filename_matches(Identity *id, Identity *private_id) | - |
1126 | { | - |
1127 | const char *suffixes[] = { ".pub", "-cert.pub", | - |
1128 | ((void *)0) | - |
1129 | }; | - |
1130 | size_t len = strlen(id->filename), plen = strlen(private_id->filename); | - |
1131 | size_t i, slen; | - |
1132 | | - |
1133 | if ( | - |
1134 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1135 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1136 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1137 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1138 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1139 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1140 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1141 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1142 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1143 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1144 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1145 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1146 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1147 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1148 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1149 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1150 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1151 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1152 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1153 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1154 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1155 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1156 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1157 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1158 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1159 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1160 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1161 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1162 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1163 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1164 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1165 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1166 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1167 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1168 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1169 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1170 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1171 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1172 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1173 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1174 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1175 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1176 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1177 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1178 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1179 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1180 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( id->filename ))[3] - __s2[3]); | 0 |
1181 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( id->filename ))[3] - __s2[3]); | 0 |
1182 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1183 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1184 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1185 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1186 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1187 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1188 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1189 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1190 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1191 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1192 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1193 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1194 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1195 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1196 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1197 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1198 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1199 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1200 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1201 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1202 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1203 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1204 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1205 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1206 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1207 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1208 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( private_id->filename ))[3] - __s2[3]); | 0 |
1209 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( private_id->filename ))[3] - __s2[3]); | 0 |
1210 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1211 | id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1212 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1213 | private_id->filenameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1214 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1215 | == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1216 | return never executed: return 1; 1;never executed: return 1; | 0 |
1217 | for (i = 0; suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
1218 | slen = strlen(suffixes[i]); | - |
1219 | if (len > slenTRUE | never evaluated | FALSE | never evaluated |
&& plen == len - slenTRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
1220 | | - |
1221 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1222 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1223 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1224 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1225 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1226 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1227 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1228 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1229 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1230 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1231 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1232 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1233 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1234 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1235 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1236 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1237 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1238 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1239 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1240 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1241 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1242 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1243 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1244 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1245 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1246 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1247 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1248 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1249 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1250 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1251 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1252 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1253 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1254 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1255 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1256 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1257 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1258 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1259 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1260 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1261 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1262 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1263 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1264 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1265 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1266 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1267 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( id->filename + (len - slen) ))[3] - __s2[3]); | 0 |
1268 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( id->filename + (len - slen) ))[3] - __s2[3]); | 0 |
1269 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1270 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1271 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1272 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1273 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1274 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1275 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1276 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1277 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1278 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1279 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1280 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1281 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1282 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1283 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1284 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1285 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1286 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1287 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1288 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1289 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1290 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1291 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1292 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1293 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1294 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1295 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( suffixes[i] ))[3] - __s2[3]); | 0 |
1296 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( suffixes[i] ))[3] - __s2[3]); | 0 |
1297 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1298 | id->filename + (len - slen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1299 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1300 | suffixes[i]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1301 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1302 | == 0TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
1303 | memcmp(id->filename, private_id->filename, plen) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1304 | return never executed: return 1; 1;never executed: return 1; | 0 |
1305 | } never executed: end of block | 0 |
1306 | return never executed: return 0; 0;never executed: return 0; | 0 |
1307 | } | - |
1308 | | - |
1309 | static int | - |
1310 | sign_and_send_pubkey(struct ssh *ssh, Authctxt *authctxt, Identity *id) | - |
1311 | { | - |
1312 | struct sshbuf *b = | - |
1313 | ((void *)0) | - |
1314 | ; | - |
1315 | Identity *private_id, *sign_id = | - |
1316 | ((void *)0) | - |
1317 | ; | - |
1318 | u_char *signature = | - |
1319 | ((void *)0) | - |
1320 | ; | - |
1321 | size_t slen = 0, skip = 0; | - |
1322 | int r, fallback_sigtype, sent = 0; | - |
1323 | char *alg = | - |
1324 | ((void *)0) | - |
1325 | , *fp = | - |
1326 | ((void *)0) | - |
1327 | ; | - |
1328 | const char *loc = ""; | - |
1329 | | - |
1330 | if ((TRUE | never evaluated | FALSE | never evaluated |
fp = sshkey_fingerprint(id->key, options.fingerprint_hash,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1331 | SSH_FP_DEFAULT)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1332 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1333 | ) | - |
1334 | return never executed: return 0; 0;never executed: return 0; | 0 |
1335 | | - |
1336 | debug3("%s: %s %s", __func__, sshkey_type(id->key), fp); | - |
1337 | if (sshkey_is_cert(id->key)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1338 | for((private_id) = ((&authctxt->keys)->tqh_first); (TRUE | never evaluated | FALSE | never evaluated |
private_id) != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1339 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1340 | ; (private_id) = ((private_id)->next.tqe_next)) { | - |
1341 | if (sshkey_equal_public(id->key, private_id->key)TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
1342 | id->key->type != private_id->key->typeTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1343 | sign_id = private_id; | - |
1344 | break; never executed: break; | 0 |
1345 | } | - |
1346 | } never executed: end of block | 0 |
1347 | | - |
1348 | | - |
1349 | | - |
1350 | | - |
1351 | | - |
1352 | | - |
1353 | | - |
1354 | if (sign_id == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1355 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1356 | && | - |
1357 | !id->isprivateTRUE | never evaluated | FALSE | never evaluated |
&& id->agent_fd == -1TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
1358 | (TRUE | never evaluated | FALSE | never evaluated |
id->key->flags & 0x0001) == 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1359 | for((private_id) = ((&authctxt->keys)->tqh_first); (TRUE | never evaluated | FALSE | never evaluated |
private_id) != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1360 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1361 | ; (private_id) = ((private_id)->next.tqe_next)) { | - |
1362 | if (private_id->key == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1363 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1364 | && | - |
1365 | id_filename_matches(id, private_id)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1366 | sign_id = private_id; | - |
1367 | break; never executed: break; | 0 |
1368 | } | - |
1369 | } never executed: end of block | 0 |
1370 | } never executed: end of block | 0 |
1371 | if (sign_id != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1372 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1373 | ) { | - |
1374 | debug2("%s: using private key \"%s\"%s for " | - |
1375 | "certificate", __func__, id->filename, | - |
1376 | id->agent_fd != -1 ? " from agent" : ""); | - |
1377 | } never executed: end of block else { | 0 |
1378 | debug("%s: no separate private key for certificate " | - |
1379 | "\"%s\"", __func__, id->filename); | - |
1380 | } never executed: end of block | 0 |
1381 | } | - |
1382 | | - |
1383 | | - |
1384 | | - |
1385 | | - |
1386 | | - |
1387 | if (sign_id == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1388 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1389 | ) | - |
1390 | sign_id = id; never executed: sign_id = id; | 0 |
1391 | | - |
1392 | | - |
1393 | for (fallback_sigtype = 0; fallback_sigtype <= 1TRUE | never evaluated | FALSE | never evaluated |
; fallback_sigtype++) { | 0 |
1394 | free(alg); | - |
1395 | slen = 0; | - |
1396 | signature = | - |
1397 | ((void *)0) | - |
1398 | ; | - |
1399 | if ((TRUE | never evaluated | FALSE | never evaluated |
alg = key_sig_algorithm(fallback_sigtype ? TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1400 | ((void *)0) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1401 | : ssh,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1402 | id->key)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1403 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1404 | ) { | - |
1405 | error("%s: no mutual signature supported", __func__); | - |
1406 | goto never executed: goto out; out;never executed: goto out; | 0 |
1407 | } | - |
1408 | debug3("%s: signing using %s", __func__, alg); | - |
1409 | | - |
1410 | sshbuf_free(b); | - |
1411 | if ((TRUE | never evaluated | FALSE | never evaluated |
b = sshbuf_new()) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1412 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1413 | ) | - |
1414 | fatal("%s: sshbuf_new failed", __func__); never executed: fatal("%s: sshbuf_new failed", __func__); | 0 |
1415 | if (datafellows & 0x00000010TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1416 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put(b, session_id2, |