From 1d99c6f3eafababa8680015d5dace87c7dd86927 Mon Sep 17 00:00:00 2001 From: mharris Date: Mon, 29 Aug 2005 06:50:24 +0000 Subject: [PATCH] auto-import xorg-x11-xauth-6.99.99.0-1 on branch devel from xorg-x11-xauth-6.99.99.0-1.src.rpm --- .cvsignore | 1 + mkxauth | 384 ++++++++++++++++++++++++++++++++++++++++++++ mkxauth.man | 254 +++++++++++++++++++++++++++++ sources | 1 + xorg-x11-xauth.spec | 82 ++++++++++ 5 files changed, 722 insertions(+) create mode 100755 mkxauth create mode 100644 mkxauth.man create mode 100644 xorg-x11-xauth.spec diff --git a/.cvsignore b/.cvsignore index e69de29..22af764 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +xauth-0.99.0.tar.bz2 diff --git a/mkxauth b/mkxauth new file mode 100755 index 0000000..93a5118 --- /dev/null +++ b/mkxauth @@ -0,0 +1,384 @@ +#!/bin/sh +# +# mkxauth: script to make per-user Xauthority database +# formerly 'newcookie' script; modified 18-Jul-1996 jim knoble +# +######################################################################## +# $Log: mkxauth,v $ +# Revision 1.1 2004/03/10 20:21:41 mharris +# automated commit of xorg-x11-0.0.6.6-0.0.2004_03_09.0 +# +# Revision 1.8mh 2004/02/23 mharris +# changed chown to use foo:bar instead of foo.bar as the latter has been +# deprecated. This entry is added by hand as mkxauth isn't in CVS +# +# Revision 1.7 1996/10/23 21:34:23 jmknoble +# take path of least surprise if no command specified; +# if hostnames specified with -c, don't assume local host. +# +# Revision 1.6 1996/10/02 20:34:12 jmknoble +# updated help text again +# +# Revision 1.5 1996/10/02 20:10:03 jmknoble +# updated help text +# +# Revision 1.4 1996/10/02 20:03:26 jmknoble +# fixed quoting problem in key generation +# +# Revision 1.3 1996/08/20 16:31:30 jmknoble +# refined random key generation (using mcookie if available) +# +# Revision 1.2 1996/08/20 15:49:33 jmknoble +# replaced key generation using perl with method using md5sum +# +# Revision 1.1 1996/08/05 16:40:20 jmknoble +# Initial revision +# +######################################################################## + +#set -x + +## default values for some variables +usr_umask=0077 +# eventual exit status +sts=0 +# verbose operation if blank +opt_vrbopr='' +# eventual string of non-option arguments +cmd_args='' +# filename for per-user Xauthority database +usrauth=.Xauthority +# username for whom to make per-user database +lclusr=`whoami` +# mode for making database; +# valid values are 'create', 'merge-local', +# 'merge-ftp', 'merge-rsh', 'merge-rzip', +# and 'none' +xauth_mode='none' +# actual path to target database +dstauth='' +# user to login as for rsh/rzip modes +rmtusr=`whoami` +# host to contact for remote Xauthority databases +rmthst='' +# local user to grab Xauthority from in merge mode +srcusr='' + +######################################################################## +# help message +function prthlp() { + echo "" + echo " usage: $0 [-q] [-u ] -m " + echo " $0 [-q] [-u ] -f " + echo " $0 [-q] [-u ] -r [-l ]" + echo " $0 [-q] [-u ] -z [-l ]" + echo " $0 [-q] [-u ] -c [ [ ... ]]" + echo "" + echo " create or update an Xauthority database containing authentication" + echo " keys for the current user or a specified user on the local host." + echo "" + echo " commands:" + echo "" + echo " -m merge the Xauthority database from local user " + echo " (if readable) with the target .Xauthority" + echo "" + echo " -f merge a remote Xauthority database with the target" + echo " .Xauthority, using ncftp" + echo "" + echo " -r merge a remote Xauthority database with the target" + echo " .Xauthority, using rsh" + echo "" + echo " -z merge a remote Xauthority database with the target" + echo " .Xauthority, using rsh and gzip" + echo "" + echo " -c ... create a local Xauthority database, or add keys to an" + echo " existing one, for all hosts listed (uses md5sum). if" + echo " no hosts are listed, assume the local host." + echo "" + echo " options:" + echo "" + echo " -q quiet operation" + echo "" + echo " -u create/merge .Xauthority for user " + echo "" + echo " -l for '-f', '-r' and '-z' modes, use for the" + echo " remote login" + echo "" + + exit 0 +} + +# check that current user is root +function chkroot() { + if [ `whoami` != root ]; then + echo "sorry---you need to be root" "$*" + exit 1 + fi +} + +# write a message to stdout iff verbose mode on +function msg() { + if [ -z "$opt_vrbopr" ]; then + echo "$@" + fi +} + +# check that a command exists +function chkcmdexs() { + for i in $*; do + if [ -z `type -p $i` ]; then + echo "`basename $0`: error: can't find command '$i'" + exit 1 + fi + done +} + +# check that a file exists, and create it if it doesn't +# *and* if we have write permissions to its parent dir +function chkfilexs() { + for i in $*; do + if [ ! -f "$i" ]; then + if [ -w `dirname $i` ]; then + msg -n "creating file $i ... " + touch $i + msg "done" + fi + fi + done +} + +# check if a file is readable +function redabl() { + local srcfil=$1 + if [ -r "$srcfil" ]; then + sts=0 + else + echo "`basename $0`: error: cannot read file $srcfil" + sts=1 + fi + return $sts +} + +# check if a file is writable +function wrtabl() { + local dstfil=$1 + if [ -w "$dstfil" ]; then + sts=0 + else + echo "`basename $0`: error: cannot write to file $dstfil" + sts=1 + fi + return $sts +} + +# set the correct ownership for a file +function givusr() { + local lststs=$1 + local usrnam=$2 + local dstfil=$3 + if [ $lststs = 0 ]; then + chown $usrnam:$usrnam $dstfil + sts=0 + else + msg "" + echo "`basename $0`: error writing to file $dstfil" + sts=1 + fi + return $sts +} + +######################################################################## +# set our umask so that no one else can read our files +umask $usr_umask + +# test some command-line args +while [ "$*" ]; do + case $1 in + -h | --help) + shift + prthlp + ;; + -q | --quiet) + shift + opt_vrbopr='-q' + ;; + -u | --user) + shift + lclusr="$1" + shift + ;; + -l | --login) + shift + rmtusr="$1" + shift + ;; + -c | --create) + shift + xauth_mode='create' + ;; + -m | --merge) + shift + xauth_mode='merge-local' + srcusr="$1" + shift + ;; + -f | --ftp) + shift + xauth_mode='merge-ftp' + rmthst="$1" + shift + ;; + -r | --rsh) + shift + xauth_mode='merge-rsh' + rmthst="$1" + shift + ;; + -z | --rzip) + shift + xauth_mode='merge-rzip' + rmthst="$1" + shift + ;; + -*) + echo "`basename $0`: invalid option '$1'" + shift + prthlp + ;; + *) + cmd_args="$cmd_args $1" + shift + ;; + esac +done + +# if called without a valid command, follow path of least surprise +if [ "$xauth_mode" = "none" ]; then + prthlp +fi + +# figure out if we're allowed to do what we said we wanted to +if [ `whoami` != $lclusr ]; then + chkroot "to change another user's .Xauthority." +fi + +# make sure xauth is available +chkcmdexs xauth + +# set name for target Xauthority database +dstauth=`eval echo ~$lclusr/$usrauth` + +# figure out what action to take +case $xauth_mode in + create) + # create an Xauthority database for user 'userid'. + # (requires md5sum, xauth) + chkcmdexs uptime dd md5sum cut + # create an empty database if one doesn't exist + chkfilexs $dstauth + # generate a random key -- depends on md5sum, among others + key=`( + whoami + uptime + [ \`type -p mcookie\` ] && mcookie + [ -f /proc/meminfo ] && cat /proc/meminfo + [ -f /dev/urandom ] && dd if=/dev/urandom bs=16 count=1 + ) 2>&1 | md5sum | cut -f 1 -d ' '` + # add all hosts specified on command line; + # if none specified, assume local host. + authhosts=`hostname` + if [ "$cmd_args" ]; then + authhosts="$cmd_args" + fi + if wrtabl $dstauth; then + for i in $authhosts; do + msg -n "adding key for $i to $dstauth ... " + xauth -f $dstauth add $i/unix:0 . $key + xauth -f $dstauth add $i:0 . $key + if [ $? != 0 ]; then + break + fi + msg "done" + done + # make sure the user owns the file + givusr $? $lclusr $dstauth + fi + ;; + merge-local) + # merge a local Xauthority database (if readable) + # from a specified user with the database for local user. + # (requires xauth) + srcauth=`eval echo ~$srcusr/$usrauth` + if redabl $srcauth; then + mrgcmd="xauth -f $dstauth merge $srcauth" + mrgmsg="merging $srcauth into $dstauth" + else + exit $sts + fi + ;; + merge-ftp) + # merge a remote Xauthority database with the local one + # for local user, using ncftp. + # (requires ncftp, xauth) + chkcmdexs ncftp + srcauth="$rmtusr@$rmthst:$usrauth" + if [ -z "$opt_vrbopr" ]; then + ftp_vrbopr="-V quiet" + else + ftp_vrbopr="-V quiet" + fi + mrgcmd='ncftp $ftp_vrbopr <<-ENDFTPCMD + open -ui $rmthst + $rmtusr + get $usrauth "|xauth -f $dstauth merge -" + quit + ENDFTPCMD' + mrgmsg="merging $srcauth into $dstauth" + ;; + merge-rsh) + # merge a remote Xauthority database with the local one + # for local user, using rsh + # (requires rsh, xauth) + chkcmdexs rsh + srcauth="$rmtusr@$rmthst:$usrauth" + mrgcmd="{ rsh -l $rmtusr $rmthst cat $usrauth } \ + | { xauth -f $dstauth merge - }" + mrgmsg="merging $srcauth into $dstauth" + ;; + merge-rzip) + # merge a remote Xauthority database with the local one + # for local user, using rsh and gzip. + # (requires rsh, gzip, xauth) + chkcmdexs rsh gzip + srcauth="$rmtusr@$rmthst:$usrauth" + mrgcmd="{ rsh -l $rmtusr $rmthst gzip -c $usrauth } \ + | { gzip -dc } \ + | { xauth -f $dstauth merge - }" + mrgmsg="merging $srcauth into $dstauth" + ;; + *) + # something's hosed + echo "oops! xauth_mode = '$xauth_mode' - this shouldn't happen." + sts=1 + ;; +esac + +# actually perform merge, if requested +case $xauth_mode in + merge-*) + # create an empty database if one doesn't exist + chkfilexs $dstauth + # perform the requested merge, if the target database is writable + if wrtabl $dstauth; then + msg "$mrgmsg ... " + eval "$mrgcmd" + # if successful, make sure the user owns the file + if givusr $? $lclusr $dstauth; then + msg "done" + fi + fi + ;; +esac + +exit $sts + diff --git a/mkxauth.man b/mkxauth.man new file mode 100644 index 0000000..3621101 --- /dev/null +++ b/mkxauth.man @@ -0,0 +1,254 @@ +.de TQ +.br +.ns +.TP \\$1 +.. +.TH mkxauth 1x "12-Dec-1996" "Red Hat Software" "Linux User's Manual" +.SH NAME +mkxauth \- create and merge .Xauthority files +.SH SYNOPSIS +(1) +.B mkxauth +[ \-q ] [ \-u +.I login +] \-c [ +.I host +[ +.I host +\|.\|.\|. ] ] +.PP +(2) +.B mkxauth +[ \-q ] [ \-u +.I login +] \-m +.I login +.PP +(3) +.B mkxauth +[ \-q ] [ \-u +.I login +] \-f +.I host +.PP +(4) +.B mkxauth +[ \-q ] [ \-u +.I login +] \-r +.I host +[ \-l +.I login +] +.PP +(5) +.B mkxauth +[ \-q ] [ \-u +.I login +] \-z +.I host +[ \-l +.I login +] +.SH DESCRIPTION +.B mkxauth +aids in the creation and maintenance of X authentication databases +(.Xauthority files). Use it to create a ~/.Xauthority file or merge +keys from another local or remote .Xauthority file. Remote .Xauthority +files can be retrieved via FTP (using +.BR ncftp (1)) +or via +.BR rsh (1). +For a slight measure of security, +.B mkxauth +does not create any temporary files containing authentication keys +(although anyone spying on network packets can see the authentication +key data as they pass through the network; for secure network +communications, use +.BR ssh (1)). +.SS Creating and Adding to a .Xauthority File +To create a .Xauthority file, use +.B mkxauth \-c +(see (1) above). +.B mkxauth +creates a .Xauthority file in the user's home directory (~/), +containing a `key' or `magic cookie' for the host it was run on (the +one returned by +.BR hostname (1)). +If a .Xauthority file already exists, the keys are added to it. If +keys for that host already exist, they are replaced. +.PP +To create or add to a .Xauthority file for another user, use +.B mkxauth \-u +.I login +.BR \-c . +.B mkxauth +adds keys to +.RI ~ login /.Xauthority +(only the root user is allowed to do this). +.PP +To add a key for more than one host, specify all hosts on the command +line: +.B mkxauth \-c daffy porky +.BR bugs . +All hosts specified on the same command line receive the same key. To +create different keys for multiple hosts, run +.B mkxauth +for each host in succession: +.PP +.RS +.TQ +mkxauth \-c daffy +.TQ +mkxauth \-c porky +.TQ +mkxauth \-c bugs +.RE +.SS Merging Keys from Local .Xauthority Files +To merge keys from another local user's .Xauthority file, use +.B mkxauth \-m +.I login +(see (2) above). +.B mkxauth +adds the keys in +.RI ~ login /.Xauthority +to ~/.Xauthority, replacing any keys which already exist. +.RI ~ login /.Xauthority +must be readable by the user running +.B mkxauth +(normally only the root user can read other people's .Xauthority files). +.SS Merging Keys via FTP +To merge keys from a remote .Xauthority file via FTP, use +.B mkxauth \-f +.I host +(see (3) above). +.B mkxauth +retrieves the remote .Xauthority from +.I host +using +.BR ncftp (1) +and adds those keys to ~/.Xauthority, replacing any keys which already +exist. +.RI [ NOTE : +you must have a ~/.netrc file set up to automatically log you into +.IR host , +otherwise the FTP login attempt will fail.] +.SS Merging Keys via rsh(1) +To merge keys from remote .Xauthority file via +.BR rsh (1), +use +.B mkxauth \-r +.I host +(see (4) above). +.B mkxauth +retrieves the remote .Xauthority from +.I host +using +.BR rsh (1) +and adds those keys to ~/.Xauthority, replacing any keys which already +exist. To login as a different user, use +.B \-l +.IR login . +.RI [ NOTE : +you must have a .rhosts file set up properly for this to work, +otherwise the remote login attempt will fail]. +.SS Merging Keys via rsh(1) and gzip(1) +If your remote .Xauthority file is large, or to make it slightly less +obvious that you're transferring authentication keys over the network, +.B mkxauth +can +.BR gzip (1) +your .Xauthority file before retrieving it via +.BR rsh (1). +To do this, use +.B mkxauth \-z +.I host +(see (5) above). +.B mkxauth +retrieves the remote .Xauthority from +.I host +using +.BR rsh (1) +and adds those keys to ~/.Xauthority, replacing any keys which already +exist. To login as a different user, use +.B \-l +.IR login . +.RI [ NOTE : +you must have a .rhosts file set up properly for this to work, +otherwise the remote login attempt will fail]. +.SS Options +To make +.B mkxauth +operate quietly, use the +.B \-q +option. +.PP +To add to +.RI ~ login /.Xauthority, +use the +.B \-u +.I login +option. +.PP +To use +.I login +for the remote login in +.B mkxauth +.BR \-f , +.B mkxauth +.BR \-r , +and +.B mkxauth +.BR \-z , +use the +.B \-l +.I login +option. +.SS Getting Help +To get quick help about +.BR mkxauth , +use +.B mkxauth +.BR \-\-help . +.SH FILES +.TQ +~/.Xauthority +.TQ +~/.netrc +.TQ +~/.rhosts +.SH COMMENTS +.B mkxauth +is mostly useful for maintaining .Xauthority files in an environment +which uses +.BR startx (1x). +.BR xdm (1x) +uses its own method of generating .Xauthority files. However, +.B mkxauth +is still useful for transferring .Xauthority information to remote +login sessions so that the user can display remote X clients on the +local host without too much trouble. +.PP +Note, however, that using +.BR rsh (1) +is inherently insecure, and sites concerned about security should use +.BR ssh (1) +instead (see http://www.cs.hut.fi/ssh/ for more information). +.SH SEE ALSO +.BR X (1x), +.BR Xsecurity (1x), +.BR gzip (1), +.BR mcookie (1), +.BR md5sum (1), +.BR ncftp (1), +.BR rsh (1), +.BR startx (1x), +.BR xauth (1x), +.BR xdm (1x) +.SH BUGS +Does not respect the XAUTHORITY environment variable. +.SH AUTHOR +Conceived and written by Jim Knoble . Copyright +1996 by Jim Knoble and Red Hat Software. Distributed under the GNU GPL +(General Public License); see ftp://prep.ai.mit.edu/pub/gnu/COPYING for +more information. \ No newline at end of file diff --git a/sources b/sources index e69de29..b7da951 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +fb8174c44beb47eb664dfa53317f5839 xauth-0.99.0.tar.bz2 diff --git a/xorg-x11-xauth.spec b/xorg-x11-xauth.spec new file mode 100644 index 0000000..06fcf0d --- /dev/null +++ b/xorg-x11-xauth.spec @@ -0,0 +1,82 @@ +%define pkgname xauth +# FIXME: Upstream version of xfs tarball is 0.99.0, which would require +# us to add an "Epoch: 1" to this package in order for rpm to upgrade from +# the FC4 (and earlier) monolithic xorg-x11-xfs-6.8.x rpm package. Since +# it is currently unknown what the final upstream tarball version is likely +# to be called, I am avoiding adding Epoch, and instead using a 6.99.99.x +# version number for the time being. This allows us to make sure xfs will +# upgrade from older releases to the new release, allows us to avoid adding +# an Epoch tag possibly unnecessarily - as Epoch is permanent and very evil. +# If upstream later names it "xfs-7.0", then we bump the version to that, +# and everything just works. +%define upstreamversion 0.99.0 + +Summary: X.Org X11 X authority utilities +Name: xorg-x11-%{pkgname} +Version: 6.99.99.0 +Release: 1 +License: MIT/X11 +Group: User Interface/X +URL: http://www.x.org +Source0: http://xorg.freedesktop.org/X11R7.0-RC0/everything/%{pkgname}-%{upstreamversion}.tar.bz2 +Source10: mkxauth +Source11: mkxauth.man +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot + +# x11 xau xext xmu +BuildRequires: xorg-x11-libX11-devel +BuildRequires: xorg-x11-libXau-devel +BuildRequires: xorg-x11-libXext-devel +BuildRequires: xorg-x11-libXmu-devel + +# FIXME: monolithic twm packaging has a hard dep on xterm, which might still +# be required. We'll have to examine the twm configuration files. +#Requires: xterm +Provides: xauth +Provides: mkxauth +Obsoletes: XFree86-xauth, mkxauth +# NOTE: xauth moved from the XFree86 package to XFree86-xauth in +# XFree86-4.2.0-50.11, so this Conflicts line is required for upgrades +# from RHL 8 and older, and RHEL 2.1 to work properly when upgrading to +# a newer OS release. +Conflicts: XFree86 < 4.2.0-50.11 + +%description +xauth is used to edit and display the authorization information +used in connecting to an X server. + +%prep +%setup -q -c %{name}-%{version} + +%build +cd %{pkgname}-%{upstreamversion} +%configure +make + +%install +rm -rf $RPM_BUILD_ROOT +cd %{pkgname}-%{upstreamversion} +%makeinstall +# Install mkxauth +{ + install -m 755 %{SOURCE10} $RPM_BUILD_ROOT%{_bindir}/ + install -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{_mandir}/man1/mkxauth.1 +} + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc +%dir %{_bindir} +%{_bindir}/xauth +%{_bindir}/mkxauth +%dir %{_mandir} +%dir %{_mandir}/man1 +%{_mandir}/man1/xauth.1* +%{_mandir}/man1/mkxauth.1* + +%changelog +* Wed Aug 24 2005 Mike A. Harris 6.99.99.0-1 +- Initial build.