From: Art Cancro Date: Fri, 20 Aug 2010 01:57:00 +0000 (+0000) Subject: * Cleanup and tuning of previous commit X-Git-Tag: v8.01~862 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=eff49d47e7e6bb5811409f79be338a7036e3ad46 * Cleanup and tuning of previous commit --- diff --git a/citadel/clientsocket.c b/citadel/clientsocket.c index a9325a2b3..67976f19f 100644 --- a/citadel/clientsocket.c +++ b/citadel/clientsocket.c @@ -52,8 +52,10 @@ int sock_connect(char *host, char *service) { struct in6_addr serveraddr; - struct addrinfo hints, *res = NULL; - int rc; + struct addrinfo hints; + struct addrinfo *res = NULL; + struct addrinfo *ai = NULL; + int rc = (-1); int sock = (-1); if ((host == NULL) || IsEmptyStr(host)) @@ -92,16 +94,12 @@ int sock_connect(char *host, char *service) /* * Try all available addresses until we connect to one or until we run out. */ - struct addrinfo *ai; for (ai = res; ai != NULL; ai = ai->ai_next) { - /* FIXME display the address to which we are trying to connect */ - sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (sock < 0) { CtdlLogPrintf(CTDL_ERR, "socket() failed: %s\n", strerror(errno)); return(-1); } - rc = connect(sock, res->ai_addr, res->ai_addrlen); if (rc >= 0) { return(sock); diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 4b6079905..20497ded7 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -251,7 +251,7 @@ void update_config(void) { } if (CitControl.version < 623) { - strcpy(config.c_ip_addr, "0.0.0.0"); + strcpy(config.c_ip_addr, "*"); } if (CitControl.version < 650) { diff --git a/citadel/textclient/tuiconfig.c b/citadel/textclient/tuiconfig.c index 61f8e5837..95596cd85 100644 --- a/citadel/textclient/tuiconfig.c +++ b/citadel/textclient/tuiconfig.c @@ -165,7 +165,7 @@ void do_system_configuration(CtdlIPC *ipc) "Automatically delete committed database logs", atoi(&sc[43][0])))); - strprompt("Server IP address (0.0.0.0 for 'any')", &sc[37][0], 15); + strprompt("Server IP address (* for 'any')", &sc[37][0], 15); strprompt("POP3 server port (-1 to disable)", &sc[23][0], 5); strprompt("POP3S server port (-1 to disable)", &sc[40][0], 5); strprompt("IMAP server port (-1 to disable)", &sc[27][0], 5); diff --git a/citadel/utillib/citadel_ipc.c b/citadel/utillib/citadel_ipc.c index 01e890241..6ed0cf671 100644 --- a/citadel/utillib/citadel_ipc.c +++ b/citadel/utillib/citadel_ipc.c @@ -2619,8 +2619,10 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc, static int tcp_connectsock(char *host, char *service) { struct in6_addr serveraddr; - struct addrinfo hints, *res = NULL; - int rc; + struct addrinfo hints; + struct addrinfo *res = NULL; + struct addrinfo *ai = NULL; + int rc = (-1); int sock = (-1); if ((host == NULL) || IsEmptyStr(host)) { @@ -2642,7 +2644,8 @@ static int tcp_connectsock(char *host, char *service) if (rc == 1) { /* dotted quad */ hints.ai_family = AF_INET; hints.ai_flags |= AI_NUMERICHOST; - } else { + } + else { rc = inet_pton(AF_INET6, host, &serveraddr); if (rc == 1) { /* IPv6 address */ hints.ai_family = AF_INET6; @@ -2654,30 +2657,22 @@ static int tcp_connectsock(char *host, char *service) rc = getaddrinfo(host, service, &hints, &res); if (rc != 0) { - // CtdlLogPrintf(CTDL_ERR, "%s: %s\n", host, gai_strerror(rc)); return(-1); } /* * Try all available addresses until we connect to one or until we run out. */ - struct addrinfo *ai; for (ai = res; ai != NULL; ai = ai->ai_next) { - /* FIXME display the address to which we are trying to connect */ -fprintf(stderr, "TRYING...\n"); - sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (sock < 0) return(-1); rc = connect(sock, ai->ai_addr, ai->ai_addrlen); if (rc >= 0) { -fprintf(stderr, "CONNECTED\n"); - return(sock); + return(sock); /* Connected! */ } else { -fprintf(stderr, "FAILED: %s\n", strerror(errno)); - // CtdlLogPrintf(CTDL_ERR, "connect() failed: %s\n", strerror(errno)); - close(sock); + close(sock); /* Failed. Close the socket to avoid fd leak! */ } } diff --git a/citadel/utils/setup.c b/citadel/utils/setup.c index f69f52beb..b7fc0f065 100644 --- a/citadel/utils/setup.c +++ b/citadel/utils/setup.c @@ -173,9 +173,11 @@ char *setup_text[] = { "user ID here. You may specify either a user name or a numeric\n" "UID.\n", -"Specify the IP address on which your server will run. If you\n" -"leave this blank, or if you specify 0.0.0.0, Citadel will listen\n" -"on all addresses. You can usually skip this unless you are\n" +"Specify the IP address on which your server will run.\n" +"You can name a specific IPv4 or IPv6 address, or you can specify\n" +"'*' for 'any address', '::' for 'any IPv6 address', or '0.0.0.0'\n" +"for 'any IPv4 address'. If you leave this blank, Citadel will\n" +"listen on all addresses. You can usually skip this unless you are\n" "running multiple instances of Citadel on the same computer.\n", "Specify the TCP port number on which your server will run.\n" @@ -185,8 +187,6 @@ char *setup_text[] = { "of Citadel on the same computer and there is something else\n" "already using port 504.\n", - - "Specify which authentication mode you wish to use.\n" "\n" " 0. Self contained authentication\n"