summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-02-23 01:15:29 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-02-23 09:13:21 -0500
commit8d821f0508f495deb376617c165cbcbf396a058a (patch)
treed24881cf8d511fabd5ef59bfd091f597bbbc6580
parentfd9847469ce7056d88baea965af70c467ef80331 (diff)
downloadsssd-8d821f0508f495deb376617c165cbcbf396a058a.tar.gz
sssd-8d821f0508f495deb376617c165cbcbf396a058a.tar.bz2
sssd-8d821f0508f495deb376617c165cbcbf396a058a.zip
pam_sss: keep selinux optional
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
-rw-r--r--Makefile.am2
-rw-r--r--src/sss_client/pam_sss.c6
-rw-r--r--src/tools/tools_util.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index c0af34c7..8ce8c64d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -960,7 +960,7 @@ pam_sss_la_SOURCES = \
pam_sss_la_LDFLAGS = \
-lpam \
- -lselinux \
+ $(SELINUX_LIBS) \
-module \
-avoid-version \
-Wl,--version-script,$(srcdir)/src/sss_client/sss_pam.exports
diff --git a/src/sss_client/pam_sss.c b/src/sss_client/pam_sss.c
index 45e31810..4fe4613a 100644
--- a/src/sss_client/pam_sss.c
+++ b/src/sss_client/pam_sss.c
@@ -41,7 +41,9 @@
#include <security/pam_modules.h>
#include <security/pam_ext.h>
#include <security/pam_modutil.h>
+#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
+#endif
#include "sss_pam_macros.h"
#include "sss_cli.h"
@@ -1083,11 +1085,13 @@ static int send_and_receive(pam_handle_t *pamh, struct pam_items *pi,
size_t replen;
int pam_status = PAM_SYSTEM_ERR;
+#ifdef HAVE_SELINUX
char *path = NULL;
char *tmp_path = NULL;
int pos, len;
int fd;
mode_t oldmask;
+#endif /* HAVE_SELINUX */
print_pam_items(pi);
@@ -1184,6 +1188,7 @@ static int send_and_receive(pam_handle_t *pamh, struct pam_items *pi,
break;
}
+#ifdef HAVE_SELINUX
if (asprintf(&path, "%s/logins/%s", selinux_policy_root(),
pi->pam_user) < 0 ||
asprintf(&tmp_path, "%sXXXXXX", path) < 0) {
@@ -1221,6 +1226,7 @@ static int send_and_receive(pam_handle_t *pamh, struct pam_items *pi,
free(path);
free(tmp_path);
umask(oldmask);
+#endif /* HAVE_SELINUX */
break;
case SSS_PAM_SETCRED:
case SSS_PAM_CLOSE_SESSION:
diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c
index 404aef25..00448953 100644
--- a/src/tools/tools_util.c
+++ b/src/tools/tools_util.c
@@ -29,9 +29,6 @@
#include <fcntl.h>
#include "config.h"
-#ifdef HAVE_SELINUX
-#include <selinux/selinux.h>
-#endif
#include "util/util.h"
#include "confdb/confdb.h"