forked from pool/nfs-utils
Accepting request 87463 from Base:System
- nfs.init: handle case where kernel adds trailing slash to name in /proc/mounts. (bnc#722431 bnc#720376) OBS-URL: https://build.opensuse.org/request/show/87463 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nfs-utils?expand=0&rev=88
This commit is contained in:
commit
9bc67bc793
@ -1,55 +0,0 @@
|
|||||||
From 1ce0374d445d8a3dbdfb3e9da4c76be9df44666b Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.de>
|
|
||||||
Date: Thu, 21 Jul 2011 14:23:00 -0400
|
|
||||||
Subject: [PATCH] Statd should always 'chdir' to its state directory.
|
|
||||||
|
|
||||||
s statd can be started by 'mount' which can sometimes be run by a
|
|
||||||
normal user, the current-working-directory could be anything. In
|
|
||||||
partcular it could be in a mounted filesystem. As 'statd' continues
|
|
||||||
running as a daemon it could keep prevent that filesystem from being
|
|
||||||
unmounted.
|
|
||||||
|
|
||||||
statd does currently 'chdir' to the state directory, but only if the
|
|
||||||
state directory is not owned by root. This is wrong - it should check
|
|
||||||
for root after the chdir, not before.
|
|
||||||
|
|
||||||
So swap the two if statements around.
|
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
||||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
||||||
---
|
|
||||||
support/nsm/file.c | 12 ++++++------
|
|
||||||
1 files changed, 6 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/support/nsm/file.c b/support/nsm/file.c
|
|
||||||
index 98b47bf..a12c753 100644
|
|
||||||
--- a/support/nsm/file.c
|
|
||||||
+++ b/support/nsm/file.c
|
|
||||||
@@ -395,18 +395,18 @@ nsm_drop_privileges(const int pidfd)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (st.st_uid == 0) {
|
|
||||||
- xlog_warn("Running as root. "
|
|
||||||
- "chown %s to choose different user", nsm_base_dirname);
|
|
||||||
- return true;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
if (chdir(nsm_base_dirname) == -1) {
|
|
||||||
xlog(L_ERROR, "Failed to change working directory to %s: %m",
|
|
||||||
nsm_base_dirname);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (st.st_uid == 0) {
|
|
||||||
+ xlog_warn("Running as root. "
|
|
||||||
+ "chown %s to choose different user", nsm_base_dirname);
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* If the pidfile happens to reside on NFS, dropping privileges
|
|
||||||
* will probably cause us to lose access, even though we are
|
|
||||||
--
|
|
||||||
1.7.3.4
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Oct 12 05:18:17 UTC 2011 - nfbrown@suse.com
|
||||||
|
|
||||||
|
- nfs.init: handle case where kernel adds trailing
|
||||||
|
slash to name in /proc/mounts.
|
||||||
|
(bnc#722431 bnc#720376)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Oct 1 15:24:33 UTC 2011 - crrodriguez@opensuse.org
|
Sat Oct 1 15:24:33 UTC 2011 - crrodriguez@opensuse.org
|
||||||
|
|
||||||
|
3
nfs.init
3
nfs.init
@ -61,7 +61,8 @@ while read -r what where type options rest ; do
|
|||||||
esac
|
esac
|
||||||
nfs=yes
|
nfs=yes
|
||||||
if test "$1" = status ; then
|
if test "$1" = status ; then
|
||||||
grep -qF "$what $where nfs" /proc/mounts && continue
|
grep -qF "$what $where nfs
|
||||||
|
$what/ $where nfs" /proc/mounts && continue
|
||||||
state=3
|
state=3
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user