--- /dev/null	Sun Mar 13 14:59:32 1994
+++ ./GNUmakefile	Thu Mar 13 22:37:15 1997
@@ -0,0 +1,38 @@
+# %%% copyright-cmetz-97
+# This software is Copyright 1997 by Craig Metz, All Rights Reserved.
+# The Inner Net License Version 2 applies to this software.
+# You should have received a copy of the license with this software. If
+# you didn't get a copy, you may request one from <license@inner.net>.
+#
+
+TARGETS=popd
+
+ifndef CONFIG_DIR
+CONFIG_DIR=/usr/inet6/lib/
+endif
+
+include $(CONFIG_DIR)GNUmakefile.inc
+
+CFLAGS+=-DBIND43 -DHAVE_VSPRINTF -DNONAUTHFILE=\"/etc/ftpusers\" -DDEBUG
+
+CFLAGS+=$(DINET6) $(DIPSEC)
+
+ifneq ($(44BSD),0)
+CFLAGS+=-DHAVE_PARAM_H
+endif
+ifeq ($(OS),Linux)
+CFLAGS+=-DSYSV -DLINUX
+endif
+
+DEST=$(LIBEXECDIR)
+
+include $(CONFIG_DIR)GNUmakefile.prog.tmpl
+
+OBJS=flock.o pop_dele.o pop_dropcopy.o pop_get_command.o pop_get_subcommand.o \
+	pop_init.o pop_last.o pop_list.o pop_log.o pop_lower.o pop_msg.o \
+	pop_parse.o pop_pass.o pop_quit.o pop_rset.o pop_send.o pop_stat.o \
+	pop_updt.o pop_user.o pop_xtnd.o pop_xmit.o popper.o pop_bull.o \
+	xtnd_xlst.o pop_uidl.o mktemp.o pop_rpop.o pop_apop.o md5.o
+
+popd: $(OBJS)
+	$(CC) $(OBJS) $(LOADLIBES) -o popd
--- /dev/null	Sun Mar 13 14:59:32 1994
+++ ./README.ipv6	Thu Mar 13 23:52:51 1997
@@ -0,0 +1,13 @@
+IPv6 Support Patch for qpopper2.2
+=================================
+
+  This program has been modified to support IPv6. Please see the notices on
+individual files for the copyrights and licenses that apply to the changes.
+This package REQUIRES that the inet6-apps package be installed first. That
+package also contains more documentation and the actual license notices
+referenced in the copyright notice.
+
+History
+=======
+
+1	Initial release independent of inet6-apps.
--- make.44bsd	Wed May 29 20:37:44 1996
+++ make.44bsd	Sun Jan 19 14:55:19 1997
@@ -26,7 +26,7 @@
 #CFLAGS+=-DRPOP
 
 # if you want to block POP access for anyone in /etc/ftpusers, uncomment
-#CFLAGS+=-DNONAUTHFILE=\"/etc/ftpusers\"
+CFLAGS+=-DNONAUTHFILE=\"/etc/ftpusers\"
 
 .include <bsd.prog.mk>
 
--- make.linux	Tue Apr 23 14:39:47 1996
+++ make.linux	Sun Jan 19 14:55:20 1997
@@ -37,14 +37,11 @@
 #	to the LIBS variable.
 
 CFLAGS                =	-DBIND43 -DHAVE_VSPRINTF -DSYSV -DLINUX \
-			-DBINMAIL_IS_SETGID \
-			-DAPOP=\"/etc/pop.auth\" -DPOPUID=\"pop\" \
-#			-DAUTH
-#
-#LIBS		= -lshadow -ldbm 
-LIBS		= -ldbm 
+			-DNONAUTHFILE=\"/etc/ftpusers\" $(XCFLAGS)
 
-TARGET                =       popper.linux
+LIBS		= -ldbm $(XLIBS)
+
+TARGET                =       popper
 
 TAR           =       ${TARGET}.tar
 
@@ -60,8 +57,8 @@
 
 ${TARGET}: ${OBJS}
 	${CC}  ${OBJS} -o ${TARGET} ${LIBS}
-	chgrp mail ${TARGET}
-	chmod 755  ${TARGET}
+#	chgrp mail ${TARGET}
+#	chmod 755  ${TARGET}
 
 popauth: popauth.o flock.o
 	${CC}  -o popauth popauth.o  flock.o -ldbm
