OpenCoverage

nchan.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/nchan.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6static void chan_send_eof2(struct ssh *, Channel *);-
7static void chan_send_eow2(struct ssh *, Channel *);-
8-
9-
10static void chan_shutdown_write(struct ssh *, Channel *);-
11static void chan_shutdown_read(struct ssh *, Channel *);-
12-
13static const char *ostates[] = { "open", "drain", "wait_ieof", "closed" };-
14static const char *istates[] = { "open", "drain", "wait_oclose", "closed" };-
15-
16static void-
17chan_set_istate(Channel *c, u_int next)-
18{-
19 if (c->istate > 3
c->istate > 3Description
TRUEnever evaluated
FALSEnever evaluated
|| next > 3
next > 3Description
TRUEnever evaluated
FALSEnever 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-
26static void-
27chan_set_ostate(Channel *c, u_int next)-
28{-
29 if (c->ostate > 3
c->ostate > 3Description
TRUEnever evaluated
FALSEnever evaluated
|| next > 3
next > 3Description
TRUEnever evaluated
FALSEnever 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-
36void-
37chan_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-
52void-
53chan_ibuf_empty(struct ssh *ssh, Channel *c)-
54{-
55 debug2("channel %d: ibuf empty", c->self);-
56 if (sshbuf_len(c->input)
sshbuf_len(c->input)Description
TRUEnever evaluated
FALSEnever 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))
!(c->flags & (0x01|0x10))Description
TRUEnever evaluated
FALSEnever 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-
74void-
75chan_obuf_empty(struct ssh *ssh, Channel *c)-
76{-
77 debug2("channel %d: obuf empty", c->self);-
78 if (sshbuf_len(c->output)
sshbuf_len(c->output)Description
TRUEnever evaluated
FALSEnever 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-
95void-
96chan_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-
107static void-
108chan_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_id
!c->have_remote_idDescription
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_st...ssh, 96)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 96)) != 0
(r = sshpkt_st...ssh, 96)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
119 (
(r = sshpkt_pu...mote_id)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_u32(ssh, c->remote_id)) != 0
(r = sshpkt_pu...mote_id)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
120 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever 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-
131static void-
132chan_send_close2(struct ssh *ssh, Channel *c)-
133{-
134 int r;-
135-
136 debug2("channel %d: send close", c->self);-
137 if (c->ostate != 3
c->ostate != 3Description
TRUEnever evaluated
FALSEnever evaluated
||
0
138 c->istate != 3
c->istate != 3Description
TRUEnever evaluated
FALSEnever 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 & 0x01
c->flags & 0x01Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
142 error("channel %d: already sent close", c->self);-
143 }
never executed: end of block
else {
0
144 if (!c->have_remote_id
!c->have_remote_idDescription
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_st...ssh, 97)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 97)) != 0
(r = sshpkt_st...ssh, 97)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
148 (
(r = sshpkt_pu...mote_id)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_u32(ssh, c->remote_id)) != 0
(r = sshpkt_pu...mote_id)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
149 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever 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-
155static void-
156chan_send_eow2(struct ssh *ssh, Channel *c)-
157{-
158 int r;-
159-
160 debug2("channel %d: send eow", c->self);-
161 if (c->ostate == 3
c->ostate == 3Description
TRUEnever evaluated
FALSEnever 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)
!(datafellows & 0x04000000)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
167 return;
never executed: return;
0
168 if (!c->have_remote_id
!c->have_remote_idDescription
TRUEnever evaluated
FALSEnever 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 ((
(r = sshpkt_st...ssh, 98)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_start(ssh, 98)) != 0
(r = sshpkt_st...ssh, 98)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
171 (
(r = sshpkt_pu...mote_id)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_u32(ssh, c->remote_id)) != 0
(r = sshpkt_pu...mote_id)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
172 (
(r = sshpkt_pu...sh.com")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0
(r = sshpkt_pu...sh.com")) != 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
173 (
(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
174 (
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshpkt_send(ssh)) != 0
(r = sshpkt_send(ssh)) != 0Description
TRUEnever evaluated
FALSEnever 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-
180void-
181chan_rcvd_ieof(struct ssh *ssh, Channel *c)-
182{-
183 debug2("channel %d: rcvd eof", c->self);-
184 c->flags |= 0x08;-
185 if (c->ostate == 0
c->ostate == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
186 chan_set_ostate(c, 1);
never executed: chan_set_ostate(c, 1);
0
187 if (c->ostate == 1
c->ostate == 1Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
188 sshbuf_len(c->output) == 0
sshbuf_len(c->output) == 0Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
189 !(c->extended_usage == 2
c->extended_usage == 2Description
TRUEnever evaluated
FALSEnever evaluated
&& c->efd != -1
c->efd != -1Description
TRUEnever evaluated
FALSEnever evaluated
&& (!(c->flags & (0x08|0x02))
!(c->flags & (0x08|0x02))Description
TRUEnever evaluated
FALSEnever evaluated
|| sshbuf_len(c->extended) > 0
sshbuf_len(c->extended) > 0Description
TRUEnever evaluated
FALSEnever evaluated
)))
0
190 chan_obuf_empty(ssh, c);
never executed: chan_obuf_empty(ssh, c);
0
191}
never executed: end of block
0
192-
193void-
194chan_rcvd_oclose(struct ssh *ssh, Channel *c)-
195{-
196 debug2("channel %d: rcvd close", c->self);-
197 if (!(c->flags & 0x10)
!(c->flags & 0x10)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
198 if (c->flags & 0x02
c->flags & 0x02Description
TRUEnever evaluated
FALSEnever 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 == 10
c->type == 10Description
TRUEnever evaluated
FALSEnever 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)
!(c->flags & 0x10)Description
TRUEnever evaluated
FALSEnever 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-
231void-
232chan_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 (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
241 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
242 ) && __builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
243 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
244 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
245 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
246 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
247 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
248 ), (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
249 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
250 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
251 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
252 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
253 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
254 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
255 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
256 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
257 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
258 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
259 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
260 ) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
261 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
262 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
263 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
264 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
265 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
266 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
267 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
268 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
269 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
270 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
271 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
272 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
273 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
274 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
275 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
276 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
277 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
278 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
279 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
280 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
281 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
282 ))[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
283 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
284 ))[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
285 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
286 ))[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 *) ( c->ctype ))[3] - __s2[3]);
0
287 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( c->ctype ))[3] - __s2[3]);
0
288 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
289 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
290 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
291 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
292 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
293 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
294 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
295 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
296 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
297 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
298 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
299 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
300 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
301 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
302 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
303 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
304 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
305 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
306 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
307 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
308 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
309 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
310 ))[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
311 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
312 ))[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
313 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
314 ))[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 *) ( "session" ))[3] - __s2[3]);
0
315 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( "session" ))[3] - __s2[3]);
0
316 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
317 c->ctype
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
318 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
319 "session"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
320 )))); })
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
321 == 0
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever 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-
332void-
333chan_mark_dead(struct ssh *ssh, Channel *c)-
334{-
335 c->type = 14;-
336}
never executed: end of block
0
337-
338int-
339chan_is_dead(struct ssh *ssh, Channel *c, int do_send)-
340{-
341 if (c->type == 14
c->type == 14Description
TRUEnever evaluated
FALSEnever 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 != 3
c->istate != 3Description
TRUEnever evaluated
FALSEnever evaluated
|| c->ostate != 3
c->ostate != 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
346 return
never executed: return 0;
0;
never executed: return 0;
0
347 if ((
(datafellows & 0x00200000)Description
TRUEnever evaluated
FALSEnever evaluated
datafellows & 0x00200000)
(datafellows & 0x00200000)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
348 c->extended_usage == 2
c->extended_usage == 2Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
349 c->efd != -1
c->efd != -1Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
350 sshbuf_len(c->extended) > 0
sshbuf_len(c->extended) > 0Description
TRUEnever evaluated
FALSEnever 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 & 0x10
c->flags & 0x10Description
TRUEnever evaluated
FALSEnever 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)
!(c->flags & 0x01)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
360 if (do_send
do_sendDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
361 chan_send_close2(ssh, c);-
362 }
never executed: end of block
else {
0
363-
364 if (c->flags & 0x02
c->flags & 0x02Description
TRUEnever evaluated
FALSEnever 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 ((
(c->flags & 0x01)Description
TRUEnever evaluated
FALSEnever evaluated
c->flags & 0x01)
(c->flags & 0x01)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
372 (
(c->flags & 0x02)Description
TRUEnever evaluated
FALSEnever evaluated
c->flags & 0x02)
(c->flags & 0x02)Description
TRUEnever evaluated
FALSEnever 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-
380static void-
381chan_shutdown_write(struct ssh *ssh, Channel *c)-
382{-
383 sshbuf_reset(c->output);-
384 if (c->type == 10
c->type == 10Description
TRUEnever evaluated
FALSEnever evaluated
)
0
385 return;
never executed: return;
0
386-
387 debug2("channel %d: close_write", c->self);-
388 if (c->sock != -1
c->sock != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
389 if (shutdown(c->sock,
shutdown(c->so... SHUT_WR ) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
390 SHUT_WR
shutdown(c->so... SHUT_WR ) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
391 ) < 0
shutdown(c->so... SHUT_WR ) < 0Description
TRUEnever evaluated
FALSEnever 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) < 0
channel_close_..., &c->wfd) < 0Description
TRUEnever evaluated
FALSEnever 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-
407static void-
408chan_shutdown_read(struct ssh *ssh, Channel *c)-
409{-
410 if (c->type == 10
c->type == 10Description
TRUEnever evaluated
FALSEnever evaluated
)
0
411 return;
never executed: return;
0
412 debug2("channel %d: close_read", c->self);-
413 if (c->sock != -1
c->sock != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
414-
415-
416-
417-
418-
419 if (shutdown(c->sock,
shutdown(c->so... SHUT_RD ) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
420 SHUT_RD
shutdown(c->so... SHUT_RD ) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
421 ) < 0
shutdown(c->so... SHUT_RD ) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
422 && -
423 (*
(*__errno_location ()) != 107Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) != 107Description
TRUEnever evaluated
FALSEnever evaluated
0
424 !=
(*__errno_location ()) != 107Description
TRUEnever evaluated
FALSEnever evaluated
0
425 107
(*__errno_location ()) != 107Description
TRUEnever evaluated
FALSEnever 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) < 0
channel_close_..., &c->rfd) < 0Description
TRUEnever evaluated
FALSEnever 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}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2