Subject: qpopper's patch for NEWS-OS 6.1
From: nanzan@bignews.ius.sony.co.jp (Hidemitsu Minamiyama)
Newsgroups: sony.sources.unix
Date: 25 Jul 1995 06:48:01 JST
Path: atg2gw!sonygw2!headgw!iusnews!iusnews!nanzan
Organization: Office Takanawa, Sony Corporation, Tokyo, Japan.
Lines: 455
Distribution: sony
Message-ID: <NANZAN.95Jul24214801@bignews.ius.sony.co.jp>
NNTP-Posting-Host: bignews

qpopper-2.1.4 ¤ò NEWS-OS 6.1 ¤ËÂÐ±þ¤µ¤»¤ë patch ¤Ç¤¹¡£

qpopper ¤Ï popper-1.831 ¤ò¥Ù¡¼¥¹¤Ë QUALCOMM Inc. ¤Çµ¡Ç½³ÈÄ¥¤µ¤ì¤¿
POP server ¥×¥í¥°¥é¥à¤Ç¤¹¡£

qpopper ¤Ë¤³¤Î patch ¤ò¤¢¤Æ¤ë¤³¤È¤Ë¤è¤ê¡¢NEWS-OS 6.1 ¤Î£Ï£Ó¤Ç¤â
£Ð£Ï£Ð¤ÎÅÅ»Ò¥á¡¼¥ë¥µ¡¼¥Ð¡¼¤È¤·¤ÆÆ¯¤«¤»¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£

qpopper-2.1.4 ¤Î¥½¡¼¥¹¤Ë²¼µ­¤Î patch ¤ò¤¢¤Æ¤Æ¤«¤é¡¢`make news-sysv`
¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£

¥µ¡¼¥Ð¡¼¥×¥í¥°¥é¥à¤¬¤Ç¤­¤¢¤¬¤Ã¤¿¤é¡¢INSTALL ¥Õ¥¡¥¤¥ë¤Ë½¾¤Ã¤Æ¥»¥Ã¥È
¥¢¥Ã¥×¤·¤Æ¤¯¤À¤µ¤¤¡£

INSTALL ¥Õ¥¡¥¤¥ë¤Ë¤Ïµ­½Ò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¤¬¡¢NEWS-OS6.1 ¤Ç¤Ï¥¹¥×¡¼¥ë
¥Ç¥£¥ì¥¯¥È¥ê¤Îµö²ÄÀßÄê¤òÊÑ¹¹¤·¤Þ¤¹¡£
	% su
	# chmod 777 /var/mail /var/mail/:??*

°Ê¾å¤Ç¥»¥Ã¥È¥¢¥Ã¥×¤Ï´°Î»¤Ç¤¹¡£

----
£Â£É£Ó¼ÒÆâ±Ä¶È²Ý¡¡Æî»³½¨¸÷



----/¤³¤³¤«¤é/----------------------------------------------------------
diff -c qpopper-2.1.4/Makefile qpopper-2.1.4.news/Makefile
*** qpopper-2.1.4/Makefile	Fri Apr 28 19:21:34 1995
--- qpopper-2.1.4.news/Makefile	Mon Jul 24 18:08:14 1995
***************
*** 45,52 ****
--- 45,56 ----
  	@echo "    make pyramid"
  	@echo "    make linux"
  	@echo "    make osf1"
+ 	@echo "    make news-sysv"
  	@echo ""
  
+ news-sysv:
+ 	make -f make.news-sysv
+ 
  sunos:
  	make -f make.sunos
  
***************
*** 99,105 ****
  	mv xae ${TAR}.Z.uuencoded.xae
  
  clean:
! 	rm -f core *.o *.Z*
  
  install.sunos: popper.sunos
  	install -c -m 700 -o root -g staff popper.sunos ${INSTALLDIR}/${TARGET}
--- 103,109 ----
  	mv xae ${TAR}.Z.uuencoded.xae
  
  clean:
! 	rm -f core *.o *.Z* popper popper.??*
  
  install.sunos: popper.sunos
  	install -c -m 700 -o root -g staff popper.sunos ${INSTALLDIR}/${TARGET}
