Has never been converted to build in modular builds, so has been unusable
since X11R7.0 release in 2005.  All known platforms with TLI/XTI support
that X11R7 & later releases run on also have (and mostly prefer) BSD
socket support for their networking API.

Mostly performed via "unifdef -USTREAMSCONN", followed by imdent,
and then manual cleanup.

Signed-off-by: Alan Coopersmith <[email protected]>
---
 chooser/chooser.c |  103 +--------------------------------
 include/dm.h      |    2 +-
 xdm/Makefile.am   |    1 -
 xdm/auth.c        |  143 ++++++++++++++++++---------------------------
 xdm/choose.c      |   59 -------------------
 xdm/netaddr.c     |   67 ++++++++-------------
 xdm/server.c      |   25 --------
 xdm/socket.c      |   84 +++++++++++++--------------
 xdm/streams.c     |  167 -----------------------------------------------------
 xdm/xdmcp.c       |   18 ------
 10 files changed, 124 insertions(+), 545 deletions(-)
 delete mode 100644 xdm/streams.c

diff --git a/chooser/chooser.c b/chooser/chooser.c
index dc1b89a..3e9446a 100644
--- a/chooser/chooser.c
+++ b/chooser/chooser.c
@@ -91,18 +91,9 @@ in this Software without prior written authorization from 
The Open Group.
 #include    <arpa/inet.h>
 
 #include    <sys/ioctl.h>
-#ifdef STREAMSCONN
-# ifdef WINTCP /* NCR with Wollongong TCP */
-#  include    <netinet/ip.h>
-# endif
-# include    <stropts.h>
-# include    <tiuser.h>
-# include    <netconfig.h>
-# include    <netdir.h>
-#endif
 
 #ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
+# include <sys/param.h>
 # ifdef BSD
 #  if (BSD >= 199103)
 #   define VARIABLE_IFREQ
@@ -804,53 +795,15 @@ InitXDMCP (char **argv)
        header.length += 2 + AuthenticationNames.data[i].length;
     XdmcpWriteHeader (&directBuffer, &header);
     XdmcpWriteARRAYofARRAY8 (&directBuffer, &AuthenticationNames);
