[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mailbox.c, crossbar.cf -- take 2..



Well, all kinds of surprises do creep around..
Vacation didn't work at all after beginning to rewrite headers in
FQDN (and also the From_ -line!)

Here is how it too works, and all with a bit less frills.

Now if somebody can come up with neat ways of controlling header
rewrite on per-expansion-list basis (mailing lists in my mind..)
and uname->fullname mapping...
Especially I am interested on having following kind of operation
running entirely inside the router:
	----- /etc/aliases -----------
	listname: "|/lib/sendmail -flistname-owner listname-senders"
	listname-owner: person(s)
	listname-sender: ":include:..."
	------------------------------
I am doing it via   $MAILSHARE/lists/listname -mechanism, however the
error handling it not very gracefull..  Especially I want that sendmailish
"-f" option working, and being associated with those target addresses
that expand from "listname-sender".  If target-addresses contain one or
more of local similar expansion aliases, similar thing shold happen to
those as well!  Err.. That is, error address of a list should be associated
on DELIVERY (as well as expansion!) -time to those addresses that came
from a list.

	/Matti Aarnio <mea@utu.fi>

----- mailbox.c.diff --------
*** mailbox.c~	Sun Dec 20 02:16:03 1992
--- mailbox.c	Thu Jun  3 11:48:51 1993
***************
*** 190,195 ****
--- 190,196 ----
  extern int errno;
  extern void warning();
  extern char *emalloc();
+ extern FILE *fdopen();
  
  #ifndef	MAXPATHLEN
  #define	MAXPATHLEN 1024
***************
*** 331,337 ****
  process(dp)
  	struct ctldesc *dp;
  {
! 	char *cp, *ts;
  	struct rcpt *rp;
  	time_t curtime;
  	extern time_t time();
--- 332,338 ----
  process(dp)
  	struct ctldesc *dp;
  {
! 	char *cp, *ts, *at;
  	struct rcpt *rp;
  	time_t curtime;
  	extern time_t time();
***************
*** 344,349 ****
--- 345,351 ----
  	for (rp = dp->recipients; rp != NULL; rp = rp->next) {
  		while (*(rp->addr->user) == TO_USER)
  			rp->addr->user++;
+ 		if ((at = strrchr(rp->addr->user,'@')) != NULL) *at = 0;
  		if (*(rp->addr->user) == QUOTE) {
  			cp = rp->addr->user + strlen(rp->addr->user) - 1;
  			if (*cp == QUOTE) {
***************
*** 351,356 ****
--- 353,359 ----
  				rp->addr->user++;
  			}
  		}
+ 		if (at) *at = '@'; /* If it followed quotes, a null prefixes it.. */
  #ifdef	RBIFF
  		/*
  		 * "contents" will be freed before rbiff done:
***************
*** 397,403 ****
  	int fdmail, uid, messagefd;
  	FILE *fp;
  	struct stat st;
! 	char *file, *cp;
  #if	defined(BIFF) || defined(RBIFF)
  	struct biffer *nbp;
  #ifdef	RBIFF
--- 400,406 ----
  	int fdmail, uid, messagefd;
  	FILE *fp;
  	struct stat st;
! 	char *file, *cp, *at;
  #if	defined(BIFF) || defined(RBIFF)
  	struct biffer *nbp;
  #ifdef	RBIFF
***************
*** 416,421 ****
--- 419,425 ----
  	file = NULL;
  	nbp = NULL;
  	uid = atoi(rp->addr->misc);
+ 	at = strchr(rp->addr->user,'@');
  	switch (*(rp->addr->user)) {
  	case TO_PIPE:	/* pipe to program */
  		/* one should disallow this if uid == nobody? */
***************
*** 449,454 ****
--- 453,461 ----
  		}
  		break;
  	default:	/* local user */
+ 		/* Zap the possible '@' for a moment -- and restore later
+ 		   [mea@utu.fi] */
+ 		if (at) *at = 0;
  		if ((pw = getpwnam(rp->addr->user)) == NULL) {
  			if (isascii(*(rp->addr->user))
  				   && isupper(*(rp->addr->user))) {
***************
*** 498,503 ****
--- 505,511 ----
  			eobiffs = nbp;
  		}
  #endif	/* BIFF || RBIFF */
+ 		if (at) *at = '@';
  		break;
  	}
  	if (exstat(rp, file, &st, lstat) < 0) {
***************
*** 720,725 ****
--- 728,734 ----
  
  	i = 0;
  	env[i++] = "SHELL=/bin/sh";
+ 	env[i++] = "IFS= \t\n";
  	cp = buf;
  	if ((s = getzenv("PATH")) == NULL)
  		env[i++] = "PATH=/usr/ucb:/usr/bin:/bin";
-----------------------------

----- crossbar.cf.diff ------
*** ../../proto/cf/crossbar.cf	Mon Sep 28 20:15:53 1992
--- /p/lib/mail/cf/crossbar.cf	Thu Jun  3 11:50:18 1993
***************
*** 46,55 ****
  	# Determine which rewrite function (for message header addresses) to use
  
  	case $(channel $to) in
! 	smtp)	rewrite=internet ;;
  	error)	rewrite=null ;;
  	local)	case "$(channel $from)" in
! 		local)	rewrite=intramachine ;;
  		*)	# addresses should be saved the way they arrive
  			rewrite=null ;;
  		esac
