I wrote (in a message from Sunday 27)
 > Keith Packard wrote (in a message from Wednesday 23)
 >  > 
 >  > While supporting multiple -nolisten arguments is good, I suggest that the
 >  > current '-nolisten tcp' should include both inet4 and inet6 tcp options; 
 >  > most people use '-nolisten tcp' to avoid exposing an open port to the X 
 >  > server to the network.
 >  > 
 >  >   -nolisten inet4         don't listen for TCP/IPv4 connections
 >  >   -nolisten inet6         don't listen for TCP/IPv6 connections
 >  >   -nolisten tcp           don't listen for any TCP connections
 > 
 > I agree here, except that it looks like Sun and X.Org are using inet
 > for IPv4, not inet4. I'm going to do this change.
 
Here's a proposed patch. When a -nolisten argument is an alias, it
will look for transport entries matching this alias (ie using the same
methods) and set the NOLISTEN flag there. 

I plan to commit this in a few days, unless someone finds out that
this is wrong.

                                        Matthieu

Index: xc/lib/xtrans/Xtrans.c
===================================================================
RCS file: /cvs/xf86/xc/lib/xtrans/Xtrans.c,v
retrieving revision 3.32
diff -u -r3.32 Xtrans.c
--- xc/lib/xtrans/Xtrans.c      24 Jul 2003 13:50:18 -0000      3.32
+++ xc/lib/xtrans/Xtrans.c      27 Jul 2003 17:26:30 -0000
@@ -131,6 +131,8 @@
 #define ioctl ioctlsocket
 #endif
 
+static int
+TRANS(AliasEq)(Xtransport *, Xtransport *);
 
 
 /*
@@ -778,7 +780,8 @@
 TRANS(NoListen) (char * protocol)
        
 {
-   Xtransport *trans;
+   Xtransport *trans, *t;
+   int i;
    
    if ((trans = TRANS(SelectTransport)(protocol)) == NULL) 
    {
@@ -787,8 +790,23 @@
 
        return -1;
    }
-   
-   trans->flags |= TRANS_NOLISTEN;
+
+   /* If protocol is an alias, set the flag for all matching protocols */
+   if (trans->flags & TRANS_ALIAS) 
+   {
+       for (i = 0; i < NUMTRANS; i++) 
+       {
+          t = Xtransports[i].transport;
+          if (!strcmp(trans->TransName, t->TransName))
+              continue; /* skip self */
+          if (TRANS(AliasEq)(trans, t)) 
+              t->flags |= TRANS_NOLISTEN;
+       } 
+   } 
+   else 
+   {
+       trans->flags |= TRANS_NOLISTEN;
+   }
    return 0;
 }
 
@@ -1386,4 +1404,62 @@
     len = strlen(buf);
 #endif /* NEED_UTSNAME */
     return len;
+}
+
+static int
+TRANS(AliasEq)(Xtransport *t1, Xtransport *t2) 
+{
+#ifdef TRANS_CLIENT
+       if (t1->OpenCOTSClient != t2->OpenCOTSClient) 
+               return 0;
+#endif
+#ifdef TRANS_SERVER
+       if (t1->OpenCOTSServer != t2->OpenCOTSServer)
+               return 0;
+#endif
+#ifdef TRANS_CLIENT
+       if (t1->OpenCLTSClient != t2->OpenCLTSClient)
+               return 0;
+#endif
+#ifdef TRANS_SERVER
+       if (t1->OpenCLTSServer != t2->OpenCLTSServer)
+               return 0;
+#endif
+#ifdef TRANS_REOPEN
+       if (t1->ReopenCOTSServer != t2->ReopenCOTSServer)
+               return 0;
+       if (t1->ReopenCLTSServer != t2->ReopenCLTSServer)
+               return 0;
+#endif
+       if (t1->SetOption != t2->SetOption)
+               return 0;
+#ifdef TRANS_SERVER
+       if (t1->CreateListener != t2->CreateListener)
+               return 0;
+       if (t1->ResetListener != t2->ResetListener)
+               return 0;
+       if (t1->Accept != t2->Accept)
+               return 0;
+#endif
+#ifdef TRANS_CLIENT
+       if (t1->Connect != t2->Connect)
+               return 0;
+#endif
+       if (t1->BytesReadable != t2->BytesReadable)
+               return 0;
+       if (t1->Read != t2->Read)
+               return 0;
+       if (t1->Write != t2->Write)
+               return 0;
+       if (t1->Readv != t2->Readv)
+               return 0;
+       if (t1->Writev != t2->Writev)
+               return 0;
+       if (t1->Disconnect != t2->Disconnect)
+               return 0;
+       if (t1->Close != t2->Close)
+               return 0;
+       if (t1->CloseForCloning != t2->CloseForCloning)
+               return 0;
+       return 1;
 }
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to