-#if defined(STREAMSCONN)
-    if ((socketFD = t_open ("/dev/udp", O_RDWR, 0)) < 0)
-       return 0;
-
-    if (t_bind( socketFD, NULL, NULL ) < 0)
-       {
-       t_close(socketFD);
-       return 0;
-       }
-
-    /*
-     * This part of the code looks contrived. It will actually fit in nicely
-     * when the CLTS part of Xtrans is implemented.
-     */
-    {
-    struct netconfig *nconf;
-
-    if( (nconf=getnetconfigent("udp")) == NULL )
-       {
-       t_unbind(socketFD);
-       t_close(socketFD);
-       return 0;
-       }
-
-    if( netdir_options(nconf, ND_SET_BROADCAST, socketFD, NULL) )
-       {
-       freenetconfigent(nconf);
-       t_unbind(socketFD);
-       t_close(socketFD);
-       return 0;
-       }
-
-    freenetconfigent(nconf);
-    }
-#else
     if ((socketFD = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
        return 0;
-# if defined(IPv6) && defined(AF_INET6)
+#if defined(IPv6) && defined(AF_INET6)
     socket6FD = socket (AF_INET6, SOCK_DGRAM, 0);
-# endif
 #endif
-#ifndef STREAMSCONN
-# ifdef SO_BROADCAST
+#ifdef SO_BROADCAST
     soopts = 1;
     if (setsockopt (socketFD, SOL_SOCKET, SO_BROADCAST, (char *)&soopts, 
sizeof (soopts)) < 0)
        perror ("setsockopt");
-# endif
 #endif
 
     XtAddInput (socketFD, (XtPointer) XtInputReadMask, ReceivePacket,
@@ -886,9 +839,6 @@ Choose (HostName *h)
        char            buf[1024];
        XdmcpBuffer     buffer;
        char            *xdm;
-#if defined(STREAMSCONN)
-        struct  t_call  call, rcv;
-#endif
 
        xdm = (char *) app_resources.xdmAddress->data;
        family = (xdm[0] << 8) + xdm[1];
@@ -917,36 +867,6 @@ Choose (HostName *h)
            break;
 #endif
        }
-#if defined(STREAMSCONN)
-       if ((fd = t_open ("/dev/tcp", O_RDWR, NULL)) == -1)
-       {
-           fprintf (stderr, "Cannot create response endpoint\n");
-           fflush(stderr);
-           exit (REMANAGE_DISPLAY);
-       }
-       if (t_bind (fd, NULL, NULL) == -1)
-       {
-           fprintf (stderr, "Cannot bind response endpoint\n");
-           fflush(stderr);
-           t_close (fd);
-           exit (REMANAGE_DISPLAY);
-       }
-       call.addr.buf=(char *)addr;
-       call.addr.len=len;
-       call.addr.maxlen=len;
-       call.opt.len=0;
-       call.opt.maxlen=0;
-       call.udata.len=0;
-       call.udata.maxlen=0;
-       if (t_connect (fd, &call, NULL) == -1)
-       {
-           t_error ("Cannot connect to xdm\n");
-           fflush(stderr);
-           t_unbind (fd);
-           t_close (fd);
-           exit (REMANAGE_DISPLAY);
-       }
-#else
        if ((fd = socket (family, SOCK_STREAM, 0)) == -1)
        {
            fprintf (stderr, "Cannot create response socket\n");
@@ -957,7 +877,6 @@ Choose (HostName *h)
            fprintf (stderr, "Cannot connect to xdm\n");
            exit (REMANAGE_DISPLAY);
        }
-#endif
        buffer.data = (BYTE *) buf;
        buffer.size = sizeof (buf);
        buffer.pointer = 0;
@@ -965,24 +884,8 @@ Choose (HostName *h)
        XdmcpWriteARRAY8 (&buffer, app_resources.clientAddress);
        XdmcpWriteCARD16 (&buffer, (CARD16) app_resources.connectionType);
        XdmcpWriteARRAY8 (&buffer, &h->hostaddr);
-#if defined(STREAMSCONN)
-       if( t_snd (fd, (char *)buffer.data, buffer.pointer, 0) < 0 )
-       {
-           fprintf (stderr, "Cannot send to xdm\n");
-           fflush(stderr);
-           t_unbind (fd);
-           t_close (fd);
-           exit (REMANAGE_DISPLAY);
-       }
-       sleep(5);       /* Hack because sometimes the connection gets
-                          closed before the data arrives on the other end. */
-       t_snddis (fd,NULL);
-       t_unbind (fd);
-       t_close (fd);
-#else
        write (fd, (char *)buffer.data, buffer.pointer);
        close (fd);
-#endif
     }
     else
     {
diff --git a/include/dm.h b/include/dm.h
index 4085cae..2512e37 100644
--- a/include/dm.h
+++ b/include/dm.h
@@ -448,7 +448,7 @@ extern int StartServer (struct display *d);
 extern int WaitForServer (struct display *d);
 extern void ResetServer (struct display *d);
 
-/* socket.c or streams.c */
+/* socket.c */
 extern int GetChooserAddr (char *addr, int *lenp);
 extern void CreateWellKnownSockets (void);
 extern void UpdateListenSockets (void);
diff --git a/xdm/Makefile.am b/xdm/Makefile.am
index 797b5c5..679fb7e 100644
--- a/xdm/Makefile.am
+++ b/xdm/Makefile.am
@@ -47,7 +47,6 @@ xdm_SOURCES =         \
         server.c       \
         session.c      \
         socket.c       \
-        streams.c      \
         util.c         \
         xdmcp.c
 
diff --git a/xdm/auth.c b/xdm/auth.c
index 9e5cba2..9ec21ac 100644
--- a/xdm/auth.c
+++ b/xdm/auth.c
@@ -48,7 +48,7 @@ from The Open Group.
 
 #include <sys/ioctl.h>
 
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#ifdef TCPCONN
 # include "dm_socket.h"
 #endif
 #ifdef DNETCONN
@@ -100,7 +100,7 @@ from The Open Group.
 #endif
 
 #ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
+# include <sys/param.h>
 # ifdef BSD
 #  if (BSD >= 199103)
 #   define VARIABLE_IFREQ
@@ -909,42 +909,19 @@ ifioctl (int fd, int cmd, char *arg)
 #  define ifioctl ioctl
 # endif /* SYSV_SIOCGIFCONF */
 
-# if defined(STREAMSCONN) && !defined(SYSV_SIOCGIFCONF) && !defined(NCR)
 
-#  include <tiuser.h>
+# ifdef WINTCP /* NCR with Wollongong TCP */
 
-/* Define this host for access control.  Find all the hosts the OS knows about
- * for this fd and add them to the selfhosts list.
- * TLI version, written without sufficient documentation.
- */
-static void
-DefineSelf (int fd, FILE *file, Xauth *auth)
-{
-    struct netbuf      netb;
-    char               addrret[1024]; /* easier than t_alloc */
-
-    netb.maxlen = sizeof(addrret);
-    netb.buf = addrret;
-    if (t_getname (fd, &netb, LOCALNAME) == -1)
-       t_error ("t_getname");
-    /* what a kludge */
-    writeAddr (FamilyInternet, 4, netb.buf+4, file, auth);
-}
-
-# else
-
-#  ifdef WINTCP /* NCR with Wollongong TCP */
-
-#   include <sys/un.h>
-#   include <stropts.h>
-#   include <tiuser.h>
+#  include <sys/un.h>
+#  include <stropts.h>
+#  include <tiuser.h>
 
-#   include <sys/stream.h>
-#   include <net/if.h>
-#   include <netinet/ip.h>
-#   include <netinet/ip_var.h>
-#   include <netinet/in.h>
-#   include <netinet/in_var.h>
+#  include <sys/stream.h>
+#  include <net/if.h>
+#  include <netinet/ip.h>
+#  include <netinet/ip_var.h>
+#  include <netinet/in.h>
+#  include <netinet/in_var.h>
 
 static void
 DefineSelf (int fd, FILE *file, Xauth *auth)
@@ -1008,24 +985,24 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
     close(ipfd);
 }
 
-#  else /* WINTCP */
+# else /* WINTCP */
 
-#   if defined(SIOCGIFCONF) || defined (USE_SIOCGLIFCONF)
+#  if defined(SIOCGIFCONF) || defined (USE_SIOCGLIFCONF)
 
-#    ifdef USE_SIOCGLIFCONF
-#     define ifr_type    struct lifreq
-#    else
-#     define ifr_type    struct ifreq
-#    endif
+#   ifdef USE_SIOCGLIFCONF
+#    define ifr_type    struct lifreq
+#   else
+#    define ifr_type    struct ifreq
+#   endif
 
 /* Handle variable length ifreq in BNR2 and later */
-#    ifdef VARIABLE_IFREQ
-#     define ifr_size(p) (sizeof (struct ifreq) + \
+#   ifdef VARIABLE_IFREQ
+#    define ifr_size(p) (sizeof (struct ifreq) + \
                     (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \
                      p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0))
