OpenCoverage

bindresvport.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/openbsd-compat/bindresvport.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9int-
10bindresvport_sa(int sd, struct sockaddr *sa)-
11{-
12 int error, af;-
13 struct sockaddr_storage myaddr;-
14 struct sockaddr_in *in;-
15 struct sockaddr_in6 *in6;-
16 u_int16_t *portp;-
17 u_int16_t port;-
18 socklen_t salen;-
19 int i;-
20-
21 if (sa ==
sa == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
22 ((void *)0)
sa == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
23 ) {-
24 memset(&myaddr, 0, sizeof(myaddr));-
25 sa = (struct sockaddr *)&myaddr;-
26 salen = sizeof(myaddr);-
27-
28 if (getsockname(sd, sa, &salen) == -1
getsockname(sd... &salen) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
29 return
never executed: return -1;
-1;
never executed: return -1;
0
30-
31 af = sa->sa_family;-
32 memset(&myaddr, 0, salen);-
33 }
never executed: end of block
else
0
34 af = sa->sa_family;
never executed: af = sa->sa_family;
0
35-
36 if (af ==
af == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
37 2
af == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
38 ) {-
39 in = (struct sockaddr_in *)sa;-
40 salen = sizeof(struct sockaddr_in);-
41 portp = &in->sin_port;-
42 }
never executed: end of block
else if (af ==
af == 10Description
TRUEnever evaluated
FALSEnever evaluated
0
43 10
af == 10Description
TRUEnever evaluated
FALSEnever evaluated
0
44 ) {-
45 in6 = (struct sockaddr_in6 *)sa;-
46 salen = sizeof(struct sockaddr_in6);-
47 portp = &in6->sin6_port;-
48 }
never executed: end of block
else {
0
49 -
50 (*__errno_location ()) -
51 = -
52 96-
53 ;-
54 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
55 }-
56 sa->sa_family = af;-
57-
58 port = -
59 (__extension__ ({ unsigned short int __v, __x = (unsigned short int) (-
60 *portp-
61 ); if (__builtin_constant_p (__x)
__builtin_constant_p (__x)Description
TRUEnever evaluated
FALSEnever evaluated
) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8)));
never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8)));
else __asm__
never executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc");
("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc");
never executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc");
__v; }))
0
62 ;-
63 if (port == 0
port == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
64 port = arc4random_uniform(((
never executed: port = arc4random_uniform((( 1024 - 1) - 600 + 1)) + 600;
0
65 1024
never executed: port = arc4random_uniform((( 1024 - 1) - 600 + 1)) + 600;
0
66 - 1) - 600 + 1)) + 600;
never executed: port = arc4random_uniform((( 1024 - 1) - 600 + 1)) + 600;
0
67-
68-
69 error = -1;-
70-
71 for(i = 0; i < ((
i < (( 1024 - 1) - 600 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
72 1024
i < (( 1024 - 1) - 600 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
73 - 1) - 600 + 1)
i < (( 1024 - 1) - 600 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
74 *portp = -
75 (__extension__ ({ unsigned short int __v, __x = (unsigned short int) (-
76 port-
77 ); if (__builtin_constant_p (__x)
__builtin_constant_p (__x)Description
TRUEnever evaluated
FALSEnever evaluated
) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8)));
never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8)));
else __asm__
never executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc");
("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc");
never executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc");
__v; }))
0
78 ;-
79-
80 error = bind(sd, sa, salen);-
81-
82-
83 if (error == 0
error == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
84 break;
never executed: break;
0
85-
86-
87 if ((
(error < 0)Description
TRUEnever evaluated
FALSEnever evaluated
error < 0)
(error < 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& !((
( (*__errno_lo...on ()) == 98 )Description
TRUEnever evaluated
FALSEnever evaluated
0
88 (*__errno_location ())
( (*__errno_lo...on ()) == 98 )Description
TRUEnever evaluated
FALSEnever evaluated
0
89 ==
( (*__errno_lo...on ()) == 98 )Description
TRUEnever evaluated
FALSEnever evaluated
0
90 98
( (*__errno_lo...on ()) == 98 )Description
TRUEnever evaluated
FALSEnever evaluated
0
91 )
( (*__errno_lo...on ()) == 98 )Description
TRUEnever evaluated
FALSEnever evaluated
|| (
( (*__errno_lo...on ()) == 22 )Description
TRUEnever evaluated
FALSEnever evaluated
0
92 (*__errno_location ())
( (*__errno_lo...on ()) == 22 )Description
TRUEnever evaluated
FALSEnever evaluated
0
93 ==
( (*__errno_lo...on ()) == 22 )Description
TRUEnever evaluated
FALSEnever evaluated
0
94 22
( (*__errno_lo...on ()) == 22 )Description
TRUEnever evaluated
FALSEnever evaluated
0
95 )
( (*__errno_lo...on ()) == 22 )Description
TRUEnever evaluated
FALSEnever evaluated
))
0
96 break;
never executed: break;
0
97-
98 port++;-
99 if (port > (
port > ( 1024 - 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
100 1024
port > ( 1024 - 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
101 - 1)
port > ( 1024 - 1)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
102 port = 600;
never executed: port = 600;
0
103 }
never executed: end of block
0
104-
105 return
never executed: return (error);
(error);
never executed: return (error);
0
106}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2