#!/bin/sh
exit 0
# ~jhs/bin/.sh/xxdbg # Temporary Debug Notes
# http://www.berklix.org/~jhs/bin/.sh/xxdbg
# See Also:
#	http://www.berklix.com/~jhs/bin/.sh/xauth.sh
#	/site/usr/local/etc/rc.d/xdm
#	/site/domain/js.berklix.net/usr/local/lib/X11/xdm/*
#	/etc/ttys
#  /usr/local/bin/
#       lrwxr-xr-x  1 root  wheel        9 Dec 25 13:04 X@ -> Xorg.wrap
#       -rwxr-xr-x  1 root  wheel  2342192 Dec 25 13:04 Xorg*
#       -r-sr-xr-x  1 root  wheel     8992 Dec 25 13:04 Xorg.wrap*
#	man Xserver

# 2021-12 by jhs@
# Script with notes while debuging why since upgrading my X DISPLAY host
# server from 9.2-RELEASE to 12.2-RELEASE, I can no longer receive on
# display (host=fire) an xterm from remote client, & get error:
#	Protocol not supported by server
#	xterm: Xt error: Can't open display: fire.js.berklix.net:0
#	FROM		TO		RESULT
#	Lapr 9.3	Fire 9.2	OK  ?
#	Lapr 9.3	Fire 12.2	Bad ?
#	Lapr 12.2	Fire 9.2	OK
#	Lapr 12.2	Fire 12.2	Bad
#	Fire 9.2	Lapr 9.3	OK  ?
#	Fire 9.2	Lapr 12.2	Bad ?
#	Fire 12.2	Lapr 9.3	OK  ?
#	Fire 12.2	Lapr 12.2	Bad ?
# 12.2 running xterm to open on a 9.2-RELEASE display works OK.
# remote host=lapr happily opens an xterm on 9.2 display host=fire
# I tried exporting an xterm from fire@9.2 to lapr@12.2-stable_screen
# lapr rejected it
# JJLATER I could try exporting an xterm from fire@12.2 to display=lapr@9.3
# but I expect it would work & to be useful.
# -----------------------------------------------------------------------------
# XINIT
# 12.2: /usr/local/bin/xinit -- -listen inet
#	Starts these processes:
#	UID  PID PPID COMMAND
#	200 1428 1427 /usr/local/bin/xinit -- -listen inet
#	  0 1429 1428 /usr/local/bin/Xorg :0  -listen inet
#	200 1432 1428 fvwm2 (fvwm)
# Then:
#	host=fire: xhost +
#	host=lapr: rm ~/.Xauthority # removing old chaff
#		   setenv DISPLAY fire.js.berklix.net:0; xterm # Runs OK
# But
#	it creates no new ~/.Xauthority
#	xauth list # errors: file /home/jhs/.Xauthority does not exist
#	+ The usual exmh problem when X is run from xinit:
#	Clicking Reply fails, just this running:
#	/usr/local/bin/wish8.7 -f /usr/local/bin/exmh
#	xdm is needed instead of xinit to allow  /usr/local/bin/exmh-bg
# -----------------------------------------------------------------------------
# STARTX
#  creates a new ~/.Xauthority, but xauth shows only a single line
#   fire.js.berklix.net/unix:0 MIT-MAGIC-COOKIE-1 ................................
# -----------------------------------------------------------------------------
# XDM
# sh: /usr/local/bin/xdm -nodaemon -listen inet -udpPort 177 -debug 1
#  xdm error: extra arguments on command line: "-listen" "inet"
# /etc/ttys: ttyv8 "/usr/local/bin/xdm -nodaemon -listen inet" xterm onifexists secure
#       xdm error: extra arguments on command line: "-listen" "inet"
# =============================================================================
# As well as xauth.sh, I have hand run :
#	xauth list
#	xauth remove fire.js.berklix.net:0
#	xauth list
#	cat /host/fire/tmp/z | xauth merge -
#	xauth list
#		lapr.js.berklix.net:0       MIT-MAGIC-COOKIE-1  ................................
#		lapr.js.berklix.net/unix:0  MIT-MAGIC-COOKIE-1  ................................
#		fire.js.berklix.net:0       MIT-MAGIC-COOKIE-1  ................................
#	xterm -display fire.js.berklix.net:0
#		xterm: Xt error: Can't open display: fire.js.berklix.net:0
#
man xdm:
DisplayManager.keyFile
              XDM-AUTHENTICATION-1 style XDMCP authentication requires that a
              private key be shared between xdm and the terminal.  This
              resource specifies the file containing those values.  Each entry
              in the file consists of a display name and the shared key.  By
              default, xdm does not include support for XDM-AUTHENTICATION-1,
              as it requires DES which is not generally distributable because
              of United States export restrictions.

DisplayManager.DISPLAY.authName
              authorize is a boolean resource which controls whether xdm
              generates and uses authorization for the local server
              connections.  If authorization is used, authName is a list of
              authorization mechanisms to use, separated by white space.
              XDMCP connections dynamically specify which authorization
              mechanisms are supported, so authName is ignored in this case.
              When authorize is set for a display and authorization is not
              available, the user is informed by having a different message
              displayed in the login widget.  By default, authorize is
              ``true,''  authName is ``MIT-MAGIC-COOKIE-1,'' or, if XDM-
              AUTHORIZATION-1 is available, ``XDM-AUTHORIZATION-1 MIT-MAGIC-
              COOKIE-1.''

       DisplayManager.DISPLAY.authFile
              This file is used to communicate the authorization data from xdm
              to the server, using the -auth server command line option.  It
              should be kept in a directory which is not world-writable as it
              could easily be removed, disabling the authorization mechanism
              in the server.  If not specified, a name is generated from
              DisplayManager.authDir and the name of the display.


xs /usr/local/bin/xdm -nodaemon -listen inet -debug 1 |& more

cd /usr/local
nice find -s . -type f -exec grep -l XDM-AUTHENTICATION {} \; > ~/tmp/XDM-AUTHENTICATION.12.2
cd /9.2-RELEASE/usr1/local	# /1s1
nice find -s . -type f -exec grep -l XDM-AUTHENTICATION {} \; > ~/tmp/XDM-AUTHENTICATION.9.2 

12.2:
./bin/Xephyr		/usr/ports/x11-servers/xephyr		pkg built on lapr	pkg built on fire
./bin/Xnest		/usr/ports/x11-servers/xorg-nestserver	pkg built on lapr	pkg built on fire
./bin/Xorg		/usr/ports/x11-servers/xorg-server	pkg built on lapr	pkg built on fire
./bin/Xwayland		/usr/ports/x11-servers/xwayland		pkg built on lapr	pkg built on fire
./bin/xdm		/usr/ports/x11/xdm			pkg built on lapr	pkg built on fire
			/usr/ports/x11/xterm			pkg built on lapr	run
			/usr/ports/x11/xauth			pkg built on lapr

lapr: /data/release/s2/usr/ports.current/packages/All/xorg-server-1.20.13,1.pkg