-#    else
-#     define ifr_size(p) (sizeof (ifr_type))
-#    endif
+#   else
+#    define ifr_size(p) (sizeof (ifr_type))
+#   endif
 
 /* Define this host for access control.  Find all the hosts the OS knows about
  * for this fd and add them to the selfhosts list.
@@ -1038,18 +1015,18 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
     char               *addr;
     int                family;
     register ifr_type  *ifr;
-#    ifdef USE_SIOCGLIFCONF
+#   ifdef USE_SIOCGLIFCONF
     void *             bufptr = buf;
     size_t             buflen = sizeof(buf);
     struct lifconf     ifc;
-#     ifdef SIOCGLIFNUM
+#    ifdef SIOCGLIFNUM
     struct lifnum      ifn;
-#     endif
-#    else
-    struct ifconf      ifc;
 #    endif
+#   else
+    struct ifconf      ifc;
+#   endif
 
-#    if defined(SIOCGLIFNUM) && defined(SIOCGLIFCONF)
+#   if defined(SIOCGLIFNUM) && defined(SIOCGLIFCONF)
     ifn.lifn_family = AF_UNSPEC;
     ifn.lifn_flags = 0;
     if (ioctl (fd, (int) SIOCGLIFNUM, (char *) &ifn) < 0)
@@ -1058,43 +1035,43 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
        buflen = ifn.lifn_count * sizeof(struct lifreq);
        bufptr = malloc(buflen);
     }
-#    endif
+#   endif
 
-#    ifdef USE_SIOCGLIFCONF
+#   ifdef USE_SIOCGLIFCONF
     ifc.lifc_family = AF_UNSPEC;
     ifc.lifc_flags = 0;
     ifc.lifc_len = buflen;
     ifc.lifc_buf = bufptr;
 
-#     define IFC_IOCTL_REQ SIOCGLIFCONF
-#     define IFC_IFC_REQ ifc.lifc_req
-#     define IFC_IFC_LEN ifc.lifc_len
-#     define IFR_IFR_ADDR ifr->lifr_addr
-#     define IFR_IFR_NAME ifr->lifr_name
+#    define IFC_IOCTL_REQ SIOCGLIFCONF
+#    define IFC_IFC_REQ ifc.lifc_req
+#    define IFC_IFC_LEN ifc.lifc_len
+#    define IFR_IFR_ADDR ifr->lifr_addr
+#    define IFR_IFR_NAME ifr->lifr_name
 
-#    else
+#   else
     ifc.ifc_len = sizeof (buf);
     ifc.ifc_buf = buf;
 
-#     define IFC_IOCTL_REQ SIOCGIFCONF
-#     ifdef ISC
-#      define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf
-#     else
-#      define IFC_IFC_REQ ifc.ifc_req
-#     endif
-#     define IFC_IFC_LEN ifc.ifc_len
-#     define IFR_IFR_ADDR ifr->ifr_addr
-#     define IFR_IFR_NAME ifr->ifr_name
+#    define IFC_IOCTL_REQ SIOCGIFCONF
+#    ifdef ISC
+#     define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf
+#    else
+#     define IFC_IFC_REQ ifc.ifc_req
 #    endif
+#    define IFC_IFC_LEN ifc.ifc_len
+#    define IFR_IFR_ADDR ifr->ifr_addr
+#    define IFR_IFR_NAME ifr->ifr_name
+#   endif
 
     if (ifioctl (fd, IFC_IOCTL_REQ, (char *) &ifc) < 0) {
         LogError ("Trouble getting network interface configuration");
 
-#    ifdef USE_SIOCGLIFCONF
+#   ifdef USE_SIOCGLIFCONF
        if (bufptr != buf) {
            free(bufptr);
        }
-#    endif
+#   endif
        return;
     }
 
@@ -1103,7 +1080,7 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
     for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr))
     {
        ifr = (ifr_type *) cp;
-#    ifdef DNETCONN
+#   ifdef DNETCONN
        /*
         * this is ugly but SIOCGIFCONF returns decnet addresses in
         * a different form from other decnet calls
@@ -1113,7 +1090,7 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
                addr = (char *)ifr->ifr_addr.sa_data;
                family = FamilyDECnet;
        } else
-#    endif
+#   endif
        {
            family = ConvertAddr ((XdmcpNetaddr) &IFR_IFR_ADDR, &len, &addr);
            if (family < 0)
@@ -1138,7 +1115,7 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
                    Debug ("Skipping localhost address\n");
                    continue;
            }
-#    if defined(IPv6) && defined(AF_INET6)
+#   if defined(IPv6) && defined(AF_INET6)
            if(family == FamilyInternet6) {
                if (IN6_IS_ADDR_LOOPBACK(((struct in6_addr *)addr))) {
                    Debug ("Skipping IPv6 localhost address\n");
@@ -1151,14 +1128,14 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
                    continue;
                }
            }
-#    endif
+#   endif
        }
        Debug ("DefineSelf: write network address, length %d\n", len);
        writeAddr (family, len, addr, file, auth);
     }
 }
 
-#   else /* SIOCGIFCONF */
+#  else /* SIOCGIFCONF */
 
 /* Define this host for access control.  Find all the hosts the OS knows about
  * for this fd and add them to the selfhosts list.
@@ -1202,9 +1179,8 @@ DefineSelf (int fd, int file, int auth)
 }
 
 
-#   endif /* SIOCGIFCONF else */
-#  endif /* WINTCP else */
-# endif /* STREAMSCONN && !SYSV_SIOCGIFCONF else */
+#  endif /* SIOCGIFCONF else */
+# endif /* WINTCP else */
 #endif /* HAVE_GETIFADDRS */
 
 static void
