pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

opensmtpd: Fix build on SmartOS and silence some warnings.



Module Name:	pkgsrc-wip
Committed By:	Juraj Lutter <otis%NetBSD.org@localhost>
Pushed By:	otis
Date:		Wed Sep 9 11:03:03 2020 +0000
Changeset:	1446b09eca0eb0039a1d1b75fc86c171d68abe63

Modified Files:
	opensmtpd/Makefile
	opensmtpd/distinfo
Added Files:
	opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c
	opensmtpd/patches/patch-openbsd-compat_getpeereid.c
	opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c
	opensmtpd/patches/patch-openbsd-compat_imsg.c
	opensmtpd/patches/patch-smtpd_proxy.c

Log Message:
opensmtpd: Fix build on SmartOS and silence some warnings.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=1446b09eca0eb0039a1d1b75fc86c171d68abe63

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 opensmtpd/Makefile                                 |  2 ++
 opensmtpd/distinfo                                 |  5 ++++
 .../patch-contrib_libexec_mail.local_mail.local.c  | 15 ++++++++++
 .../patches/patch-openbsd-compat_getpeereid.c      | 18 ++++++++++++
 .../patches/patch-openbsd-compat_imsg-buffer.c     | 31 +++++++++++++++++++++
 opensmtpd/patches/patch-openbsd-compat_imsg.c      | 31 +++++++++++++++++++++
 opensmtpd/patches/patch-smtpd_proxy.c              | 32 ++++++++++++++++++++++
 7 files changed, 134 insertions(+)

diffs:
diff --git a/opensmtpd/Makefile b/opensmtpd/Makefile
index 80cc8f55bd..536335289d 100644
--- a/opensmtpd/Makefile
+++ b/opensmtpd/Makefile
@@ -39,6 +39,8 @@ CONFIGURE_ARGS+=	--with-ssl-dir=${SSLBASE:Q}
 CONFIGURE_ARGS+=	--enable-table-db
 CONFIGURE_ARGS+=	--without-zlib-version-check
 
+CFLAGS.SunOS+=		-D__EXTENSIONS__
+
 EXAMPLEDIR=	${PREFIX}/share/examples/opensmtpd
 CONF_FILES=	${EXAMPLEDIR}/smtpd.conf ${PKG_SYSCONFDIR}/smtpd.conf
 
diff --git a/opensmtpd/distinfo b/opensmtpd/distinfo
index a17c63dc83..7c08474dc4 100644
--- a/opensmtpd/distinfo
+++ b/opensmtpd/distinfo
@@ -4,5 +4,10 @@ SHA1 (opensmtpd-6.7.1p1.tar.gz) = ddf1033971cf7c87d33b93d5ac80d7e65ac7a08b
 RMD160 (opensmtpd-6.7.1p1.tar.gz) = 8362d14c4620f15ce2d39fd8a68e8919c13b883c
 SHA512 (opensmtpd-6.7.1p1.tar.gz) = 403952e77b360f42d8dc8ae7cd7faeced831b9e37bffd7c67d338b7208f7471d50f3594c3475a9282d18cb17435efd305ec8c05f89eaeab5d363ddb1c4d54a2e
 Size (opensmtpd-6.7.1p1.tar.gz) = 859364 bytes
+SHA1 (patch-contrib_libexec_mail.local_mail.local.c) = bec19540fa52c7c6596ab5923f3a67b334ddf168
 SHA1 (patch-mk_smtpd_Makefile.am) = 57a7921cb5de3f6388ad98f9b74b98ca49da38bb
+SHA1 (patch-openbsd-compat_getpeereid.c) = 8d60140bffcabb6accf9b7bbe0f419c2c25d352d
+SHA1 (patch-openbsd-compat_imsg-buffer.c) = 88ca16db5dd400de14dafe7cc35d40adfd45a4c0
+SHA1 (patch-openbsd-compat_imsg.c) = ef84b7883b75bfc726085dac67b7bead16029e20
+SHA1 (patch-smtpd_proxy.c) = a8ffd7df13aac3eea004a0b36114fdaf391127f4
 SHA1 (patch-smtpd_smtp__session.c) = e053facbb726e78691688dbf532882418f08b25d
