Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!news.mathworks.com!howland.erols.net!Frankfurt.Germany.EU.net!Stuttgart.Germany.EU.net!main.Germany.EU.net!Dortmund.Germany.EU.net!interface-business.de!usenet From: j@ida.interface-business.de (J Wunsch) Newsgroups: comp.unix.bsd.netbsd.misc Subject: Re: Netbooting NetBSD/SPARC from FreeBSD-box Date: 2 Oct 1996 14:09:08 GMT Organization: interface business GmbH, Dresden Lines: 216 Message-ID: <52tt24$asp@innocence.interface-business.de> References: <51s4j3$2n0@charm.il.ft.hse.nl> <51ul84$68@pier2.bayarea.net> <3246E21F.FF6D5DF@freebsd.org> Reply-To: joerg_wunsch@interface-business.de (Joerg Wunsch) NNTP-Posting-Host: ida.interface-business.de X-Newsreader: knews 0.9.6 X-Phone: +49-351-31809-14 X-Fax: +49-351-3361187 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E "Jordan K. Hubbard" <jkh@FreeBSD.org> wrote: > Ah, and a P.S. from FreeBSD's mountd manpage: > > -r The -r option allows mount RPCs requests for regular files > to be > served. Yep, it has been back-ported from FreeBSD-current to be included in 2.1.5. For the curious, here's the diff between FreeBSD 2.1R and 2.1.5R. Maybe it's even applicable to NetBSD? Index: mountd.8 =================================================================== RCS file: /home/ncvs/src/sbin/mountd/mountd.8,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -r1.3 -r1.3.4.1 --- mountd.8 1995/02/22 21:42:48 1.3 +++ mountd.8 1996/01/11 00:12:44 1.3.4.1 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" From: @(#)mountd.8 8.1 (Berkeley) 6/9/93 -.\" $Id: mountd.8,v 1.3 1995/02/22 21:42:48 ats Exp $ +.\" $Id: mountd.8,v 1.3.4.1 1996/01/11 00:12:44 joerg Exp $ .\" .Dd September 22, 1994 .Dt MOUNTD 8 @@ -42,7 +42,7 @@ mount requests .Sh SYNOPSIS .Nm /sbin/mountd -.Op Fl n +.Op Fl nr .Op Ar exportsfile .Sh DESCRIPTION .Xr Mountd @@ -65,6 +65,15 @@ option allows non-root mount requests to be served. This should only be specified if there are clients such as PC's, that require it. +.It Fl r +The +.Fl r +option allows mount RPCs requests for regular files to be served. +Although this seems to violate the mount protocol specification, some diskless +workstations do mount requests for their swapfiles and expect them to be +regular files. Since a regular file cannot be specified in /etc/exports, the +entire file system that the swapfiles reside in will have to be exported with +the ``-alldirs'' flag. .It Ar exportsfile The .Ar exportsfile Index: mountd.c =================================================================== RCS file: /home/ncvs/src/sbin/mountd/mountd.c,v retrieving revision 1.8 retrieving revision 1.8.2.2 diff -u -r1.8 -r1.8.2.2 --- mountd.c 1995/06/11 19:30:46 1.8 +++ mountd.c 1996/01/11 00:12:45 1.8.2.2 @@ -43,7 +43,7 @@ #ifndef lint /*static char sccsid[] = "From: @(#)mountd.c 8.8 (Berkeley) 2/20/94";*/ static const char rcsid[] = - "$Id: mountd.c,v 1.8 1995/06/11 19:30:46 rgrimes Exp $"; + "$Id: mountd.c,v 1.8.2.2 1996/01/11 00:12:45 joerg Exp $"; #endif /*not lint*/ #include <sys/param.h> @@ -205,7 +205,8 @@ 1, { (gid_t) -2 } }; -int root_only = 1; +int resvport_only = 1; +int dir_only = 1; int opt_flags; /* Bits for above */ #define OP_MAPROOT 0x01 @@ -238,6 +239,7 @@ { SVCXPRT *udptransp, *tcptransp; int c; +#ifdef __FreeBSD__ struct vfsconf *vfc; vfc = getvfsbyname("nfs"); @@ -250,17 +252,21 @@ if(!vfc) { errx(1, "NFS support is not available in the running kernel"); } +#endif /* __FreeBSD__ */ - while ((c = getopt(argc, argv, "dn")) != EOF) + while ((c = getopt(argc, argv, "dnr")) != EOF) switch (c) { + case 'n': + resvport_only = 0; + break; + case 'r': + dir_only = 0; + break; case 'd': debug = debug ? 0 : 1; break; - case 'n': - root_only = 0; - break; default: - fprintf(stderr, "Usage: mountd [-n] [export_file]\n"); + fprintf(stderr, "Usage: mountd [-r] [-n] [export_file]\n"); exit(1); }; argc -= optind; @@ -329,6 +335,7 @@ struct statfs fsb; struct hostent *hp; u_long saddr; + u_short sport; char rpcpath[RPCMNT_PATHLEN+1], dirpath[MAXPATHLEN]; int bad = ENOENT, omask, defset; uid_t uid = -2; @@ -345,6 +352,7 @@ } saddr = transp->xp_raddr.sin_addr.s_addr; + sport = ntohs(transp->xp_raddr.sin_port); hp = (struct hostent *)NULL; switch (rqstp->rq_proc) { case NULLPROC: @@ -352,7 +360,7 @@ syslog(LOG_ERR, "Can't send reply"); return; case RPCMNT_MOUNT: - if ((uid != 0 && root_only) || uid == -2) { + if (sport >= IPPORT_RESERVED && resvport_only) { svcerr_weakauth(transp); return; } @@ -363,11 +371,13 @@ /* * Get the real pathname and make sure it is a directory - * that exists. + * or a regular file if the -r option was specified + * and it exists. */ if (realpath(rpcpath, dirpath) == 0 || stat(dirpath, &stb) < 0 || - (stb.st_mode & S_IFMT) != S_IFDIR || + (!S_ISDIR(stb.st_mode) && + (dir_only || !S_ISREG(stb.st_mode))) || statfs(dirpath, &fsb) < 0) { chdir("/"); /* Just in case realpath doesn't */ if (debug) @@ -421,7 +431,7 @@ syslog(LOG_ERR, "Can't send reply"); return; case RPCMNT_UMOUNT: - if ((uid != 0 && root_only) || uid == -2) { + if (sport >= IPPORT_RESERVED && resvport_only) { svcerr_weakauth(transp); return; } @@ -437,7 +447,7 @@ del_mlist(inet_ntoa(transp->xp_raddr.sin_addr), dirpath); return; case RPCMNT_UMNTALL: - if ((uid != 0 && root_only) || uid == -2) { + if (sport >= IPPORT_RESERVED && resvport_only) { svcerr_weakauth(transp); return; } @@ -832,7 +842,7 @@ hpe = (struct hostent *)malloc(sizeof(struct hostent)); if (hpe == (struct hostent *)NULL) out_of_mem(); - hpe->h_name = "Default"; + hpe->h_name = strdup("Default"); hpe->h_addrtype = AF_INET; hpe->h_length = sizeof (u_long); hpe->h_addr_list = (char **)NULL; Index: netgroup.5 =================================================================== RCS file: /home/ncvs/src/sbin/mountd/netgroup.5,v retrieving revision 1.1.1.1.6.1 retrieving revision 1.1.1.1.6.2 diff -u -r1.1.1.1.6.1 -r1.1.1.1.6.2 --- netgroup.5 1995/08/26 06:16:47 1.1.1.1.6.1 +++ netgroup.5 1996/01/30 14:00:38 1.1.1.1.6.2 @@ -90,7 +90,7 @@ .Nm netgroup memberships are computed on the fly. By contrast, the NIS .Nm netgroup -database consists of three seperate maps (netgroup, netgroup.byuser +database consists of three separate maps (netgroup, netgroup.byuser and netgroup.byhost) that are keyed to allow .Fn innetgr 3 lookups to be done quickly. The FreeBSD @@ -118,7 +118,7 @@ .Nm netgroup information (with no NIS '+' token), then only the local .Nm netgroup -information will be processed (and NIS will be ingored). +information will be processed (and NIS will be ignored). .It If .Pa /etc/netgroup -- J"org Wunsch Unix support engineer joerg_wunsch@interface-business.de http://www.interface-business.de/~j