nfs-utils/0007-statd-user-from-sm
Neil Brown 0138b6c771 Only sm and sm.bak need to be accessible by
statd or sm-notify after they drop privs.
  Providing they get created, the parent
- 0007-statd-user-from-sm
  Change rpc.statd and sm-notify to take uid from the sm
  directory.

OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=207
2019-09-17 01:17:20 +00:00

46 lines
1.3 KiB
Plaintext

statd: take user-id from /var/lib/nfs/sm
Having /var/lib/nfs writeable by statd is not ideal
as there are files in there that statd doesn't need
to access.
Aftger dropping privs, statd and sm-notify only need to
access files in the directories sm and sm.bak.
So take the uid for these deamons from 'sm'.
Signed-off-by: NeilBrown <neilb@suse.com>
---
support/nsm/file.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
--- a/support/nsm/file.c
+++ b/support/nsm/file.c
@@ -388,23 +388,17 @@ nsm_drop_privileges(const int pidfd)
(void)umask(S_IRWXO);
- /*
- * XXX: If we can't stat dirname, or if dirname is owned by
- * root, we should use "statduser" instead, which is set up
- * by configure.ac. Nothing in nfs-utils seems to use
- * "statduser," though.
- */
- if (lstat(nsm_base_dirname, &st) == -1) {
- xlog(L_ERROR, "Failed to stat %s: %m", nsm_base_dirname);
- return false;
- }
-
if (chdir(nsm_base_dirname) == -1) {
xlog(L_ERROR, "Failed to change working directory to %s: %m",
nsm_base_dirname);
return false;
}
+ if (lstat(NSM_MONITOR_DIR, &st) == -1) {
+ xlog(L_ERROR, "Failed to stat %s/%s: %m", nsm_base_dirname, NSM_MONITOR_DIR);
+ return false;
+ }
+
if (!prune_bounding_set())
return false;