|
|
ced1f5 |
From 9e1df30e737566ca92c93cb09028717415120f47 Mon Sep 17 00:00:00 2001
|
|
|
976a3f |
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
|
|
|
976a3f |
Date: Tue, 6 Feb 2018 19:17:55 +0100
|
|
|
ced1f5 |
Subject: [PATCH 99/99] util: Add sss_ prefix to some functions
|
|
|
976a3f |
MIME-Version: 1.0
|
|
|
976a3f |
Content-Type: text/plain; charset=UTF-8
|
|
|
976a3f |
Content-Transfer-Encoding: 8bit
|
|
|
976a3f |
|
|
|
976a3f |
Add sss_ prefix to del_seuser and set_seuser for consistency
|
|
|
976a3f |
with sss_get_seuser. Also sss_ prefix makes it clear that
|
|
|
976a3f |
these functions come from SSSD.
|
|
|
976a3f |
|
|
|
976a3f |
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
|
|
|
976a3f |
|
|
|
976a3f |
Resolves:
|
|
|
976a3f |
https://pagure.io/SSSD/sssd/issue/3618
|
|
|
976a3f |
(cherry picked from commit 6b9c38df5712b951e31800efea2df0802e333e08)
|
|
|
976a3f |
---
|
|
|
976a3f |
src/providers/ipa/selinux_child.c | 4 ++--
|
|
|
976a3f |
src/tools/sss_useradd.c | 2 +-
|
|
|
976a3f |
src/tools/sss_userdel.c | 2 +-
|
|
|
976a3f |
src/tools/sss_usermod.c | 2 +-
|
|
|
976a3f |
src/util/sss_semanage.c | 12 ++++++------
|
|
|
976a3f |
src/util/util.h | 6 +++---
|
|
|
976a3f |
6 files changed, 14 insertions(+), 14 deletions(-)
|
|
|
976a3f |
|
|
|
976a3f |
diff --git a/src/providers/ipa/selinux_child.c b/src/providers/ipa/selinux_child.c
|
|
|
ced1f5 |
index c659976e80cb7317671da52fe4777ee821589e36..a601b28c4c68afca51758b1967d1bfc1d51fb450 100644
|
|
|
976a3f |
--- a/src/providers/ipa/selinux_child.c
|
|
|
976a3f |
+++ b/src/providers/ipa/selinux_child.c
|
|
|
976a3f |
@@ -157,9 +157,9 @@ static int sc_set_seuser(const char *login_name, const char *seuser_name,
|
|
|
976a3f |
* default. We need to remove the SELinux user from the DB
|
|
|
976a3f |
* in that case
|
|
|
976a3f |
*/
|
|
|
976a3f |
- ret = del_seuser(login_name);
|
|
|
976a3f |
+ ret = sss_del_seuser(login_name);
|
|
|
976a3f |
} else {
|
|
|
976a3f |
- ret = set_seuser(login_name, seuser_name, mls);
|
|
|
976a3f |
+ ret = sss_set_seuser(login_name, seuser_name, mls);
|
|
|
976a3f |
}
|
|
|
976a3f |
umask(old_mask);
|
|
|
976a3f |
return ret;
|
|
|
976a3f |
diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c
|
|
|
976a3f |
index 8521b83011b42c9e2acca4136f154acb3919440c..ca2cbd6c119e5a1735e5b3b524cddeccb68a2578 100644
|
|
|
976a3f |
--- a/src/tools/sss_useradd.c
|
|
|
976a3f |
+++ b/src/tools/sss_useradd.c
|
|
|
976a3f |
@@ -205,7 +205,7 @@ int main(int argc, const char **argv)
|
|
|
976a3f |
|
|
|
976a3f |
/* Set SELinux login context - must be done after transaction is done
|
|
|
976a3f |
* b/c libselinux calls getpwnam */
|
|
|
976a3f |
- ret = set_seuser(tctx->octx->name, pc_selinux_user, NULL);
|
|
|
976a3f |
+ ret = sss_set_seuser(tctx->octx->name, pc_selinux_user, NULL);
|
|
|
976a3f |
if (ret != EOK) {
|
|
|
976a3f |
ERROR("Cannot set SELinux login context\n");
|
|
|
976a3f |
ret = EXIT_FAILURE;
|
|
|
976a3f |
diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c
|
|
|
976a3f |
index d085dc3cabd31b2ee82b13c6cbc39c7658b071d1..fb0f2c2ab6163738da2dcf4177c06cd5dc524345 100644
|
|
|
976a3f |
--- a/src/tools/sss_userdel.c
|
|
|
976a3f |
+++ b/src/tools/sss_userdel.c
|
|
|
976a3f |
@@ -254,7 +254,7 @@ int main(int argc, const char **argv)
|
|
|
976a3f |
|
|
|
976a3f |
/* Set SELinux login context - must be done after transaction is done
|
|
|
976a3f |
* b/c libselinux calls getpwnam */
|
|
|
976a3f |
- ret = del_seuser(tctx->octx->name);
|
|
|
976a3f |
+ ret = sss_del_seuser(tctx->octx->name);
|
|
|
976a3f |
if (ret != EOK) {
|
|
|
976a3f |
ERROR("Cannot reset SELinux login context\n");
|
|
|
976a3f |
ret = EXIT_FAILURE;
|
|
|
976a3f |
diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c
|
|
|
976a3f |
index 55e94394766f5f46bb3c14c231186f2d79d6b6ab..6a818f13ad2a7e087e23fa2190b83aeb1eabdbac 100644
|
|
|
976a3f |
--- a/src/tools/sss_usermod.c
|
|
|
976a3f |
+++ b/src/tools/sss_usermod.c
|
|
|
976a3f |
@@ -300,7 +300,7 @@ int main(int argc, const char **argv)
|
|
|
976a3f |
|
|
|
976a3f |
/* Set SELinux login context - must be done after transaction is done
|
|
|
976a3f |
* b/c libselinux calls getpwnam */
|
|
|
976a3f |
- ret = set_seuser(tctx->octx->name, pc_selinux_user, NULL);
|
|
|
976a3f |
+ ret = sss_set_seuser(tctx->octx->name, pc_selinux_user, NULL);
|
|
|
976a3f |
if (ret != EOK) {
|
|
|
976a3f |
ERROR("Cannot set SELinux login context\n");
|
|
|
976a3f |
ret = EXIT_FAILURE;
|
|
|
976a3f |
diff --git a/src/util/sss_semanage.c b/src/util/sss_semanage.c
|
|
|
976a3f |
index 25b6bcdad2ad7e7ac710497f13d6a6e22360b0dd..1150b6236c2c227fe2fc69f2505b6e254a1e64ec 100644
|
|
|
976a3f |
--- a/src/util/sss_semanage.c
|
|
|
976a3f |
+++ b/src/util/sss_semanage.c
|
|
|
976a3f |
@@ -272,8 +272,8 @@ int sss_get_seuser(const char *linuxuser,
|
|
|
976a3f |
return getseuserbyname(linuxuser, selinuxuser, level);
|
|
|
976a3f |
}
|
|
|
976a3f |
|
|
|
976a3f |
-int set_seuser(const char *login_name, const char *seuser_name,
|
|
|
976a3f |
- const char *mls)
|
|
|
976a3f |
+int sss_set_seuser(const char *login_name, const char *seuser_name,
|
|
|
976a3f |
+ const char *mls)
|
|
|
976a3f |
{
|
|
|
976a3f |
semanage_handle_t *handle = NULL;
|
|
|
976a3f |
semanage_seuser_key_t *key = NULL;
|
|
|
976a3f |
@@ -346,7 +346,7 @@ done:
|
|
|
976a3f |
return ret;
|
|
|
976a3f |
}
|
|
|
976a3f |
|
|
|
976a3f |
-int del_seuser(const char *login_name)
|
|
|
976a3f |
+int sss_del_seuser(const char *login_name)
|
|
|
976a3f |
{
|
|
|
976a3f |
semanage_handle_t *handle = NULL;
|
|
|
976a3f |
semanage_seuser_key_t *key = NULL;
|
|
|
976a3f |
@@ -426,13 +426,13 @@ done:
|
|
|
976a3f |
return ret;
|
|
|
976a3f |
}
|
|
|
976a3f |
#else /* HAVE_SEMANAGE && HAVE_SELINUX */
|
|
|
976a3f |
-int set_seuser(const char *login_name, const char *seuser_name,
|
|
|
976a3f |
- const char *mls)
|
|
|
976a3f |
+int sss_set_seuser(const char *login_name, const char *seuser_name,
|
|
|
976a3f |
+ const char *mls)
|
|
|
976a3f |
{
|
|
|
976a3f |
return EOK;
|
|
|
976a3f |
}
|
|
|
976a3f |
|
|
|
976a3f |
-int del_seuser(const char *login_name)
|
|
|
976a3f |
+int sss_del_seuser(const char *login_name)
|
|
|
976a3f |
{
|
|
|
976a3f |
return EOK;
|
|
|
976a3f |
}
|
|
|
976a3f |
diff --git a/src/util/util.h b/src/util/util.h
|
|
|
ced1f5 |
index be818a9531897e4f988cae48bf6ba30aea0e6d56..ef8ef7f57d7949aa2735171f11195dbcdc42288a 100644
|
|
|
976a3f |
--- a/src/util/util.h
|
|
|
976a3f |
+++ b/src/util/util.h
|
|
|
ced1f5 |
@@ -651,9 +651,9 @@ errno_t restore_creds(struct sss_creds *saved_creds);
|
|
|
976a3f |
* certain permissions. Therefore the caller should make sure the umask is
|
|
|
976a3f |
* not too restricted (especially when called from the daemon code).
|
|
|
976a3f |
*/
|
|
|
976a3f |
-int set_seuser(const char *login_name, const char *seuser_name,
|
|
|
976a3f |
- const char *mlsrange);
|
|
|
976a3f |
-int del_seuser(const char *login_name);
|
|
|
976a3f |
+int sss_set_seuser(const char *login_name, const char *seuser_name,
|
|
|
976a3f |
+ const char *mlsrange);
|
|
|
976a3f |
+int sss_del_seuser(const char *login_name);
|
|
|
976a3f |
int sss_get_seuser(const char *linuxuser,
|
|
|
976a3f |
char **selinuxuser,
|
|
|
976a3f |
char **level);
|
|
|
976a3f |
--
|
|
|
976a3f |
2.14.3
|
|
|
976a3f |
|