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
This commit is contained in:
Jonathan Lemon 1997-09-12 16:25:24 +00:00
parent 987b847efc
commit a968cfd87c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29317
2 changed files with 36 additions and 14 deletions

View File

@ -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 <sys/param.h>
@ -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;
}
}
/*

View File

@ -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 <sys/param.h>
@ -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;
}
}
/*