dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0032-NSS-Run-as-a-user-specified-by-monitor.patch

905b4d
From d4bbfc12cae1eb2efe2451885605c37ec7702a21 Mon Sep 17 00:00:00 2001
905b4d
From: Jakub Hrozek <jhrozek@redhat.com>
905b4d
Date: Sun, 21 Sep 2014 13:52:05 +0200
905b4d
Subject: [PATCH 32/46] NSS: Run as a user specified by monitor
905b4d
905b4d
Adds the NSS responder to the list of services known to work as a
905b4d
non-root user and becomes the specified user after starting the NSS
905b4d
responder.
905b4d
905b4d
Reviewed-by: Pavel Reichl <preichl@redhat.com>
905b4d
Reviewed-by: Simo Sorce <simo@redhat.com>
905b4d
(cherry picked from commit 5d19966eda424bd71964c6913b84d705dce3b350)
905b4d
---
905b4d
 src/monitor/monitor.c      | 3 +++
905b4d
 src/responder/nss/nsssrv.c | 3 ++-
905b4d
 2 files changed, 5 insertions(+), 1 deletion(-)
905b4d
905b4d
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
905b4d
index 04702428c4ed7fd1d77c6f18e491fa69b3700f4f..297648a60836cec1bd95c0a2972c8d14be32675a 100644
905b4d
--- a/src/monitor/monitor.c
905b4d
+++ b/src/monitor/monitor.c
905b4d
@@ -1062,6 +1062,9 @@ static errno_t get_ping_config(struct mt_ctx *ctx, const char *path,
905b4d
  */
905b4d
 static bool svc_supported_as_nonroot(const char *svc_name)
905b4d
 {
905b4d
+    if (strcmp(svc_name, "nss") == 0) {
905b4d
+        return true;
905b4d
+    }
905b4d
     return false;
905b4d
 }
905b4d
 
905b4d
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
905b4d
index 420fd3d316959a67737f23e9a8b3d1c797583ea3..dbbdb4f844410eabe01f184ccdf8d9deb41833f4 100644
905b4d
--- a/src/responder/nss/nsssrv.c
905b4d
+++ b/src/responder/nss/nsssrv.c
905b4d
@@ -568,7 +568,8 @@ int main(int argc, const char *argv[])
905b4d
     /* set up things like debug, signals, daemonization, etc... */
905b4d
     debug_log_file = "sssd_nss";
905b4d
 
905b4d
-    ret = server_setup("sssd[nss]", 0, 0, 0, CONFDB_NSS_CONF_ENTRY, &main_ctx);
905b4d
+    ret = server_setup("sssd[nss]", 0, uid, gid, CONFDB_NSS_CONF_ENTRY,
905b4d
+                       &main_ctx);
905b4d
     if (ret != EOK) return 2;
905b4d
 
905b4d
     ret = die_if_parent_died();
905b4d
-- 
905b4d
1.9.3
905b4d