When config.c_ip_addr is set, use that IP address
authorArt Cancro <ajc@citadel.org>
Tue, 5 Jun 2007 20:47:43 +0000 (20:47 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 5 Jun 2007 20:47:43 +0000 (20:47 +0000)
not only for listening sockets, but also client sockets.  This will
allow outbound email to be sourced from the correct IP address when
multiple unrelated Citadels are running on the same server.

citadel/clientsocket.c

index c2f992ed72013163a08f61b246738766bb85b3bf..1fffa2bdc940c69d06ea046523eea78ec1023007 100644 (file)
@@ -30,7 +30,8 @@
 #include "snprintf.h"
 #endif
 #include "sysdep_decls.h"
-#include <clientsocket.h>
+#include "config.h"
+#include "clientsocket.h"
 
 #ifndef INADDR_NONE
 #define INADDR_NONE 0xffffffff
@@ -53,6 +54,9 @@ int sock_connect(char *host, char *service, char *protocol)
 
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
+       if (strlen(config.c_ip_addr) > 0) {
+               sin.sin_addr.s_addr = inet_addr(config.c_ip_addr);
+       }
 
        pse = getservbyname(service, protocol);
        if (pse) {