summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypserv
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2010-01-20 16:50:13 +0000
committerhrs <hrs@FreeBSD.org>2010-01-20 16:50:13 +0000
commitd1ed694608965dcaaa85f3d1eacedf3d704557b1 (patch)
tree04b8bc7ace92faa2c5ee97ca178fa3e48f989704 /usr.sbin/ypserv
parent05f13fb70af354b0b1806e33d6aef5fb8c587f15 (diff)
downloadFreeBSD-src-d1ed694608965dcaaa85f3d1eacedf3d704557b1.zip
FreeBSD-src-d1ed694608965dcaaa85f3d1eacedf3d704557b1.tar.gz
Simply ignore unsupported protocols listed in /etc/netconfig and
abort only if no transport is available. This fixes (INET && !INET6) and (!INET && INET6) case, for example.
Diffstat (limited to 'usr.sbin/ypserv')
-rw-r--r--usr.sbin/ypserv/yp_main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c
index 7fe2790..ec39d1b 100644
--- a/usr.sbin/ypserv/yp_main.c
+++ b/usr.sbin/ypserv/yp_main.c
@@ -450,6 +450,7 @@ main(int argc, char *argv[])
{
int ch;
int error;
+ int ntrans;
void *nc_handle;
struct netconfig *nconf;
@@ -527,12 +528,13 @@ main(int argc, char *argv[])
/*
* Create RPC service for each transport.
*/
+ ntrans = 0;
while((nconf = getnetconfig(nc_handle))) {
if ((nconf->nc_flag & NC_VISIBLE)) {
if (__rpc_nconf2sockinfo(nconf, &si) == 0) {
- _msgout("cannot get information for %s",
- nconf->nc_netid);
- exit(1);
+ _msgout("cannot get information for %s. "
+ "Ignored.", nconf->nc_netid);
+ continue;
}
if (_rpcpmstart) {
if (si.si_socktype != _rpcfdtype ||
@@ -545,12 +547,16 @@ main(int argc, char *argv[])
endnetconfig(nc_handle);
exit(1);
}
+ ntrans++;
}
}
endnetconfig(nc_handle);
while(!(SLIST_EMPTY(&ble_head)))
SLIST_REMOVE_HEAD(&ble_head, ble_next);
-
+ if (ntrans == 0) {
+ _msgout("no transport is available. Aborted.");
+ exit(1);
+ }
if (_rpcpmstart) {
(void) signal(SIGALRM, (SIG_PF) closedown);
(void) alarm(_RPCSVC_CLOSEDOWN/2);
OpenPOWER on IntegriCloud