[PATCH app-xdm 20/23] config: use AC_SEARCH_LIBS and AC_CHECK_FUNCS for setusercontext
Gaetan Nadon
memsize at videotron.ca
Wed Sep 1 11:04:23 PDT 2010
It does the same thing, but on one line.
Only difference is that -lutil is added to LIBS
so it is available to all targets. This is done elsewhere
for PAM and selinux checks.
Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
configure.ac | 10 +---------
dm.h | 2 +-
session.c | 12 ++++++------
3 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2e251e2..707d8a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,15 +70,7 @@ AC_CHECK_FUNC(getspnam, AC_DEFINE(USESHADOW,1,
[Define to 1 if you have the shadow password functions.]))
AC_SEARCH_LIBS([setproctitle], [util bsd], [AC_CHECK_FUNCS(setproctitle)])
-
-# According to the old Imakefile, BSD/OS has this in libutil
-AC_CHECK_FUNC(setusercontext, [HAS_SETUSERCONTEXT="yes"],
- AC_CHECK_LIB(util, setusercontext,
- [HAS_SETUSERCONTEXT="yes" ; XDM_OS_LIBS="$XDM_OS_LIBS -lutil"]))
-if test "x$HAS_SETUSERCONTEXT" = "xyes" ; then
- AC_DEFINE(HAS_SETUSERCONTEXT,1,
- [Define to 1 if you have the 'setusercontext' function.])
-fi
+AC_SEARCH_LIBS([setusercontext], [util], [AC_CHECK_FUNCS(setusercontext)])
AC_CHECK_FUNCS([daemon sigaction openlog asprintf])
AC_CHECK_HEADERS([grp.h syslog.h sys/param.h])
diff --git a/dm.h b/dm.h
index 502cbb9..6633248 100644
--- a/dm.h
+++ b/dm.h
@@ -110,7 +110,7 @@ typedef union wait waitType;
# ifdef CSRG_BASED
# include <sys/param.h>
-# ifdef HAS_SETUSERCONTEXT
+# ifdef HAVE_SETUSERCONTEXT
# include <login_cap.h>
# include <pwd.h>
# ifdef USE_BSDAUTH
diff --git a/session.c b/session.c
index ad216d3..e0ab4bc 100644
--- a/session.c
+++ b/session.c
@@ -573,7 +573,7 @@ StartClient (
char **f, *home;
char *failsafeArgv[2];
pid_t pid;
-#ifdef HAS_SETUSERCONTEXT
+#ifdef HAVE_SETUSERCONTEXT
struct passwd* pwd;
#endif
#ifdef USE_PAM
@@ -641,7 +641,7 @@ StartClient (
#endif
#ifndef AIXV3
-# ifndef HAS_SETUSERCONTEXT
+# ifndef HAVE_SETUSERCONTEXT
if (setgid (verify->gid) < 0) {
LogError ("setgid %d (user \"%s\") failed: %s\n",
verify->gid, name, _SysErrorMsg (errno));
@@ -661,7 +661,7 @@ StartClient (
return (0);
}
# endif /* QNX4 doesn't support multi-groups, no initgroups() */
-# endif /* !HAS_SETUSERCONTEXT */
+# endif /* !HAVE_SETUSERCONTEXT */
# ifdef USE_PAM
if (pamh) {
@@ -684,13 +684,13 @@ StartClient (
}
# endif
-# ifndef HAS_SETUSERCONTEXT
+# ifndef HAVE_SETUSERCONTEXT
if (setuid(verify->uid) < 0) {
LogError ("setuid %d (user \"%s\") failed: %s\n",
verify->uid, name, _SysErrorMsg (errno));
return (0);
}
-# else /* HAS_SETUSERCONTEXT */
+# else /* HAVE_SETUSERCONTEXT */
/*
* Set the user's credentials: uid, gid, groups,
* environment variables, resource limits, and umask.
@@ -708,7 +708,7 @@ StartClient (
name, _SysErrorMsg (errno));
return (0);
}
-# endif /* HAS_SETUSERCONTEXT */
+# endif /* HAVE_SETUSERCONTEXT */
#else /* AIXV3 */
/*
* Set the user's credentials: uid, gid, groups,
--
1.6.0.4
More information about the xorg-devel
mailing list