[comp.mail.mh] Problem with POP mailer

arul@sdsu.UUCP (Arul Ananthanarayanan) (05/24/89)

I am experiencing a problem using the pop daemon that comes with
mh-6.6.

The pop server is accepting connections properly, but it does not differentiate
between mail messages properly. The entire contents of /usr/spool/mail
is treated as one message.

I tried changing the mmdelimit flags in mtstailor but to no avail.

Any hints?

Thanks,

Arul
-- 
"Mathematics and alcohol don't mix, please don't drink and derive"
------------------------------------------------------------------
   UUCP:    ....!ucsd!sdsu!arul              work:(619) 594-7207
   ARPA:    arul%sdsu.uucp@ucsd.edu          home:(619) 583-0439

jw@sics.se (Johan Widen) (05/25/89)

>I am experiencing a problem using the pop daemon that comes with
>mh-6.6.
>
>The pop server is accepting connections properly, but it does not differentiate
>between mail messages properly. The entire contents of /usr/spool/mail
>is treated as one message.

I have just encountered the same problem. It turned out that enabling pop
without enabling DPOP would not work. You can fix the problems by
commenting out some of the #ifdef DPOP lines (together with the corresponding
 #endif's), in support/pop/popser.c. I also discovered a null dereference
in support/pop/popwrd.c

I enclose a couple of diffs. Note that the my changes to popser.c are in
need of a cleanup, take the diff as a pointer to the trouble spots.

*** popwrd.c~	Fri Oct 30 00:02:01 1987
--- popwrd.c	Mon May 22 16:44:49 1989
***************
*** 163,169 ****
  	    for (; *ap; ap++)
  		fprintf (fp, "%s%s", ap != bb -> bb_aka ? "," : "", *ap);
  	fprintf (fp, ":%s:%s:", tail (bb -> bb_file), bb -> bb_passwd);
! 	if ((ap = bb -> bb_leader) != NULL
  		&& (strcmp (*ap, POPUID) != 0 || ap[1] != NULL))
  	    for (; *ap; ap++)
  		fprintf (fp, "%s%s", ap != bb -> bb_leader ? "," : "", *ap);
--- 163,169 ----
  	    for (; *ap; ap++)
  		fprintf (fp, "%s%s", ap != bb -> bb_aka ? "," : "", *ap);
  	fprintf (fp, ":%s:%s:", tail (bb -> bb_file), bb -> bb_passwd);
! 	if ((ap = bb -> bb_leader) != NULL && *ap
  		&& (strcmp (*ap, POPUID) != 0 || ap[1] != NULL))
  	    for (; *ap; ap++)
  		fprintf (fp, "%s%s", ap != bb -> bb_leader ? "," : "", *ap);
*** popser.c.orig	Fri Oct 30 00:01:59 1987
--- popser.c	Mon May 22 22:17:38 1989
***************
*** 80,89 ****
  
  /*  */
  
! #ifdef	DPOP
  static int pop_uid;
  static int pop_gid;
! #endif	DPOP
  
  static int  rproto;
  static char *hostname;
--- 80,89 ----
  
  /*  */
  
! /* #ifdef	DPOP */
  static int pop_uid;
  static int pop_gid;
! /* #endif	DPOP */
  
  static int  rproto;
  static char *hostname;
