[comp.windows.x] xhost idea/improvement

burnham@tramp.Colorado.EDU (Master of Shadows) (05/19/91)

   Has anyone ever thought of adding a 'request permission' state to the xhost 
permissions system.  It would sit in the gray area between 'permission
denied' and 'permission granted.'  Below is an example of what I mean.

   I have my machine's (call it mymachine) xhost status set to 'request 
permission.'  A friend of mine at another machine (call it anothermachine)
wants to show me the xload on anothermachine.  He types in "xload
-d mymachine:0 &".  I get a small window on my screen with the following:

     +--------------------------------------------------------+
     | User friend at machine anothermachine requests access. |
     |                                                        |
     |       +--------+                      +--------+       |
     |       |        |                      |        |       |
     |       | accept |                      |  deny  |       |
     |       |        |                      |        |       |
     |       +--------+                      +--------+       |
     |                                                        |
     +--------------------------------------------------------+

   If I press the 'accept' button the xload appears on my display and my
friend (having received no errors assumes that the xload in now on my 
display).
   
   If I press the 'deny' button (because the last xload my friend ran was 
really melt) nothing happens on my end and my friend gets the usual xhost
permission denied message.

   I believe this change can be fairly easily made, while still being
invisible to the client program.  All the work on the client side of things
would be handled in the call XOpenDisplay.  To the best of my knowledge the
only change there would be the addition of user name to the data that the 
client sends to the server during connection setup.

   The rest of this system would be handled by communication between the 
destination display's window manager and server.  The server receives the 
user and machine name from the client requesting access.  The xhost 
permissions are set at 'request permission', so the server sends the user name
and machine name to the window manager in a RequestPermission event.  The 
window manager is free to do what it wants with the this information.  In my 
example it opened up a window with 'accept' and 'deny' buttons.  The window 
manager would then send to the server an RequestResponse event which would 
say 'accepted' or 'denied'.  At this point the server would return to the 
client the usual data depending on the state of the RequestResponse event.

   This system could easily be backwards compatible.  If user name is not
sent to a server which expected it, the XOpenDisplay request is denied
when the xhost permissions were set to 'request permission'.

   If the user name data is at the end of the connection setup data a server
could ignore it if it did not have the 'request permission' capabilities.  
(Not sure about that).

   If the window manager does not have the 'request permission' capability 
then it would never receive the RequestPermission event.  The server would 
time out the connection request after waiting for the RequestResponse event.

   The only real problem that I can see is the addition of new events.  
Perhaps the new events could be hidden logically in other already existing 
events.

   Just an idea.  If any of the above seems vague, it is probably because I
am stretching my less than a year's worth of experience pretty far.  8)
What do you experts out there think?

                 "Sleep!?!  Sleep is a waste of time."

                              Later Daze