@@ -1242,13 +1218,6 @@ writeLocalAuth (FILE *file, Xauth *auth, char *name)
 
     Debug ("writeLocalAuth: %s %.*s\n", name, auth->name_length, auth->name);
     setAuthNumber (auth, name);
-#ifdef STREAMSCONN
-    fd = t_open ("/dev/tcp", O_RDWR, 0);
-    t_bind(fd, NULL, NULL);
-    DefineSelf (fd, file, auth);
-    t_unbind (fd);
-    t_close (fd);
-#endif
 #ifdef TCPCONN
 # if defined(IPv6) && defined(AF_INET6)
     fd = socket (AF_INET6, SOCK_STREAM, 0);
diff --git a/xdm/choose.c b/xdm/choose.c
index e5e003d..a569b86 100644
--- a/xdm/choose.c
+++ b/xdm/choose.c
@@ -50,9 +50,6 @@ in this Software without prior written authorization from The 
Open Group.
 # include <ctype.h>
 # include <errno.h>
 
-# if defined(STREAMSCONN)
-#  include       <tiuser.h>
-# endif
 
 # include <time.h>
 # define Time_t time_t
@@ -413,68 +410,18 @@ ProcessChooserSocket (int fd)
     ARRAY8     clientAddress = {0, NULL};
     CARD16     connectionType;
     ARRAY8     choice = {0, NULL};
-# if defined(STREAMSCONN)
-    struct t_call *call;
-    int flags=0;
-# endif
 
     Debug ("Process chooser socket\n");
     len = sizeof (buf);
-# if defined(STREAMSCONN)
-    call = (struct t_call *)t_alloc( fd, T_CALL, T_ALL );
-    if( call == NULL )
-    {
-       t_error( "ProcessChooserSocket: t_alloc failed" );
-       LogError ("Cannot setup to listen on chooser connection\n");
-       return;
-    }
-    if( t_listen( fd, call ) < 0 )
-    {
-       t_error( "ProcessChooserSocket: t_listen failed" );
-       t_free( (char *)call, T_CALL );
-       LogError ("Cannot listen on chooser connection\n");
-       return;
-    }
-    client_fd = t_open ("/dev/tcp", O_RDWR, NULL);
-    if (client_fd == -1)
-    {
-       t_error( "ProcessChooserSocket: t_open failed" );
-       t_free( (char *)call, T_CALL );
-       LogError ("Cannot open new chooser connection\n");
-       return;
-    }
-    if( t_bind( client_fd, NULL, NULL ) < 0 )
-    {
-       t_error( "ProcessChooserSocket: t_bind failed" );
-       t_free( (char *)call, T_CALL );
-       LogError ("Cannot bind new chooser connection\n");
-        t_close (client_fd);
-       return;
-    }
-    if( t_accept (fd, client_fd, call) < 0 )
-    {
-       t_error( "ProcessChooserSocket: t_accept failed" );
-       LogError ("Cannot accept chooser connection\n");
-       t_free( (char *)call, T_CALL );
-        t_unbind (client_fd);
-        t_close (client_fd);
-       return;
-    }
-# else
     client_fd = accept (fd, (struct sockaddr *)buf, (void *)&len);
     if (client_fd == -1)
     {
        LogError ("Cannot accept chooser connection\n");
        return;
     }
-# endif
     Debug ("Accepted %d\n", client_fd);
 
-# if defined(STREAMSCONN)
-    len = t_rcv (client_fd, buf, sizeof (buf),&flags);
-# else
     len = read (client_fd, buf, sizeof (buf));
-# endif
     Debug ("Read returns %d\n", len);
     if (len > 0)
     {
@@ -504,13 +451,7 @@ ProcessChooserSocket (int fd)
        LogError ("Choice response read error: %s\n", _SysErrorMsg(errno));
     }
 
-# if defined(STREAMSCONN)
-    t_unbind (client_fd);
-    t_free( (char *)call, T_CALL );
-    t_close (client_fd);
-# else
     close (client_fd);
-# endif
 }
 
 void
diff --git a/xdm/netaddr.c b/xdm/netaddr.c
index 0588935..d42e9b7 100644
--- a/xdm/netaddr.c
+++ b/xdm/netaddr.c
@@ -55,12 +55,7 @@ from The Open Group.
 
 int NetaddrFamily(XdmcpNetaddr netaddrp)
 {
-# ifdef STREAMSCONN
-    short family = *(short *)netaddrp;
-    return family;
-# else
     return ((struct sockaddr *)netaddrp)->sa_family;
-# endif
 }
 
 