--- pop_init.c	Wed May 22 13:14:36 1996
+++ pop_init.c	Thu Mar 13 22:37:16 1997
@@ -1,4 +1,13 @@
 /*
+%%% portions-copyright-cmetz-97
+Portions of this software are Copyright 1997 by Craig Metz, All Rights
+Reserved. The Inner Net License Version 2 applies to these portions of
+the software.
+You should have received a copy of the license with this software. If
+you didn't get a copy, you may request one from <license@inner.net>.
+
+*/
+/*
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
@@ -36,6 +45,13 @@
 #include <strings.h>
 #endif
 
+#if INET6
+#include <netinet6/in6.h>
+#include <stdlib.h>
+
+#include "support.h"
+#endif /* INET6 */
+
 #include "popper.h"
 
 /* CNS Kerberos IV */
@@ -71,7 +87,7 @@
 
 authenticate(p, addr)
      POP     *p;
-     struct sockaddr_in *addr;
+     struct sockaddr *addr;
 {
 
 #ifdef KERBEROS
@@ -119,9 +135,16 @@
 int             argcount;
 char    **      argmessage;
 {
-
+#if INET6
+    union {
+      struct sockaddr sa;
+      struct sockaddr_in sin;
+      struct sockaddr_in6 sin6;
+    } cs;
+#else /* INET6 */
     struct sockaddr_in      cs;                 /*  Communication parameters */
     struct hostent      *   ch;                 /*  Client host information */
+#endif /* INET6 */
     int                     errflag = 0;
     int                     c;
     int                     len;
@@ -263,6 +286,41 @@
         exit(1);
     }
 
+#if INET6
+    {
+    char *hbuf, *sbuf;
+    if (!(hbuf = malloc(64))) {
+      pop_log(p, POP_PRIORITY, "malloc failed: %s(%d)", strerror(errno), errno);
+      exit(1);
+    };
+    if (!(sbuf = malloc(32))) {
+      pop_log(p, POP_PRIORITY, "malloc failed: %s(%d)", strerror(errno), errno);
+      exit(1);
+    };
+    if (getnameinfo((struct sockaddr *)&cs, NRL_SA_LEN((struct sockaddr *)&cs), hbuf, 64, sbuf, 32, NI_NUMERICSERV)) {
+      pop_log(p, POP_PRIORITY, "getnameinfo failed");
+      exit(1);
+    };
+    if (!(p->client = malloc(strlen(hbuf) + strlen(sbuf) + 2))) {
+      pop_log(p, POP_PRIORITY, "malloc failed: %s(%d)", strerror(errno), errno);
+      exit(1);
+    };
+    strcpy(p->client, hbuf);
+    strcat(p->client, ".");
+    strcat(p->client, sbuf);
+    free(hbuf);
+    free(sbuf);
+
+    p->privport = 0;
+    switch(cs.sa.sa_family) {
+      case AF_INET:
+        p->privport = ((cs.sin.sin_port < IPPORT_RESERVED) && (cs.sin.sin_port >= IPPORT_RESERVED/2));
+        break;
+      case AF_INET6:
+        p->privport = ((cs.sin6.sin6_port < IPPORT_RESERVED) && (cs.sin6.sin6_port >= IPPORT_RESERVED/2));
+    };
+    };
+#else /* INET6 */
     /*  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));
@@ -349,6 +407,7 @@
 
 #endif /* BIND43 */
     }
+#endif /* INET6 */
 
     /*  Create input file stream for TCP/IP communication */
     if ((p->input = fdopen(sp,"r")) == NULL){
@@ -367,8 +426,12 @@
 #ifdef DEBUG
     if (p->debug)
 	pop_log(p,POP_PRIORITY,
+#if INET6
+	    "(v%s) Servicing request from \"%s\"", VERSION,p->client);
+#else /* INET6 */
 	    "(v%s) Servicing request from \"%s\" at %s",
-		VERSION,p->client,p->ipaddr);
+		VERSION,p->client);
+#endif /* INET6 */
 #endif
 
     return(authenticate(p, &cs));
