Try a privileged port for binding whenever possible because the
ypbind daemon requires the ypserv daemon is running on a privileged port. Reported by: Andrzej Tobola
This commit is contained in:
parent
e5c9c8533d
commit
d04ef9128c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202686
@ -303,13 +303,18 @@ create_service(const int sock, const struct netconfig *nconf,
|
||||
freeaddrinfo(res0);
|
||||
return -1;
|
||||
}
|
||||
if (bind(s, res->ai_addr,
|
||||
res->ai_addrlen) == -1) {
|
||||
_msgout("cannot bind %s socket: %s",
|
||||
nconf->nc_netid, strerror(errno));
|
||||
freeaddrinfo(res0);
|
||||
close(sock);
|
||||
return -1;
|
||||
if (bindresvport_sa(s, res->ai_addr) == -1) {
|
||||
if ((errno != EPERM) ||
|
||||
(bind(s, res->ai_addr,
|
||||
res->ai_addrlen) == -1)) {
|
||||
_msgout("cannot bind "
|
||||
"%s socket: %s",
|
||||
nconf->nc_netid,
|
||||
strerror(errno));
|
||||
freeaddrinfo(res0);
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (nconf->nc_semantics != NC_TPI_CLTS)
|
||||
listen(s, SOMAXCONN);
|
||||
|
Loading…
Reference in New Issue
Block a user