@@ -70,25 +65,20 @@ int NetaddrFamily(XdmcpNetaddr netaddrp)
 
 char * NetaddrPort(XdmcpNetaddr netaddrp, int *lenp)
 {
-# ifdef STREAMSCONN
-    *lenp = 2;
-    return netaddrp+2;
-# else
     switch (NetaddrFamily(netaddrp))
     {
     case AF_INET:
        *lenp = 2;
        return (char *)&(((struct sockaddr_in *)netaddrp)->sin_port);
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
     case AF_INET6:
        *lenp = 2;
        return (char *)&(((struct sockaddr_in6 *)netaddrp)->sin6_port);
-#  endif
+# endif
     default:
        *lenp = 0;
        return NULL;
     }
-# endif
 }
 
 
@@ -97,21 +87,17 @@ char * NetaddrPort(XdmcpNetaddr netaddrp, int *lenp)
 
 char * NetaddrAddress(XdmcpNetaddr netaddrp, int *lenp)
 {
-# ifdef STREAMSCONN
-    *lenp = 4;
-    return netaddrp+4;
-# else
     switch (NetaddrFamily(netaddrp)) {
-#  ifdef UNIXCONN
+# ifdef UNIXCONN
     case AF_UNIX:
        *lenp = strlen(((struct sockaddr_un *)netaddrp)->sun_path);
         return (char *) (((struct sockaddr_un *)netaddrp)->sun_path);
-#  endif
-#  ifdef TCPCONN
+# endif
+# ifdef TCPCONN
     case AF_INET:
         *lenp = sizeof (struct in_addr);
         return (char *) &(((struct sockaddr_in *)netaddrp)->sin_addr);
-#   if defined(IPv6) && defined(AF_INET6)
+#  if defined(IPv6) && defined(AF_INET6)
     case AF_INET6:
     {
        struct in6_addr *a = &(((struct sockaddr_in6 *)netaddrp)->sin6_addr);
@@ -123,21 +109,20 @@ char * NetaddrAddress(XdmcpNetaddr netaddrp, int *lenp)
            return (char *) &(a->s6_addr);
        }
     }
-#   endif
 #  endif
-#  ifdef DNETCONN
+# endif
+# ifdef DNETCONN
     case AF_DECnet:
         *lenp = sizeof (struct dn_naddr);
         return (char *) &(((struct sockaddr_dn *)netaddrp)->sdn_add);
-#  endif
-#  ifdef AF_CHAOS
+# endif
+# ifdef AF_CHAOS
     case AF_CHAOS:
-#  endif
+# endif
     default:
        *lenp = 0;
        return NULL;
     }
-# endif /* STREAMSCONN else */
 }
 
 
@@ -152,53 +137,47 @@ int ConvertAddr (XdmcpNetaddr saddr, int *len, char 
**addr)
     if ((len == NULL) || (saddr == NULL))
         return -1;
     *addr = NetaddrAddress(saddr, len);
-# ifdef STREAMSCONN
-    /* kludge */
-    if (NetaddrFamily(saddr) == 2)
-       retval = FamilyInternet;
-# else
     switch (NetaddrFamily(saddr))
     {
-#  ifdef AF_UNSPEC
+# ifdef AF_UNSPEC
       case AF_UNSPEC:
        retval = FamilyLocal;
        break;
-#  endif
-#  ifdef AF_UNIX
-#   ifndef hpux
+# endif
+# ifdef AF_UNIX
+#  ifndef hpux
       case AF_UNIX:
         retval = FamilyLocal;
        break;
-#   endif
 #  endif
-#  ifdef TCPCONN
+# endif
+# ifdef TCPCONN
       case AF_INET:
         retval = FamilyInternet;
        break;
-#   if defined(IPv6) && defined(AF_INET6)
+#  if defined(IPv6) && defined(AF_INET6)
       case AF_INET6:
        if (*len == sizeof(struct in_addr))
            retval = FamilyInternet;
        else
            retval = FamilyInternet6;
        break;
-#   endif
 #  endif
-#  ifdef DNETCONN
+# endif
+# ifdef DNETCONN
       case AF_DECnet:
         retval = FamilyDECnet;
        break;
-#  endif
-#  ifdef AF_CHAOS
+# endif
+# ifdef AF_CHAOS
     case AF_CHAOS:
        retval = FamilyChaos;
        break;
-#  endif
+# endif
       default:
        retval = -1;
         break;
     }
-# endif /* STREAMSCONN else */
     Debug ("ConvertAddr returning %d for family %d\n", retval,
           NetaddrFamily(saddr));
     return retval;
diff --git a/xdm/server.c b/xdm/server.c
index 1bb8873..c5c6ae9 100644
--- a/xdm/server.c
+++ b/xdm/server.c
@@ -239,29 +239,15 @@ abortOpen (int n)
 
 #ifdef XDMCP
 
-# ifdef STREAMSCONN
-#  include <tiuser.h>
-# endif
 
 static void
 GetRemoteAddress (struct display *d, int fd)
 {
     char    buf[512];
     int            len = sizeof (buf);
-# ifdef STREAMSCONN
-    struct netbuf      netb;
-# endif
 
     free (d->peer);
-# ifdef STREAMSCONN
-    netb.maxlen = sizeof(buf);
-    netb.buf = buf;
-    t_getname(fd, &netb, REMOTENAME);
-    len = 8;
-    /* lucky for us, t_getname returns something that looks like a sockaddr */
-# else
     getpeername (fd, (struct sockaddr *) buf, (void *)&len);
-# endif
     d->peerlen = 0;
     if (len)
     {
@@ -299,17 +285,6 @@ WaitForServer (struct display *d)
            errno = 0;
            (void) XSetIOErrorHandler (openErrorHandler);
            d->dpy = XOpenDisplay (d->name);
-#ifdef STREAMSCONN
-           {
-               /* For some reason, the next XOpenDisplay we do is
-                  going to fail, so we might as well get that out
-                  of the way.  There is something broken here. */
-               Display *bogusDpy = XOpenDisplay (d->name);
-               Debug ("bogus XOpenDisplay %s\n",
-                      bogusDpy ? "succeeded" : "failed");
-               if (bogusDpy) XCloseDisplay(bogusDpy); /* just in case */
-           }
-#endif
            (void) alarm ((unsigned) 0);
            (void) Signal (SIGALRM, SIG_DFL);
            (void) XSetIOErrorHandler ((int (*)(Display *)) 0);
diff --git a/xdm/socket.c b/xdm/socket.c
index 29e344f..b658238 100644
--- a/xdm/socket.c
+++ b/xdm/socket.c
@@ -59,16 +59,15 @@ from the copyright holder.
 #include "dm_error.h"
 
 #ifdef XDMCP
-# ifndef STREAMSCONN
 
-#  include <errno.h>
-#  include "dm_socket.h"
+# include <errno.h>
+# include "dm_socket.h"
 
-#  ifndef X_NO_SYS_UN
-#   include <sys/un.h>
-#  endif
-#  include <netdb.h>
-#  include <arpa/inet.h>
+# ifndef X_NO_SYS_UN
+#  include <sys/un.h>
+# endif
+# include <netdb.h>
+# include <arpa/inet.h>
 
 extern int     chooserFd;
 
@@ -84,10 +83,10 @@ CreateWellKnownSockets (void)
     if (request_port == 0)
        return;
 
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
     chooserFd = socket (AF_INET6, SOCK_STREAM, 0);
     if (chooserFd == -1)
-#  endif
+# endif
     chooserFd = socket (AF_INET, SOCK_STREAM, 0);
     Debug ("Created chooser socket %d\n", chooserFd);
     if (chooserFd == -1)
@@ -106,11 +105,11 @@ GetChooserAddr (
     char       *addr,
     int                *lenp)
 {
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
     struct sockaddr_storage in_addr;
-#  else
+# else
     struct sockaddr_in in_addr;
-#  endif
+# endif
     int                        len;
     int                        retval = 0;
 
@@ -119,12 +118,12 @@ GetChooserAddr (
        return -1;      /* TODO check other listening sockets */
     if (getsockname (chooserFd, (struct sockaddr *)&in_addr, (void *)&len) < 0)
        return -1;
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
     if (((struct sockaddr *)&in_addr)->sa_family == AF_INET6)
        Debug ("Chooser socket port: %d (IPv6)\n",
          ntohs(((struct sockaddr_in6 *) &in_addr)->sin6_port));
     else
-#  endif
+# endif
        Debug ("Chooser socket port: %d\n",
          ntohs(((struct sockaddr_in *) &in_addr)->sin_port));
     if (*lenp < len)
@@ -141,15 +140,15 @@ CreateListeningSocket (struct sockaddr *sock_addr, int 
salen)
 {
     int fd;
     const char *addrstring = "unknown";
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
     char addrbuf[INET6_ADDRSTRLEN];
-#  endif
+# endif
 
     if (request_port == 0)
            return -1;
 
     if (debugLevel > 0) {
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
        void *ipaddr;
        if (sock_addr->sa_family == AF_INET6) {
            ipaddr = & ((struct sockaddr_in6 *) sock_addr)->sin6_addr;
@@ -159,9 +158,9 @@ CreateListeningSocket (struct sockaddr *sock_addr, int 
salen)
        addrstring =
          inet_ntop(sock_addr->sa_family, ipaddr, addrbuf, sizeof(addrbuf));
 
-#  else
+# else
        addrstring = inet_ntoa(((struct sockaddr_in *) sock_addr)->sin_addr);
-#  endif
+# endif
 
        Debug ("creating socket to listen on port %d of address %s\n",
          request_port,addrstring);
@@ -175,7 +174,7 @@ CreateListeningSocket (struct sockaddr *sock_addr, int 
salen)
     }
     RegisterCloseOnFork (fd);
 
-#  if defined(IPv6) && defined(IPV6_V6ONLY)
+# if defined(IPv6) && defined(IPV6_V6ONLY)
     if (sock_addr->sa_family == AF_INET6) {
        int zero = 0;
        if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof(zero)) < 0) 
{
@@ -183,7 +182,7 @@ CreateListeningSocket (struct sockaddr *sock_addr, int 
salen)
                      _SysErrorMsg (errno));
        }
     }
-#  endif
+# endif
 
     if (bind (fd, sock_addr, salen) == -1)
     {
@@ -249,12 +248,12 @@ FindInList(struct socklist *list, ARRAY8Ptr addr)
                addrdata = (char *)
                  &(((struct sockaddr_in *)s->addr)->sin_addr.s_addr);
                break;
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
            case AF_INET6:
                addrdata = (char *)
                  &(((struct sockaddr_in6 *)s->addr)->sin6_addr.s6_addr);
                break;
-#  endif
+# endif
            default:
                /* Unrecognized address family */
                continue;
@@ -290,16 +289,16 @@ CreateSocklistEntry(ARRAY8Ptr addr)
        s->addr = (struct sockaddr *) sin;
 
        bzero (sin, sizeof (struct sockaddr_in));
-#  ifdef BSD44SOCKETS
+# ifdef BSD44SOCKETS
        sin->sin_len = sizeof(struct sockaddr_in);
-#  endif
+# endif
        s->salen = sizeof(struct sockaddr_in);
        s->addrlen = sizeof(struct in_addr);
        sin->sin_family = AF_INET;
        sin->sin_port = htons ((short) request_port);
        memcpy(&sin->sin_addr, addr->data, addr->length);
     }
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
     else if (addr->length == 16) /* IPv6 */
     {
        struct sockaddr_in6 *sin6;
@@ -312,16 +311,16 @@ CreateSocklistEntry(ARRAY8Ptr addr)
        s->addr = (struct sockaddr *) sin6;
 
        bzero (sin6, sizeof (struct sockaddr_in6));
-#   ifdef SIN6_LEN
+#  ifdef SIN6_LEN
        sin6->sin6_len = sizeof(struct sockaddr_in6);
-#   endif
+#  endif
        s->salen = sizeof(struct sockaddr_in6);
        s->addrlen = sizeof(struct in6_addr);
        sin6->sin6_family = AF_INET6;
        sin6->sin6_port = htons ((short) request_port);
        memcpy(&sin6->sin6_addr, addr->data, addr->length);
     }
-#  endif
+# endif
     else {
        /* Unknown address type */
        free(s);
@@ -340,13 +339,13 @@ UpdateListener(ARRAY8Ptr addr, void **closure)
     if (addr == NULL || addr->length == 0) {
        ARRAY8 tmpaddr;
        struct in_addr in;
-#  if defined(IPv6) && defined(AF_INET6)
+# if defined(IPv6) && defined(AF_INET6)
        struct in6_addr in6 = in6addr_any;
        tmpaddr.length = sizeof(in6);
        tmpaddr.data = (CARD8Ptr) &in6;
        UpdateListener(&tmpaddr, closure);
        if (*closure) return;
-#  endif
+# endif
        in.s_addr = htonl (INADDR_ANY);
        tmpaddr.length = sizeof(in);
        tmpaddr.data = (CARD8Ptr) &in;
@@ -379,8 +378,8 @@ UpdateListener(ARRAY8Ptr addr, void **closure)
     *closure = (void *) s;
 }
 
-#  define JOIN_MCAST_GROUP 0
-#  define LEAVE_MCAST_GROUP 1
+# define JOIN_MCAST_GROUP 0
+# define LEAVE_MCAST_GROUP 1
 
 static void
 ChangeMcastMembership(struct socklist *s, struct socklist *g, int op)
@@ -416,13 +415,13 @@ ChangeMcastMembership(struct socklist *s, struct socklist 
*g, int op)
            }
            return;
        }
-#  if defined(IPv6) && defined(AF_INET6)
-#   ifndef IPV6_JOIN_GROUP
-#    define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
-#   endif
-#   ifndef IPV6_LEAVE_GROUP
-#    define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
-#   endif
+# if defined(IPv6) && defined(AF_INET6)
+#  ifndef IPV6_JOIN_GROUP
+#   define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
+#  endif
+#  ifndef IPV6_LEAVE_GROUP
+#   define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
+#  endif
        case AF_INET6:
        {
            struct ipv6_mreq mreq6;
@@ -459,7 +458,7 @@ ChangeMcastMembership(struct socklist *s, struct socklist 
*g, int op)
            }
            return;
        }
-#  endif
+# endif
     }
 }
 