--- pop_rpop.c	Thu Feb  1 14:43:19 1996
+++ pop_rpop.c	Thu Mar 13 22:37:16 1997
@@ -1,4 +1,13 @@
 /*
+%%% portions-copyright-cmetz-97
+Portions of this software are Copyright 1997 by Craig Metz, All Rights
+Reserved. The Inner Net License Version 2 applies to these portions of
+the software.
+You should have received a copy of the license with this software. If
+you didn't get a copy, you may request one from <license@inner.net>.
+
+*/
+/*
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
@@ -27,9 +36,15 @@
 {
   struct passwd  *   pw;
 
+#if INET6
+    if (!p->privport) {
+      pop_log(p,POP_PRIORITY,
+	      "RPOP command from %s on illegal port.",p->client);
+#else /* INET6 */
     if (p->ipport >= IPPORT_RESERVED || p->ipport < IPPORT_RESERVED/2)  {
       pop_log(p,POP_PRIORITY,
 	      "RPOP command from %s (%s) on illegal port.",p->client,p->ipaddr);
+#endif /* INET6 */
         return (pop_msg(p,POP_FAILURE,
             "Permission denied.",p->user));
     }
--- popper.c	Wed May 29 20:40:54 1996
+++ popper.c	Thu Mar 13 22:37:16 1997
@@ -1,4 +1,13 @@
 /*
+%%% portions-copyright-cmetz-97
+Portions of this software are Copyright 1997 by Craig Metz, All Rights
+Reserved. The Inner Net License Version 2 applies to these portions of
+the software.
+You should have received a copy of the license with this software. If
+you didn't get a copy, you may request one from <license@inner.net>.
+
+*/
+/*
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
@@ -103,7 +112,11 @@
 
     for (p.CurrentState=auth1;p.CurrentState!=halt&&p.CurrentState!=error;) {
 #ifdef SETPROCTITLE
+#if INET6
+	setproctitle("%s@%s: cmd read", p.user, p.client);
+#else /* INET6 */
 	setproctitle("%s@%s [%s]: cmd read", p.user, p.client, p.ipaddr);
+#endif /* INET6 */
 #endif
         if (hangup) {
             pop_msg(&p,POP_FAILURE,"POP hangup",p.myhost);
@@ -133,8 +146,12 @@
 		for (i = 0; s->command[i]; i++)
 		    command[i] = toupper(s->command[i]);
 		command[i] = 0;
+#if INET6
+		setproctitle("%s@%s: %s", p.user, p.client, command);
+#else /* INET6 */
 		setproctitle("%s@%s [%s]: %s",
 				    p.user, p.client, p.ipaddr, command);
+#endif /* INET6 */
 #endif
                 p.CurrentState = s->result[(*s->function)(&p)];
             } else {
@@ -151,8 +168,12 @@
     /*  Log the end of activity */
     if (p.debug)
 	pop_log(&p,POP_PRIORITY,
+#if INET6
+	    "(v%s) Ending request from %s@%s", VERSION,p.user,p.client);
+#else /* INET6 */
 	    "(v%s) Ending request from \"%s\" at (%s) %s",
 					VERSION,p.user,p.client,p.ipaddr);
+#endif /* INET6 */
 #endif
 
     /*  Stop logging */
--- popper.h	Wed May 22 14:26:25 1996
+++ popper.h	Thu Mar 13 22:37:17 1997
@@ -1,4 +1,13 @@
 /*
+%%% portions-copyright-cmetz-97
+Portions of this software are Copyright 1997 by Craig Metz, All Rights
+Reserved. The Inner Net License Version 2 applies to these portions of
+the software.
+You should have received a copy of the license with this software. If
+you didn't get a copy, you may request one from <license@inner.net>.
+
+*/
+/*
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
@@ -275,10 +284,14 @@
                                                     computer */
     char            *   client;                 /*  Canonical name of client 
                                                     computer */
+#if INET6
+    int                 privport;
+#else /* INET6 */
     char            *   ipaddr;                 /*  Dotted-notation format of 
                                                     client IP address */
     unsigned short      ipport;                 /*  Client port for privileged 
                                                     operations */
+#endif /* INET6 */
     char                user[MAXUSERNAMELEN];   /*  Name of the POP user */
     state               CurrentState;           /*  The current POP operational                                                     state */
     MsgInfoList     *   mlp;                    /*  Message information list */