Common subdirectories: qpopper-2.1.4/doc and qpopper-2.1.4.news/doc
diff -c qpopper-2.1.4/make.news-sysv qpopper-2.1.4.news/make.news-sysv
*** qpopper-2.1.4/make.news-sysv	Mon Jul 24 21:01:58 1995
--- qpopper-2.1.4.news/make.news-sysv	Thu Jul 13 16:54:28 1995
***************
*** 0 ****
--- 1,117 ----
+ #@(#)@(#)Makefile	2.5  2.5 4/3/91
+ 
+ CSRCS		=	flock.c pop_dele.c pop_dropcopy.c \
+ 			pop_get_command.c pop_get_subcommand.c pop_init.c \
+ 			pop_last.c pop_list.c pop_log.c pop_lower.c \
+ 			pop_msg.c pop_parse.c pop_pass.c pop_quit.c \
+ 			pop_rset.c pop_send.c pop_stat.c pop_updt.c \
+ 			pop_user.c pop_xtnd.c pop_xmit.c popper.c \
+ 			pop_bull.c xtnd_xlst.c pop_uidl.c mktemp.c pop_rpop.c
+ 
+ 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
+ 
+ DOCS		=	README pop3.rfc1081 pop3e.rfc1082 popper.8
+ 
+ INCLUDES	=	popper.h version.h
+ 
+ SRCS		=	${CSRCS} ${INCLUDES}
+ 
+ SCCS		=	/usr/ucb/sccs
+ 
+ REL		=
+ 
+ #CC = gcc -fstrength-reduce -fpcc-struct-return 
+ CC = cc
+ 
+ MAKEFILE	=	Makefile
+ 
+ #               Options are:
+ #		AIX		-	AIX decided to implement wait()
+ #					differently.  Also turns on SYSV.
+ #		AUTH		-	Does shadow password checking if your
+ #					system supports it.
+ #		AUTHFILE	-	Authorized users file, supercedes
+ #					/etc/passwd for access.  A username
+ #					and password are still required.
+ #               BIND43          -	If you are using BSD 4.3 domain 
+ #					name service.
+ #		DEBUG		-	Include the debugging code.  Note:  You
+ #					still have to use the -d or -t flag to
+ #					enable debugging.
+ #               HAVE_VSPRINTF   -	If the vsprintf functions are available 
+ #					on your system.
+ #		KEEP_TEMP_DROP	-	.user.pop file is not removed.  This
+ #					can be used to determine when a user
+ #					has last accessed the system without
+ #					the use of log files.
+ #		KERBEROS	-	Kerberos is used instead of
+ #					/etc/passwd for authentication.
+ #		LARGESITE	-	Reduce logging from misc and errors
+ #					to just errors.
+ #		MAILOCK		-	If your OS supports SYSV mail file
+ #					locking it is strongly recommended
+ #					that you
+ #					use it.
+ #		RPOP		-	Use /etc/rhosts and .rhosts files for
+ #					authentication instead of /etc/passwd.
+ #		STRDUP		-	Define if System does not support the
+ #					strdup() call.
+ #               STRNCASECMP     -	If you do not have strncasecmp()
+ #					the define this value
+ #               SYSLOG42        -	For BSD 4.2 syslog (default is BSD 4.3 
+ #					syslog).
+ #               SYSV            -       System V locking, seeking, and include 
+ #                                       conventions.
+ 
+ CFLAGS		=	-DDEBUG -DBIND43 -DHAVE_VSPRINTF -DAUTH -DMAILOCK -DSYSV -DNEWS -DDEBUG
+ 
+ TARGET		=	popper.news-sysv
+ 
+ TAR		=	${TARGET}.tar
+ 
+ INSTALLDIR	=	/usr/etc
+ 
+ MANPAGE		=	popper.8
+ 
+ CATPAGE		=	popper.0
+ 
+ MANDIR		=	/usr/local/man/cat8
+ 
+ 
+ 
+ ${TARGET}: ${OBJS}
+ 	${CC}  ${OBJS} -o ${TARGET} -lsocket -lnsl -lresolv -lmail
+ #	${CC}  ${OBJS} -o ${TARGET} -lsocket -lnsl -lresolv -lmail
+ 
+ tar: ${SRCS} ${DOCS} ${MAKEFILE}
+ 	rm -f ${TAR} *.Z*
+ 	tar -cvf ${TAR} ${SRCS} ${DOCS} ${MAKEFILE}
+ 	compress ${TAR}
+ 	uuencode ${TAR}.Z ${TAR}.Z > ${TAR}.Z.uuencoded
+ 	split -300 ${TAR}.Z.uuencoded
+ 	mv xaa ${TAR}.Z.uuencoded.xaa
+ 	mv xab ${TAR}.Z.uuencoded.xab
+ 	mv xac ${TAR}.Z.uuencoded.xac
+ 	mv xad ${TAR}.Z.uuencoded.xad
+ 	mv xae ${TAR}.Z.uuencoded.xae
+ 
+ clean:
+ 	rm -f core *.o *.Z*
+ 	${SCCS} clean
+ 
+ sources: ${SRCS}
+ 
+ ${SRCS}:
+ 	${SCCS} get ${REL} $@ -p | expand -4 > $@
+ 
+ ${DOCS}:
+ 	${SCCS} get README -p | expand -4 > README
+ 	${SCCS} get popper.8 -p | expand -4 > popper.8
+ 	
+ ${OBJS}:    popper.h version.h
diff -c qpopper-2.1.4/pop_bull.c qpopper-2.1.4.news/pop_bull.c
*** qpopper-2.1.4/pop_bull.c	Fri Apr 28 19:21:34 1995
--- qpopper-2.1.4.news/pop_bull.c	Thu Jul 13 13:54:20 1995
***************
*** 10,15 ****
--- 10,18 ----
  #include <sys/types.h>
  #include <sys/dir.h>
  #else
