summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoritojun <itojun@pkgsrc.org>1999-07-08 17:11:56 +0000
committeritojun <itojun@pkgsrc.org>1999-07-08 17:11:56 +0000
commit874182b2fe1107b57fdfc534cca8a30f25c4ab67 (patch)
tree043c281956ac200f5ebcc4f2973544f2eae9238d
parent57ead35da3d1d65efb5819f84203e15f47ad7ef5 (diff)
downloadpkgsrc-874182b2fe1107b57fdfc534cca8a30f25c4ab67.tar.gz
enable IPV6 build (USE_INET6)
-rw-r--r--mail/qpopper/Makefile11
-rw-r--r--mail/qpopper/patches.v6/patch-ba17
-rw-r--r--mail/qpopper/patches.v6/patch-bb176
3 files changed, 203 insertions, 1 deletions
diff --git a/mail/qpopper/Makefile b/mail/qpopper/Makefile
index f1f629acb55..e80a928d3a5 100644
--- a/mail/qpopper/Makefile
+++ b/mail/qpopper/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 1999/06/08 11:54:08 bad Exp $
+# $NetBSD: Makefile,v 1.15 1999/07/08 17:11:56 itojun Exp $
#
DISTNAME= qpopper2.53
@@ -22,6 +22,15 @@ CONFIGURE_ARGS+= --libexecdir=${PREFIX}/libexec \
.if defined(QPOPPER_SERVERMODE)
CONFIGURE_ARGS+= --enable-servermode
.endif
+.if defined(USE_INET6)
+CONFIGURE_ENV+= O_DEFS="${O_DEFS}" CFLAGS="-DINET6"
+PATCHDIR= ${WRKDIR}/.patches
+
+pre-patch:
+ ${MKDIR} ${WRKDIR}/.patches
+ ${CP} ${.CURDIR}/patches/patch-* ${WRKDIR}/.patches
+ ${CP} ${.CURDIR}/patches.v6/patch-* ${WRKDIR}/.patches
+.endif
# popper makefile doesn't have an install target...
do-install:
diff --git a/mail/qpopper/patches.v6/patch-ba b/mail/qpopper/patches.v6/patch-ba
new file mode 100644
index 00000000000..2ac1c33bca6
--- /dev/null
+++ b/mail/qpopper/patches.v6/patch-ba
@@ -0,0 +1,17 @@
+$NetBSD: patch-ba,v 1.1 1999/07/08 17:11:57 itojun Exp $
+
+--- /dev/null Wed May 13 18:16:48 1998
++++ sockunion.h Wed May 13 17:57:27 1998
+@@ -0,0 +1,12 @@
++union sockunion {
++ struct sockinet {
++ u_char si_len;
++ u_char si_family;
++ u_short si_port;
++ } su_si;
++ struct sockaddr_in su_sin;
++ struct sockaddr_in6 su_sin6;
++};
++#define su_len su_si.si_len
++#define su_family su_si.si_family
++#define su_port su_si.si_port
diff --git a/mail/qpopper/patches.v6/patch-bb b/mail/qpopper/patches.v6/patch-bb
new file mode 100644
index 00000000000..67ef79f4f8e
--- /dev/null
+++ b/mail/qpopper/patches.v6/patch-bb
@@ -0,0 +1,176 @@
+$NetBSD: patch-bb,v 1.1 1999/07/08 17:11:57 itojun Exp $
+
+--- pop_init.c.orig Thu Nov 20 06:20:38 1997
++++ pop_init.c Thu May 14 14:28:25 1998
+@@ -44,6 +44,8 @@
+
+ #include <popper.h>
+
++#include "sockunion.h"
++
+ /* CNS Kerberos IV */
+ #ifdef KERBEROS
+ AUTH_DAT kdata;
+@@ -75,9 +77,31 @@
+ }
+ #endif
+
++char *
++sock_ntop(p)
++ struct sockaddr *p;
++{
++ static char ntop_buf[INET6_ADDRSTRLEN];
++ union sockunion *su;
++
++ su = (union sockunion *)p;
++ switch (su->su_family) {
++ case AF_INET:
++ inet_ntop(su->su_family, &su->su_sin.sin_addr, ntop_buf,
++ sizeof(ntop_buf));
++ return ntop_buf;
++ case AF_INET6:
++ inet_ntop(su->su_family, &su->su_sin6.sin6_addr, ntop_buf,
++ sizeof(ntop_buf));
++ return ntop_buf;
++ default:
++ return "(unsupported AF)";
++ }
++}
++
+ authenticate(p, addr)
+ POP *p;
+- struct sockaddr_in *addr;
++ struct socket *addr;
+ {
+
+ #ifdef KERBEROS
+@@ -87,10 +111,10 @@
+ char version[9];
+ int auth;
+
+- if (p->kerberos) {
++ if (p->kerberos && addr->sa_family == AF_INET) { /*XXX*/
+ strcpy(instance, "*");
+ auth = krb_recvauth(0L, 0, &ticket, KERBEROS_SERVICE, instance,
+- addr, (struct sockaddr_in *) NULL,
++ (struct sockaddr_in *)addr, (struct sockaddr_in *) NULL,
+ &kdata, "", schedule, version);
+
+ if (auth != KSUCCESS) {
+@@ -105,7 +129,7 @@
+ # ifdef DEBUG
+ if (p->debug)
+ pop_log(p, POP_DEBUG, "%s.%s@%s (%s): ok", kdata.pname,
+- kdata.pinst, kdata.prealm, inet_ntoa(addr->sin_addr));
++ kdata.pinst, kdata.prealm, sock_ntop(addr));
+ # endif /* DEBUG */
+
+ strncpy(p->user, kdata.pname, sizeof(p->user));
+@@ -126,7 +150,7 @@
+ char ** argmessage;
+ {
+
+- struct sockaddr_in cs; /* Communication parameters */
++ union sockunion cs; /* Communication parameters */
+ struct hostent * ch; /* Client host information */
+ int errflag = 0;
+ int c;
+@@ -272,13 +296,23 @@
+
+ /* Save the dotted decimal form of the client's IP address
+ in the POP parameter block */
+- p->ipaddr = (char *)strdup(inet_ntoa(cs.sin_addr));
++ p->ipaddr = (char *)strdup(sock_ntop(&cs));
+
+ /* Save the client's port */
+- p->ipport = ntohs(cs.sin_port);
++ p->ipport = ntohs(cs.su_port);
+
+ /* Get the canonical name of the host to whom I am speaking */
+- ch = gethostbyaddr((char *) &cs.sin_addr, sizeof(cs.sin_addr), AF_INET);
++ switch (cs.su_family) {
++ case AF_INET:
++ ch = gethostbyaddr((char *) &cs.su_sin.sin_addr, sizeof(cs.su_sin.sin_addr), AF_INET);
++ break;
++ case AF_INET6:
++ ch = gethostbyaddr((char *) &cs.su_sin6.sin6_addr, sizeof(cs.su_sin6.sin6_addr), AF_INET6);
++ break;
++ default:
++ ch = NULL;
++ break;
++ }
+ if (ch == NULL){
+ pop_log(p,POP_PRIORITY,
+ "(v%s) Unable to get canonical name of client, err = %d",
+@@ -320,6 +354,7 @@
+
+ strncpy(h_name, ch->h_name, sizeof(h_name));
+
++#if 0
+ /* See if the name obtained for the client's IP
+ address returns an address */
+ if ((ch_again = gethostbyname(h_name)) == NULL) {
+@@ -336,7 +371,7 @@
+ /* Look for the client's IP address in the list returned
+ for its name */
+ for (addrp=ch_again->h_addr_list; *addrp; ++addrp)
+- if (bcmp(*addrp,&(cs.sin_addr),sizeof(cs.sin_addr)) == 0) break;
++ if (bcmp(*addrp,&(cs.su_sin.sin_addr),sizeof(cs.su_sin.sin_addr)) == 0) break;
+
+ if (!*addrp) {
+ pop_log (p,POP_PRIORITY,
+@@ -345,6 +380,54 @@
+ p->client = p->ipaddr;
+ }
+ }
++#else
++ {
++ struct addrinfo hints, *res;
++ int error;
++
++ p->client = (char *)strdup(ch->h_name);
++
++ /*
++ * See if the name obtained for the client's IP
++ * address returns an address
++ */
++ memset(&hints, 0, sizeof(hints));
++ hints.ai_flags = AI_CANONNAME;
++ hints.ai_family = AF_UNSPEC;
++ hints.ai_socktype = SOCK_STREAM;
++ hints.ai_protocol = 0;
++ error = getaddrinfo(h_name, NULL, &hints, &res);
++ if (error) {
++ pop_log(p,POP_PRIORITY,
++ "Client at \"%s\" resolves to an unknown host name \"%s\"",
++ p->ipaddr, h_name);
++ p->client = p->ipaddr;
++ } else {
++ for ( ; res; res = res->ai_next) {
++ if (res->ai_addr->sa_family == AF_INET) {
++ if (!memcmp(&((struct sockaddr_in *)res->ai_addr)->sin_addr,
++ &(cs.su_sin.sin_addr), sizeof(cs.su_sin.sin_addr))) {
++ break;
++ }
++ } else if (res->ai_addr->sa_family == AF_INET6) {
++ if (!memcmp(&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
++ &(cs.su_sin6.sin6_addr), sizeof(cs.su_sin6.sin6_addr))) {
++ break;
++ }
++ } else {
++ break;
++ }
++ }
++
++ if (!res) {
++ pop_log (p,POP_PRIORITY,
++ "Client address \"%s\" not listed for its host name \"%s\"",
++ p->ipaddr,h_name);
++ p->client = p->ipaddr;
++ }
++ }
++ }
++#endif
+
+ #ifdef RES_DEFNAMES
+ /*