Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/bss_acpt.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | typedef struct bio_accept_st { | - | ||||||||||||
5 | int state; | - | ||||||||||||
6 | int accept_family; | - | ||||||||||||
7 | int bind_mode; | - | ||||||||||||
8 | int accepted_mode; | - | ||||||||||||
9 | char *param_addr; | - | ||||||||||||
10 | char *param_serv; | - | ||||||||||||
11 | - | |||||||||||||
12 | int accept_sock; | - | ||||||||||||
13 | - | |||||||||||||
14 | BIO_ADDRINFO *addr_first; | - | ||||||||||||
15 | const BIO_ADDRINFO *addr_iter; | - | ||||||||||||
16 | BIO_ADDR cache_accepting_addr; | - | ||||||||||||
17 | char *cache_accepting_name, *cache_accepting_serv; | - | ||||||||||||
18 | BIO_ADDR cache_peer_addr; | - | ||||||||||||
19 | char *cache_peer_name, *cache_peer_serv; | - | ||||||||||||
20 | - | |||||||||||||
21 | BIO *bio_chain; | - | ||||||||||||
22 | } BIO_ACCEPT; | - | ||||||||||||
23 | - | |||||||||||||
24 | static int acpt_write(BIO *h, const char *buf, int num); | - | ||||||||||||
25 | static int acpt_read(BIO *h, char *buf, int size); | - | ||||||||||||
26 | static int acpt_puts(BIO *h, const char *str); | - | ||||||||||||
27 | static long acpt_ctrl(BIO *h, int cmd, long arg1, void *arg2); | - | ||||||||||||
28 | static int acpt_new(BIO *h); | - | ||||||||||||
29 | static int acpt_free(BIO *data); | - | ||||||||||||
30 | static int acpt_state(BIO *b, BIO_ACCEPT *c); | - | ||||||||||||
31 | static void acpt_close_socket(BIO *data); | - | ||||||||||||
32 | static BIO_ACCEPT *BIO_ACCEPT_new(void); | - | ||||||||||||
33 | static void BIO_ACCEPT_free(BIO_ACCEPT *a); | - | ||||||||||||
34 | static const BIO_METHOD methods_acceptp = { | - | ||||||||||||
35 | (13|0x0400|0x0100), | - | ||||||||||||
36 | "socket accept", | - | ||||||||||||
37 | - | |||||||||||||
38 | bwrite_conv, | - | ||||||||||||
39 | acpt_write, | - | ||||||||||||
40 | - | |||||||||||||
41 | bread_conv, | - | ||||||||||||
42 | acpt_read, | - | ||||||||||||
43 | acpt_puts, | - | ||||||||||||
44 | - | |||||||||||||
45 | ((void *)0) | - | ||||||||||||
46 | , | - | ||||||||||||
47 | acpt_ctrl, | - | ||||||||||||
48 | acpt_new, | - | ||||||||||||
49 | acpt_free, | - | ||||||||||||
50 | - | |||||||||||||
51 | ((void *)0) | - | ||||||||||||
52 | , | - | ||||||||||||
53 | }; | - | ||||||||||||
54 | - | |||||||||||||
55 | const BIO_METHOD *BIO_s_accept(void) | - | ||||||||||||
56 | { | - | ||||||||||||
57 | return executed 2 times by 1 test: &methods_acceptp;return &methods_acceptp; Executed by:
executed 2 times by 1 test: return &methods_acceptp; Executed by:
| 2 | ||||||||||||
58 | } | - | ||||||||||||
59 | - | |||||||||||||
60 | static int acpt_new(BIO *bi) | - | ||||||||||||
61 | { | - | ||||||||||||
62 | BIO_ACCEPT *ba; | - | ||||||||||||
63 | - | |||||||||||||
64 | bi->init = 0; | - | ||||||||||||
65 | bi->num = (int)(-1); | - | ||||||||||||
66 | bi->flags = 0; | - | ||||||||||||
67 | if ((
| 0-2 | ||||||||||||
68 | ((void *)0)
| 0-2 | ||||||||||||
69 | ) | - | ||||||||||||
70 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
71 | bi->ptr = (char *)ba; | - | ||||||||||||
72 | ba->state = 1; | - | ||||||||||||
73 | bi->shutdown = 1; | - | ||||||||||||
74 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||
75 | } | - | ||||||||||||
76 | - | |||||||||||||
77 | static BIO_ACCEPT *BIO_ACCEPT_new(void) | - | ||||||||||||
78 | { | - | ||||||||||||
79 | BIO_ACCEPT *ret; | - | ||||||||||||
80 | - | |||||||||||||
81 | if ((
| 0-2 | ||||||||||||
82 | ((void *)0)
| 0-2 | ||||||||||||
83 | ) { | - | ||||||||||||
84 | ERR_put_error(32,(152),((1|64)),__FILE__,96); | - | ||||||||||||
85 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
86 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
87 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
88 | } | - | ||||||||||||
89 | ret->accept_family = 256; | - | ||||||||||||
90 | ret->accept_sock = (int)(-1); | - | ||||||||||||
91 | return executed 2 times by 1 test: ret;return ret; Executed by:
executed 2 times by 1 test: return ret; Executed by:
| 2 | ||||||||||||
92 | } | - | ||||||||||||
93 | - | |||||||||||||
94 | static void BIO_ACCEPT_free(BIO_ACCEPT *a) | - | ||||||||||||
95 | { | - | ||||||||||||
96 | if (a ==
| 0-2 | ||||||||||||
97 | ((void *)0)
| 0-2 | ||||||||||||
98 | ) | - | ||||||||||||
99 | return; never executed: return; | 0 | ||||||||||||
100 | CRYPTO_free(a->param_addr, __FILE__, 108); | - | ||||||||||||
101 | CRYPTO_free(a->param_serv, __FILE__, 109); | - | ||||||||||||
102 | BIO_ADDRINFO_free(a->addr_first); | - | ||||||||||||
103 | CRYPTO_free(a->cache_accepting_name, __FILE__, 111); | - | ||||||||||||
104 | CRYPTO_free(a->cache_accepting_serv, __FILE__, 112); | - | ||||||||||||
105 | CRYPTO_free(a->cache_peer_name, __FILE__, 113); | - | ||||||||||||
106 | CRYPTO_free(a->cache_peer_serv, __FILE__, 114); | - | ||||||||||||
107 | BIO_free(a->bio_chain); | - | ||||||||||||
108 | CRYPTO_free(a, __FILE__, 116); | - | ||||||||||||
109 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
110 | - | |||||||||||||
111 | static void acpt_close_socket(BIO *bio) | - | ||||||||||||
112 | { | - | ||||||||||||
113 | BIO_ACCEPT *c; | - | ||||||||||||
114 | - | |||||||||||||
115 | c = (BIO_ACCEPT *)bio->ptr; | - | ||||||||||||
116 | if (c->accept_sock != (int)(-1)
| 0-2 | ||||||||||||
117 | shutdown(c->accept_sock, 2); | - | ||||||||||||
118 | close(c->accept_sock); | - | ||||||||||||
119 | c->accept_sock = (int)(-1); | - | ||||||||||||
120 | bio->num = (int)(-1); | - | ||||||||||||
121 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
122 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
123 | - | |||||||||||||
124 | static int acpt_free(BIO *a) | - | ||||||||||||
125 | { | - | ||||||||||||
126 | BIO_ACCEPT *data; | - | ||||||||||||
127 | - | |||||||||||||
128 | if (a ==
| 0-2 | ||||||||||||
129 | ((void *)0)
| 0-2 | ||||||||||||
130 | ) | - | ||||||||||||
131 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
132 | data = (BIO_ACCEPT *)a->ptr; | - | ||||||||||||
133 | - | |||||||||||||
134 | if (a->shutdown
| 0-2 | ||||||||||||
135 | acpt_close_socket(a); | - | ||||||||||||
136 | BIO_ACCEPT_free(data); | - | ||||||||||||
137 | a->ptr = | - | ||||||||||||
138 | ((void *)0) | - | ||||||||||||
139 | ; | - | ||||||||||||
140 | a->flags = 0; | - | ||||||||||||
141 | a->init = 0; | - | ||||||||||||
142 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
143 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||
144 | } | - | ||||||||||||
145 | - | |||||||||||||
146 | static int acpt_state(BIO *b, BIO_ACCEPT *c) | - | ||||||||||||
147 | { | - | ||||||||||||
148 | BIO *bio = | - | ||||||||||||
149 | ((void *)0) | - | ||||||||||||
150 | , *dbio; | - | ||||||||||||
151 | int s = -1, ret = -1; | - | ||||||||||||
152 | - | |||||||||||||
153 | for (;;) { | - | ||||||||||||
154 | switch (c->state) { | - | ||||||||||||
155 | case executed 2 times by 1 test: 1:case 1: Executed by:
executed 2 times by 1 test: case 1: Executed by:
| 2 | ||||||||||||
156 | if (c->param_addr ==
| 0-2 | ||||||||||||
157 | ((void *)0)
| 0-2 | ||||||||||||
158 | && c->param_serv ==
| 0 | ||||||||||||
159 | ((void *)0)
| 0 | ||||||||||||
160 | ) { | - | ||||||||||||
161 | ERR_put_error(32,(100),(143),__FILE__,159); | - | ||||||||||||
162 | ERR_add_error_data(4, | - | ||||||||||||
163 | "hostname=", c->param_addr, | - | ||||||||||||
164 | " service=", c->param_serv); | - | ||||||||||||
165 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
166 | } | - | ||||||||||||
167 | - | |||||||||||||
168 | - | |||||||||||||
169 | - | |||||||||||||
170 | - | |||||||||||||
171 | - | |||||||||||||
172 | CRYPTO_free(c->cache_accepting_name, __FILE__, 170); | - | ||||||||||||
173 | c->cache_accepting_name = | - | ||||||||||||
174 | ((void *)0) | - | ||||||||||||
175 | ; | - | ||||||||||||
176 | CRYPTO_free(c->cache_accepting_serv, __FILE__, 172); | - | ||||||||||||
177 | c->cache_accepting_serv = | - | ||||||||||||
178 | ((void *)0) | - | ||||||||||||
179 | ; | - | ||||||||||||
180 | CRYPTO_free(c->cache_peer_name, __FILE__, 174); | - | ||||||||||||
181 | c->cache_peer_name = | - | ||||||||||||
182 | ((void *)0) | - | ||||||||||||
183 | ; | - | ||||||||||||
184 | CRYPTO_free(c->cache_peer_serv, __FILE__, 176); | - | ||||||||||||
185 | c->cache_peer_serv = | - | ||||||||||||
186 | ((void *)0) | - | ||||||||||||
187 | ; | - | ||||||||||||
188 | - | |||||||||||||
189 | c->state = 2; | - | ||||||||||||
190 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
191 | - | |||||||||||||
192 | case executed 2 times by 1 test: 2:case 2: Executed by:
executed 2 times by 1 test: case 2: Executed by:
| 2 | ||||||||||||
193 | { | - | ||||||||||||
194 | int family = | - | ||||||||||||
195 | 0 | - | ||||||||||||
196 | ; | - | ||||||||||||
197 | switch (c->accept_family) { | - | ||||||||||||
198 | case executed 1 time by 1 test: 6:case 6: Executed by:
executed 1 time by 1 test: case 6: Executed by:
| 1 | ||||||||||||
199 | if (1) { | - | ||||||||||||
200 | - | |||||||||||||
201 | - | |||||||||||||
202 | - | |||||||||||||
203 | - | |||||||||||||
204 | family = | - | ||||||||||||
205 | 10 | - | ||||||||||||
206 | ; | - | ||||||||||||
207 | } executed 1 time by 1 test: else {end of block Executed by:
dead code: { ERR_put_error(32,(100),(145),__FILE__,195); goto exit_loop; } | - | ||||||||||||
208 | - | |||||||||||||
209 | ERR_put_error(32,(100),(145),__FILE__,195); dead code: { ERR_put_error(32,(100),(145),__FILE__,195); goto exit_loop; } | - | ||||||||||||
210 | goto exit_loop; dead code: { ERR_put_error(32,(100),(145),__FILE__,195); goto exit_loop; } | - | ||||||||||||
211 | } dead code: { ERR_put_error(32,(100),(145),__FILE__,195); goto exit_loop; } | - | ||||||||||||
212 | break; executed 1 time by 1 test: break; Executed by:
| 1 | ||||||||||||
213 | case executed 1 time by 1 test: 4:case 4: Executed by:
executed 1 time by 1 test: case 4: Executed by:
| 1 | ||||||||||||
214 | family = | - | ||||||||||||
215 | 2 | - | ||||||||||||
216 | ; | - | ||||||||||||
217 | break; executed 1 time by 1 test: break; Executed by:
| 1 | ||||||||||||
218 | case never executed: 256:case 256: never executed: case 256: | 0 | ||||||||||||
219 | family = | - | ||||||||||||
220 | 0 | - | ||||||||||||
221 | ; | - | ||||||||||||
222 | break; never executed: break; | 0 | ||||||||||||
223 | default never executed: :default: never executed: default: | 0 | ||||||||||||
224 | ERR_put_error(32,(100),(146),__FILE__,206); | - | ||||||||||||
225 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
226 | } | - | ||||||||||||
227 | if (BIO_lookup(c->param_addr, c->param_serv, BIO_LOOKUP_SERVER,
| 0-2 | ||||||||||||
228 | family,
| 0-2 | ||||||||||||
229 | SOCK_STREAM
| 0-2 | ||||||||||||
230 | , &c->addr_first) == 0
| 0-2 | ||||||||||||
231 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
232 | } | - | ||||||||||||
233 | if (c->addr_first ==
| 0-2 | ||||||||||||
234 | ((void *)0)
| 0-2 | ||||||||||||
235 | ) { | - | ||||||||||||
236 | ERR_put_error(32,(100),(142),__FILE__,214); | - | ||||||||||||
237 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
238 | } | - | ||||||||||||
239 | - | |||||||||||||
240 | - | |||||||||||||
241 | - | |||||||||||||
242 | c->addr_iter = c->addr_first; | - | ||||||||||||
243 | c->state = 3; | - | ||||||||||||
244 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
245 | - | |||||||||||||
246 | case executed 2 times by 1 test: 3:case 3: Executed by:
executed 2 times by 1 test: case 3: Executed by:
| 2 | ||||||||||||
247 | ret = BIO_socket(BIO_ADDRINFO_family(c->addr_iter), | - | ||||||||||||
248 | BIO_ADDRINFO_socktype(c->addr_iter), | - | ||||||||||||
249 | BIO_ADDRINFO_protocol(c->addr_iter), 0); | - | ||||||||||||
250 | if (ret == (int)(-1)
| 0-2 | ||||||||||||
251 | ERR_put_error(2,(4),( | - | ||||||||||||
252 | (*__errno_location ()) | - | ||||||||||||
253 | ),__FILE__,229); | - | ||||||||||||
254 | ERR_add_error_data(4, | - | ||||||||||||
255 | "hostname=", c->param_addr, | - | ||||||||||||
256 | " service=", c->param_serv); | - | ||||||||||||
257 | ERR_put_error(32,(100),(118),__FILE__,233); | - | ||||||||||||
258 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
259 | } | - | ||||||||||||
260 | c->accept_sock = ret; | - | ||||||||||||
261 | b->num = ret; | - | ||||||||||||
262 | c->state = 4; | - | ||||||||||||
263 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
264 | - | |||||||||||||
265 | case executed 2 times by 1 test: 4:case 4: Executed by:
executed 2 times by 1 test: case 4: Executed by:
| 2 | ||||||||||||
266 | { | - | ||||||||||||
267 | if (!BIO_listen(c->accept_sock,
| 0-2 | ||||||||||||
268 | BIO_ADDRINFO_address(c->addr_iter),
| 0-2 | ||||||||||||
269 | c->bind_mode)
| 0-2 | ||||||||||||
270 | BIO_closesocket(c->accept_sock); | - | ||||||||||||
271 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
272 | } | - | ||||||||||||
273 | } | - | ||||||||||||
274 | - | |||||||||||||
275 | { | - | ||||||||||||
276 | union BIO_sock_info_u info; | - | ||||||||||||
277 | - | |||||||||||||
278 | info.addr = &c->cache_accepting_addr; | - | ||||||||||||
279 | if (!BIO_sock_info(c->accept_sock, BIO_SOCK_INFO_ADDRESS,
| 0-2 | ||||||||||||
280 | &info)
| 0-2 | ||||||||||||
281 | BIO_closesocket(c->accept_sock); | - | ||||||||||||
282 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
283 | } | - | ||||||||||||
284 | } | - | ||||||||||||
285 | - | |||||||||||||
286 | c->cache_accepting_name = | - | ||||||||||||
287 | BIO_ADDR_hostname_string(&c->cache_accepting_addr, 1); | - | ||||||||||||
288 | c->cache_accepting_serv = | - | ||||||||||||
289 | BIO_ADDR_service_string(&c->cache_accepting_addr, 1); | - | ||||||||||||
290 | c->state = 5; | - | ||||||||||||
291 | s = -1; | - | ||||||||||||
292 | ret = 1; | - | ||||||||||||
293 | goto executed 2 times by 1 test: end;goto end; Executed by:
executed 2 times by 1 test: goto end; Executed by:
| 2 | ||||||||||||
294 | - | |||||||||||||
295 | case executed 2 times by 1 test: 5:case 5: Executed by:
executed 2 times by 1 test: case 5: Executed by:
| 2 | ||||||||||||
296 | if (b->next_bio !=
| 0-2 | ||||||||||||
297 | ((void *)0)
| 0-2 | ||||||||||||
298 | ) { | - | ||||||||||||
299 | c->state = 6; | - | ||||||||||||
300 | break; never executed: break; | 0 | ||||||||||||
301 | } | - | ||||||||||||
302 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||
303 | b->retry_reason = 0; | - | ||||||||||||
304 | - | |||||||||||||
305 | CRYPTO_free(c->cache_peer_name, __FILE__, 279); | - | ||||||||||||
306 | c->cache_peer_name = | - | ||||||||||||
307 | ((void *)0) | - | ||||||||||||
308 | ; | - | ||||||||||||
309 | CRYPTO_free(c->cache_peer_serv, __FILE__, 281); | - | ||||||||||||
310 | c->cache_peer_serv = | - | ||||||||||||
311 | ((void *)0) | - | ||||||||||||
312 | ; | - | ||||||||||||
313 | - | |||||||||||||
314 | s = BIO_accept_ex(c->accept_sock, &c->cache_peer_addr, | - | ||||||||||||
315 | c->accepted_mode); | - | ||||||||||||
316 | - | |||||||||||||
317 | - | |||||||||||||
318 | - | |||||||||||||
319 | - | |||||||||||||
320 | if (s < 0
| 0-2 | ||||||||||||
321 | if (BIO_sock_should_retry(s)
| 0 | ||||||||||||
322 | BIO_set_flags(b, (0x04|0x08)); | - | ||||||||||||
323 | b->retry_reason = 0x03; | - | ||||||||||||
324 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||
325 | } | - | ||||||||||||
326 | } never executed: end of block | 0 | ||||||||||||
327 | - | |||||||||||||
328 | - | |||||||||||||
329 | if (s < 0
| 0-2 | ||||||||||||
330 | ret = s; | - | ||||||||||||
331 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
332 | } | - | ||||||||||||
333 | - | |||||||||||||
334 | bio = BIO_new_socket(s, 0x01); | - | ||||||||||||
335 | if (bio ==
| 0-2 | ||||||||||||
336 | ((void *)0)
| 0-2 | ||||||||||||
337 | ) | - | ||||||||||||
338 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
339 | - | |||||||||||||
340 | BIO_set_callback(bio, BIO_get_callback(b)); | - | ||||||||||||
341 | BIO_set_callback_arg(bio, BIO_get_callback_arg(b)); | - | ||||||||||||
342 | - | |||||||||||||
343 | - | |||||||||||||
344 | - | |||||||||||||
345 | - | |||||||||||||
346 | - | |||||||||||||
347 | if (c->bio_chain !=
| 0-2 | ||||||||||||
348 | ((void *)0)
| 0-2 | ||||||||||||
349 | ) { | - | ||||||||||||
350 | if ((
| 0 | ||||||||||||
351 | ((void *)0)
| 0 | ||||||||||||
352 | ) | - | ||||||||||||
353 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
354 | if (!BIO_push(dbio, bio)
| 0 | ||||||||||||
355 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
356 | bio = dbio; | - | ||||||||||||
357 | } never executed: end of block | 0 | ||||||||||||
358 | if (BIO_push(b, bio) ==
| 0-2 | ||||||||||||
359 | ((void *)0)
| 0-2 | ||||||||||||
360 | ) | - | ||||||||||||
361 | goto never executed: exit_loop;goto exit_loop; never executed: goto exit_loop; | 0 | ||||||||||||
362 | - | |||||||||||||
363 | c->cache_peer_name = | - | ||||||||||||
364 | BIO_ADDR_hostname_string(&c->cache_peer_addr, 1); | - | ||||||||||||
365 | c->cache_peer_serv = | - | ||||||||||||
366 | BIO_ADDR_service_string(&c->cache_peer_addr, 1); | - | ||||||||||||
367 | c->state = 6; | - | ||||||||||||
368 | bio = | - | ||||||||||||
369 | ((void *)0) | - | ||||||||||||
370 | ; | - | ||||||||||||
371 | ret = 1; | - | ||||||||||||
372 | goto executed 2 times by 1 test: end;goto end; Executed by:
executed 2 times by 1 test: goto end; Executed by:
| 2 | ||||||||||||
373 | - | |||||||||||||
374 | case never executed: 6:case 6: never executed: case 6: | 0 | ||||||||||||
375 | if (b->next_bio ==
| 0 | ||||||||||||
376 | ((void *)0)
| 0 | ||||||||||||
377 | ) { | - | ||||||||||||
378 | c->state = 5; | - | ||||||||||||
379 | break; never executed: break; | 0 | ||||||||||||
380 | } | - | ||||||||||||
381 | ret = 1; | - | ||||||||||||
382 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||
383 | - | |||||||||||||
384 | default never executed: :default: never executed: default: | 0 | ||||||||||||
385 | ret = 0; | - | ||||||||||||
386 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||
387 | } | - | ||||||||||||
388 | } | - | ||||||||||||
389 | - | |||||||||||||
390 | exit_loop: code before this statement never executed: exit_loop: | 0 | ||||||||||||
391 | if (bio !=
| 0 | ||||||||||||
392 | ((void *)0)
| 0 | ||||||||||||
393 | ) | - | ||||||||||||
394 | BIO_free(bio); never executed: BIO_free(bio); | 0 | ||||||||||||
395 | else if (s >= 0
| 0 | ||||||||||||
396 | BIO_closesocket(s); never executed: BIO_closesocket(s); | 0 | ||||||||||||
397 | end: code before this statement never executed: end: | 0 | ||||||||||||
398 | return executed 4 times by 1 test: ret;return ret; Executed by:
executed 4 times by 1 test: return ret; Executed by:
| 4 | ||||||||||||
399 | } | - | ||||||||||||
400 | - | |||||||||||||
401 | static int acpt_read(BIO *b, char *out, int outl) | - | ||||||||||||
402 | { | - | ||||||||||||
403 | int ret = 0; | - | ||||||||||||
404 | BIO_ACCEPT *data; | - | ||||||||||||
405 | - | |||||||||||||
406 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||
407 | data = (BIO_ACCEPT *)b->ptr; | - | ||||||||||||
408 | - | |||||||||||||
409 | while (b->next_bio ==
| 0 | ||||||||||||
410 | ((void *)0)
| 0 | ||||||||||||
411 | ) { | - | ||||||||||||
412 | ret = acpt_state(b, data); | - | ||||||||||||
413 | if (ret <= 0
| 0 | ||||||||||||
414 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
415 | } never executed: end of block | 0 | ||||||||||||
416 | - | |||||||||||||
417 | ret = BIO_read(b->next_bio, out, outl); | - | ||||||||||||
418 | BIO_copy_next_retry(b); | - | ||||||||||||
419 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
420 | } | - | ||||||||||||
421 | - | |||||||||||||
422 | static int acpt_write(BIO *b, const char *in, int inl) | - | ||||||||||||
423 | { | - | ||||||||||||
424 | int ret; | - | ||||||||||||
425 | BIO_ACCEPT *data; | - | ||||||||||||
426 | - | |||||||||||||
427 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||
428 | data = (BIO_ACCEPT *)b->ptr; | - | ||||||||||||
429 | - | |||||||||||||
430 | while (b->next_bio ==
| 0 | ||||||||||||
431 | ((void *)0)
| 0 | ||||||||||||
432 | ) { | - | ||||||||||||
433 | ret = acpt_state(b, data); | - | ||||||||||||
434 | if (ret <= 0
| 0 | ||||||||||||
435 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
436 | } never executed: end of block | 0 | ||||||||||||
437 | - | |||||||||||||
438 | ret = BIO_write(b->next_bio, in, inl); | - | ||||||||||||
439 | BIO_copy_next_retry(b); | - | ||||||||||||
440 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
441 | } | - | ||||||||||||
442 | - | |||||||||||||
443 | static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr) | - | ||||||||||||
444 | { | - | ||||||||||||
445 | int *ip; | - | ||||||||||||
446 | long ret = 1; | - | ||||||||||||
447 | BIO_ACCEPT *data; | - | ||||||||||||
448 | char **pp; | - | ||||||||||||
449 | - | |||||||||||||
450 | data = (BIO_ACCEPT *)b->ptr; | - | ||||||||||||
451 | - | |||||||||||||
452 | switch (cmd) { | - | ||||||||||||
453 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||
454 | ret = 0; | - | ||||||||||||
455 | data->state = 1; | - | ||||||||||||
456 | acpt_close_socket(b); | - | ||||||||||||
457 | BIO_ADDRINFO_free(data->addr_first); | - | ||||||||||||
458 | data->addr_first = | - | ||||||||||||
459 | ((void *)0) | - | ||||||||||||
460 | ; | - | ||||||||||||
461 | b->flags = 0; | - | ||||||||||||
462 | break; never executed: break; | 0 | ||||||||||||
463 | case executed 4 times by 1 test: 101:case 101: Executed by:
executed 4 times by 1 test: case 101: Executed by:
| 4 | ||||||||||||
464 | - | |||||||||||||
465 | ret = (long)acpt_state(b, data); | - | ||||||||||||
466 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||
467 | case executed 4 times by 1 test: 118:case 118: Executed by:
executed 4 times by 1 test: case 118: Executed by:
| 4 | ||||||||||||
468 | if (ptr !=
| 0-4 | ||||||||||||
469 | ((void *)0)
| 0-4 | ||||||||||||
470 | ) { | - | ||||||||||||
471 | if (num == 0
| 2 | ||||||||||||
472 | char *hold_serv = data->param_serv; | - | ||||||||||||
473 | - | |||||||||||||
474 | - | |||||||||||||
475 | - | |||||||||||||
476 | - | |||||||||||||
477 | CRYPTO_free(data->param_addr, __FILE__, 425); | - | ||||||||||||
478 | data->param_addr = | - | ||||||||||||
479 | ((void *)0) | - | ||||||||||||
480 | ; | - | ||||||||||||
481 | ret = BIO_parse_hostserv(ptr, | - | ||||||||||||
482 | &data->param_addr, | - | ||||||||||||
483 | &data->param_serv, | - | ||||||||||||
484 | BIO_PARSE_PRIO_SERV); | - | ||||||||||||
485 | if (hold_serv != data->param_serv
| 0-2 | ||||||||||||
486 | CRYPTO_free(hold_serv, __FILE__, 432); executed 2 times by 1 test: CRYPTO_free(hold_serv, __FILE__, 432); Executed by:
| 2 | ||||||||||||
487 | b->init = 1; | - | ||||||||||||
488 | } executed 2 times by 1 test: else if (num == 1end of block Executed by:
| 0-2 | ||||||||||||
489 | CRYPTO_free(data->param_serv, __FILE__, 435); | - | ||||||||||||
490 | data->param_serv = CRYPTO_strdup(ptr, __FILE__, 436); | - | ||||||||||||
491 | b->init = 1; | - | ||||||||||||
492 | } never executed: else if (num == 2end of block
| 0-2 | ||||||||||||
493 | data->bind_mode |= 0x08; | - | ||||||||||||
494 | } never executed: else if (num == 3end of block
| 0-2 | ||||||||||||
495 | BIO_free(data->bio_chain); | - | ||||||||||||
496 | data->bio_chain = (BIO *)ptr; | - | ||||||||||||
497 | } never executed: else if (num == 4end of block
| 0-2 | ||||||||||||
498 | data->accept_family = *(int *)ptr; | - | ||||||||||||
499 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
500 | } executed 4 times by 1 test: else {end of block Executed by:
| 4 | ||||||||||||
501 | if (num == 2
| 0 | ||||||||||||
502 | data->bind_mode &= ~0x08; | - | ||||||||||||
503 | } never executed: end of block | 0 | ||||||||||||
504 | } never executed: end of block | 0 | ||||||||||||
505 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||
506 | case executed 2 times by 1 test: 102:case 102: Executed by:
executed 2 times by 1 test: case 102: Executed by:
| 2 | ||||||||||||
507 | if (num != 0
| 0-2 | ||||||||||||
508 | data->accepted_mode |= 0x08; executed 2 times by 1 test: data->accepted_mode |= 0x08; Executed by:
| 2 | ||||||||||||
509 | else | - | ||||||||||||
510 | data->accepted_mode &= ~0x08; never executed: data->accepted_mode &= ~0x08; | 0 | ||||||||||||
511 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
512 | case never executed: 104:case 104: never executed: case 104: | 0 | ||||||||||||
513 | b->num = *((int *)ptr); | - | ||||||||||||
514 | data->accept_sock = b->num; | - | ||||||||||||
515 | data->state = 5; | - | ||||||||||||
516 | b->shutdown = (int)num; | - | ||||||||||||
517 | b->init = 1; | - | ||||||||||||
518 | break; never executed: break; | 0 | ||||||||||||
519 | case never executed: 105:case 105: never executed: case 105: | 0 | ||||||||||||
520 | if (b->init
| 0 | ||||||||||||
521 | ip = (int *)ptr; | - | ||||||||||||
522 | if (ip !=
| 0 | ||||||||||||
523 | ((void *)0)
| 0 | ||||||||||||
524 | ) | - | ||||||||||||
525 | * never executed: ip = data->accept_sock;*ip = data->accept_sock; never executed: *ip = data->accept_sock; | 0 | ||||||||||||
526 | ret = data->accept_sock; | - | ||||||||||||
527 | } never executed: elseend of block | 0 | ||||||||||||
528 | ret = -1; never executed: ret = -1; | 0 | ||||||||||||
529 | break; never executed: break; | 0 | ||||||||||||
530 | case executed 2 times by 1 test: 124:case 124: Executed by:
executed 2 times by 1 test: case 124: Executed by:
| 2 | ||||||||||||
531 | if (b->init
| 0-2 | ||||||||||||
532 | if (num == 0
| 0-2 | ||||||||||||
533 | ((void *)0)
| 0 | ||||||||||||
534 | ) { | - | ||||||||||||
535 | pp = (char **)ptr; | - | ||||||||||||
536 | *pp = data->cache_accepting_name; | - | ||||||||||||
537 | } never executed: else if (num == 1end of block
| 0-2 | ||||||||||||
538 | ((void *)0)
| 0-2 | ||||||||||||
539 | ) { | - | ||||||||||||
540 | pp = (char **)ptr; | - | ||||||||||||
541 | *pp = data->cache_accepting_serv; | - | ||||||||||||
542 | } executed 2 times by 1 test: else if (num == 2end of block Executed by:
| 0-2 | ||||||||||||
543 | ((void *)0)
| 0 | ||||||||||||
544 | ) { | - | ||||||||||||
545 | pp = (char **)ptr; | - | ||||||||||||
546 | *pp = data->cache_peer_name; | - | ||||||||||||
547 | } never executed: else if (num == 3end of block
| 0 | ||||||||||||
548 | ((void *)0)
| 0 | ||||||||||||
549 | ) { | - | ||||||||||||
550 | pp = (char **)ptr; | - | ||||||||||||
551 | *pp = data->cache_peer_serv; | - | ||||||||||||
552 | } never executed: else if (num == 4end of block
| 0 | ||||||||||||
553 | switch (BIO_ADDRINFO_family(data->addr_iter)) { | - | ||||||||||||
554 | - | |||||||||||||
555 | case never executed: case 10 : never executed: case 10 : | 0 | ||||||||||||
556 | 10 never executed: case 10 : | 0 | ||||||||||||
557 | : never executed: case 10 : | 0 | ||||||||||||
558 | ret = 6; | - | ||||||||||||
559 | break; never executed: break; | 0 | ||||||||||||
560 | - | |||||||||||||
561 | case never executed: case 2 : never executed: case 2 : | 0 | ||||||||||||
562 | 2 never executed: case 2 : | 0 | ||||||||||||
563 | : never executed: case 2 : | 0 | ||||||||||||
564 | ret = 4; | - | ||||||||||||
565 | break; never executed: break; | 0 | ||||||||||||
566 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||
567 | ret = data->accept_family; | - | ||||||||||||
568 | break; never executed: break; | 0 | ||||||||||||
569 | default never executed: :default: never executed: default: | 0 | ||||||||||||
570 | ret = -1; | - | ||||||||||||
571 | break; never executed: break; | 0 | ||||||||||||
572 | } | - | ||||||||||||
573 | } else | - | ||||||||||||
574 | ret = -1; never executed: ret = -1; | 0 | ||||||||||||
575 | } else | - | ||||||||||||
576 | ret = -1; never executed: ret = -1; | 0 | ||||||||||||
577 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
578 | case never executed: 8:case 8: never executed: case 8: | 0 | ||||||||||||
579 | ret = b->shutdown; | - | ||||||||||||
580 | break; never executed: break; | 0 | ||||||||||||
581 | case never executed: 9:case 9: never executed: case 9: | 0 | ||||||||||||
582 | b->shutdown = (int)num; | - | ||||||||||||
583 | break; never executed: break; | 0 | ||||||||||||
584 | case never executed: 10:case 10: never executed: case 10: | 0 | ||||||||||||
585 | case never executed: 13:case 13: never executed: case 13: | 0 | ||||||||||||
586 | ret = 0; | - | ||||||||||||
587 | break; never executed: break; | 0 | ||||||||||||
588 | case never executed: 11:case 11: never executed: case 11: | 0 | ||||||||||||
589 | break; never executed: break; | 0 | ||||||||||||
590 | case executed 2 times by 1 test: 131:case 131: Executed by:
executed 2 times by 1 test: case 131: Executed by:
| 2 | ||||||||||||
591 | data->bind_mode = (int)num; | - | ||||||||||||
592 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||
593 | case never executed: 132:case 132: never executed: case 132: | 0 | ||||||||||||
594 | ret = (long)data->bind_mode; | - | ||||||||||||
595 | break; never executed: break; | 0 | ||||||||||||
596 | case never executed: 12:case 12: never executed: case 12: | 0 | ||||||||||||
597 | break; never executed: break; | 0 | ||||||||||||
598 | - | |||||||||||||
599 | default executed 4 times by 1 test: :default: Executed by:
executed 4 times by 1 test: default: Executed by:
| 4 | ||||||||||||
600 | ret = 0; | - | ||||||||||||
601 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||
602 | } | - | ||||||||||||
603 | return executed 18 times by 1 test: ret;return ret; Executed by:
executed 18 times by 1 test: return ret; Executed by:
| 18 | ||||||||||||
604 | } | - | ||||||||||||
605 | - | |||||||||||||
606 | static int acpt_puts(BIO *bp, const char *str) | - | ||||||||||||
607 | { | - | ||||||||||||
608 | int n, ret; | - | ||||||||||||
609 | - | |||||||||||||
610 | n = strlen(str); | - | ||||||||||||
611 | ret = acpt_write(bp, str, n); | - | ||||||||||||
612 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
613 | } | - | ||||||||||||
614 | - | |||||||||||||
615 | BIO *BIO_new_accept(const char *str) | - | ||||||||||||
616 | { | - | ||||||||||||
617 | BIO *ret; | - | ||||||||||||
618 | - | |||||||||||||
619 | ret = BIO_new(BIO_s_accept()); | - | ||||||||||||
620 | if (ret ==
| 0-2 | ||||||||||||
621 | ((void *)0)
| 0-2 | ||||||||||||
622 | ) | - | ||||||||||||
623 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
624 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
625 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
626 | if (BIO_ctrl(ret,118,0, (char *)(str))
| 0-2 | ||||||||||||
627 | return executed 2 times by 1 test: ret;return ret; Executed by:
executed 2 times by 1 test: return ret; Executed by:
| 2 | ||||||||||||
628 | BIO_free(ret); | - | ||||||||||||
629 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
630 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
631 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
632 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |