dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From da163073db166a8f3acc07391ccdaedc8aa70230 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 205/205] 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 bc9460e122ce991087a744fd5335e6c468c6a64b..701be4b35b0f9a9afd9c58eae724d3b8615d0b8c 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 74ce2dcecfe17d1cea96cfb5c4b7edb8fd46f09f..e816ba8462afb907e291aaa1692208ccb822205c 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -655,9 +655,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