Zero out grp before re-using it (new ones are already cleared by
authormillert <millert@openbsd.org>
Fri, 16 May 2014 17:30:28 +0000 (17:30 +0000)
committermillert <millert@openbsd.org>
Fri, 16 May 2014 17:30:28 +0000 (17:30 +0000)
calloc).   We only reuse grp when there is an unresolvable host.
Fixes a bug where if a host in a netgroup is unresolvable then
entire netgroup is ignore.  OK krw@

sbin/mountd/mountd.c

index 92bbd23..b7adff2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mountd.c,v 1.74 2014/04/22 20:25:16 tedu Exp $        */
+/*     $OpenBSD: mountd.c,v 1.75 2014/05/16 17:30:28 millert Exp $     */
 /*     $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
 
 /*
@@ -875,6 +875,8 @@ get_exportlist(void)
                                if (has_host) {
                                    grp->gr_next = get_grp();
                                    grp = grp->gr_next;
+                               } else {
+                                   memset(grp, 0, sizeof(*grp));
                                }
                                if (netgrp) {
                                    if (hst == NULL) {