dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From f504126d3d54b5b1b5467b59616255ef4c46d1be Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Wed, 1 Oct 2014 14:47:09 +0200
Subject: [PATCH 24/46] BUILD: Add a config option for sssd user, own private
 directories as the user

Adds a new configure-time option that lets you select the user to run
SSSD as. The default is 'root' for backwards compatibility.

The directories the deamon stores its private data at are also created
as owned by this user during install time.

Reviewed-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
(cherry picked from commit bc13c352ba9c2877f1e9bc62e55ad60fc000a55d)
---
 Makefile.am        | 23 +++++++++++++++++------
 configure.ac       |  1 +
 src/conf_macros.m4 | 19 +++++++++++++++++++
 3 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b949c9c24070026570de970b545918a7eb279c6d..61bf5cf957d4024b67f48cf42f5735b5fa368945 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,6 +78,14 @@ sudolibdir = @sudolibpath@
 UNICODE_LIBS=@UNICODE_LIBS@
 
 MKDIR_P = @MKDIR_P@
+INSTALL = @INSTALL@
+
+SSSD_USER = @SSSD_USER@
+
+INSTALL_USER_DIR_FLAGS = -d
+if SSSD_USER
+INSTALL_USER_DIR_FLAGS += -o $(SSSD_USER) -g $(SSSD_USER)
+endif
 
 AM_CFLAGS =
 if WANT_AUX_INFO
@@ -2740,24 +2748,27 @@ installsssddirs::
     $(DESTDIR)$(bindir) \
     $(DESTDIR)$(sbindir) \
     $(DESTDIR)$(mandir) \
+    $(DESTDIR)$(pidpath) \
     $(DESTDIR)$(pluginpath) \
     $(DESTDIR)$(libdir)/ldb \
     $(DESTDIR)$(dbuspolicydir) \
     $(DESTDIR)$(dbusservicedir) \
-    $(DESTDIR)$(pipepath)/private \
     $(DESTDIR)$(sssdlibdir) \
     $(DESTDIR)$(pkglibdir) \
-    $(DESTDIR)$(sssdconfdir) \
     $(DESTDIR)$(sssddatadir) \
+    $(DESTDIR)$(sudolibdir) \
+    $(DESTDIR)$(autofslibdir) \
+    $(NULL); \
+	$(INSTALL) $(INSTALL_USER_DIR_FLAGS) \
     $(DESTDIR)$(dbpath) \
     $(DESTDIR)$(mcpath) \
-    $(DESTDIR)$(pidpath) \
-    $(DESTDIR)$(logpath) \
+    $(DESTDIR)$(pipepath) \
+    $(DESTDIR)$(pipepath)/private \
     $(DESTDIR)$(pubconfpath) \
     $(DESTDIR)$(pubconfpath)/krb5.include.d \
     $(DESTDIR)$(gpocachepath) \
-    $(DESTDIR)$(sudolibdir) \
-    $(DESTDIR)$(autofslibdir) \
+    $(DESTDIR)$(sssdconfdir) \
+    $(DESTDIR)$(logpath) \
     $(NULL)
 
 if HAVE_DOXYGEN
diff --git a/configure.ac b/configure.ac
index e6745cb454624d1d62e1a827c2fbf557f6502ae9..e5ec204ad9671d15deb1830c60168e066a66f198 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,7 @@ WITH_SAMBA
 WITH_NFS
 WITH_NFS_LIB_PATH
 WITH_LIBWBCLIENT
+WITH_SSSD_USER
 
 m4_include([src/external/pkg.m4])
 m4_include([src/external/libpopt.m4])
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index 4aa58138c85db9266fd3f1765fc357b3fd104941..fbee81f56e484b618379f7c987ecee50ae48917e 100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -737,3 +737,22 @@ AC_DEFUN([WITH_NFS_LIB_PATH],
     fi
     AC_SUBST(nfslibpath)
   ])
+
+AC_DEFUN([WITH_SSSD_USER],
+  [ AC_ARG_WITH([sssd-user],
+                [AS_HELP_STRING([--with-sssd-user=<user>],
+                                [User for running SSSD (root)]
+                               )
+                ]
+               )
+
+    SSSD_USER=root
+
+    if test x"$with_sssd_user" != x; then
+        SSSD_USER=$with_sssd_user
+    fi
+
+    AC_SUBST(SSSD_USER)
+    AC_DEFINE_UNQUOTED(SSSD_USER, "$SSSD_USER", ["The default user to run SSSD as"])
+    AM_CONDITIONAL([SSSD_USER], [test x"$with_sssd_user" != x])
+  ])
-- 
1.9.3