From 551d6af699d053638ed88fdf543c957fe35009c1 Mon Sep 17 00:00:00 2001 From: jlemon Date: Fri, 12 Sep 1997 16:25:24 +0000 Subject: If a host in an export line in /etc/exports (or within a netgroup on an export line) is unresolvable, make a note of it via syslog and skip that individual host instead of skipping the entire line. PR: 1981, 815 Perused by: joerg --- usr.sbin/mountd/mountd.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'usr.sbin/mountd') diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 38ead40..b82a0f3 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -43,7 +43,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; */ static const char rcsid[] = - "$Id: mountd.c,v 1.22 1997/07/16 09:27:53 dfr Exp $"; + "$Id: mountd.c,v 1.23 1997/08/29 19:22:28 guido Exp $"; #endif /*not lint*/ #include @@ -873,14 +873,12 @@ get_exportlist() } if (netgrp) { if (get_host(hst, grp, tgrp)) { - syslog(LOG_ERR, "Bad netgroup %s", cp); - getexp_err(ep, tgrp); - endnetgrent(); - goto nextline; + syslog(LOG_ERR, "Bad host %s in netgroup %s, skipping", hst, cp); + grp->gr_type = GT_IGNORE; } } else if (get_host(cp, grp, tgrp)) { - getexp_err(ep, tgrp); - goto nextline; + syslog(LOG_ERR, "Bad host %s, skipping", cp); + grp->gr_type = GT_IGNORE; } has_host = TRUE; } while (netgrp && getnetgrent(&hst, &usr, &dom)); @@ -916,6 +914,19 @@ get_exportlist() } else if ((opt_flags & OP_NET) && tgrp->gr_next) { getexp_err(ep, tgrp); goto nextline; + + /* + * If an export list was specified on this line, make sure + * that we have at least one valid entry, otherwise skip it. + */ + } else { + grp = tgrp; + while (grp && grp->gr_type == GT_IGNORE) + grp = grp->gr_next; + if (! grp) { + getexp_err(ep, tgrp); + goto nextline; + } } /* -- cgit v1.1