[comp.windows.x] Questions on xdm and X authority

sachs@FID.Morgan.COM (Josef Sachs) (06/05/91)

Question 1:  If I start up X via xinit, I can specify server options, e.g.
             xinit -- -ar1 600
             to specify the autorepeat initiate interval for Xsun.
             Is there any way to do this, on a per-user basis, with xdm?

Question 2:  I'm using the MIT-MAGIC-COOKIE-1 authorization protocol
             in my X server.  I'd like root to be able to bring up a
             client for issuing alert messages.  He can do this by
             setting XAUTHORITY to my .Xauthority file, but how can
             he figure out what user is signed on via xdm, since the
             X started by xdm is running as root?  Alternatively, is
             there some way the server can respect MIT-MAGIC-COOKIE-1
             but always allow connections from root clients?
--
  ======================================================================
  |  Josef Sachs                     \     Morgan Stanley & Co., Inc.  |
  |  sachs@FID.Morgan.COM             \    1251 Avenue of the Americas |
  |  Fixed Income Research Department  \   New York, NY  10020 USA     |
  |  (212) 703-7031                     \                              |
  ======================================================================

ekberg@ssd.dl.nec.COM (Tom Ekberg) (06/05/91)

 > Question 1:  If I start up X via xinit, I can specify server options, e.g.
 >              xinit -- -ar1 600
 >              to specify the autorepeat initiate interval for Xsun.
 >              Is there any way to do this, on a per-user basis, with xdm?

I can answer this one since I had to do it last week.  I got tired of deleting
the ddduplicate characters   :-(   I don't know why nobody fixes the problem
directly by changing the MIT X source code.  It is a simple 1 line change.
Perhaps I need to send in a bug report.

On our system, we have a directory /usr/lib/X11/xdm which contains some
interesting files.  One of them is Xservers which is the one I changed -- it
tells how to bring up the server.  The following is the only uncommented line
in my version of that file:

	:0 local /usr/bin/X11/X -ar1 500

  -- tom, ekberg@asl.dl.nec.com (x3503)

schoch@starnet.com (Steve Schoch) (06/06/91)

In article <SACHS.91Jun4164126@s6.FID.Morgan.COM> sachs@FID.Morgan.COM (Josef Sachs) writes:
>Question 2:  I'm using the MIT-MAGIC-COOKIE-1 authorization protocol
>             in my X server.  I'd like root to be able to bring up a
>             client for issuing alert messages.  He can do this by
>             setting XAUTHORITY to my .Xauthority file, but how can
>             he figure out what user is signed on via xdm, since the
>             X started by xdm is running as root?  Alternatively, is
>             there some way the server can respect MIT-MAGIC-COOKIE-1
>             but always allow connections from root clients?

Under the current scheme, the X server has no way of knowing who is
running the client because the user is not sent as part of the X connection
startup.  However, I suppose one could create a new authorization protocol
that would check for a connection from a privledged socket (you couldn't
do this for UNIX connections) and would then believe the username that
this new authorization procotol sent.  This would require adding this
new protocol to both the server and the set-uid clients you want to be
able to use it.

There is an easier way.  I'll assume when you sign on via xdm that you
bring up an xterm window in your .xsession file.  I'll also assume that
on your system xterm writes to /etc/utmp so you show up as being logged
in.

The solution then is to have the alert program go through the utmp file
until it finds a user logged in with ut_host set to ":0".  It can then
setenv XAUTHORITY to this user's home directory.

	Steve