--- 46,61 ----
  	# Determine which rewrite function (for message header addresses) to use
  
  	case $(channel $to) in
! 	smtp)	case "$(channel $from)" in
! 		smtp)	# addresses should be forwarded the way they arrive
! 			rewrite=null ;;
! 		*)	rewrite=internet ;;
! 		esac
! 		;;
  	error)	rewrite=null ;;
  	local)	case "$(channel $from)" in
! 		local)	#rewrite=intramachine ;;
! 			rewrite=internet ;;
  		*)	# addresses should be saved the way they arrive
  			rewrite=null ;;
  		esac
***************
*** 93,99 ****
  	# Rewrite the envelope addresses appropriately
  
  	case "$(channel $to)" in
! 	uucp|local)
  		# Local destination on a system that delivers in UCB Mail
  		# compatible mail spool files means that the From_ line
  		# must be in all-! form, which is the same as the UUCP
--- 99,105 ----
  	# Rewrite the envelope addresses appropriately
  
  	case "$(channel $to)" in
! 	uucp)
  		# Local destination on a system that delivers in UCB Mail
  		# compatible mail spool files means that the From_ line
  		# must be in all-! form, which is the same as the UUCP
***************
*** 111,123 ****
  		(.)\.uucp!(.*)	setf "$(user $to)" \1!\2 ;;
  		tfis
  		;;
! 	smtp)
  		tmp="$(smtproute "$(user $from)")"
  		sift "$tmp" in
  		(@$hostname[:,].*)|([^@:,]+@$hostname)
  			break ;;
  		.*
! 			tmp="@$hostname:$tmp" ;;
  		@(.+):(.+:.+)
  			tmp="@\1,\2" ; continue ;;
  		tfis
--- 117,130 ----
  		(.)\.uucp!(.*)	setf "$(user $to)" \1!\2 ;;
  		tfis
  		;;
! 	smtp|local)
  		tmp="$(smtproute "$(user $from)")"
  		sift "$tmp" in
  		(@$hostname[:,].*)|([^@:,]+@$hostname)
  			break ;;
  		.*
! 			# tmp="@$hostname:$tmp"  # DON'T !
! 			;;
  		@(.+):(.+:.+)
  			tmp="@\1,\2" ; continue ;;
  		tfis
***************
*** 167,173 ****
  
  	log recipient: "$(channel $to)" "$(host $to)" "$(user $to)"
  
! 	return ($rewrite $from $to)
  
  }	# end of crossbar
  
--- 174,180 ----
  
  	log recipient: "$(channel $to)" "$(host $to)" "$(user $to)"
  
! 	return ($rewrite "$from" "$to")
  
  }	# end of crossbar
  
-----------------------------