dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[Dotgnu-pnet-commits] pnetlib/Xsharp EmbeddedApplication.cs, 1.1, 1.2


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/Xsharp EmbeddedApplication.cs, 1.1, 1.2
Date: Fri, 31 Oct 2003 23:42:34 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv13215/Xsharp

Modified Files:
        EmbeddedApplication.cs 
Log Message:


Detect ssh accounts in a better way; make sure that SSH_CLIENT is properly
exported with older versions of bash.


Index: EmbeddedApplication.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/EmbeddedApplication.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EmbeddedApplication.cs      31 Oct 2003 06:44:35 -0000      1.1
--- EmbeddedApplication.cs      31 Oct 2003 23:42:32 -0000      1.2
***************
*** 436,439 ****
--- 436,441 ----
                                IntPtr dpy;
                                Xlib.Xint major, minor;
+                               String client;
+                               int index;
                                displayName = null;
                                try
***************
*** 476,483 ****
                                        // connect via ssh's X11 forwarding 
mechanism as it
                                        // does not know how to proxy appgroup 
security tokens.
!                                       
if(Environment.GetEnvironmentVariable("SSH_ASKPASS")
!                                                       != null ||
!                                          
Environment.GetEnvironmentVariable("SSH_TTY") != null)
                                        {
                                                displayName = 
Environment.GetEnvironmentVariable
                                                        ("XREALDISPLAY");
--- 478,501 ----
                                        // connect via ssh's X11 forwarding 
mechanism as it
                                        // does not know how to proxy appgroup 
security tokens.
!                                       // Try to discover where the ssh client 
lives.
!                                       client = 
Environment.GetEnvironmentVariable("SSH_CLIENT");
!                                       if(client != null && client.Length > 0)
!                                       {
!                                               // Synthesize a display name 
from the ssh client name.
!                                               index = client.IndexOf(' ');
!                                               if(index == -1)
!                                               {
!                                                       index = client.Length;
!                                               }
!                                               displayName = 
client.Substring(0, index) + ":0.0";
!                                               goto probeDisplay;
!                                       }
!                                       else 
if(Environment.GetEnvironmentVariable("SSH_ASKPASS")
!                                                               != null ||
!                                                   
Environment.GetEnvironmentVariable("SSH_TTY")
!                                                               != null)
                                        {
+                                               // Older versions of bash do 
not export SSH_CLIENT
+                                               // within an ssh login session.
                                                displayName = 
Environment.GetEnvironmentVariable
                                                        ("XREALDISPLAY");
***************
*** 487,494 ****
                                                        {
                                                                
Console.Error.WriteLine
!                                                                       ("You 
must set the XREALDISPLAY " +
!                                                                        
"environment variable when using");
                                                                
Console.Error.WriteLine
!                                                                       ("an 
ssh account and X11 forwarding.");
                                                                errorReported = 
true;
                                                        }
--- 505,516 ----
                                                        {
                                                                
Console.Error.WriteLine
!                                                                       ("The 
`SSH_CLIENT' environment variable " +
!                                                                        "is 
not exported from the shell.");
                                                                
Console.Error.WriteLine
!                                                                       
("Either export `SSH_CLIENT' or set the " +
!                                                                        
"`XREALDISPLAY' environment");
!                                                               
Console.Error.WriteLine
!                                                                       
("variable to the name of the real " +
!                                                                        "X 
display.");
                                                                errorReported = 
true;
                                                        }
***************
*** 496,502 ****
                                                        return false;
                                                }
                                                if(!displayProbed)
                                                {
!                                                       // Probe the 
XREALDISPLAY to see if it can be used.
                                                        displayProbed = true;
                                                        IntPtr probe = 
Xlib.XOpenDisplay(displayName);
--- 518,525 ----
                                                        return false;
                                                }
+                                       probeDisplay:
                                                if(!displayProbed)
                                                {
!                                                       // Probe the new 
display to see if it can be used.
                                                        displayProbed = true;
                                                        IntPtr probe = 
Xlib.XOpenDisplay(displayName);
***************
*** 507,513 ****
                                                                        
Console.Error.WriteLine
                                                                                
("The X server at `{0}' is not " +
!                                                                               
 "accessible.  You may need to use " +
!                                                                               
 "`xhost +' to permit access.",
                                                                                
 displayName);
                                                                        
errorReported = true;
                                                                }
--- 530,537 ----
                                                                        
Console.Error.WriteLine
                                                                                
("The X server at `{0}' is not " +
!                                                                               
 "accessible.  You may need",
                                                                                
 displayName);
+                                                                       
Console.Error.WriteLine
+                                                                               
("to use `xhost +' to permit access.");
                                                                        
errorReported = true;
                                                                }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]