[PATCH app-xdm 5/6] config: use AC_CHECK_FUNCS for setusercontext
Alan Coopersmith
alan.coopersmith at oracle.com
Tue Oct 26 12:59:04 PDT 2010
Gaetan Nadon wrote:
> AC_CHECK_FUNCS defines HAVE_SETUSERCONTEXT
>
> The replaced code made an incorrect assumption that it was only
> availble on BSD-like systems.
>
> Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
> ---
> configure.ac | 11 +----------
> dm.h | 2 +-
> session.c | 12 ++++++------
> 3 files changed, 8 insertions(+), 17 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 127e53a..4c7f04e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -91,7 +91,7 @@ AC_TYPE_SIGNAL
> #
> # Required system libraries have been searched for and are listed in $LIBS
> #------------------------------------------------------------------------------
> -AC_CHECK_FUNCS([daemon sigaction openlog asprintf setproctitle])
> +AC_CHECK_FUNCS([daemon sigaction openlog asprintf setproctitle setusercontext])
>
> #------------------------------------------------------------------------------
>
> @@ -116,15 +116,6 @@ AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAS_GETIFADDRS,1,
> AC_CHECK_FUNC(getspnam, AC_DEFINE(USESHADOW,1,
> [Define to 1 if you have the shadow password functions.]))
>
> -# 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
> -
> XTRANS_CONNECTION_FLAGS
> dnl Sets $SECURE_RPC to "yes" or "no"
> XTRANS_SECURE_RPC_FLAGS
> 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,
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the xorg-devel
mailing list