[PATCH v2 app-xdm 18/19] config: replace platform check with compiler defines for SU

Mark Kettenis mark.kettenis at xs4all.nl
Sun Oct 3 12:47:01 PDT 2010


> From: Gaetan Nadon <memsize at videotron.ca>
> Date: Sun, 03 Oct 2010 15:36:44 -0400
> 
> The intent for the platform check for SU is to use "su -m" for
> BSD-like systems. The compiler already provide defines for
> such systems.
> 
> Better alternatives are to perform a feature check on the behavior of "su",
> or to change code in xdm-config to setuid.
> 
> For the time being, this patch will reduce maintenance by replacing
> the large case statement and the Automake variable with an 
> existing one liner of defines.

Sorry, but I still think the existing approach makes more sense.  I
don't see why a pretty much static sequence of case statements is a
"maintenance burden".

>  config/Makefile.am    |    2 +-
>  config/xdm-config.cpp |    7 ++++++-
>  configure.ac          |   24 ------------------------
>  3 files changed, 7 insertions(+), 26 deletions(-)
> 
> diff --git a/config/Makefile.am b/config/Makefile.am
> index d13645f..c3d837f 100644
> --- a/config/Makefile.am
> +++ b/config/Makefile.am
> @@ -54,7 +54,7 @@ CPP_FILES_FLAGS = -DBINDIR="$(bindir)" -DDEFAULTVT="$(DEFAULTVT)" \
>      -DXDMDIR="$(XDMLIBDIR)" -DXDMLOGDIR="$(XDMLOGDIR)" \
>      -DXDMXAUTHDIR="$(XDMXAUTHDIR)" \
>      -DXDMPIDDIR="$(XDMPIDDIR)" -DXDMCONFIGDIR="$(XDMCONFIGDIR)" \
> -    -DXDMSCRIPTDIR="$(XDMSCRIPTDIR)" -DSU="$(SU)" \
> +    -DXDMSCRIPTDIR="$(XDMSCRIPTDIR)" \
>      -DCHOOSERPATH="$(XDMLIBDIR)/chooser" $(XPMDEFINES) \
>      -DSHELL_CMD="$(SHELL_CMD)" $(MKTEMP_DEFINES)
>  
> diff --git a/config/xdm-config.cpp b/config/xdm-config.cpp
> index 59d548b..81a5931 100644
> --- a/config/xdm-config.cpp
> +++ b/config/xdm-config.cpp
> @@ -16,7 +16,12 @@ DisplayManager.keyFile:		XDMCONFIGDIR/xdm-keys
>  DisplayManager.servers:		XDMCONFIGDIR/Xservers
>  DisplayManager.accessFile:	XDMCONFIGDIR/Xaccess
>  DisplayManager*resources:	XDMCONFIGDIR/Xresources
> -DisplayManager.willing:		SU nobody -c XDMSCRIPTDIR/Xwilling
> +# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \
> +	|| defined(__APPLE__) || defined(__DragonFly__)
> +DisplayManager.willing:		su -m nobody -c XDMSCRIPTDIR/Xwilling
> +#else
> +DisplayManager.willing:		su nobody -c XDMSCRIPTDIR/Xwilling
> +#endif
>  ! All displays should use authorization, but we cannot be sure
>  ! X terminals may not be configured that way, so they will require
>  ! individual resource settings.
> diff --git a/configure.ac b/configure.ac
> index 53793a1..69f251c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -145,30 +145,6 @@ if test "x$USE_SELINUX" != "xno" ; then
>  	LIBS="$old_LIBS"
>  fi
>  
> -# FIXME: Find better test for which OS'es use su -m  - for now, just try to
> -# mirror the Imakefile setting of:
> -# if  defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || defined(FreeBSDArchitecture) || defined(DarwinArchitecture)
> -
> -
> -case $host_os in
> -    linux*|gnu*|*-gnu)
> -	SU="su"
> -        ;;
> -    darwin*)
> -	SU="su -m"
> -        ;;
> -    *bsd*|dragonfly*)
> -	SU="su -m"
> -        ;;
> -    solaris*|sysv4*)
> -	SU="su"
> -	;;
> -    *)
> -	SU="su"
> -        ;;
> -esac
> -AC_SUBST(SU)
> -
>  # Check for /dev/random or /dev/urandom
>  AC_ARG_WITH(random-device, 
>  	AC_HELP_STRING([--with-random-device\[=<pathname>\]],
> -- 
> 1.6.0.4
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list