dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 9e1df30e737566ca92c93cb09028717415120f47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
Date: Tue, 6 Feb 2018 19:17:55 +0100
Subject: [PATCH 99/99] util: Add sss_ prefix to some functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add sss_ prefix to del_seuser and set_seuser for consistency
with sss_get_seuser. Also sss_ prefix makes it clear that
these functions come from SSSD.

Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

Resolves:
https://pagure.io/SSSD/sssd/issue/3618
(cherry picked from commit 6b9c38df5712b951e31800efea2df0802e333e08)
---
 src/providers/ipa/selinux_child.c |  4 ++--
 src/tools/sss_useradd.c           |  2 +-
 src/tools/sss_userdel.c           |  2 +-
 src/tools/sss_usermod.c           |  2 +-
 src/util/sss_semanage.c           | 12 ++++++------
 src/util/util.h                   |  6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/providers/ipa/selinux_child.c b/src/providers/ipa/selinux_child.c
index c659976e80cb7317671da52fe4777ee821589e36..a601b28c4c68afca51758b1967d1bfc1d51fb450 100644
--- a/src/providers/ipa/selinux_child.c
+++ b/src/providers/ipa/selinux_child.c
@@ -157,9 +157,9 @@ static int sc_set_seuser(const char *login_name, const char *seuser_name,
          * default. We need to remove the SELinux user from the DB
          * in that case
          */
-        ret = del_seuser(login_name);
+        ret = sss_del_seuser(login_name);
     } else {
-        ret = set_seuser(login_name, seuser_name, mls);
+        ret = sss_set_seuser(login_name, seuser_name, mls);
     }
     umask(old_mask);
     return ret;
diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c
index 8521b83011b42c9e2acca4136f154acb3919440c..ca2cbd6c119e5a1735e5b3b524cddeccb68a2578 100644
--- a/src/tools/sss_useradd.c
+++ b/src/tools/sss_useradd.c
@@ -205,7 +205,7 @@ int main(int argc, const char **argv)
 
     /* Set SELinux login context - must be done after transaction is done
      * b/c libselinux calls getpwnam */
-    ret = set_seuser(tctx->octx->name, pc_selinux_user, NULL);
+    ret = sss_set_seuser(tctx->octx->name, pc_selinux_user, NULL);
     if (ret != EOK) {
         ERROR("Cannot set SELinux login context\n");
         ret = EXIT_FAILURE;
diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c
index d085dc3cabd31b2ee82b13c6cbc39c7658b071d1..fb0f2c2ab6163738da2dcf4177c06cd5dc524345 100644
--- a/src/tools/sss_userdel.c
+++ b/src/tools/sss_userdel.c
@@ -254,7 +254,7 @@ int main(int argc, const char **argv)
 
     /* Set SELinux login context - must be done after transaction is done
      * b/c libselinux calls getpwnam */
-    ret = del_seuser(tctx->octx->name);
+    ret = sss_del_seuser(tctx->octx->name);
     if (ret != EOK) {
         ERROR("Cannot reset SELinux login context\n");
         ret = EXIT_FAILURE;
diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c
index 55e94394766f5f46bb3c14c231186f2d79d6b6ab..6a818f13ad2a7e087e23fa2190b83aeb1eabdbac 100644
--- a/src/tools/sss_usermod.c
+++ b/src/tools/sss_usermod.c
@@ -300,7 +300,7 @@ int main(int argc, const char **argv)
 
     /* Set SELinux login context - must be done after transaction is done
      * b/c libselinux calls getpwnam */
-    ret = set_seuser(tctx->octx->name, pc_selinux_user, NULL);
+    ret = sss_set_seuser(tctx->octx->name, pc_selinux_user, NULL);
     if (ret != EOK) {
         ERROR("Cannot set SELinux login context\n");
         ret = EXIT_FAILURE;
diff --git a/src/util/sss_semanage.c b/src/util/sss_semanage.c
index 25b6bcdad2ad7e7ac710497f13d6a6e22360b0dd..1150b6236c2c227fe2fc69f2505b6e254a1e64ec 100644
--- a/src/util/sss_semanage.c
+++ b/src/util/sss_semanage.c
@@ -272,8 +272,8 @@ int sss_get_seuser(const char *linuxuser,
     return getseuserbyname(linuxuser, selinuxuser, level);
 }
 
-int set_seuser(const char *login_name, const char *seuser_name,
-               const char *mls)
+int sss_set_seuser(const char *login_name, const char *seuser_name,
+                   const char *mls)
 {
     semanage_handle_t *handle = NULL;
     semanage_seuser_key_t *key = NULL;
@@ -346,7 +346,7 @@ done:
     return ret;
 }
 
-int del_seuser(const char *login_name)
+int sss_del_seuser(const char *login_name)
 {
     semanage_handle_t *handle = NULL;
     semanage_seuser_key_t *key = NULL;
@@ -426,13 +426,13 @@ done:
     return ret;
 }
 #else /* HAVE_SEMANAGE && HAVE_SELINUX */
-int set_seuser(const char *login_name, const char *seuser_name,
-               const char *mls)
+int sss_set_seuser(const char *login_name, const char *seuser_name,
+                   const char *mls)
 {
     return EOK;
 }
 
-int del_seuser(const char *login_name)
+int sss_del_seuser(const char *login_name)
 {
     return EOK;
 }
diff --git a/src/util/util.h b/src/util/util.h
index be818a9531897e4f988cae48bf6ba30aea0e6d56..ef8ef7f57d7949aa2735171f11195dbcdc42288a 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -651,9 +651,9 @@ errno_t restore_creds(struct sss_creds *saved_creds);
  * certain permissions. Therefore the caller should make sure the umask is
  * not too restricted (especially when called from the daemon code).
  */
-int set_seuser(const char *login_name, const char *seuser_name,
-               const char *mlsrange);
-int del_seuser(const char *login_name);
+int sss_set_seuser(const char *login_name, const char *seuser_name,
+                   const char *mlsrange);
+int sss_del_seuser(const char *login_name);
 int sss_get_seuser(const char *linuxuser,
                    char **selinuxuser,
                    char **level);
-- 
2.14.3