From d2adfa903837271e77953e7ae0dce74a05e8c949 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 19 Aug 2010 16:41:34 +0000 Subject: [PATCH] * Client connectsock() is now TCP only --- citadel/utillib/citadel_ipc.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/citadel/utillib/citadel_ipc.c b/citadel/utillib/citadel_ipc.c index bfef117d5..016207aa2 100644 --- a/citadel/utillib/citadel_ipc.c +++ b/citadel/utillib/citadel_ipc.c @@ -2613,7 +2613,7 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc, } -static int connectsock(char *host, char *service, char *protocol, int defaultPort) +static int tcp_connectsock(char *host, char *service, int defaultPort) { struct hostent *phe; struct servent *pse; @@ -2624,7 +2624,7 @@ static int connectsock(char *host, char *service, char *protocol, int defaultPor memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; - pse = getservbyname(service, protocol); + pse = getservbyname(service, "tcp"); if (pse != NULL) { sin.sin_port = pse->s_port; } @@ -2640,14 +2640,10 @@ static int connectsock(char *host, char *service, char *protocol, int defaultPor } else if ((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) { return -1; } - if ((ppe = getprotobyname(protocol)) == 0) { + if ((ppe = getprotobyname("tcp")) == 0) { 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) { @@ -3242,7 +3238,7 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf) return ipc; } - ipc->sock = connectsock(cithost, citport, "tcp", 504); + ipc->sock = tcp_connectsock(cithost, citport, 504); if (ipc->sock == -1) { ifree(ipc); return 0; -- 2.39.2