[PATCH:xinit] Check for openssl as mkcookie fallback on all platforms, not just OpenBSD

Thomas Klausner wiz at NetBSD.org
Thu Oct 3 15:23:38 PDT 2013


On Sun, Aug 04, 2013 at 10:04:32AM +0200, Thomas Klausner wrote:
> Looks fine to me. On NetBSD:
> 
> checking for openssl... /usr/bin/openssl
> configure: startx will depend on "/usr/bin/openssl rand -hex 16" to generate xauth cookies
> 
> Reviewed-by: Thomas Klausner <wiz at NetBSD.org>

There's a bug report for pkgsrc (http://gnats.netbsd.org/48266) that
NetBSD 5's openssl doesn't know the -hex option.

The submitter suggests using "openssl rand 16" instead, but that
outputs binary characters.

On NetBSD-6.99.23, passed through od like on Solaris, that would give:

# openssl rand  16 | od -X -A n -N 16    
                4ff19e91        a1ba645c        b097619d        250b9817

What do you suggest using on that NetBSD release?
 Thomas

>  Thomas
> 
> On Sat, Aug 03, 2013 at 12:20:33AM -0700, Alan Coopersmith wrote:
> > Configure will notify the builder which cookie maker it chooses,
> > so that packagers can add a dependency on the program needed.
> > 
> > Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> > ---
> >  configure.ac |   27 ++++++++++++++++++---------
> >  1 file changed, 18 insertions(+), 9 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index c7fb0ab..0900bf1 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -153,17 +153,26 @@ esac
> >  AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
> >    [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
> >  
> > -case $host_os in
> > -	*openbsd*)
> > -	MCOOKIE='/usr/sbin/openssl rand -hex 16'
> > -	;;
> > -	*solaris*)
> > -	MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
> > -	;;
> > -esac
> > -
> > +# If mcookie not found, try openssl, else per-system fallbacks
> > +if test "x$MCOOKIE" = x ; then
> > +    AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
> > +        [$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
> > +    if test "x$OPENSSL" != x ; then
> > +        MCOOKIE="$OPENSSL rand -hex 16"
> > +    else
> > +        case $host_os in
> > +            *openbsd*)
> > +                MCOOKIE='/usr/sbin/openssl rand -hex 16'
> > +                ;;
> > +            *solaris*)
> > +                MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
> > +                ;;
> > +        esac
> > +    fi
> > +fi
> >  if test "x$MCOOKIE" != x ; then
> >  	STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
> > +	AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
> >  fi
> >  AC_SUBST(STARTX_COOKIE_FLAGS)
> >  
> > -- 
> > 1.7.9.2
> > 
> > _______________________________________________
> > 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
> > 
> _______________________________________________
> 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