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

mailbox and From_ user@domain



My "local destination" does not care about UCB !-style vs. FQDN @-style
addresses.  Both work!  (And I prefer @-style..)

Therefore I finally made necessary modifications, and below is the result.
Now to think (and tinkster) on how to force local addresses to always
present FQDN format...

	/Matti Aarnio  <mea@utu.fi>

------------- mailbox.c.diff --------------
*** mailbox.c~	Sun Dec 20 02:16:03 1992
--- mailbox.c	Thu Jun  3 09:00:26 1993
***************
*** 190,195 ****
--- 190,196 ----
  extern int errno;
  extern void warning();
  extern char *emalloc();
+ extern FILE *fdopen();
  
  #ifndef	MAXPATHLEN
  #define	MAXPATHLEN 1024
***************
*** 397,403 ****
  	int fdmail, uid, messagefd;
  	FILE *fp;
  	struct stat st;
! 	char *file, *cp;
  #if	defined(BIFF) || defined(RBIFF)
  	struct biffer *nbp;
  #ifdef	RBIFF
--- 398,404 ----
  	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 ****
--- 417,423 ----
  	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 ****
--- 451,459 ----
  		}
  		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))) {
***************
*** 459,464 ****
--- 464,470 ----
  			if ((pw = getpwnam(rp->addr->user)) == NULL) {
  				DIAGNOSTIC(rp, EX_NOUSER,
  				   "user \"%s\" doesn't exist", rp->addr->user);
+ 				if (at) *at = '@';
  				return;
  			}
  		}
***************
*** 468,476 ****
--- 474,484 ----
  			if (rp->status != EX_OK)
  				return;
  		}
+ 		if (at) *at = '@';
  		if (*maild == 0)		/* didn't find it? */
  			if (!creatembox(rp, &file, &st.st_uid, &st.st_gid, pw))
  				return;		/* creatembox sets status */
+ 		if (at) *at = 0;
  #if	defined(BIFF) || defined(RBIFF)
  		if (!dobiff && !dorbiff)
  			break;
***************
*** 498,503 ****
--- 506,512 ----
  			eobiffs = nbp;
  		}
  #endif	/* BIFF || RBIFF */
+ 		if (at) *at = '@';
  		break;
  	}
  	if (exstat(rp, file, &st, lstat) < 0) {
***************
*** 523,529 ****
  		return;			/* setupuidgid sets status */
  
  	if ((fdmail = open(file, O_RDWR|O_APPEND)) < 0) {
! 		char fmtbuf[512];
  
  		(void) sprintf(fmtbuf, "open(\"%%s\") failed: %s",
  				       strerror(errno));
--- 532,538 ----
  		return;			/* setupuidgid sets status */
  
  	if ((fdmail = open(file, O_RDWR|O_APPEND)) < 0) {
!  		char fmtbuf[512];
  
  		(void) sprintf(fmtbuf, "open(\"%%s\") failed: %s",
  				       strerror(errno));
***************
*** 720,725 ****
--- 729,735 ----
  
  	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 ------------
*** /p/lib/mail/cf/crossbar.cf~	Thu Feb 25 11:27:32 1993
--- /p/lib/mail/cf/crossbar.cf	Thu Jun  3 09:05:27 1993
***************
*** 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
--- 93,99 ----
  	# 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
--- 111,124 ----
  		(.)\.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
-------------------------------------------