Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | static void chan_send_eof2(struct ssh *, Channel *); | - |
7 | static void chan_send_eow2(struct ssh *, Channel *); | - |
8 | | - |
9 | | - |
10 | static void chan_shutdown_write(struct ssh *, Channel *); | - |
11 | static void chan_shutdown_read(struct ssh *, Channel *); | - |
12 | | - |
13 | static const char *ostates[] = { "open", "drain", "wait_ieof", "closed" }; | - |
14 | static const char *istates[] = { "open", "drain", "wait_oclose", "closed" }; | - |
15 | | - |
16 | static void | - |
17 | chan_set_istate(Channel *c, u_int next) | - |
18 | { | - |
19 | if (c->istate > 3TRUE | never evaluated | FALSE | never evaluated |
|| next > 3TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
20 | fatal("chan_set_istate: bad state %d -> %d", c->istate, next); never executed: fatal("chan_set_istate: bad state %d -> %d", c->istate, next); | 0 |
21 | debug2("channel %d: input %s -> %s", c->self, istates[c->istate], | - |
22 | istates[next]); | - |
23 | c->istate = next; | - |
24 | } never executed: end of block | 0 |
25 | | - |
26 | static void | - |
27 | chan_set_ostate(Channel *c, u_int next) | - |
28 | { | - |
29 | if (c->ostate > 3TRUE | never evaluated | FALSE | never evaluated |
|| next > 3TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
30 | fatal("chan_set_ostate: bad state %d -> %d", c->ostate, next); never executed: fatal("chan_set_ostate: bad state %d -> %d", c->ostate, next); | 0 |
31 | debug2("channel %d: output %s -> %s", c->self, ostates[c->ostate], | - |
32 | ostates[next]); | - |
33 | c->ostate = next; | - |
34 | } never executed: end of block | 0 |
35 | | - |
36 | void | - |
37 | chan_read_failed(struct ssh *ssh, Channel *c) | - |
38 | { | - |
39 | debug2("channel %d: read failed", c->self); | - |
40 | switch (c->istate) { | - |
41 | case never executed: case 0: 0:never executed: case 0: | 0 |
42 | chan_shutdown_read(ssh, c); | - |
43 | chan_set_istate(c, 1); | - |
44 | break; never executed: break; | 0 |
45 | default never executed: default: :never executed: default: | 0 |
46 | error("channel %d: chan_read_failed for istate %d", | - |
47 | c->self, c->istate); | - |
48 | break; never executed: break; | 0 |
49 | } | - |
50 | } | - |
51 | | - |
52 | void | - |
53 | chan_ibuf_empty(struct ssh *ssh, Channel *c) | - |
54 | { | - |
55 | debug2("channel %d: ibuf empty", c->self); | - |
56 | if (sshbuf_len(c->input)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
57 | error("channel %d: chan_ibuf_empty for non empty buffer", | - |
58 | c->self); | - |
59 | return; never executed: return; | 0 |
60 | } | - |
61 | switch (c->istate) { | - |
62 | case never executed: case 1: 1:never executed: case 1: | 0 |
63 | if (!(c->flags & (0x01|0x10))TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
64 | chan_send_eof2(ssh, c); never executed: chan_send_eof2(ssh, c); | 0 |
65 | chan_set_istate(c, 3); | - |
66 | break; never executed: break; | 0 |
67 | default never executed: default: :never executed: default: | 0 |
68 | error("channel %d: chan_ibuf_empty for istate %d", | - |
69 | c->self, c->istate); | - |
70 | break; never executed: break; | 0 |
71 | } | - |
72 | } | - |
73 | | - |
74 | void | - |
75 | chan_obuf_empty(struct ssh *ssh, Channel *c) | - |
76 | { | - |
77 | debug2("channel %d: obuf empty", c->self); | - |
78 | if (sshbuf_len(c->output)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
79 | error("channel %d: chan_obuf_empty for non empty buffer", | - |
80 | c->self); | - |
81 | return; never executed: return; | 0 |
82 | } | - |
83 | switch (c->ostate) { | - |
84 | case never executed: case 1: 1:never executed: case 1: | 0 |
85 | chan_shutdown_write(ssh, c); | - |
86 | chan_set_ostate(c, 3); | - |
87 | break; never executed: break; | 0 |
88 | default never executed: default: :never executed: default: | 0 |
89 | error("channel %d: internal error: obuf_empty for ostate %d", | - |
90 | c->self, c->ostate); | - |
91 | break; never executed: break; | 0 |
92 | } | - |
93 | } | - |
94 | | - |
95 | void | - |
96 | chan_rcvd_eow(struct ssh *ssh, Channel *c) | - |
97 | { | - |
98 | debug2("channel %d: rcvd eow", c->self); | - |
99 | switch (c->istate) { | - |
100 | case never executed: case 0: 0:never executed: case 0: | 0 |
101 | chan_shutdown_read(ssh, c); | - |
102 | chan_set_istate(c, 3); | - |
103 | break; never executed: break; | 0 |
104 | } | - |
105 | } never executed: end of block | 0 |
106 | | - |
107 | static void | - |
108 | chan_send_eof2(struct ssh *ssh, Channel *c) | - |
109 | { | - |
110 | int r; | - |
111 | | - |
112 | debug2("channel %d: send eof", c->self); | - |
113 | switch (c->istate) { | - |
114 | case never executed: case 1: 1:never executed: case 1: | 0 |
115 | if (!c->have_remote_idTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
116 | fatal("%s: channel %d: no remote_id", never executed: fatal("%s: channel %d: no remote_id", __func__, c->self); | 0 |
117 | __func__, c->self); never executed: fatal("%s: channel %d: no remote_id", __func__, c->self); | 0 |
118 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, 96)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
119 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_u32(ssh, c->remote_id)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
120 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
121 | fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); never executed: fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); | 0 |
122 | c->flags |= 0x04; | - |
123 | break; never executed: break; | 0 |
124 | default never executed: default: :never executed: default: | 0 |
125 | error("channel %d: cannot send eof for istate %d", | - |
126 | c->self, c->istate); | - |
127 | break; never executed: break; | 0 |
128 | } | - |
129 | } | - |
130 | | - |
131 | static void | - |
132 | chan_send_close2(struct ssh *ssh, Channel *c) | - |
133 | { | - |
134 | int r; | - |
135 | | - |
136 | debug2("channel %d: send close", c->self); | - |
137 | if (c->ostate != 3TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
138 | c->istate != 3TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
139 | error("channel %d: cannot send close for istate/ostate %d/%d", | - |
140 | c->self, c->istate, c->ostate); | - |
141 | } never executed: end of block else if (c->flags & 0x01TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
142 | error("channel %d: already sent close", c->self); | - |
143 | } never executed: end of block else { | 0 |
144 | if (!c->have_remote_idTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
145 | fatal("%s: channel %d: no remote_id", never executed: fatal("%s: channel %d: no remote_id", __func__, c->self); | 0 |
146 | __func__, c->self); never executed: fatal("%s: channel %d: no remote_id", __func__, c->self); | 0 |
147 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, 97)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
148 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_u32(ssh, c->remote_id)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
149 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
150 | fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); never executed: fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); | 0 |
151 | c->flags |= 0x01; | - |
152 | } never executed: end of block | 0 |
153 | } | - |
154 | | - |
155 | static void | - |
156 | chan_send_eow2(struct ssh *ssh, Channel *c) | - |
157 | { | - |
158 | int r; | - |
159 | | - |
160 | debug2("channel %d: send eow", c->self); | - |
161 | if (c->ostate == 3TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
162 | error("channel %d: must not sent eow on closed output", | - |
163 | c->self); | - |
164 | return; never executed: return; | 0 |
165 | } | - |
166 | if (!(datafellows & 0x04000000)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
167 | return; never executed: return; | 0 |
168 | if (!c->have_remote_idTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
169 | fatal("%s: channel %d: no remote_id", __func__, c->self); never executed: fatal("%s: channel %d: no remote_id", __func__, c->self); | 0 |
170 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, 98)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
171 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_u32(ssh, c->remote_id)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
172 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
173 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put_u8(ssh, 0)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
174 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
175 | fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); never executed: fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); | 0 |
176 | } never executed: end of block | 0 |
177 | | - |
178 | | - |
179 | | - |
180 | void | - |
181 | chan_rcvd_ieof(struct ssh *ssh, Channel *c) | - |
182 | { | - |
183 | debug2("channel %d: rcvd eof", c->self); | - |
184 | c->flags |= 0x08; | - |
185 | if (c->ostate == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
186 | chan_set_ostate(c, 1); never executed: chan_set_ostate(c, 1); | 0 |
187 | if (c->ostate == 1TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
188 | sshbuf_len(c->output) == 0TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
189 | !(c->extended_usage == 2TRUE | never evaluated | FALSE | never evaluated |
&& c->efd != -1TRUE | never evaluated | FALSE | never evaluated |
&& (!(c->flags & (0x08|0x02))TRUE | never evaluated | FALSE | never evaluated |
|| sshbuf_len(c->extended) > 0TRUE | never evaluated | FALSE | never evaluated |
))) | 0 |
190 | chan_obuf_empty(ssh, c); never executed: chan_obuf_empty(ssh, c); | 0 |
191 | } never executed: end of block | 0 |
192 | | - |
193 | void | - |
194 | chan_rcvd_oclose(struct ssh *ssh, Channel *c) | - |
195 | { | - |
196 | debug2("channel %d: rcvd close", c->self); | - |
197 | if (!(c->flags & 0x10)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
198 | if (c->flags & 0x02TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
199 | error("channel %d: protocol error: close rcvd twice", never executed: error("channel %d: protocol error: close rcvd twice", c->self); | 0 |
200 | c->self); never executed: error("channel %d: protocol error: close rcvd twice", c->self); | 0 |
201 | c->flags |= 0x02; | - |
202 | } never executed: end of block | 0 |
203 | if (c->type == 10TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
204 | | - |
205 | chan_set_ostate(c, 3); | - |
206 | chan_set_istate(c, 3); | - |
207 | return; never executed: return; | 0 |
208 | } | - |
209 | switch (c->ostate) { | - |
210 | case never executed: case 0: 0:never executed: case 0: | 0 |
211 | | - |
212 | | - |
213 | | - |
214 | | - |
215 | chan_set_ostate(c, 1); | - |
216 | break; never executed: break; | 0 |
217 | } | - |
218 | switch (c->istate) { | - |
219 | case never executed: case 0: 0:never executed: case 0: | 0 |
220 | chan_shutdown_read(ssh, c); | - |
221 | chan_set_istate(c, 3); | - |
222 | break; never executed: break; | 0 |
223 | case never executed: case 1: 1:never executed: case 1: | 0 |
224 | if (!(c->flags & 0x10)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
225 | chan_send_eof2(ssh, c); never executed: chan_send_eof2(ssh, c); | 0 |
226 | chan_set_istate(c, 3); | - |
227 | break; never executed: break; | 0 |
228 | } | - |
229 | } never executed: end of block | 0 |
230 | | - |
231 | void | - |
232 | chan_write_failed(struct ssh *ssh, Channel *c) | - |
233 | { | - |
234 | debug2("channel %d: write failed", c->self); | - |
235 | switch (c->ostate) { | - |
236 | case never executed: case 0: 0:never executed: case 0: | 0 |
237 | case never executed: case 1: 1:never executed: case 1: | 0 |
238 | chan_shutdown_write(ssh, c); | - |
239 | if ( | - |
240 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
241 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
242 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
243 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
244 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
245 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
246 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
247 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
248 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
249 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
250 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
251 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
252 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
253 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
254 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
255 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
256 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
257 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
258 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
259 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
260 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
261 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
262 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
263 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
264 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
265 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
266 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
267 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
268 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
269 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
270 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
271 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
272 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
273 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
274 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
275 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
276 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
277 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
278 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
279 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
280 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
281 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
282 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
283 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
284 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
285 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
286 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( c->ctype ))[3] - __s2[3]); | 0 |
287 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( c->ctype ))[3] - __s2[3]); | 0 |
288 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
289 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
290 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
291 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
292 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
293 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
294 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
295 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
296 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
297 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
298 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
299 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
300 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
301 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
302 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
303 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
304 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
305 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
306 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
307 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
308 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
309 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
310 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
311 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
312 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
313 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
314 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "session" ))[3] - __s2[3]); | 0 |
315 | "session"TRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( "session" ))[3] - __s2[3]); | 0 |
316 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
317 | c->ctypeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
318 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
319 | "session"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
320 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
321 | == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
322 | chan_send_eow2(ssh, c); never executed: chan_send_eow2(ssh, c); | 0 |
323 | chan_set_ostate(c, 3); | - |
324 | break; never executed: break; | 0 |
325 | default never executed: default: :never executed: default: | 0 |
326 | error("channel %d: chan_write_failed for ostate %d", | - |
327 | c->self, c->ostate); | - |
328 | break; never executed: break; | 0 |
329 | } | - |
330 | } | - |
331 | | - |
332 | void | - |
333 | chan_mark_dead(struct ssh *ssh, Channel *c) | - |
334 | { | - |
335 | c->type = 14; | - |
336 | } never executed: end of block | 0 |
337 | | - |
338 | int | - |
339 | chan_is_dead(struct ssh *ssh, Channel *c, int do_send) | - |
340 | { | - |
341 | if (c->type == 14TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
342 | debug2("channel %d: zombie", c->self); | - |
343 | return never executed: return 1; 1;never executed: return 1; | 0 |
344 | } | - |
345 | if (c->istate != 3TRUE | never evaluated | FALSE | never evaluated |
|| c->ostate != 3TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
346 | return never executed: return 0; 0;never executed: return 0; | 0 |
347 | if ((TRUE | never evaluated | FALSE | never evaluated |
datafellows & 0x00200000)TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
348 | c->extended_usage == 2TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
349 | c->efd != -1TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
350 | sshbuf_len(c->extended) > 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
351 | debug2("channel %d: active efd: %d len %zu", | - |
352 | c->self, c->efd, sshbuf_len(c->extended)); | - |
353 | return never executed: return 0; 0;never executed: return 0; | 0 |
354 | } | - |
355 | if (c->flags & 0x10TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
356 | debug2("channel %d: is dead (local)", c->self); | - |
357 | return never executed: return 1; 1;never executed: return 1; | 0 |
358 | } | - |
359 | if (!(c->flags & 0x01)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
360 | if (do_sendTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
361 | chan_send_close2(ssh, c); | - |
362 | } never executed: end of block else { | 0 |
363 | | - |
364 | if (c->flags & 0x02TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
365 | debug2("channel %d: almost dead", | - |
366 | c->self); | - |
367 | return never executed: return 1; 1;never executed: return 1; | 0 |
368 | } | - |
369 | } never executed: end of block | 0 |
370 | } | - |
371 | if ((TRUE | never evaluated | FALSE | never evaluated |
c->flags & 0x01)TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
372 | (TRUE | never evaluated | FALSE | never evaluated |
c->flags & 0x02)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
373 | debug2("channel %d: is dead", c->self); | - |
374 | return never executed: return 1; 1;never executed: return 1; | 0 |
375 | } | - |
376 | return never executed: return 0; 0;never executed: return 0; | 0 |
377 | } | - |
378 | | - |
379 | | - |
380 | static void | - |
381 | chan_shutdown_write(struct ssh *ssh, Channel *c) | - |
382 | { | - |
383 | sshbuf_reset(c->output); | - |
384 | if (c->type == 10TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
385 | return; never executed: return; | 0 |
386 | | - |
387 | debug2("channel %d: close_write", c->self); | - |
388 | if (c->sock != -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
389 | if (shutdown(c->sock, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
390 | SHUT_WRTRUE | never evaluated | FALSE | never evaluated |
| 0 |
391 | ) < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
392 | debug2("channel %d: chan_shutdown_write: " never executed: debug2("channel %d: chan_shutdown_write: " "shutdown() failed for fd %d: %.100s", c->self, c->sock, strerror( (*__errno_location ()) )); | 0 |
393 | "shutdown() failed for fd %d: %.100s", never executed: debug2("channel %d: chan_shutdown_write: " "shutdown() failed for fd %d: %.100s", c->self, c->sock, strerror( (*__errno_location ()) )); | 0 |
394 | c->self, c->sock, strerror( never executed: debug2("channel %d: chan_shutdown_write: " "shutdown() failed for fd %d: %.100s", c->self, c->sock, strerror( (*__errno_location ()) )); | 0 |
395 | (*__errno_location ()) never executed: debug2("channel %d: chan_shutdown_write: " "shutdown() failed for fd %d: %.100s", c->self, c->sock, strerror( (*__errno_location ()) )); | 0 |
396 | )); never executed: debug2("channel %d: chan_shutdown_write: " "shutdown() failed for fd %d: %.100s", c->self, c->sock, strerror( (*__errno_location ()) )); | 0 |
397 | } never executed: end of block else { | 0 |
398 | if (channel_close_fd(ssh, &c->wfd) < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
399 | logit("channel %d: chan_shutdown_write: " never executed: logit("channel %d: chan_shutdown_write: " "close() failed for fd %d: %.100s", c->self, c->wfd, strerror( (*__errno_location ()) )); | 0 |
400 | "close() failed for fd %d: %.100s", never executed: logit("channel %d: chan_shutdown_write: " "close() failed for fd %d: %.100s", c->self, c->wfd, strerror( (*__errno_location ()) )); | 0 |
401 | c->self, c->wfd, strerror( never executed: logit("channel %d: chan_shutdown_write: " "close() failed for fd %d: %.100s", c->self, c->wfd, strerror( (*__errno_location ()) )); | 0 |
402 | (*__errno_location ()) never executed: logit("channel %d: chan_shutdown_write: " "close() failed for fd %d: %.100s", c->self, c->wfd, strerror( (*__errno_location ()) )); | 0 |
403 | )); never executed: logit("channel %d: chan_shutdown_write: " "close() failed for fd %d: %.100s", c->self, c->wfd, strerror( (*__errno_location ()) )); | 0 |
404 | } never executed: end of block | 0 |
405 | } | - |
406 | | - |
407 | static void | - |
408 | chan_shutdown_read(struct ssh *ssh, Channel *c) | - |
409 | { | - |
410 | if (c->type == 10TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
411 | return; never executed: return; | 0 |
412 | debug2("channel %d: close_read", c->self); | - |
413 | if (c->sock != -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
414 | | - |
415 | | - |
416 | | - |
417 | | - |
418 | | - |
419 | if (shutdown(c->sock, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
420 | SHUT_RDTRUE | never evaluated | FALSE | never evaluated |
| 0 |
421 | ) < 0TRUE | never evaluated | FALSE | never evaluated |
| 0 |
422 | && | - |
423 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
424 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
425 | 107TRUE | never evaluated | FALSE | never evaluated |
| 0 |
426 | ) | - |
427 | error("channel %d: chan_shutdown_read: " never executed: error("channel %d: chan_shutdown_read: " "shutdown() failed for fd %d [i%d o%d]: %.100s", c->self, c->sock, c->istate, c->ostate, strerror( (*__errno_location ()) )); | 0 |
428 | "shutdown() failed for fd %d [i%d o%d]: %.100s", never executed: error("channel %d: chan_shutdown_read: " "shutdown() failed for fd %d [i%d o%d]: %.100s", c->self, c->sock, c->istate, c->ostate, strerror( (*__errno_location ()) )); | 0 |
429 | c->self, c->sock, c->istate, c->ostate, never executed: error("channel %d: chan_shutdown_read: " "shutdown() failed for fd %d [i%d o%d]: %.100s", c->self, c->sock, c->istate, c->ostate, strerror( (*__errno_location ()) )); | 0 |
430 | strerror( never executed: error("channel %d: chan_shutdown_read: " "shutdown() failed for fd %d [i%d o%d]: %.100s", c->self, c->sock, c->istate, c->ostate, strerror( (*__errno_location ()) )); | 0 |
431 | (*__errno_location ()) never executed: error("channel %d: chan_shutdown_read: " "shutdown() failed for fd %d [i%d o%d]: %.100s", c->self, c->sock, c->istate, c->ostate, strerror( (*__errno_location ()) )); | 0 |
432 | )); never executed: error("channel %d: chan_shutdown_read: " "shutdown() failed for fd %d [i%d o%d]: %.100s", c->self, c->sock, c->istate, c->ostate, strerror( (*__errno_location ()) )); | 0 |
433 | } never executed: end of block else { | 0 |
434 | if (channel_close_fd(ssh, &c->rfd) < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
435 | logit("channel %d: chan_shutdown_read: " never executed: logit("channel %d: chan_shutdown_read: " "close() failed for fd %d: %.100s", c->self, c->rfd, strerror( (*__errno_location ()) )); | 0 |
436 | "close() failed for fd %d: %.100s", never executed: logit("channel %d: chan_shutdown_read: " "close() failed for fd %d: %.100s", c->self, c->rfd, strerror( (*__errno_location ()) )); | 0 |
437 | c->self, c->rfd, strerror( never executed: logit("channel %d: chan_shutdown_read: " "close() failed for fd %d: %.100s", c->self, c->rfd, strerror( (*__errno_location ()) )); | 0 |
438 | (*__errno_location ()) never executed: logit("channel %d: chan_shutdown_read: " "close() failed for fd %d: %.100s", c->self, c->rfd, strerror( (*__errno_location ()) )); | 0 |
439 | )); never executed: logit("channel %d: chan_shutdown_read: " "close() failed for fd %d: %.100s", c->self, c->rfd, strerror( (*__errno_location ()) )); | 0 |
440 | } never executed: end of block | 0 |
441 | } | - |
| | |