Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!news.umbc.edu!europa.eng.gtefsd.com!howland.reston.ans.net!torn!nermal.cs.uoguelph.ca!herman!rmacklem From: rmacklem@herman.cs.uoguelph.ca (Richard A Macklem) Newsgroups: comp.unix.bsd Subject: 4.4BSD mountd.c bug/fix Date: 9 Nov 1993 00:11:05 GMT Organization: University of Guelph Lines: 147 Message-ID: <2bmn6p$jpm@nermal.cs.uoguelph.ca> NNTP-Posting-Host: herman.cs.uoguelph.ca Summary: mountd broken for exports to the world Keywords: mountd exports X-Newsreader: TIN [version 1.2 PL2] The following "diff -c" of the 4.4BSD mountd.c fixes a couple of problems when file systems are exported to the world. (Can you guess that most of the test sites don't think exporting to the world is such a good idea:-) Have fun, rick *** mountd.c.bak Mon Sep 27 16:36:41 1993 --- mountd.c Mon Nov 8 18:24:02 1993 *************** *** 455,467 **** { register struct exportlist *ep; int false = 0; ! int omask; omask = sigblock(sigmask(SIGHUP)); ep = exphead; while (ep) { ! if (put_exlist(ep->ex_dirl, xdrsp, ep->ex_defdir)) goto errout; ep = ep->ex_next; } sigsetmask(omask); --- 455,472 ---- { register struct exportlist *ep; int false = 0; ! int omask, putdef; omask = sigblock(sigmask(SIGHUP)); ep = exphead; while (ep) { ! putdef = 0; ! if (put_exlist(ep->ex_dirl, xdrsp, ep->ex_defdir, &putdef)) goto errout; + if (ep->ex_defdir && putdef == 0 && + put_exlist(ep->ex_defdir, xdrsp, (struct dirlist *)0, + &putdef)) + goto errout; ep = ep->ex_next; } sigsetmask(omask); *************** *** 477,486 **** * Called from xdr_explist() to traverse the tree and export the * directory paths. */ ! put_exlist(dp, xdrsp, adp) register struct dirlist *dp; XDR *xdrsp; struct dirlist *adp; { register struct grouplist *grp; register struct hostlist *hp; --- 482,492 ---- * Called from xdr_explist() to traverse the tree and export the * directory paths. */ ! put_exlist(dp, xdrsp, adp, putdefp) register struct dirlist *dp; XDR *xdrsp; struct dirlist *adp; + int *putdefp; { register struct grouplist *grp; register struct hostlist *hp; *************** *** 491,497 **** char *strp; if (dp) { ! if (put_exlist(dp->dp_left, xdrsp, adp)) return (1); if (!xdr_bool(xdrsp, &true)) return (1); --- 497,503 ---- char *strp; if (dp) { ! if (put_exlist(dp->dp_left, xdrsp, adp, putdefp)) return (1); if (!xdr_bool(xdrsp, &true)) return (1); *************** *** 498,505 **** strp = dp->dp_dirp; if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) return (1); ! if (adp && !strcmp(dp->dp_dirp, adp->dp_dirp)) gotalldir = 1; if ((dp->dp_flag & DP_DEFSET) == 0 && (gotalldir == 0 || (adp->dp_flag & DP_DEFSET) == 0)) { hp = dp->dp_hosts; --- 504,513 ---- strp = dp->dp_dirp; if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) return (1); ! if (adp && !strcmp(dp->dp_dirp, adp->dp_dirp)) { gotalldir = 1; + *putdefp = 1; + } if ((dp->dp_flag & DP_DEFSET) == 0 && (gotalldir == 0 || (adp->dp_flag & DP_DEFSET) == 0)) { hp = dp->dp_hosts; *************** *** 529,535 **** } if (!xdr_bool(xdrsp, &false)) return (1); ! if (put_exlist(dp->dp_right, xdrsp, adp)) return (1); } return (0); --- 537,543 ---- } if (!xdr_bool(xdrsp, &false)) return (1); ! if (put_exlist(dp->dp_right, xdrsp, adp, putdefp)) return (1); } return (0); *************** *** 1407,1418 **** while (!done) { switch (grp->gr_type) { case GT_HOST: ! if (addrp) sin.sin_addr.s_addr = **addrp; ! else ! sin.sin_addr.s_addr = INADDR_ANY; args.saddr = (struct sockaddr *)&sin; - args.slen = sizeof(sin); args.msklen = 0; break; case GT_NET: --- 1415,1426 ---- while (!done) { switch (grp->gr_type) { case GT_HOST: ! if (addrp) { sin.sin_addr.s_addr = **addrp; ! args.slen = sizeof(sin); ! } else ! args.slen = 0; args.saddr = (struct sockaddr *)&sin; args.msklen = 0; break; case GT_NET: