* hack.doc: updated to reflect Cit86Net compatibility fields removed from the
authorArt Cancro <ajc@citadel.org>
Thu, 15 Nov 2001 04:11:31 +0000 (04:11 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 15 Nov 2001 04:11:31 +0000 (04:11 +0000)
  file format (since we dumbed down the gateway software)
* ipc_c_tcp.c: removed SOCKS4 support.  Nobody uses it anymore.
* ipc_c_tcp.c: fixed a bug which caused the client to fall back to defaultPort
  if a numeric port number was specified instead of a service name

citadel/ChangeLog
citadel/ipc_c_tcp.c
citadel/techdoc/hack.txt

index dd3821b935d5aa0c4fcd3f8bc455f91b0c25b7b4..fb9a7840f862b6f2de00b0fb80b5f184450c2ecf 100644 (file)
@@ -1,4 +1,11 @@
  $Log$
+ Revision 580.75  2001/11/15 04:11:30  ajc
+ * hack.doc: updated to reflect Cit86Net compatibility fields removed from the
+   file format (since we dumbed down the gateway software)
+ * ipc_c_tcp.c: removed SOCKS4 support.  Nobody uses it anymore.
+ * ipc_c_tcp.c: fixed a bug which caused the client to fall back to defaultPort
+   if a numeric port number was specified instead of a service name
+
  Revision 580.74  2001/11/14 02:59:01  ajc
  * Network run frequency is now a site-definable setting
 
@@ -2855,4 +2862,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index b957b7de84c525da747b4d4d69199eeb1b3d97b6..28217ed57d5999e3287cb46cc6b957dce997ae6d 100644 (file)
@@ -80,9 +80,13 @@ static int connectsock(char *host, char *service, char *protocol, int defaultPor
        sin.sin_family = AF_INET;
 
        pse = getservbyname(service, protocol);
-       if (pse) {
+       if (pse != NULL) {
                sin.sin_port = pse->s_port;
-       } else {
+       }
+       else if (atoi(service) > 0) {
+               sin.sin_port = htons(atoi(service));
+       }
+       else {
                sin.sin_port = htons(defaultPort);
        }
        phe = gethostbyname(host);
@@ -128,7 +132,6 @@ int uds_connectsock(char *sockpath)
        struct sockaddr_un addr;
        int s;
 
-
        memset(&addr, 0, sizeof(addr));
        addr.sun_family = AF_UNIX;
        safestrncpy(addr.sun_path, sockpath, sizeof addr.sun_path);
@@ -150,41 +153,6 @@ int uds_connectsock(char *sockpath)
        return s;
 }
 
-/*
- * convert service and host entries into a six-byte numeric in the format
- * expected by a SOCKS v4 server
- */
-static void numericize(char *buf, char *host, char *service, char *protocol, int defaultPort)
-{
-       struct hostent *phe;
-       struct servent *pse;
-       struct sockaddr_in sin;
-
-       memset(&sin, 0, sizeof(sin));
-       sin.sin_family = AF_INET;
-
-       pse = getservbyname(service, protocol);
-       if (pse) {
-               sin.sin_port = pse->s_port;
-       } else {
-               sin.sin_port = htons(defaultPort);
-       }
-       buf[1] = (((sin.sin_port) & 0xFF00) >> 8);
-       buf[0] = ((sin.sin_port) & 0x00FF);
-
-       phe = gethostbyname(host);
-       if (phe) {
-               memcpy(&sin.sin_addr, phe->h_addr, phe->h_length);
-       } else if ((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) {
-               fprintf(stderr, "Can't get %s host entry: %s\n",
-                       host, strerror(errno));
-               logoff(3);
-       }
-       buf[5] = ((sin.sin_addr.s_addr) & 0xFF000000) >> 24;
-       buf[4] = ((sin.sin_addr.s_addr) & 0x00FF0000) >> 16;
-       buf[3] = ((sin.sin_addr.s_addr) & 0x0000FF00) >> 8;
-       buf[2] = ((sin.sin_addr.s_addr) & 0x000000FF);
-}
 
 /*
  * input binary data from socket
@@ -270,44 +238,31 @@ void attach_to_server(int argc, char **argv, char *hostbuf, char *portbuf)
 {
        int a;
        char cithost[SIZ];
-       int host_copied = 0;
        char citport[SIZ];
-       int port_copied = 0;
-       char socks4[SIZ];
-       char buf[SIZ];
-       struct passwd *p;
        char sockpath[SIZ];
 
        strcpy(cithost, DEFAULT_HOST);  /* default host */
        strcpy(citport, DEFAULT_PORT);  /* default port */
-       strcpy(socks4, "");     /* SOCKS v4 server */
-
 
        for (a = 0; a < argc; ++a) {
                if (a == 0) {
                        /* do nothing */
-               } else if (!strcmp(argv[a], "-s")) {
-                       strcpy(socks4, argv[++a]);
-               } else if (host_copied == 0) {
-                       host_copied = 1;
+               } else if (a == 1) {
                        strcpy(cithost, argv[a]);
-               } else if (port_copied == 0) {
-                       port_copied = 1;
+               } else if (a == 2) {
                        strcpy(citport, argv[a]);
                }
-/*
-   else {
-   fprintf(stderr,"%s: usage: ",argv[0]);
-   fprintf(stderr,"%s [host] [port] ",argv[0]);
-   fprintf(stderr,"[-s socks_server]\n");
-   logoff(2);
-   }
- */
+               else {
+                       fprintf(stderr,"%s: usage: ",argv[0]);
+                       fprintf(stderr,"%s [host] [port] ",argv[0]);
+                       logoff(2);
+               }
        }
 
        if ((!strcmp(cithost, "localhost"))
-           || (!strcmp(cithost, "127.0.0.1")))
+          || (!strcmp(cithost, "127.0.0.1"))) {
                server_is_local = 1;
+       }
 
        /* If we're using a unix domain socket we can do a bunch of stuff */
        if (!strcmp(cithost, UDS)) {
@@ -318,37 +273,10 @@ void attach_to_server(int argc, char **argv, char *hostbuf, char *portbuf)
                return;
        }
 
-       /* if not using a SOCKS proxy server, make the connection directly */
-       if (strlen(socks4) == 0) {
-               serv_sock = connectsock(cithost, citport, "tcp", 504);
-               if (hostbuf != NULL) strcpy(hostbuf, cithost);
-               if (portbuf != NULL) strcpy(portbuf, citport);
-               return;
-       }
-       /* if using SOCKS, connect first to the proxy... */
-       serv_sock = connectsock(socks4, "1080", "tcp", 1080);
-       printf("Connected to SOCKS proxy at %s.\n", socks4);
-       printf("Attaching to server...\r");
-       fflush(stdout);
-
-       snprintf(buf, sizeof buf, "%c%c",
-                4,             /* version 4 */
-                1);            /* method = connect */
-       serv_write(buf, 2);
-
-       numericize(buf, cithost, citport, "tcp", 504);
-       serv_write(buf, 6);     /* port and address */
-
-       p = (struct passwd *) getpwuid(getuid());
-       serv_write(p->pw_name, strlen(p->pw_name) + 1);
-       /* user name */
-
-       serv_read(buf, 8);      /* get response */
-
-       if (buf[1] != 90) {
-               printf("SOCKS server denied this proxy request.\n");
-               logoff(3);
-       }
+       serv_sock = connectsock(cithost, citport, "tcp", 504);
+       if (hostbuf != NULL) strcpy(hostbuf, cithost);
+       if (portbuf != NULL) strcpy(portbuf, citport);
+       return;
 }
 
 /*
index 40b7d62d09805669d19196183899ab9fb73c79eb..649efa5260a625093ba7319d2a926ddf23886429 100644 (file)
@@ -78,9 +78,6 @@ all software should be written to IGNORE fields not currently defined.
 BYTE   Mnemonic        Comments
 
 A      Author          Name of originator of message.
-B      Phone number    The dialup number of the system this message
-                       originated on.  This is optional, and is only
-                       defined for helping implement C86Net gateways.
 D      Destination     Contains name of the system this message should
                        be sent to, for mail routing (private mail only).
 E      Extended ID     A persistent alphanumeric Message ID used for
@@ -92,11 +89,6 @@ E    Extended ID     A persistent alphanumeric Message ID used for
                        message should be dropped.
 F      rFc822 address  For Internet mail, this is the delivery address of the
                        message author.
-G      Gateway domain  This field is provided solely for the implementation
-                        of C86Net gateways, and holds the C86Net domain of
-                        the system this message originated on.  Unless you're
-                        implementing such a gateway, there's no need to even
-                        bother with this field.
 H      HumanNodeName   Human-readable name of system message originated on.
 I      Original ID     A 32-bit integer containing the message ID on the
                        system the message *originated* on.