fix ipv6 connections in smtp client
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 25 Jan 2011 22:51:22 +0000 (23:51 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 25 Jan 2011 22:51:22 +0000 (23:51 +0100)
citadel/event_client.c
citadel/modules/smtp/serv_smtpeventclient.c

index 60f74282df813cee217614d2ba6af44c1b8e4403..4ba983220e947352014fea149c83082b72872a7e 100644 (file)
@@ -384,9 +384,9 @@ eNextState event_connect_socket(AsyncIO *IO, double conn_timeout, double first_r
        IO->conn_fail.data = IO;
        ev_timer_init(&IO->rw_timeout, IO_Timout_callback, first_rw_timeout, 0);
        IO->rw_timeout.data = IO;
-       ///struct sockaddr_in *addr = &IO->Addr;
+
        if (IO->IP6)
-               rc = connect(IO->sock, &IO->Addr, sizeof(struct in6_addr));
+               rc = connect(IO->sock, &IO->Addr, sizeof(struct sockaddr_in6));
        else
                rc = connect(IO->sock, (struct sockaddr_in *)&IO->Addr, sizeof(struct sockaddr_in));
 
index e09080200425d99808625e57f31546cd00961a57..7eb42248cee393a9d832b3584fe1e5d07585da34 100644 (file)
@@ -306,12 +306,12 @@ eNextState mx_connect_relay_ip(AsyncIO *IO)
        if (SendMsg->pCurrRelay->Port != 0)
                IO->dport = SendMsg->pCurrRelay->Port;
 
-       memset(&IO->Addr, 0, sizeof(struct in6_addr));
+       memset(&IO->Addr, 0, sizeof(struct sockaddr_in6));
        if (IO->IP6) {
                memcpy(&IO->Addr.sin6_addr.s6_addr, 
                       &SendMsg->pCurrRelay->Addr,
                       sizeof(struct in6_addr));
-               
+
                IO->Addr.sin6_family = AF_INET6;
                IO->Addr.sin6_port = htons(IO->dport);
        }