marvit@HPLPM.HPL.HP.COM (Peter Marvit) (10/26/90)
Several folks have recently complained that slocal seems to concatenate
messgaes which are redsitributed into the normal maildrop. I sent a
series of patches out last June which fixes the problem. Below is the
text of my original message. I'm still unhappy about the klugey nature,
but (heck) it works...
-Peter
------------------------------ CUT HERE -------------------------------
Subject: Re: slocal breaks dist -- suggestions?
Date: Mon, 11 Jun 90 16:19:39 PDT
From: Peter Marvit <marvit@hplpm.hpl.hp.com>
OK. I looked into the slocal problem in MH6.7. It seems that slocal did
the *WRONG* thing when plopping messages back into a UNIX maildrop. I'm
not crazy about hte following diffs, but they should be innouos enough.
Specifically, for slocal,
BUG: slocal recreated a maildrop with incorrect permissisions.
FIX: in the Makefile, setgid mail slocal. In the code, create a
maildrop with MAILGRP, if necessary. This is #ifdef SYS5.
BUG: slocal botches the "\n\nFrom " uucp-style message delimeter
if it "delivers" a message to the standard maildrop or other
maildrop-like file.
FIX: Append a "\n" to any uucp-style message. Possibly
unecessary, but the worst will be an extra newline at the end of
a message.
Cheers,
Peter "Happy again" Marvit
: Peter Marvit Hewlett-Packard Labs in Palo Alto, CA (415) 857-6646 :
: Internet: <marvit@hplabs.hpl.hp.com> uucp: {any backbone}!hplabs!marvit :
Context diffs follow. Be sure to cut the last line ("Cut here").
------------------------------ CUT HERE -------------------------------
*** uip/slocal.c.ORIG Fri Jun 1 16:55:09 1990
--- uip/slocal.c Mon Jun 11 16:15:40 1990
***************
*** 1,6
/* slocal.c - MH style mailer to write to a local user's mailbox */
#ifndef lint
! static char ident[] = "@(#)$Id: slocal.c,v 1.8 90/04/05 14:58:46 sources Exp $";
#endif lint
/* This program implements mail delivery in the MH/MMDF style.
--- 1,6 -----
/* slocal.c - MH style mailer to write to a local user's mailbox */
#ifndef lint
! static char ident[] = "@(#)$Id: slocal.c,v 1.8.1 90/06/11 12:00:00 sources Exp $";
#endif lint
/* This program implements mail delivery in the MH/MMDF style.
***************
*** 19,24
This program should be used ONLY if you have "mts sendmail" or "mts mh"
or "mts mmdf1" set in your MH configuration.
*/
/* */
--- 19,27 -----
This program should be used ONLY if you have "mts sendmail" or "mts mh"
or "mts mmdf1" set in your MH configuration.
+
+ Added hack to preserve UNIX (uucp) delimiters when adding mail to
+ a mail drop. (marvit@hplabs.hpl.hp.com, 11 June, '90)
*/
/* */
***************
*** 40,45
#define NVEC 100
/* */
--- 43,51 -----
#define NVEC 100
+ #ifdef SYS5
+ #define MAILGRP 6
+ #endif SYS5
/* */
***************
*** 822,828
*from;
{
int md,
! mapping;
register char *bp;
char buffer[BUFSIZ];
--- 828,836 -----
*from;
{
int md,
! mapping,
! local_gid,
! file_mode;
register char *bp;
char buffer[BUFSIZ];
***************
*** 843,849
if (verbose)
(void) fflush (stdout);
! if ((md = mbx_open (mailbox, pw -> pw_uid, pw -> pw_gid, m_gmprot ()))
== NOTOK) {
adorn ("", "unable to open:");
return NOTOK;
--- 851,885 -----
if (verbose)
(void) fflush (stdout);
! /*
! * If, for some reason, we actually have to recreate the mail drop, we have
! * to make sure all the permissions and ownerships are correct. If we're
! * not writing to a standard maildrop *and* there exists a .mh_profile for
! * the recipient, use the "msg-protect" info to create the file drop.
! * Otherwise, use the compiled default message protections.
! */
!
! if (strcmp(mailbox, mbox) == 0){
! #ifdef SYS5
! local_gid = MAILGRP; /* Must be gid = mail */
! file_mode = 0660; /* Not strictly necessary, but very nice */
! #else
! local_gid = pw -> pw_gid; /* If not SYS5, then it doesn't matter */
! file_mode = 0600; /* Enforce this, since UA's run setuid root */
! #endif
! }
! else{
! local_gid = pw -> pw_gid;
! if (stat (concat (home, "/" , mh_profile, NULLCP),buffer) == 0){
! mypath = home;
! file_mode = m_gmprot(); /* Use .mh_profile, if it exists */
! }
! else{
! file_mode = atooi(msgprot); /* Otherwise, use compiled default */
! }
! }
!
! if ((md = mbx_open (mailbox, pw -> pw_uid, local_gid, file_mode))
== NOTOK) {
adorn ("", "unable to open:");
return NOTOK;
***************
*** 1163,1168
return NOTOK;
}
}
(void) fclose (ffp);
if (ferror (qfp)) {
--- 1199,1215 -----
return NOTOK;
}
}
+ /*
+ * Make sure there is a trailing new line at the end of the message. This
+ * is kludge and should properly be done some other way. We know that it
+ * is *probably* a uucp message because we've found at leat one "From ".
+ * Why? Without the trailing newline, messages get smushed togther.
+ * UUCP delimiters is "\n\nFrom ", but slocal would otherwise create
+ * "\nFrom " -- a mess in a mailfrop.
+ */
+
+ if (first != 0)
+ fputs("\n", ffp);
(void) fclose (ffp);
if (ferror (qfp)) {
*** conf/makefiles/uip.ORIG Thu Apr 12 13:27:23 1990
--- conf/makefiles/uip Wed Jun 6 18:58:17 1990
***************
*** 993,998
-$(REMOVE) $@ zslocal
cp xslocal $@
-chmod $(PGMPROT) $@
-@ls -l $@
-@echo ""
--- 993,1002 -----
-$(REMOVE) $@ zslocal
cp xslocal $@
-chmod $(PGMPROT) $@
+ @BEGIN: MAILGROUP
+ -@chgrp @(MAILGROUP) $@
+ -@chmod g+s $@
+ @END: MAILGROUP
-@ls -l $@
-@echo ""
------------------------------ CUT HERE -------------------------------