+ #ifdef NEWS
+ #  include <sys/types.h>
+ #endif
  #include <dirent.h>
  #endif
  #include <ctype.h>
diff -c qpopper-2.1.4/pop_dropcopy.c qpopper-2.1.4.news/pop_dropcopy.c
*** qpopper-2.1.4/pop_dropcopy.c	Fri Apr 28 19:21:34 1995
--- qpopper-2.1.4.news/pop_dropcopy.c	Mon Jul 24 17:24:48 1995
***************
*** 302,308 ****
      FILE		    *mail_drop;		    /*  Streams for fids */
  
      /*  Acquire a stream pointer for the maildrop */
!     if ( (mail_drop = fdopen(mfd,"r")) == NULL ) {
          (void)close(mfd) ;
          return pop_msg(p,POP_FAILURE,"Cannot assign stream for %s",
              p->drop_name);
--- 302,308 ----
      FILE		    *mail_drop;		    /*  Streams for fids */
  
      /*  Acquire a stream pointer for the maildrop */
!     if ( (mail_drop = (FILE *)fdopen(mfd,"r")) == NULL ) {
          (void)close(mfd) ;
          return pop_msg(p,POP_FAILURE,"Cannot assign stream for %s",
              p->drop_name);
***************
*** 502,508 ****
      /* First create a unique file.  Would prefer mkstemp, but Ultrix...*/
      strcpy(template,POP_TMPDROP);
      if (((tfn=mkstemp(template)) == -1) ||
! 	((tf=fdopen(tfn, "w+")) == NULL)) {	/* failure, bail out	*/
          pop_log(p,POP_PRIORITY,
              "Unable to create temporary temporary maildrop '%s': %s",template,
                  (errno < sys_nerr) ? sys_errlist[errno] : "") ;
--- 502,508 ----
      /* First create a unique file.  Would prefer mkstemp, but Ultrix...*/
      strcpy(template,POP_TMPDROP);
      if (((tfn=mkstemp(template)) == -1) ||
! 	((tf=(FILE *)fdopen(tfn, "w+")) == NULL)) {	/* failure, bail out	*/
          pop_log(p,POP_PRIORITY,
              "Unable to create temporary temporary maildrop '%s': %s",template,
                  (errno < sys_nerr) ? sys_errlist[errno] : "") ;
***************
*** 569,575 ****
  #endif
      
      /*  Acquire a stream pointer for the temporary maildrop */
!     if ( (p->drop = fdopen(dfd,"r+")) == NULL ) {
          (void)close(dfd) ;
          return pop_msg(p,POP_FAILURE,"Cannot assign stream for %s",
              p->temp_drop);
--- 569,575 ----
  #endif
      
      /*  Acquire a stream pointer for the temporary maildrop */
!     if ( (p->drop = (FILE *)fdopen(dfd,"r+")) == NULL ) {
          (void)close(dfd) ;
          return pop_msg(p,POP_FAILURE,"Cannot assign stream for %s",
              p->temp_drop);
***************
*** 584,592 ****
      offset = lseek((int)fileno(p->drop),0,L_XTND);
  
  #ifdef MAILOCK
      /*  Lock the maildrop */
!     if (maillock(p->user,1) != 0)
!             return pop_msg(p,POP_FAILURE, "maillock: '%s'", p->temp_drop);
  #endif
  
      /*  Open the user's maildrop, If this fails,  no harm in assuming empty */
--- 584,596 ----
      offset = lseek((int)fileno(p->drop),0,L_XTND);
  
  #ifdef MAILOCK
+   {
+   int err;
      /*  Lock the maildrop */
!     syslog(LOG_INFO, "user=%s\n", p->user);
!     if ((err = maillock(p->user,1)) != 0)
!             return pop_msg(p,POP_FAILURE, "(pop_dropcopy)maillock: '%s'(%d)", p->temp_drop, err);
!   }
  #endif
  
      /*  Open the user's maildrop, If this fails,  no harm in assuming empty */
diff -c qpopper-2.1.4/pop_get_subcommand.c qpopper-2.1.4.news/pop_get_subcommand.c
*** qpopper-2.1.4/pop_get_subcommand.c	Fri Apr 28 19:21:34 1995
--- qpopper-2.1.4.news/pop_get_subcommand.c	Thu Jun 29 15:33:39 1995
***************
*** 7,13 ****
  #ifndef lint
  static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
  static char SccsId[] = "@(#)@(#)pop_get_subcommand.c	2.1  2.1 3/18/91";
! #endif not lint
  
  #include <stdio.h>
  #include <sys/types.h>
--- 7,13 ----
  #ifndef lint
  static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
  static char SccsId[] = "@(#)@(#)pop_get_subcommand.c	2.1  2.1 3/18/91";
! #endif /* not lint */
  
  #include <stdio.h>
  #include <sys/types.h>
diff -c qpopper-2.1.4/pop_init.c qpopper-2.1.4.news/pop_init.c
*** qpopper-2.1.4/pop_init.c	Fri Apr 28 19:21:34 1995
--- qpopper-2.1.4.news/pop_init.c	Thu Jul 13 13:20:52 1995
***************
*** 7,17 ****
  #ifndef lint
  static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
  static char SccsId[] = "@(#)@(#)pop_init.c	2.1  2.1 3/18/91";
! #endif not lint
  
  #include <errno.h>
  #include <stdio.h>
  #include <sys/types.h>
  #include <netinet/in.h>
  #include <netdb.h>
  #include <arpa/inet.h>
--- 7,18 ----
  #ifndef lint
  static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
  static char SccsId[] = "@(#)@(#)pop_init.c	2.1  2.1 3/18/91";
! #endif /* not lint */
  
  #include <errno.h>
  #include <stdio.h>
  #include <sys/types.h>
+ #include <sys/socket.h>
  #include <netinet/in.h>
  #include <netdb.h>
  #include <arpa/inet.h>
***************
*** 108,114 ****
  int             argcount;
  char    **      argmessage;
  {
- 
      struct sockaddr_in      cs;                 /*  Communication parameters */
      struct hostent      *   ch;                 /*  Client host information */
      int                     errflag = 0;
--- 109,114 ----
***************
*** 226,232 ****
  #       include <resolv.h>
  
          /*  Distrust distant nameservers */
! #if !(defined(BSD) && (BSD >= 199103)) && !defined(OSF1)
          extern struct state     _res;
  #endif
          struct hostent      *   ch_again;
--- 226,232 ----
  #       include <resolv.h>
  
          /*  Distrust distant nameservers */
! #if !(defined(BSD) && (BSD >= 199103)) && !defined(OSF1) && !defined(NEWS)
          extern struct state     _res;
  #endif
          struct hostent      *   ch_again;
***************
*** 276,282 ****
      }
  
      /*  Create input file stream for TCP/IP communication */
!     if ((p->input = fdopen(sp,"r")) == NULL){
          pop_log(p,POP_PRIORITY,
              "Unable to open communication stream for input, err = %d",errno);
          exit (-1);
--- 276,282 ----
      }
  
      /*  Create input file stream for TCP/IP communication */
!     if ((p->input = (FILE *)fdopen(sp,"r")) == NULL){
          pop_log(p,POP_PRIORITY,
              "Unable to open communication stream for input, err = %d",errno);
          exit (-1);
***************
*** 283,289 ****
      }
  
      /*  Create output file stream for TCP/IP communication */
!     if ((p->output = fdopen(sp,"w")) == NULL){
          pop_log(p,POP_PRIORITY,
              "Unable to open communication stream for output, err = %d",errno);
          exit (-1);
--- 283,289 ----
      }
  
      /*  Create output file stream for TCP/IP communication */
!     if ((p->output = (FILE *)fdopen(sp,"w")) == NULL){
          pop_log(p,POP_PRIORITY,
              "Unable to open communication stream for output, err = %d",errno);
          exit (-1);
diff -c qpopper-2.1.4/pop_pass.c qpopper-2.1.4.news/pop_pass.c
*** qpopper-2.1.4/pop_pass.c	Fri Apr 28 19:21:35 1995
--- qpopper-2.1.4.news/pop_pass.c	Mon Jul 24 18:07:46 1995
***************
*** 190,195 ****
--- 190,247 ----
  
  #endif	/* SOLARIS2 */
  
+ #ifdef NEWS
+ 
+ #include <shadow.h>
+ 
+ static int
+ auth_user(p, pw)
+ POP     *   p;
+ struct passwd *pw;
+ {
+     struct passwd *pwp;
+     register struct spwd * pwd;
+     long today;
+ 
+     /*  Look for the user in the password file */
+     if ((pwp = getpwnam(p->user)) == NULL)
+         return (pop_msg(p,POP_FAILURE, pwerrmsg, p->user));
+ 
+     *pw = *pwp;
+ 
+     /*  Look for the user in the shadow password file */
+     if ((pwd = getspnam(p->user)) == NULL) {
+         if (!strcmp(pw->pw_passwd, "x"))	/* This my be a YP entry */
+ 	    return (pop_msg(p,POP_FAILURE, pwerrmsg, p->user));
+     } else {
+ 	today = (long)time((time_t *)NULL)/(24L*60L*60L);
+ 
+ 	/* Check for expiration date */
+ 	if (pwd->sp_expire > 0 && today > pwd->sp_expire)
+ 	    return (pop_msg(p,POP_FAILURE,"\"%s\": account expired.",p->user));
+ 
+ 	/* Check if password is valid */
+ 	if (pwd->sp_max > 0 && today > pwd->sp_lstchg+pwd->sp_max)
+ 	    return (pop_msg(p,POP_FAILURE,"\"%s\": account expired.",p->user));
+ 
+ 	pw->pw_passwd = strdup(pwd->sp_pwdp);
+ 	endspent();
+     }
+ 
+     /*  We don't accept connections from users with null passwords */
+     if ((pw->pw_passwd == NULL) || (*pw->pw_passwd == '\0') ||
+ 					    (strlen(pw->pw_passwd) != 13))
+ 	return (pop_msg(p,POP_FAILURE, pwerrmsg, p->user));
+ 
+     /*  Compare the supplied password with the password file entry */
+     if (strcmp (crypt (p->pop_parm[1], pw->pw_passwd), pw->pw_passwd) != 0)
+ 	return (pop_msg(p,POP_FAILURE, pwerrmsg, p->user));
+ 
+     return(POP_SUCCESS);
+ }
+ 
+ #endif	/* NEWS */
+ 
  #ifdef POPSCO
  
  # include <sys/security.h>
------------------------------------------------------/¤³¤³¤Þ¤Ç/--------
