* Removed the 'protocol' parameter from the sock_connect() function. All we have...
authorArt Cancro <ajc@citadel.org>
Thu, 19 Aug 2010 02:39:31 +0000 (02:39 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 19 Aug 2010 02:39:31 +0000 (02:39 +0000)
citadel/clientsocket.c
citadel/clientsocket.h
citadel/modules/clamav/serv_virus.c
citadel/modules/network/serv_network.c
citadel/modules/pop3client/serv_pop3client.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/spam/serv_spam.c

index 7220709ba449af9f3ab1c95734b2b1a26035e8b8..67414f93a56ee76bcdd21acdb7fe4ee07a0ee6ba 100644 (file)
@@ -54,7 +54,7 @@
 #define INADDR_NONE 0xffffffff
 #endif
 
-int sock_connect(char *host, char *service, char *protocol)
+int sock_connect(char *host, char *service)
 {
        struct hostent *phe;
        struct servent *pse;
@@ -67,13 +67,11 @@ int sock_connect(char *host, char *service, char *protocol)
                return(-1);
        if ((service == NULL) || IsEmptyStr(service)) 
                return(-1);
-       if ((protocol == NULL) || IsEmptyStr(protocol)) 
-               return(-1);
 
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
 
-       pse = getservbyname(service, protocol);
+       pse = getservbyname(service, "tcp");
        if (pse) {
                sin.sin_port = pse->s_port;
        } else if ((sin.sin_port = htons((u_short) atoi(service))) == 0) {
@@ -89,16 +87,11 @@ int sock_connect(char *host, char *service, char *protocol)
                        host, strerror(errno));
                return(-1);
        }
-       if ((ppe = getprotobyname(protocol)) == 0) {
-               CtdlLogPrintf(CTDL_CRIT, "Can't get %s protocol entry: %s\n",
-                       protocol, strerror(errno));
+       if ((ppe = getprotobyname("tcp")) == 0) {
+               CtdlLogPrintf(CTDL_CRIT, "Can't get tcp protocol entry: %s\n", strerror(errno));
                return(-1);
        }
-       if (!strcmp(protocol, "udp")) {
-               type = SOCK_DGRAM;
-       } else {
-               type = SOCK_STREAM;
-       }
+       type = SOCK_STREAM;
 
        s = socket(PF_INET, type, ppe->p_proto);
        if (s < 0) {
index 0274052a5ec6a83ee0d3c0e4c3a5825dd0207d34..794a6dbf3a8520e712cdc975cd915b20d66e9342 100644 (file)
@@ -20,7 +20,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-int sock_connect(char *host, char *service, char *protocol);
+int sock_connect(char *host, char *service);
 int sock_read_to(int *sock, char *buf, int bytes, int timeout, int keep_reading_until_full);
 int sock_read(int *sock, char *buf, int bytes, int keep_reading_until_full);
 int sock_write(int *sock, const char *buf, int nbytes);
index 38b47de84cf1465f5f21a25d369b60b41cff0c7f..ab77f1865d3b1c95875074aa187b9059f153abd4 100644 (file)
@@ -102,10 +102,10 @@ int clamd(struct CtdlMessage *msg) {
                 extract_token(hostbuf, buf, 0, ':', sizeof hostbuf);
                 if (extract_token(portbuf, buf, 1, ':', sizeof portbuf)==-1)
                   /* Didn't specify a port so we'll try the psuedo-standard 3310 */
-                  sock = sock_connect(hostbuf, CLAMD_PORT, "tcp");
+                  sock = sock_connect(hostbuf, CLAMD_PORT);
                 else
                   /* Port specified lets try connecting to it! */
-                  sock = sock_connect(hostbuf, portbuf, "tcp");
+                  sock = sock_connect(hostbuf, portbuf);
 
                 if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
         }
@@ -140,7 +140,7 @@ int clamd(struct CtdlMessage *msg) {
        extract_token(portbuf, buf, 1, ' ', sizeof portbuf);
 
        /* Attempt to establish connection to STREAM socket */
-        streamsock = sock_connect(hostbuf, portbuf, "tcp");
+        streamsock = sock_connect(hostbuf, portbuf);
 
        if (streamsock < 0) {
                /* If the service isn't running, just pass the mail
index e89f26eec7b78c03e21d0efe98a82a877a0fffd1..964f1611c70bd4dc390776228a0792aa5ff24b48 100644 (file)
@@ -2075,7 +2075,7 @@ void network_poll_node(char *node, char *secret, char *host, char *port) {
        CtdlLogPrintf(CTDL_DEBUG, "network: polling <%s>\n", node);
        CtdlLogPrintf(CTDL_NOTICE, "Connecting to <%s> at %s:%s\n", node, host, port);
 
-       sock = sock_connect(host, port, "tcp");
+       sock = sock_connect(host, port);
        if (sock < 0) {
                CtdlLogPrintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
                network_talking_to(node, NTT_REMOVE);
index 3bc0984833e8491e80dc74118105f701ed0e2a43..4250cc446ac67486dcf95ca75573538d646b901c 100644 (file)
@@ -90,7 +90,7 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
        if (CtdlThreadCheckStop())
                return;
                
-       sock = sock_connect(pop3host, "110", "tcp");
+       sock = sock_connect(pop3host, "110");
        if (sock < 0) {
                CtdlLogPrintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
                return;
index 3cc6d5e84858de5fe39e494d8c77131e86fbbac8..b6ae6d044f9e0b6f358263aa4dde9046053b7d18 100644 (file)
@@ -1083,7 +1083,7 @@ void smtp_try(const char *key, const char *addr, int *status,
                        strcpy(mx_port, "25");
                }
                CtdlLogPrintf(CTDL_DEBUG, "SMTP client: connecting to %s : %s ...\n", mx_host, mx_port);
-               sock = sock_connect(mx_host, mx_port, "tcp");
+               sock = sock_connect(mx_host, mx_port);
                snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno));
                if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "SMTP client: connected!\n");
                if (sock < 0) {
index 235b0caa318e1e67b788ffdde885186f64eaa7f2..3473a82d2a36f032e144d7da001b06abd42190d9 100644 (file)
@@ -95,7 +95,7 @@ int spam_assassin(struct CtdlMessage *msg) {
         for (sa=0; sa<num_sahosts; ++sa) {
                 extract_token(buf, sahosts, sa, '|', sizeof buf);
                 CtdlLogPrintf(CTDL_INFO, "Connecting to SpamAssassin at <%s>\n", buf);
-                sock = sock_connect(buf, SPAMASSASSIN_PORT, "tcp");
+                sock = sock_connect(buf, SPAMASSASSIN_PORT);
                 if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
         }