| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssh/src/dispatch.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | int | - | ||||||||||||
| 8 | dispatch_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 ((
| 0 | ||||||||||||
| 14 | (
| 0 | ||||||||||||
| 15 | (
| 0 | ||||||||||||
| 16 | (
| 0 | ||||||||||||
| 17 | sshpkt_fatal(ssh, __func__, r); never executed: sshpkt_fatal(ssh, __func__, r); | 0 | ||||||||||||
| 18 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 19 | } | - | ||||||||||||
| 20 | - | |||||||||||||
| 21 | int | - | ||||||||||||
| 22 | dispatch_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: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 26 | } | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | void | - | ||||||||||||
| 29 | ssh_dispatch_init(struct ssh *ssh, dispatch_fn *dflt) | - | ||||||||||||
| 30 | { | - | ||||||||||||
| 31 | u_int i; | - | ||||||||||||
| 32 | for (i = 0; i < 255
| 0 | ||||||||||||
| 33 | ssh->dispatch[i] = dflt; never executed: ssh->dispatch[i] = dflt; | 0 | ||||||||||||
| 34 | } never executed: end of block | 0 | ||||||||||||
| 35 | - | |||||||||||||
| 36 | void | - | ||||||||||||
| 37 | ssh_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
| 416-20384 | ||||||||||||
| 42 | if (i >= 255
| 0-20384 | ||||||||||||
| 43 | break; never executed: break; | 0 | ||||||||||||
| 44 | ssh->dispatch[i] = fn; | - | ||||||||||||
| 45 | } executed 20384 times by 1 test: end of blockExecuted by:
| 20384 | ||||||||||||
| 46 | } executed 416 times by 1 test: end of blockExecuted by:
| 416 | ||||||||||||
| 47 | - | |||||||||||||
| 48 | void | - | ||||||||||||
| 49 | ssh_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 blockExecuted by:
| 1816 | ||||||||||||
| 53 | - | |||||||||||||
| 54 | int | - | ||||||||||||
| 55 | ssh_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
| 0 | ||||||||||||
| 63 | r = ssh_packet_read_seqnr(ssh, &type, &seqnr); | - | ||||||||||||
| 64 | if (r != 0
| 0 | ||||||||||||
| 65 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||
| 66 | } never executed: else {end of block | 0 | ||||||||||||
| 67 | r = ssh_packet_read_poll_seqnr(ssh, &type, &seqnr); | - | ||||||||||||
| 68 | if (r != 0
| 0 | ||||||||||||
| 69 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||
| 70 | if (type == 0
| 0 | ||||||||||||
| 71 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 72 | } never executed: end of block | 0 | ||||||||||||
| 73 | if (type > 0
| 0 | ||||||||||||
| 74 | ssh->dispatch[type] !=
| 0 | ||||||||||||
| 75 | ((void *)0)
| 0 | ||||||||||||
| 76 | ) { | - | ||||||||||||
| 77 | if (ssh->dispatch_skip_packets
| 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
| 0 | ||||||||||||
| 84 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||
| 85 | } never executed: else {end of block | 0 | ||||||||||||
| 86 | r = sshpkt_disconnect(ssh, | - | ||||||||||||
| 87 | "protocol error: rcvd type %d", type); | - | ||||||||||||
| 88 | if (r != 0
| 0 | ||||||||||||
| 89 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||
| 90 | return never executed: -29;return -29;never executed: return -29; | 0 | ||||||||||||
| 91 | } | - | ||||||||||||
| 92 | if (done !=
| 0 | ||||||||||||
| 93 | ((void *)0)
| 0 | ||||||||||||
| 94 | && *
| 0 | ||||||||||||
| 95 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 96 | } never executed: end of block | 0 | ||||||||||||
| 97 | } never executed: end of block | 0 | ||||||||||||
| 98 | - | |||||||||||||
| 99 | void | - | ||||||||||||
| 100 | ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done) | - | ||||||||||||
| 101 | { | - | ||||||||||||
| 102 | int r; | - | ||||||||||||
| 103 | - | |||||||||||||
| 104 | if ((
| 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 code | Preprocessed file |