OpenCoverage

sshconnect2.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/sshconnect2.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22extern char *client_version_string;-
23extern char *server_version_string;-
24extern Options options;-
25-
26-
27-
28-
29-
30u_char *session_id2 = -
31 ((void *)0)-
32 ;-
33u_int session_id2_len = 0;-
34-
35char *xxx_host;-
36struct sockaddr *xxx_hostaddr;-
37-
38static int-
39verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)-
40{-
41 if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1
verify_host_ke...hostkey) == -1Description
TRUEnever evaluated
FALSEnever 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-
46static char *-
47order_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_hostfiles
i < options.num_user_hostfilesDescription
TRUEnever evaluated
FALSEnever 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_hostfiles
i < options.nu...stem_hostfilesDescription
TRUEnever evaluated
FALSEnever 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 ((
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
alg =
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
71 __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
72 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
73 ) && ((size_t)(const void *)((
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
74 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
75 ) + 1) - (size_t)(const void *)(
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
76 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
77 ) == 1) && (__r0 = ((const char *) (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
78 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
79 ))[0], ((const char *) (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
80 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
81 ))[0] != '\0') ? ((__r1 = ((const char *) (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
82 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
83 ))[1], ((const char *) (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
84 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
85 ))[1] == '\0') ? __strsep_1c (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
86 &avail
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
87 , __r0) : ((__r2 = ((const char *) (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
88 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
89 ))[2], __r2 == '\0') ? __strsep_2c (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
90 &avail
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
91 , __r0, __r1) : (((const char *) (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
92 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
93 ))[3] == '\0' ? __strsep_3c (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
94 &avail
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
95 , __r0, __r1, __r2) : __strsep_g (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
96 &avail
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
97 ,
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
98 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
99 )))) : __strsep_g (
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
100 &avail
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
101 ,
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
102 ","
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
103 )); })
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
0
104 )
(alg = __exten..., "," )); }) )Description
TRUEnever evaluated
FALSEnever evaluated
&& *
*alg != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
alg != '\0'
*alg != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
105 if ((
(ktype = sshke... == KEY_UNSPECDescription
TRUEnever evaluated
FALSEnever evaluated
ktype = sshkey_type_from_name(alg)) == KEY_UNSPEC
(ktype = sshke... == KEY_UNSPECDescription
TRUEnever evaluated
FALSEnever 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,
lookup_key_in_... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
108 sshkey_type_plain(ktype),
lookup_key_in_... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
109 ((void *)0)
lookup_key_in_... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
110 )
lookup_key_in_... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
111 do { if (*
*first != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
first != '\0'
*first != '\0'Description
TRUEnever evaluated
FALSEnever 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 (*
*last != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
last != '\0'
*last != '\0'Description
TRUEnever evaluated
FALSEnever 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 (*
*first != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
first != '\0'
*first != '\0'Description
TRUEnever evaluated
FALSEnever 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-
130void-
131ssh_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 ((
(s = kex_names...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
s = kex_names_cat(options.kex_algorithms, "ext-info-c")) ==
(s = kex_names...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
142 ((void *)0)
(s = kex_names...== ((void *)0)Description
TRUEnever evaluated
FALSEnever 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.compression
options.compressionDescription
TRUEnever evaluated
FALSEnever 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 !=
options.hostke...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
156 ((void *)0)
options.hostke...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
157 ) {-
158 all_key = sshkey_alg_list(0, 0, 1, ',');-
159 if (kex_assemble_names(&options.hostkeyalgorithms,
kex_assemble_n... all_key) != 0Description
TRUEnever evaluated
FALSEnever 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) != 0
kex_assemble_n... all_key) != 0Description
TRUEnever evaluated
FALSEnever 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_limit
options.rekey_limitDescription
TRUEnever evaluated
FALSEnever evaluated
|| options.rekey_interval
options.rekey_intervalDescription
TRUEnever evaluated
FALSEnever 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 ((
(r = kex_setup...roposal)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = kex_setup(active_state, myproposal)) != 0
(r = kex_setup...roposal)) != 0Description
TRUEnever evaluated
FALSEnever 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 ((
(r = kex_prop2...roposal)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = kex_prop2buf(kex->my, myproposal)) != 0
(r = kex_prop2...roposal)) != 0Description
TRUEnever evaluated
FALSEnever 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-
215typedef struct cauthctxt Authctxt;-
216typedef struct cauthmethod Authmethod;-
217typedef struct identity Identity;-
218typedef struct idlist Idlist;-
219-
220struct 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};-
229struct idlist { struct identity *tqh_first; struct identity **tqh_last; };-
230-
231struct 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-
253struct cauthmethod {-
254 char *name;-
255 int (*userauth)(Authctxt *authctxt);-
256 void (*cleanup)(Authctxt *authctxt);-
257 int *enabled;-
258 int *batch_flag;-
259};-
260-
261int input_userauth_service_accept(int, u_int32_t, struct ssh *);-
262int input_userauth_ext_info(int, u_int32_t, struct ssh *);-
263int input_userauth_success(int, u_int32_t, struct ssh *);-
264int input_userauth_success_unexpected(int, u_int32_t, struct ssh *);-
265int input_userauth_failure(int, u_int32_t, struct ssh *);-
266int input_userauth_banner(int, u_int32_t, struct ssh *);-
267int input_userauth_error(int, u_int32_t, struct ssh *);-
268int input_userauth_info_req(int, u_int32_t, struct ssh *);-
269int input_userauth_pk_ok(int, u_int32_t, struct ssh *);-
270int input_userauth_passwd_changereq(int, u_int32_t, struct ssh *);-
271-
272int userauth_none(Authctxt *);-
273int userauth_pubkey(Authctxt *);-
274int userauth_passwd(Authctxt *);-
275int userauth_kbdint(Authctxt *);-
276int userauth_hostbased(Authctxt *);-
277void userauth(Authctxt *, char *);-
278-
279static int sign_and_send_pubkey(struct ssh *ssh, Authctxt *, Identity *);-
280static void pubkey_prepare(Authctxt *);-
281static void pubkey_cleanup(Authctxt *);-
282static void pubkey_reset(Authctxt *);-
283static struct sshkey *load_identity_file(Identity *);-
284-
285static Authmethod *authmethod_get(char *authlist);-
286static Authmethod *authmethod_lookup(const char *name);-
287static char *authmethods_get(void);-
288-
289Authmethod 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-
353void-
354ssh_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_authentication
options.challe...authenticationDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
362 options.kbd_interactive_authentication = 1;
never executed: options.kbd_interactive_authentication = 1;
0
363 if (options.preferred_authentications ==
options.prefer...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
364 ((void *)0)
options.prefer...== ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ==
authctxt.method == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
390 ((void *)0)
authctxt.method == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_st...(ssh, 5)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 5)) != 0
(r = sshpkt_st...(ssh, 5)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
395 (
(r = sshpkt_pu...erauth")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, "ssh-userauth")) != 0
(r = sshpkt_pu...erauth")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
396 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever 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.success
!authctxt.successDescription
TRUEnever evaluated
FALSEnever 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-
419int-
420input_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) > 0
ssh_packet_remaining(ssh) > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
426 char *reply;-
427-
428 if ((
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_cstring(ssh, &reply,
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
429 ((void *)0)
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
430 )) != 0
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_end(ssh)) != 0
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEnever 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-
454int-
455input_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-
460void-
461userauth(Authctxt *authctxt, char *authlist)-
462{-
463 struct ssh *ssh = active_state;-
464-
465 if (authctxt->method !=
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
466 ((void *)0)
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
467 && authctxt->method->cleanup !=
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
468 ((void *)0)
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ==
authlist == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
477 ((void *)0)
authlist == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ==
method == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
487 ((void *)0)
method == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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) != 0
method->userau...authctxt) != 0Description
TRUEnever evaluated
FALSEnever 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-
513int-
514input_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-
522int-
523input_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 > 0
len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& options.log_level >= SYSLOG_LEVEL_INFO
options.log_le...LOG_LEVEL_INFODescription
TRUEnever evaluated
FALSEnever 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-
543int-
544input_userauth_success(int type, u_int32_t seq, struct ssh *ssh)-
545{-
546 Authctxt *authctxt = ssh->authctxt;-
547-
548 if (authctxt ==
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
549 ((void *)0)
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 !=
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
557 ((void *)0)
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
558 && authctxt->method->cleanup !=
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
559 ((void *)0)
authctxt->meth...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever 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-
570int-
571input_userauth_success_unexpected(int type, u_int32_t seq, struct ssh *ssh)-
572{-
573 Authctxt *authctxt = ssh->authctxt;-
574-
575 if (authctxt ==
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
576 ((void *)0)
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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-
586int-
587input_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 ==
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
597 ((void *)0)
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
598 )-
599 fatal("input_userauth_failure: no authentication context");
never executed: fatal("input_userauth_failure: no authentication context");
0
600-
601 if ((
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_cstring(ssh, &authlist,
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
602 ((void *)0)
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
603 )) != 0
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
604 (
(r = sshpkt_ge...partial)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_u8(ssh, &partial)) != 0
(r = sshpkt_ge...partial)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
605 (
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_end(ssh)) != 0
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
606 goto
never executed: goto out;
out;
never executed: goto out;
0
607-
608 if (partial
partial != 0Description
TRUEnever evaluated
FALSEnever evaluated
!= 0
partial != 0Description
TRUEnever evaluated
FALSEnever 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-
628static char *-
629format_identity(Identity *id)-
630{-
631 char *fp = -
632 ((void *)0)-
633 , *ret = -
634 ((void *)0)-
635 ;-
636-
637 if (id->key !=
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
638 ((void *)0)
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever 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-
655int-
656input_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 ==
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
680 ((void *)0)
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_cstring(ssh, &pkalg,
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
685 ((void *)0)
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
686 )) != 0
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
687 (
(r = sshpkt_ge..., &blen)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0
(r = sshpkt_ge..., &blen)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
688 (
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_end(ssh)) != 0
(r = sshpkt_get_end(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
689 goto
never executed: goto done;
done;
never executed: goto done;
0
690-
691 if ((
(pktype = sshk... == KEY_UNSPECDescription
TRUEnever evaluated
FALSEnever evaluated
pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPEC
(pktype = sshk... == KEY_UNSPECDescription
TRUEnever evaluated
FALSEnever 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 ((
(r = sshkey_fr...n, &key)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshkey_from_blob(pkblob, blen, &key)) != 0
(r = sshkey_fr...n, &key)) != 0Description
TRUEnever evaluated
FALSEnever 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 != pktype
key->type != pktypeDescription
TRUEnever evaluated
FALSEnever 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)); (
(id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
id) !=
(id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
712((
(id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
(id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
void *)0)
(id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
713; (id) = (*(((struct idlist *)((id)->next.tqe_prev))->tqh_last))) {-
714 if (sshkey_equal(key, id->key)
sshkey_equal(key, id->key)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
715 found = 1;-
716 break;
never executed: break;
0
717 }-
718 }
never executed: end of block
0
719 if (!found
!foundDescription
TRUEnever evaluated
FALSEnever evaluated
|| id ==
id == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
720 ((void *)0)
id == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 == 0
r == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sent == 0
sent == 0Description
TRUEnever evaluated
FALSEnever 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}-
748int-
749userauth_none(Authctxt *authctxt)-
750{-
751 struct ssh *ssh = active_state;-
752 int r;-
753-
754-
755 if ((
(r = sshpkt_st...ssh, 50)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 50)) != 0
(r = sshpkt_st...ssh, 50)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
756 (
(r = sshpkt_pu...er_user)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0
(r = sshpkt_pu...er_user)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
757 (
(r = sshpkt_pu...service)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->service)) != 0
(r = sshpkt_pu...service)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
758 (
(r = sshpkt_pu...d->name)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0
(r = sshpkt_pu...d->name)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
759 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever 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-
764int-
765userauth_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_alias
options.host_key_aliasDescription
TRUEnever evaluated
FALSEnever evaluated
? options.host_key_alias :
0
772 authctxt->host;-
773 int r;-
774-
775 if (attempt++ >= options.number_of_password_prompts
attempt++ >= o...ssword_promptsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
776 return
never executed: return 0;
0;
never executed: return 0;
0
777-
778 if (attempt != 1
attempt != 1Description
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_st...ssh, 50)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 50)) != 0
(r = sshpkt_st...ssh, 50)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
785 (
(r = sshpkt_pu...er_user)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0
(r = sshpkt_pu...er_user)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
786 (
(r = sshpkt_pu...service)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->service)) != 0
(r = sshpkt_pu...service)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
787 (
(r = sshpkt_pu...d->name)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0
(r = sshpkt_pu...d->name)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
788 (
(r = sshpkt_pu...(ssh, 0)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_u8(ssh, 0)) != 0
(r = sshpkt_pu...(ssh, 0)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
789 (
(r = sshpkt_pu...assword)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, password)) != 0
(r = sshpkt_pu...assword)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
790 (
(r = sshpkt_ad...ssh, 64)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_add_padding(ssh, 64)) != 0
(r = sshpkt_ad...ssh, 64)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
791 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
792 fatal("%s: %s", __func__, ssh_err(r));
never executed: fatal("%s: %s", __func__, ssh_err(r));
0
793-
794 if (password
passwordDescription
TRUEnever evaluated
FALSEnever 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-
807int-
808input_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 ==
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
827 ((void *)0)
authctxt == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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_alias
options.host_key_aliasDescription
TRUEnever evaluated
FALSEnever evaluated
? options.host_key_alias : authctxt->host;
0
832-
833 if ((
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_cstring(ssh, &info,
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
834 ((void *)0)
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
835 )) != 0
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
836 (
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_get_cstring(ssh, &lang,
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
837 ((void *)0)
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
838 )) != 0
(r = sshpkt_ge...d *)0) )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
839 goto
never executed: goto out;
out;
never executed: goto out;
0
840 if (strlen(info) > 0
strlen(info) > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
841 logit("%s", info);
never executed: logit("%s", info);
0
842 if ((
(r = sshpkt_st...ssh, 50)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 50)) != 0
(r = sshpkt_st...ssh, 50)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
843 (
(r = sshpkt_pu...er_user)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0
(r = sshpkt_pu...er_user)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
844 (
(r = sshpkt_pu...service)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->service)) != 0
(r = sshpkt_pu...service)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
845 (
(r = sshpkt_pu...d->name)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0
(r = sshpkt_pu...d->name)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
846 (
(r = sshpkt_pu...(ssh, 1)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_u8(ssh, 1)) != 0
(r = sshpkt_pu...(ssh, 1)) != 0Description
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_pu...assword)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, password)) != 0
(r = sshpkt_pu...assword)) != 0Description
TRUEnever evaluated
FALSEnever 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 ==
password == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
861 ((void *)0)
password == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ==
password == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
868 ((void *)0)
password == ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
880 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
881 ) && __builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
882 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
883 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
884 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
885 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
886 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
887 ), (!((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
888 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
889 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
890 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
891 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
892 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
893 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
894 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
895 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
896 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
897 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
898 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
899 ) : (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
900 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
901 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
902 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
903 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
904 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
905 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
906 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
907 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
908 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
909 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
910 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
911 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
912 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
913 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
914 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
915 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
916 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
917 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
918 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
919 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
920 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
921 ))[0] - __s2[0]); if (__s1_len > 0
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
922 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
923 ))[1] - __s2[1]); if (__s1_len > 1
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
924 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
925 ))[2] - __s2[2]); if (__s1_len > 2
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( password ))[3] - __s2[3]);
0
926 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( password ))[3] - __s2[3]);
0
927 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
928 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
929 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
930 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
931 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
932 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
933 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
934 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
935 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
936 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
937 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
938 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
939 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
940 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
941 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
942 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
943 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
944 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
945 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
946 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
947 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
948 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
949 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
950 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
951 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
952 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
953 ))[2] - __s2[2]); if (__s2_len > 2
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( retype ))[3] - __s2[3]);
0
954 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( retype ))[3] - __s2[3]);
0
955 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
956 password
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
957 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
958 retype
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
959 )))); })
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
960 != 0
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_pu...assword)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, password)) != 0
(r = sshpkt_pu...assword)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
970 (
(r = sshpkt_ad...ssh, 64)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_add_padding(ssh, 64)) != 0
(r = sshpkt_ad...ssh, 64)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
971 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever 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 (password
passwordDescription
TRUEnever evaluated
FALSEnever 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}-
984static char *-
985key_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 ==
ssh == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
997 ((void *)0)
ssh == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
998 || ssh->kex->server_sig_algs ==
ssh->kex->serv...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
999 ((void *)0)
ssh->kex->serv...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1000 ||-
1001 (key->type != KEY_RSA
key->type != KEY_RSADescription
TRUEnever evaluated
FALSEnever evaluated
&& key->type != KEY_RSA_CERT
key->type != KEY_RSA_CERTDescription
TRUEnever evaluated
FALSEnever 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 ((
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
cp =
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1017 __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1018 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1019 ) && ((size_t)(const void *)((
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1020 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1021 ) + 1) - (size_t)(const void *)(
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1022 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1023 ) == 1) && (__r0 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1024 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1025 ))[0], ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1026 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1027 ))[0] != '\0') ? ((__r1 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1028 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1029 ))[1], ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1030 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1031 ))[1] == '\0') ? __strsep_1c (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1032 &allowed
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1033 , __r0) : ((__r2 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1034 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1035 ))[2], __r2 == '\0') ? __strsep_2c (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1036 &allowed
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1037 , __r0, __r1) : (((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1038 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1039 ))[3] == '\0' ? __strsep_3c (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1040 &allowed
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1041 , __r0, __r1, __r2) : __strsep_g (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1042 &allowed
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1043 ,
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1044 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1045 )))) : __strsep_g (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1046 &allowed
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1047 ,
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1048 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1049 )); })
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1050 ) !=
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1051 ((void *)0)
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1052 ) {-
1053 if (sshkey_type_from_name(cp) != key->type
sshkey_type_fr...) != key->typeDescription
TRUEnever evaluated
FALSEnever 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 !=
tmp != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1059 ((void *)0)
tmp != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1060 )-
1061 alg = xstrdup(cp);
never executed: alg = xstrdup(cp);
0
1062 free(tmp);-
1063 if (alg !=
alg != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1064 ((void *)0)
alg != ((void *)0)Description
TRUEnever evaluated
FALSEnever 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-
1072static int-
1073identity_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 !=
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1081 ((void *)0)
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1082 && id->agent_fd != -1
id->agent_fd != -1Description
TRUEnever evaluated
FALSEnever 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 !=
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1092 ((void *)0)
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1093 &&-
1094 (id->isprivate
id->isprivateDescription
TRUEnever evaluated
FALSEnever evaluated
|| (
(id->key->flags & 0x0001)Description
TRUEnever evaluated
FALSEnever evaluated
id->key->flags & 0x0001)
(id->key->flags & 0x0001)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1095 if ((
(r = sshkey_si... compat)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshkey_sign(id->key, sigp, lenp, data, datalen,
(r = sshkey_si... compat)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1096 alg, compat)) != 0
(r = sshkey_si... compat)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1097 return
never executed: return r;
r;
never executed: return r;
0
1098-
1099-
1100-
1101-
1102 if ((
(r = sshkey_ch...np, alg)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshkey_check_sigtype(*sigp, *lenp, alg)) != 0
(r = sshkey_ch...np, alg)) != 0Description
TRUEnever evaluated
FALSEnever 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 ((
(prv = load_id...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
prv = load_identity_file(id)) ==
(prv = load_id...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1109 ((void *)0)
(prv = load_id...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1110 )-
1111 return
never executed: return -46;
-46;
never executed: return -46;
0
1112 if (id->key !=
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1113 ((void *)0)
id->key != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1114 && !sshkey_equal_public(prv, id->key)
!sshkey_equal_...(prv, id->key)Description
TRUEnever evaluated
FALSEnever 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-
1124static int-
1125id_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 (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1135 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1136 ) && __builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1137 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1138 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1139 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1140 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1141 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1142 ), (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1143 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1144 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1145 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1146 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1147 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1148 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1149 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1150 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1151 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1152 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1153 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1154 ) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1155 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1156 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1157 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1158 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1159 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1160 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1161 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1162 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1163 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1164 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1165 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1166 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1167 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1168 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1169 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1170 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1171 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1172 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1173 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1174 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1175 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1176 ))[0] - __s2[0]); if (__s1_len > 0
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1177 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1178 ))[1] - __s2[1]); if (__s1_len > 1
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1179 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1180 ))[2] - __s2[2]); if (__s1_len > 2
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( id->filename ))[3] - __s2[3]);
0
1181 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( id->filename ))[3] - __s2[3]);
0
1182 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1183 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1184 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1185 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1186 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1187 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1188 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1189 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1190 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1191 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1192 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1193 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1194 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1195 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1196 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1197 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1198 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1199 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1200 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1201 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1202 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1203 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1204 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1205 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1206 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1207 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1208 ))[2] - __s2[2]); if (__s2_len > 2
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever 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->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( private_id->filename ))[3] - __s2[3]);
0
1210 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1211 id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1212 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1213 private_id->filename
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1214 )))); })
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1215 == 0
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1216 return
never executed: return 1;
1;
never executed: return 1;
0
1217 for (i = 0; suffixes[i]
suffixes[i]Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1218 slen = strlen(suffixes[i]);-
1219 if (len > slen
len > slenDescription
TRUEnever evaluated
FALSEnever evaluated
&& plen == len - slen
plen == len - slenDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
1220 -
1221 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1222 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1223 ) && __builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1224 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1225 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1226 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1227 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1228 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1229 ), (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1230 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1231 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1232 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1233 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1234 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1235 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1236 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1237 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1238 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1239 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1240 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1241 ) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1242 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1243 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1244 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1245 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1246 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1247 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1248 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1249 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1250 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1251 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1252 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1253 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1254 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1255 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1256 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1257 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1258 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1259 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1260 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1261 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1262 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1263 ))[0] - __s2[0]); if (__s1_len > 0
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1264 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1265 ))[1] - __s2[1]); if (__s1_len > 1
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1266 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1267 ))[2] - __s2[2]); if (__s1_len > 2
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever 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)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever 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 (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1270 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1271 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1272 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1273 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1274 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1275 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1276 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1277 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1278 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1279 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1280 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1281 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1282 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1283 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1284 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1285 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1286 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1287 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1288 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1289 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1290 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1291 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1292 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1293 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1294 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1295 ))[2] - __s2[2]); if (__s2_len > 2
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( suffixes[i] ))[3] - __s2[3]);
0
1296 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( suffixes[i] ))[3] - __s2[3]);
0
1297 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1298 id->filename + (len - slen)
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1299 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1300 suffixes[i]
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1301 )))); })
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1302 == 0
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1303 memcmp(id->filename, private_id->filename, plen) == 0
memcmp(id->fil...me, plen) == 0Description
TRUEnever evaluated
FALSEnever 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-
1309static int-
1310sign_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 ((
(fp = sshkey_f...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
fp = sshkey_fingerprint(id->key, options.fingerprint_hash,
(fp = sshkey_f...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1331 SSH_FP_DEFAULT)) ==
(fp = sshkey_f...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1332 ((void *)0)
(fp = sshkey_f...== ((void *)0)Description
TRUEnever evaluated
FALSEnever 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)
sshkey_is_cert(id->key)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1338 for((private_id) = ((&authctxt->keys)->tqh_first); (
(private_id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
private_id) !=
(private_id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1339 ((void *)0)
(private_id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1340 ; (private_id) = ((private_id)->next.tqe_next)) {-
1341 if (sshkey_equal_public(id->key, private_id->key)
sshkey_equal_p...ivate_id->key)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1342 id->key->type != private_id->key->type
id->key->type ..._id->key->typeDescription
TRUEnever evaluated
FALSEnever 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 ==
sign_id == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1355 ((void *)0)
sign_id == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1356 &&-
1357 !id->isprivate
!id->isprivateDescription
TRUEnever evaluated
FALSEnever evaluated
&& id->agent_fd == -1
id->agent_fd == -1Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1358 (
(id->key->flags & 0x0001) == 0Description
TRUEnever evaluated
FALSEnever evaluated
id->key->flags & 0x0001) == 0
(id->key->flags & 0x0001) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1359 for((private_id) = ((&authctxt->keys)->tqh_first); (
(private_id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
private_id) !=
(private_id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1360 ((void *)0)
(private_id) != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1361 ; (private_id) = ((private_id)->next.tqe_next)) {-
1362 if (private_id->key ==
private_id->key == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1363 ((void *)0)
private_id->key == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1364 &&-
1365 id_filename_matches(id, private_id)
id_filename_ma...d, private_id)Description
TRUEnever evaluated
FALSEnever 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 !=
sign_id != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1372 ((void *)0)
sign_id != ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ==
sign_id == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1388 ((void *)0)
sign_id == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1389 )-
1390 sign_id = id;
never executed: sign_id = id;
0
1391-
1392-
1393 for (fallback_sigtype = 0; fallback_sigtype <= 1
fallback_sigtype <= 1Description
TRUEnever evaluated
FALSEnever evaluated
; fallback_sigtype++) {
0
1394 free(alg);-
1395 slen = 0;-
1396 signature = -
1397 ((void *)0)-
1398 ;-
1399 if ((
(alg = key_sig...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
alg = key_sig_algorithm(fallback_sigtype ?
(alg = key_sig...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1400 ((void *)0)
(alg = key_sig...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1401 : ssh,
(alg = key_sig...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1402 id->key)) ==
(alg = key_sig...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1403 ((void *)0)
(alg = key_sig...== ((void *)0)Description
TRUEnever evaluated
FALSEnever 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 ((
(b = sshbuf_ne...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
b = sshbuf_new()) ==
(b = sshbuf_ne...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1412 ((void *)0)
(b = sshbuf_ne...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1413 )-
1414 fatal("%s: sshbuf_new failed", __func__);
never executed: fatal("%s: sshbuf_new failed", __func__);
0
1415 if (datafellows & 0x00000010
datafellows & 0x00000010Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1416 if ((
(r = sshbuf_pu...id2_len)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshbuf_put(b, session_id2,
(r = sshbuf_pu...id2_len)) != 0Description
TRUEnever evaluated