***************
*** 227,235 ****
  {
      char    buffer[BUFSIZ],
             *vec[NVEC + 1];
! #if	defined (DPOP) || defined (BPOP)
      register struct passwd *pw;
! #endif	defined (DPOP) || defined (BPOP)
      register struct vector *v;
  
      m_foil (NULLCP);
--- 227,235 ----
  {
      char    buffer[BUFSIZ],
             *vec[NVEC + 1];
! /* #if	defined (DPOP) || defined (BPOP) */
      register struct passwd *pw;
! /* #endif	defined (DPOP) || defined (BPOP) */
      register struct vector *v;
  
      m_foil (NULLCP);
***************
*** 246,252 ****
      }
      (void) signal (SIGPIPE, pipeser);
  
! #ifdef	DPOP
      if ((pw = getpwnam (POPUID)) == NULL || !setpwinfo (pw, POPDB, 1)) {
  	(void) respond (NOTOK, "%s loses on DB initialization -- %s",
  		    server, pw ? getbberr () : "POP user-id unknown");
--- 246,252 ----
      }
      (void) signal (SIGPIPE, pipeser);
  
! /* #ifdef	DPOP */
      if ((pw = getpwnam (POPUID)) == NULL || !setpwinfo (pw, POPDB, 1)) {
  	(void) respond (NOTOK, "%s loses on DB initialization -- %s",
  		    server, pw ? getbberr () : "POP user-id unknown");
***************
*** 254,260 ****
      }
      pop_uid = pw -> pw_uid;
      pop_gid = pw -> pw_gid;
! #endif	DPOP
  #ifdef	BPOP
      if ((pw = getpwnam (popbbuser)) && pw -> pw_uid) {
  	guest_uid = pw -> pw_uid;
--- 254,260 ----
      }
      pop_uid = pw -> pw_uid;
      pop_gid = pw -> pw_gid;
! /* #endif	DPOP */
  #ifdef	BPOP
      if ((pw = getpwnam (popbbuser)) && pw -> pw_uid) {
  	guest_uid = pw -> pw_uid;
***************
*** 408,424 ****
  static int rpop (vec)
  register char  **vec;
  {
! #ifndef	DPOP
      register struct passwd *pw;
! #else	DPOP
      register int hostok = 0;
      register char  *bp,
  		   *cp;
      char    buffer[BUFSIZ];
      register struct bboard *pw;
! #endif	DPOP
  
! #ifndef	DPOP
      if (!rproto || (pw = getpwnam (username)) == NULL) {
  #ifdef	TRUSTED
  	trusted (0, hostname, vec[1], 0, username, 0, "rpop", "tcp",
--- 408,424 ----
  static int rpop (vec)
  register char  **vec;
  {
! /* #ifndef	DPOP
      register struct passwd *pw;
! #else	DPOP */
      register int hostok = 0;
      register char  *bp,
  		   *cp;
      char    buffer[BUFSIZ];
      register struct bboard *pw;
! /* #endif	DPOP */
  
! /* #ifndef	DPOP
      if (!rproto || (pw = getpwnam (username)) == NULL) {
  #ifdef	TRUSTED
  	trusted (0, hostname, vec[1], 0, username, 0, "rpop", "tcp",
***************
*** 435,441 ****
  #endif	TRUSTED
  	return respond (NOTOK, "permission denied");
      }
! #else	DPOP
      if (!rproto
  	    || ((pw = getbbnam (username)) == NULL
  		&& (pw = getbbaka (username)) == NULL)) {
--- 435,441 ----
  #endif	TRUSTED
  	return respond (NOTOK, "permission denied");
      }
! #else	DPOP */
      if (!rproto
  	    || ((pw = getbbnam (username)) == NULL
  		&& (pw = getbbaka (username)) == NULL)) {
***************
*** 467,481 ****
  #endif	TRUSTED
  	return respond (NOTOK, "permission denied");
      }
! #endif	DPOP
  
  #ifdef	TRUSTED
      if (trusted (1, hostname, vec[1], 0, username,
! #ifndef	DPOP
  		pw -> pw_uid == 0,
! #else	DPOP
  		0,
! #endif	DPOP
  		"rpop", "tcp", NULL)
  	    == 0)
  	return respond (NOTOK, "permission denied");
--- 467,481 ----
  #endif	TRUSTED
  	return respond (NOTOK, "permission denied");
      }
! /* #endif	DPOP */
  
  #ifdef	TRUSTED
      if (trusted (1, hostname, vec[1], 0, username,
! /* #ifndef	DPOP
  		pw -> pw_uid == 0,
! #else	DPOP */
  		0,
! /* #endif	DPOP */
  		"rpop", "tcp", NULL)
  	    == 0)
  	return respond (NOTOK, "permission denied");
***************
*** 502,516 ****
      }
      else {
  #endif	BPOP
! #ifndef	DPOP
  	(void) setgid (pw -> pw_gid);
  	(void) initgroups (pw -> pw_name, pw -> pw_gid);
  	(void) setuid (pw -> pw_uid);
! #else	DPOP
  	(void) setgid (pop_gid);
  	(void) initgroups (POPUID, pop_gid);
  	(void) setuid (pop_uid);
! #endif	DPOP
  #ifdef	BPOP
      }
  #endif	BPOP
--- 502,516 ----
      }
      else {
  #endif	BPOP
! /* #ifndef	DPOP
  	(void) setgid (pw -> pw_gid);
  	(void) initgroups (pw -> pw_name, pw -> pw_gid);
  	(void) setuid (pw -> pw_uid);
! #else	DPOP */
  	(void) setgid (pop_gid);
  	(void) initgroups (POPUID, pop_gid);
  	(void) setuid (pop_uid);
! /* #endif	DPOP */
  #ifdef	BPOP
      }
  #endif	BPOP
--
Johan Widen
SICS, PO Box 1263, S-164 28 KISTA, SWEDEN	Internet: jw@sics.se
Tel: +46 8 752 15 32	Ttx: 812 61 54 SICS S	Fax: +46 8 751 72 30

jw@sics.se (Johan Widen) (05/25/89)

>The pop server is accepting connections properly, but it does not differentiate
>between mail messages properly. The entire contents of /usr/spool/mail
>is treated as one message.

Sorry, I did not address your specific problem in the previous article.

pop really requires that the mailer that puts stuff into the 'maildrop'
is /usr/new/lib/mh/spop

When spop delivers a message to user foo, it will also create/update
an index file for the maildrop. popd will use the index file to find
the message boundaries in the maildrop.
--
Johan Widen
SICS, PO Box 1263, S-164 28 KISTA, SWEDEN	Internet: jw@sics.se
Tel: +46 8 752 15 32	Ttx: 812 61 54 SICS S	Fax: +46 8 751 72 30