OpenCoverage

dispatch.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/dispatch.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7int-
8dispatch_protocol_error(int type, u_int32_t seq, struct ssh *ssh)-
9{-
10 int r;-
11-
12 logit("dispatch_protocol_error: type %d seq %u", type, seq);-
13 if ((
(r = sshpkt_st...(ssh, 3)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 3)) != 0
(r = sshpkt_st...(ssh, 3)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
14 (
(r = sshpkt_pu...sh, seq)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_u32(ssh, seq)) != 0
(r = sshpkt_pu...sh, seq)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
15 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
16 (
(r = ssh_packe...ait(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = ssh_packet_write_wait(ssh)) != 0
(r = ssh_packe...ait(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
17 sshpkt_fatal(ssh, __func__, r);
never executed: sshpkt_fatal(ssh, __func__, r);
0
18 return
never executed: return 0;
0;
never executed: return 0;
0
19}-
20-
21int-
22dispatch_protocol_ignore(int type, u_int32_t seq, struct ssh *ssh)-
23{-
24 logit("dispatch_protocol_ignore: type %d seq %u", type, seq);-
25 return
never executed: return 0;
0;
never executed: return 0;
0
26}-
27-
28void-
29ssh_dispatch_init(struct ssh *ssh, dispatch_fn *dflt)-
30{-
31 u_int i;-
32 for (i = 0; i < 255
i < 255Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
33 ssh->dispatch[i] = dflt;
never executed: ssh->dispatch[i] = dflt;
0
34}
never executed: end of block
0
35-
36void-
37ssh_dispatch_range(struct ssh *ssh, u_int from, u_int to, dispatch_fn *fn)-
38{-
39 u_int i;-
40-
41 for (i = from; i <= to
i <= toDescription
TRUEevaluated 20384 times by 1 test
Evaluated by:
  • test_kex
FALSEevaluated 416 times by 1 test
Evaluated by:
  • test_kex
; i++) {
416-20384
42 if (i >= 255
i >= 255Description
TRUEnever evaluated
FALSEevaluated 20384 times by 1 test
Evaluated by:
  • test_kex
)
0-20384
43 break;
never executed: break;
0
44 ssh->dispatch[i] = fn;-
45 }
executed 20384 times by 1 test: end of block
Executed by:
  • test_kex
20384
46}
executed 416 times by 1 test: end of block
Executed by:
  • test_kex
416
47-
48void-
49ssh_dispatch_set(struct ssh *ssh, int type, dispatch_fn *fn)-
50{-
51 ssh->dispatch[type] = fn;-
52}
executed 1816 times by 1 test: end of block
Executed by:
  • test_kex
1816
53-
54int-
55ssh_dispatch_run(struct ssh *ssh, int mode, volatile sig_atomic_t *done)-
56{-
57 int r;-
58 u_char type;-
59 u_int32_t seqnr;-
60-
61 for (;;) {-
62 if (mode == DISPATCH_BLOCK
mode == DISPATCH_BLOCKDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
63 r = ssh_packet_read_seqnr(ssh, &type, &seqnr);-
64 if (r != 0
r != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
65 return
never executed: return r;
r;
never executed: return r;
0
66 }
never executed: end of block
else {
0
67 r = ssh_packet_read_poll_seqnr(ssh, &type, &seqnr);-
68 if (r != 0
r != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
69 return
never executed: return r;
r;
never executed: return r;
0
70 if (type == 0
type == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
71 return
never executed: return 0;
0;
never executed: return 0;
0
72 }
never executed: end of block
0
73 if (type > 0
type > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& type < 255
type < 255Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
74 ssh->dispatch[type] !=
ssh->dispatch[...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
75 ((void *)0)
ssh->dispatch[...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
76 ) {-
77 if (ssh->dispatch_skip_packets
ssh->dispatch_skip_packetsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
78 debug2("skipped packet (type %u)", type);-
79 ssh->dispatch_skip_packets--;-
80 continue;
never executed: continue;
0
81 }-
82 r = (*ssh->dispatch[type])(type, seqnr, ssh);-
83 if (r != 0
r != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
84 return
never executed: return r;
r;
never executed: return r;
0
85 }
never executed: end of block
else {
0
86 r = sshpkt_disconnect(ssh,-
87 "protocol error: rcvd type %d", type);-
88 if (r != 0
r != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
89 return
never executed: return r;
r;
never executed: return r;
0
90 return
never executed: return -29;
-29;
never executed: return -29;
0
91 }-
92 if (done !=
done != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
93 ((void *)0)
done != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
94 && *
*doneDescription
TRUEnever evaluated
FALSEnever evaluated
done
*doneDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
95 return
never executed: return 0;
0;
never executed: return 0;
0
96 }
never executed: end of block
0
97}
never executed: end of block
0
98-
99void-
100ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done)-
101{-
102 int r;-
103-
104 if ((
(r = ssh_dispa...e, done)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = ssh_dispatch_run(ssh, mode, done)) != 0
(r = ssh_dispa...e, done)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
105 sshpkt_fatal(ssh, __func__, r);
never executed: sshpkt_fatal(ssh, __func__, r);
0
106}
never executed: end of block
0
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2