mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
- Missing htons() in bsd-bindresvport.c, fix from Holger Trapp
<Holger.Trapp@Informatik.TU-Chemnitz.DE>
This commit is contained in:
parent
0727893340
commit
8dbbe6e546
@ -5,6 +5,8 @@
|
|||||||
<andre.lucas@dial.pipex.com>
|
<andre.lucas@dial.pipex.com>
|
||||||
- Make IPv4 use the default in RPM packages
|
- Make IPv4 use the default in RPM packages
|
||||||
- Irix uses preformatted manpages
|
- Irix uses preformatted manpages
|
||||||
|
- Missing htons() in bsd-bindresvport.c, fix from Holger Trapp
|
||||||
|
<Holger.Trapp@Informatik.TU-Chemnitz.DE>
|
||||||
|
|
||||||
20000120
|
20000120
|
||||||
- Don't use getaddrinfo on AIX
|
- Don't use getaddrinfo on AIX
|
||||||
|
@ -61,6 +61,7 @@ bindresvport_af(sd, sa, af)
|
|||||||
struct sockaddr_in *sin;
|
struct sockaddr_in *sin;
|
||||||
struct sockaddr_in6 *sin6;
|
struct sockaddr_in6 *sin6;
|
||||||
u_int16_t *portp;
|
u_int16_t *portp;
|
||||||
|
u_int16_t port;
|
||||||
int salen;
|
int salen;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -83,10 +84,13 @@ bindresvport_af(sd, sa, af)
|
|||||||
}
|
}
|
||||||
sa->sa_family = af;
|
sa->sa_family = af;
|
||||||
|
|
||||||
if (*portp == 0)
|
port = ntohs(*portp);
|
||||||
*portp = (u_int16_t)(arc4random() % NPORTS) + STARTPORT;
|
if (port == 0)
|
||||||
|
port = (arc4random() % NPORTS) + STARTPORT;
|
||||||
|
|
||||||
for(i = 0; i < NPORTS; i++) {
|
for(i = 0; i < NPORTS; i++) {
|
||||||
|
*portp = htons(port);
|
||||||
|
|
||||||
error = bind(sd, sa, salen);
|
error = bind(sd, sa, salen);
|
||||||
|
|
||||||
/* Terminate on success */
|
/* Terminate on success */
|
||||||
@ -97,7 +101,9 @@ bindresvport_af(sd, sa, af)
|
|||||||
if ((error < 0) && !((errno == EADDRINUSE) || (errno == EINVAL)))
|
if ((error < 0) && !((errno == EADDRINUSE) || (errno == EINVAL)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
*portp = (i % NPORTS) + STARTPORT;
|
port++;
|
||||||
|
if (port > ENDPORT)
|
||||||
|
port = STARTPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user