summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-08-27 08:23:57 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-09-04 10:14:18 +0200
commit3d038d2e0dc7af04ec2f7c85ae325accb39f6237 (patch)
treeff5b059032a2e91c46a39d57dc829014100f83ab
parent51dfd4f3816cb53b931bf4d1cc28a5bea9f33a7a (diff)
downloadsssd-3d038d2e0dc7af04ec2f7c85ae325accb39f6237.tar.gz
sssd-3d038d2e0dc7af04ec2f7c85ae325accb39f6237.tar.xz
sssd-3d038d2e0dc7af04ec2f7c85ae325accb39f6237.zip
Check if the SELinux login directory exists
https://fedorahosted.org/sssd/ticket/1492
-rw-r--r--configure.ac1
-rw-r--r--src/external/selinux.m49
-rw-r--r--src/responder/pam/pamsrv_cmd.c6
3 files changed, 13 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 5cd8c723..aabf375c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,6 +214,7 @@ fi
if test x$HAVE_SELINUX != x; then
AM_CHECK_SELINUX
+ AM_CHECK_SELINUX_LOGIN_DIR
fi
if test x$HAVE_SEMANAGE != x -a x$HAVE_SELINUX != x; then
diff --git a/src/external/selinux.m4 b/src/external/selinux.m4
index d1b961a4..1f41b312 100644
--- a/src/external/selinux.m4
+++ b/src/external/selinux.m4
@@ -23,3 +23,12 @@ AC_DEFUN([AM_CHECK_SEMANAGE],
[AC_MSG_ERROR([libsemanage is missing])])
AC_SUBST(SEMANAGE_LIBS)
])
+
+dnl Check if the SELinux login directory exists
+AC_DEFUN([AM_CHECK_SELINUX_LOGIN_DIR],
+[
+ AC_CHECK_FILE(/etc/selinux/targeted/logins/,
+ [AC_DEFINE([HAVE_SELINUX_LOGIN_DIR], [1],
+ [The directory to store SELinux user login is available])],
+ [AC_MSG_WARN([SELinux login directory is not available])])
+])
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 238b4fa7..4c035683 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -33,7 +33,7 @@
#include "responder/pam/pam_helpers.h"
#include "db/sysdb.h"
#include "db/sysdb_selinux.h"
-#ifdef HAVE_SELINUX
+#ifdef HAVE_SELINUX_LOGIN_DIR
#include <selinux/selinux.h>
#endif
@@ -356,7 +356,7 @@ fail:
return ret;
}
-#ifdef HAVE_SELINUX
+#ifdef HAVE_SELINUX_LOGIN_DIR
#define ALL_SERVICES "*"
#define selogin_path(mem_ctx, username) \
@@ -829,7 +829,7 @@ static void pam_reply(struct pam_auth_req *preq)
return;
}
-#ifdef HAVE_SELINUX
+#ifdef HAVE_SELINUX_LOGIN_DIR
if (pd->cmd == SSS_PAM_ACCT_MGMT &&
pd->pam_status == PAM_SUCCESS) {
/* Try to fetch data from sysdb