diff --git a/opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c b/opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c
new file mode 100644
index 0000000000..115edee3fd
--- /dev/null
+++ b/opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Initialize variable to silence warning.
+
+--- contrib/libexec/mail.local/mail.local.c.orig	2020-05-21 19:06:04.000000000 +0000
++++ contrib/libexec/mail.local/mail.local.c
+@@ -288,7 +288,7 @@ void
+ notifybiff(char *msg)
+ {
+ 	static struct addrinfo *res0;
+-	struct addrinfo hints, *res;
++	struct addrinfo hints, *res = NULL;
+ 	static int f = -1;
+ 	size_t len;
+ 	int error;
diff --git a/opensmtpd/patches/patch-openbsd-compat_getpeereid.c b/opensmtpd/patches/patch-openbsd-compat_getpeereid.c
new file mode 100644
index 0000000000..5b2b612d51
--- /dev/null
+++ b/opensmtpd/patches/patch-openbsd-compat_getpeereid.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Silence warnings.
+
+--- openbsd-compat/getpeereid.c.orig	2020-05-21 19:06:04.000000000 +0000
++++ openbsd-compat/getpeereid.c
+@@ -48,9 +48,9 @@ getpeereid(int s, uid_t *euid, gid_t *gi
+ 
+ 	if (getpeerucred(s, &ucred) == -1)
+ 		return (-1);
+-	if ((*euid = ucred_geteuid(ucred)) == -1)
++	if ((*euid = ucred_geteuid(ucred)) == (uid_t)-1)
+ 		return (-1);
+-	if ((*gid = ucred_getrgid(ucred)) == -1)
++	if ((*gid = ucred_getrgid(ucred)) == (gid_t)-1)
+ 		return (-1);
+ 
+ 	ucred_free(ucred);
diff --git a/opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c b/opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c
new file mode 100644
index 0000000000..23e09b6c46
--- /dev/null
+++ b/opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Fix build on SmartOS
+
+--- openbsd-compat/imsg-buffer.c.orig	2020-05-21 19:06:04.000000000 +0000
++++ openbsd-compat/imsg-buffer.c
+@@ -16,6 +16,15 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++/* needed for CMSG_* functions on SunOS */
++#if defined(__sun)
++#if (__STDC_VERSION__ - 0 < 199901L)
++#define _XOPEN_SOURCE 500
++#else
++#define _XOPEN_SOURCE 600
++#endif
++#endif
++
+ #include "includes.h"
+ 
+ #include <sys/param.h>
+@@ -26,7 +35,7 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#ifndef HAVE_EXPLICIT_BZERO
++#if defined (HAVE_EXPLICIT_BZERO) || (defined(sun) || defined(__sun))
+ #include <strings.h>
+ #endif
+ #include <unistd.h>
diff --git a/opensmtpd/patches/patch-openbsd-compat_imsg.c b/opensmtpd/patches/patch-openbsd-compat_imsg.c
new file mode 100644
index 0000000000..6e101443e3
--- /dev/null
+++ b/opensmtpd/patches/patch-openbsd-compat_imsg.c
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Fix build on SmartOS
+
+--- openbsd-compat/imsg.c.orig	2020-05-21 19:06:04.000000000 +0000
++++ openbsd-compat/imsg.c
+@@ -16,6 +16,15 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++/* needed for CMSG_* functions on SunOS */
++#if defined(__sun)
++#if (__STDC_VERSION__ - 0 < 199901L)
++#define _XOPEN_SOURCE 500
++#else
++#define _XOPEN_SOURCE 600
++#endif
++#endif
++
+ #include "includes.h"
+ 
+ #include <sys/param.h>
+@@ -26,7 +35,7 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#ifndef HAVE_EXPLICIT_BZERO
++#if !defined (HAVE_EXPLICIT_BZERO) || (defined(sun) || defined(__sun))
+ #include <strings.h>
+ #endif
+ #include <unistd.h>
diff --git a/opensmtpd/patches/patch-smtpd_proxy.c b/opensmtpd/patches/patch-smtpd_proxy.c
new file mode 100644
index 0000000000..3832f035c6
--- /dev/null
+++ b/opensmtpd/patches/patch-smtpd_proxy.c
@@ -0,0 +1,32 @@
+$NetBSD$
+
+Rename local variables to avoid name clash on SmartOS.
+
+--- smtpd/proxy.c.orig	2020-05-21 19:06:04.000000000 +0000
++++ smtpd/proxy.c
+@@ -341,7 +341,7 @@ proxy_translate_ss(struct proxy_session
+ {
+ 	struct sockaddr_in *sin = (struct sockaddr_in *) &s->ss;
+ 	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &s->ss;
+-	struct sockaddr_un *sun = (struct sockaddr_un *) &s->ss;
++	struct sockaddr_un *lsun = (struct sockaddr_un *) &s->ss;
+ 	size_t sun_len;
+ 
+ 	switch (s->hdr.fam) {
+@@ -370,13 +370,13 @@ proxy_translate_ss(struct proxy_session
+ 		memset(&s->ss, 0, sizeof(s->ss));
+ 		sun_len = strnlen(s->addr.un.src_addr,
+ 		    sizeof(s->addr.un.src_addr));
+-		if (sun_len > sizeof(sun->sun_path)) {
++		if (sun_len > sizeof(lsun->sun_path)) {
+ 			proxy_error(s, "address translation", "Unix socket path"
+ 			    " longer than supported");
+ 			return (-1);
+ 		}
+-		sun->sun_family = AF_UNIX;
+-		memcpy(sun->sun_path, s->addr.un.src_addr, sun_len);
++		lsun->sun_family = AF_UNIX;
++		memcpy(lsun->sun_path, s->addr.un.src_addr, sun_len);
+ 		break;
+ 
+ 	default:


Home | Main Index | Thread Index | Old Index