[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

X connections refused



The problem about X connections refused may very well be a problem of
the Symbolics refusing connections from unauthorized hosts.  With 8.1,
Genera checks for incoming connections to be from authorized hosts.  I
use the following code which implements a (Symbolics) command "xhost"
which adds authorized hosts.

There's also code below that will let you fix the "xon" command that came
with X11 (I don't know if it is current though) to allow for X-terminal
type situations (where the "xhost" has to be executed on the display host,
not the CPU host).  The Symbolics display is like that.

Here's a file I load to set up the X terminals on my 3600:

NOTE:  The :rel8.1 feature is a local hack.


;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: USER; Base: 10; Default-character-style: (:FIX :ROMAN :NORMAL) -*-

;;; Code to add a command to start up an XTERM on the Lispm


(defvar *DEFAULT-XTERM-HOST* (neti:parse-host "OCEAN"))

;;; EVAL is here to avoid compiling this form so 8.1 difference can co-exist with 8.0
(eval
'(progn
   (defun add-authorized-host (host)
     (when (member :rel8.1 *features*)
       (setf (gethash (net:parse-host host)
		      (funcall (find-symbol "X-SERVER-AUTHORIZED-HOSTS" :x-server-lisp)
			       (symbol-value (find-symbol "*X-SERVER-DATA*" :x-server-lisp))))
	     t)
       (loop for (net address) in (send (net:parse-host host) :network-addresses)
	     do
	 (let ((addr-spec
		 (case (send net :type)
		   ((:internet)
		    (multiple-value-bind (a b c d) (tcp:explode-internet-address address)
		      (list :internet a b c d)))
		   ((:chaos)
		    (list :chaos (ldb (byte 8 0) address) (ldb (byte 8 8) address)))
		   ((:dna)
		    (list :DECnet (ldb (byte 8 0) address) (ldb (byte 8 8) address))))))
	   (setf (gethash addr-spec
			  (funcall (find-symbol "X-SERVER-AUTHORIZED-ADDRESSES" :x-server-lisp)
				   (symbol-value (find-symbol "*X-SERVER-DATA*" :x-server-lisp))))
		 t)))
       ))
   (compile 'add-authorized-host)
   )
)

;;; Added the variables *xterm-file* and *xterm-host-append* for
;;; added flexibility when attaching to foreign hosts.
;;; Yvan Leclerc 3/10/93 16:41:50

(defvar *xterm-file* "/usr/local/bin/X11/xterm")
;(setq *xterm-file* "/usr/bin/X11/xterm")
(defvar *xterm-host-append* "")
;(setq *xterm-host-append* ".ai.sri.com")
(cp:define-command (COM-START-XTERM
		     :name "Start XTERM"
		     :command-table "Global"
		     :provide-output-destination-keyword nil)
    (&key
      (foreign-host 'neti:host
		    :prompt "foreign host"
		    :documentation "Host to run XTERM on"
		    :default *default-xterm-host*)
      (flush-output 'scl:boolean
		    :prompt "flush output"
		    :documentation "Flush the output from XTERM"
		    :default t)
      (screen 'scl:integer
	      :prompt "screen number"
	      :documentation "Number for screen (0=main screen)"
	      :default 0)
     )
   (let ((cp:*command-table* (cp:find-command-table :User)))
     (when (member :rel8.1 *features*)
       (add-authorized-host foreign-host))
     ;; WMT 9/19/91 For some reason Lowrance didn't work without the path so I'm wiring it in
;   (cp:execute-command "Execute Command" foreign-host (format nil "/usr/bin/csh -e /usr/local/bin/X11/xterm -ls -display ~A:0.~D -e csh -X $HOME/.xinitrc-lispm ~@[ >&//dev//null &~]"
   (cp:execute-command "Execute Command" foreign-host (format nil "~A -ls -sb -sl 1000 -geometry 80x24+1-0 -display ~A~A:0.~D -n ~A-Xterm-toplevel -T Xterm-~A-toplevel -e csh -c \"set mychoice=X11 ; source .cshrc ; source .login ; source .xinitrc-lispm\" ~@[ >&//dev//null &~]"
							      *xterm-file*
							      (string-downcase (send neti:*local-host* :name))
							      *xterm-host-append*
							      screen
							      (string-downcase (send foreign-host :name))
							      (string-downcase (send foreign-host :name))
							      flush-output))))



(cp:install-command 'x-server-program 'com-start-xterm "Start XTERM")
(dw::define-standard-menu-accelerator com-start-xterm x-server-program "Start XTERM")

(cp:define-command (COM-AUTHORIZE-HOSTS
		     :name "Authorize hosts"
		     :command-table 'x-server-program
		     :provide-output-destination-keyword nil)
    ((host-list '(cl:sequence neti:host)
	   :prompt "hosts"
	   :documentation "Hosts to allow access to lispm X server window"
	   ))
   (loop for host in host-list
	     do (add-authorized-host host)))



(dw::define-standard-menu-accelerator com-authorize-host x-server-program "Authorize Host")
;;; Note this works like "xhost" on Unix systems except doesn't allow + or -
(cp:install-command "user" 'com-authorize-hosts "xhost")


;;; Include the following in your XON script on the Unix machine
;;; display_host="`echo $DISPLAY | sed \"s/:.*//\"`"
;;; rawhost=`expr $display_host : '\([^.]*\)\..*'`
;;; if [ "$rawhost" = "" ] ; then display_host=${display_host}.`domainname`; fi
;;;
;;; Put this just after HOSTNAME gets domainname appended to it (bug fix of original script)
;;; # Make sure domain is on host too.
;;; rawhost=`expr $host : '\([^.]*\)\..*'`
;;; if [ "$rawhost" = "" ] ; then host=${host}.`domainname` ; fi
;;; 
;;; This next line is already in the XON script but add the lines below it
;;; if [ $HOSTNAME != $host ]; then
;;;     if [ $display_host != $HOSTNAME ] && [ $host != $display_host ]; then
;;; 	if [ `basename $command` != "xon" ]; then
;;; 	   if [ "$debug" ]; then
;;; # Yes, I did mean to leave off the "+" below
;;; # The reason has to do with commands on display_host (Symbolics)
;;; 	       rsh $display_host xhost $host
;;; 	   else
;;; 	       rsh $display_host xhost $host > /dev/null 2>&1
;;; 	   fi
;;; 	fi