From ad13fe9511811b2fd55500f08cfa653b67dbef45 Mon Sep 17 00:00:00 2001 From: joerg Date: Mon, 15 Jun 1998 15:41:41 +0000 Subject: Watch out for null hostnames in netgroup entries, to avoid dumping core. This happens if someone tries to export to a netgroup like: mygroup (,,mynisdomain) --- sbin/mountd/mountd.c | 6 ++++-- usr.sbin/mountd/mountd.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 8152100..7b25e38 100644 --- a/sbin/mountd/mountd.c +++ b/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.27 1997/12/13 19:50:14 guido Exp $"; + "$Id: mountd.c,v 1.28 1998/01/20 15:22:27 bde Exp $"; #endif /*not lint*/ #include @@ -913,7 +913,9 @@ get_exportlist() grp = grp->gr_next; } if (netgrp) { - if (get_host(hst, grp, tgrp)) { + if (hst == 0) { + syslog(LOG_ERR, "Null hostname in netgroup %s, skipping", cp); + } else if (get_host(hst, grp, tgrp)) { syslog(LOG_ERR, "Bad host %s in netgroup %s, skipping", hst, cp); grp->gr_type = GT_IGNORE; } diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 8152100..7b25e38 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.27 1997/12/13 19:50:14 guido Exp $"; + "$Id: mountd.c,v 1.28 1998/01/20 15:22:27 bde Exp $"; #endif /*not lint*/ #include @@ -913,7 +913,9 @@ get_exportlist() grp = grp->gr_next; } if (netgrp) { - if (get_host(hst, grp, tgrp)) { + if (hst == 0) { + syslog(LOG_ERR, "Null hostname in netgroup %s, skipping", cp); + } else if (get_host(hst, grp, tgrp)) { syslog(LOG_ERR, "Bad host %s in netgroup %s, skipping", hst, cp); grp->gr_type = GT_IGNORE; } -- cgit v1.1