Date: Thu, 13 Jan 2022 14:53:13 GMT From: Baptiste Daroussin <bapt@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: dc303d54a751 - main - mail/mlmmj: add support for ipv6 Message-ID: <202201131453.20DErDir008397@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/ports/commit/?id=dc303d54a75187db7fe6ec5ea59aa9f94a8c409f commit dc303d54a75187db7fe6ec5ea59aa9f94a8c409f Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2022-01-13 14:44:04 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2022-01-13 14:44:58 +0000 mail/mlmmj: add support for ipv6 --- mail/mlmmj/Makefile | 2 +- mail/mlmmj/files/patch-src_init__sockfd.c | 74 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/mail/mlmmj/Makefile b/mail/mlmmj/Makefile index 8d75ef9c50dd..b8b31051d641 100644 --- a/mail/mlmmj/Makefile +++ b/mail/mlmmj/Makefile @@ -2,7 +2,7 @@ PORTNAME= mlmmj PORTVERSION= 1.3.0 -PORTREVISION= 8 +PORTREVISION= 9 CATEGORIES= mail MASTER_SITES= http://mlmmj.org/releases/ diff --git a/mail/mlmmj/files/patch-src_init__sockfd.c b/mail/mlmmj/files/patch-src_init__sockfd.c new file mode 100644 index 000000000000..5eb98647a35d --- /dev/null +++ b/mail/mlmmj/files/patch-src_init__sockfd.c @@ -0,0 +1,74 @@ +--- src/init_sockfd.c.orig 2012-03-13 12:16:36 UTC ++++ src/init_sockfd.c +@@ -22,6 +22,7 @@ + */ + + #include <stdlib.h> ++#include <stdio.h> + #include <sys/types.h> + #include <sys/socket.h> + #include <unistd.h> +@@ -29,35 +30,53 @@ + #include <arpa/inet.h> + #include <string.h> + #include <inttypes.h> ++#include <netdb.h> + + #include "init_sockfd.h" + #include "log_error.h" + + void init_sockfd(int *sockfd, const char *relayhost, unsigned short port) + { +- int len, on; +- struct sockaddr_in addr; ++ int on, sd; ++ struct addrinfo *ai = NULL, *curai, hints; ++ char srv[NI_MAXSERV]; ++ *sockfd = -1; + + if (getenv("MLMMJ_TESTING")) { + relayhost = "127.0.0.1"; + port = 10025; + } + +- *sockfd = socket(PF_INET, SOCK_STREAM, 0); ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_socktype = SOCK_STREAM; ++ hints.ai_family = PF_UNSPEC; ++ snprintf(srv, sizeof(srv), "%d", port); ++ if (getaddrinfo(relayhost, srv, &hints, &ai) != 0) { ++ log_error(LOG_ARGS, "Unable to lookup for relayhost %s:%s", ++ relayhost, srv); ++ return; ++ } + if(*sockfd == -1) { + log_error(LOG_ARGS, "Could not get socket"); + return; + } +- addr.sin_family = PF_INET; +- addr.sin_addr.s_addr = inet_addr(relayhost); +- addr.sin_port = htons(port); +- len = sizeof(addr); +- if(connect(*sockfd, (struct sockaddr *)&addr, len) == -1) { ++ for (curai = ai; curai != NULL; curai = curai->ai_next) { ++ if ((sd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) < 0) { ++ continue; ++ } ++ if (connect(sd, ai->ai_addr, ai->ai_addrlen) == 0) { ++ close(sd); ++ sd = -1; ++ continue; ++ } ++ break; ++ } ++ freeaddrinfo(ai); ++ if (sd == -1) { + log_error(LOG_ARGS, "Could not connect to %s", relayhost); +- close(*sockfd); +- *sockfd = -1; + return; + } ++ *sockfd = sd; + + on = 1; + if(setsockopt(*sockfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&on,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202201131453.20DErDir008397>