@@ -553,5 +552,4 @@ void ProcessListenSockets (fd_set *readmask)
     }
 }
 
-# endif /* !STREAMSCONN */
 #endif /* XDMCP */
diff --git a/xdm/streams.c b/xdm/streams.c
deleted file mode 100644
index c4cb2ca..0000000
--- a/xdm/streams.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-
-Copyright 1988, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-/*
- * xdm - display manager daemon
- * Author:  Keith Packard, MIT X Consortium
- *
- * streams.c - Support for STREAMS
- */
-
-#include "dm.h"
-#include "dm_error.h"
-
-#ifdef XDMCP
-# ifdef STREAMSCONN
-
-#  include <fcntl.h>
-#  include <tiuser.h>
-#  include <netconfig.h>
-#  include <netdir.h>
-
-extern int     xdmcpFd;
-extern int     chooserFd;
-
-extern FD_TYPE WellKnownSocketsMask;
-extern int     WellKnownSocketsMax;
-
-void
-CreateWellKnownSockets (void)
-{
-    struct t_bind bind_addr;
-    struct netconfig *nconf;
-    struct nd_hostserv service;
-    struct nd_addrlist *servaddrs;
-    char *name, *localHostname();
-    char bindbuf[15];
-    int it;
-
-    if (request_port == 0)
-       return;
-    Debug ("creating UDP stream %d\n", request_port);
-
-    nconf = getnetconfigent("udp");
-    if (!nconf) {
-       t_error("getnetconfigent udp");
-       return;
-    }
-
-    xdmcpFd = t_open(nconf->nc_device, O_RDWR, NULL);
-    if (xdmcpFd == -1) {
-       LogError ("XDMCP stream creation failed\n");
-       t_error ("CreateWellKnownSockets(xdmcpFd): t_open failed");
-       return;
-    }
-    name = localHostname ();
-    registerHostname (name, strlen (name));
-    RegisterCloseOnFork (xdmcpFd);
-
-    service.h_host = HOST_SELF;
-    snprintf(bindbuf, sizeof(bindbuf), "%d", request_port);
-    service.h_serv = bindbuf;
-    netdir_getbyname(nconf, &service, &servaddrs);
-    freenetconfigent(nconf);
-
-    bind_addr.qlen = 5;
-    bind_addr.addr.buf = servaddrs->n_addrs[0].buf;
-    bind_addr.addr.len = servaddrs->n_addrs[0].len;
-    bind_addr.addr.maxlen = servaddrs->n_addrs[0].len;
-    it = t_bind(xdmcpFd, &bind_addr, &bind_addr);
-    netdir_free((char *)servaddrs, ND_ADDRLIST);
-    if (it < 0)
-    {
-       LogError ("error binding STREAMS address %d\n", request_port);
-       t_error("CreateWellKNowSocket(xdmcpFd): t_bind failed");
-       t_close (xdmcpFd);
-       xdmcpFd = -1;
-       return;
-    }
-    WellKnownSocketsMax = xdmcpFd;
-    FD_SET (xdmcpFd, &WellKnownSocketsMask);
-
-    chooserFd = t_open ("/dev/tcp", O_RDWR, NULL);
-    Debug ("Created chooser fd %d\n", chooserFd);
-    if (chooserFd == -1)
-    {
-       LogError ("chooser stream creation failed\n");
-       t_error("CreateWellKnowSockets(chooserFd): t_open failed");
-       return;
-    }
-    bind_addr.qlen = 5;
-    bind_addr.addr.len = 0;
-    bind_addr.addr.maxlen = 0;
-    if( t_bind( chooserFd, &bind_addr, NULL ) < 0 )
-    {
-        t_error("CreateWellKnowSockets(chooserFd): t_bind failed");
-    }
-
-    if (chooserFd > WellKnownSocketsMax)
-       WellKnownSocketsMax = chooserFd;
-    FD_SET (chooserFd, &WellKnownSocketsMask);
-}
-
-int
-GetChooserAddr (char *addr,    /* return */
-    int *lenp)                 /* size of addr, returned as amt used */
-{
-    struct netbuf nbuf;
-    int retval;
-
-    nbuf.buf = addr;
-    nbuf.len = *lenp;
-    nbuf.maxlen = *lenp;
-    retval = t_getname (chooserFd, &nbuf, LOCALNAME);
-    if (retval < 0) {
-       if (debugLevel > 0)
-           t_error("t_getname on chooser fd");
-    }
-    *lenp = nbuf.len;
-    return retval;
-}
-
-/* TODO: Implement support for controlling which interfaces are listened on
-   and for listening to multicast addresses.  See the sockets equivalent in
-   sockets.c for details. */
-
-void UpdateListenSockets (void)
-{
-    return;
-}
-
-void CloseListenSockets (void)
-{
-    return;
-}
-
-void ProcessListenSockets (fd_set *readmask)
-{
-    return;
-}
-
-# endif /* STREAMSCONN */
-#endif /* XDMCP */
diff --git a/xdm/xdmcp.c b/xdm/xdmcp.c
index 1c34e7c..051d501 100644
--- a/xdm/xdmcp.c
+++ b/xdm/xdmcp.c
@@ -79,9 +79,6 @@ static void send_refuse (struct sockaddr *from, int fromlen, 
CARD32 sessionID, i
 static void send_unwilling (struct sockaddr *from, int fromlen, ARRAY8Ptr 
authenticationName, ARRAY8Ptr status, int fd);
 static void send_willing (struct sockaddr *from, int fromlen, ARRAY8Ptr 
authenticationName, ARRAY8Ptr status, int fd);
 
-# ifdef STREAMSCONN
-int    xdmcpFd = -1;
-# endif
 int    chooserFd = -1;
 # if defined(IPv6) && defined(AF_INET6)
 int    chooserFd6 = -1;
@@ -95,14 +92,6 @@ int  WellKnownSocketsMax;
 void
 DestroyWellKnownSockets (void)
 {
-# ifdef STREAMSCONN
-    if (xdmcpFd != -1)
-    {
-       close (xdmcpFd);
-       FD_CLR(xdmcpFd, &WellKnownSocketsMask);
-       xdmcpFd = -1;
-    }
-# endif
     if (chooserFd != -1)
     {
        close (chooserFd);
@@ -137,9 +126,6 @@ int
 AnyWellKnownSockets (void)
 {
     return
-# ifdef STREAMS_CONN
-      xdmcpFd != -1 ||
-# endif
 # if defined(IPv6) && defined(AF_INET6)
       chooserFd6 != -1 ||
 # endif
@@ -411,10 +397,6 @@ WaitForSomething (void)
                nready, Rescan, ChildReady);
        if (nready > 0)
        {
-# ifdef STREAMSCONN
-           if (xdmcpFd >= 0 && FD_ISSET (xdmcpFd, &reads))
-               ProcessRequestSocket (xdmcpFd);
-# endif
            if (chooserFd >= 0 && FD_ISSET (chooserFd, &reads))
            {
 # ifdef ISC
-- 
1.7.9.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to