Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/mountd do_nfssvc: remove code to go up the path, as...
details: https://anonhg.NetBSD.org/src/rev/782f646c7d8d
branches: trunk
changeset: 586930:782f646c7d8d
user: yamt <yamt%NetBSD.org@localhost>
date: Thu Jan 05 10:38:29 2006 +0000
description:
do_nfssvc: remove code to go up the path, as it's nonsense and
sometimes even harmful.
diffstat:
usr.sbin/mountd/mountd.c | 67 ++++++++++++-----------------------------------
1 files changed, 18 insertions(+), 49 deletions(-)
diffs (98 lines):
diff -r 0c49336b2d6f -r 782f646c7d8d usr.sbin/mountd/mountd.c
--- a/usr.sbin/mountd/mountd.c Thu Jan 05 10:24:11 2006 +0000
+++ b/usr.sbin/mountd/mountd.c Thu Jan 05 10:38:29 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mountd.c,v 1.100 2005/12/04 18:01:53 christos Exp $ */
+/* $NetBSD: mountd.c,v 1.101 2006/01/05 10:38:29 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -47,7 +47,7 @@
#if 0
static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: mountd.c,v 1.100 2005/12/04 18:01:53 christos Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.101 2006/01/05 10:38:29 yamt Exp $");
#endif
#endif /* not lint */
@@ -2024,6 +2024,8 @@
}
done = FALSE;
while (!done) {
+ struct mountd_exports_list mel;
+
switch (grp->gr_type) {
case GT_HOST:
if (addrp != NULL && addrp->sa_family == AF_INET6 &&
@@ -2073,56 +2075,23 @@
/*
* XXX:
- * Maybe I should just use the fsb->f_mntonname path instead
- * of looping back up the dirp to the mount point??
+ * Maybe I should just use the fsb->f_mntonname path?
*/
- for (;;) {
- struct mountd_exports_list mel;
- mel.mel_path = dirp;
- mel.mel_nexports = 1;
- mel.mel_exports = &export;
-
- if (nfssvc(NFSSVC_SETEXPORTSLIST, &mel) != -1)
- break;
+ mel.mel_path = dirp;
+ mel.mel_nexports = 1;
+ mel.mel_exports = &export;
- if (cp)
- *cp-- = savedc;
- else
- cp = dirp + dirplen - 1;
- if (errno == EPERM) {
- syslog(LOG_ERR,
- "\"%s\", line %ld: Can't change attributes for %s to %s: %m",
- line, (unsigned long)lineno,
- dirp, (grp->gr_type == GT_HOST) ?
- grp->gr_ptr.gt_addrinfo->ai_canonname :
- (grp->gr_type == GT_NET) ?
- grp->gr_ptr.gt_net.nt_name :
- "Unknown");
- return (1);
- }
- if (opt_flags & OP_ALLDIRS) {
- syslog(LOG_ERR,
- "\"%s\", line %ld: Could not remount %s: %m",
- line, (unsigned long)lineno,
- dirp);
- return (1);
- }
- /* back up over the last component */
- while (*cp == '/' && cp > dirp)
- cp--;
- while (*(cp - 1) != '/' && cp > dirp)
- cp--;
- if (cp == dirp) {
- if (debug)
- (void)fprintf(stderr, "mnt unsucc\n");
- syslog(LOG_ERR,
- "\"%s\", line %ld: Can't export %s: %m",
- line, (unsigned long)lineno, dirp);
- return (1);
- }
- savedc = *cp;
- *cp = '\0';
+ if (nfssvc(NFSSVC_SETEXPORTSLIST, &mel) != 0) {
+ syslog(LOG_ERR,
+ "\"%s\", line %ld: Can't change attributes for %s to %s: %m",
+ line, (unsigned long)lineno,
+ dirp, (grp->gr_type == GT_HOST) ?
+ grp->gr_ptr.gt_addrinfo->ai_canonname :
+ (grp->gr_type == GT_NET) ?
+ grp->gr_ptr.gt_net.nt_name :
+ "Unknown");
+ return (1);
}
skip:
if (addrp) {
Home |
Main Index |
Thread Index |
Old Index