Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site topaz.ARPA Path: utzoo!watmath!clyde!cbosgd!cbdkc1!desoto!packard!topaz!hedrick From: hedrick@topaz.ARPA (Chuck Hedrick) Newsgroups: net.mail Subject: Re: colons in mail addresses (domains and UCB Mail) Message-ID: <1801@topaz.ARPA> Date: Sat, 27-Apr-85 19:31:15 EDT Article-I.D.: topaz.1801 Posted: Sat Apr 27 19:31:15 1985 Date-Received: Sun, 28-Apr-85 08:18:56 EDT References: <684@plus5.UUCP> <1698@decwrl.UUCP> <485@decuac.UUCP> <498@decuac.UUCP> Reply-To: hedrick@topaz.UUCP (Hedrick) Organization: Rutgers Univ., New Brunswick, N.J. Lines: 91 I believe you have fallen into a hack intended to support some obscure syntax used only at UCB. We discovered this when trying to fix Mail so that replies didn't include my own name. Let me clarify. I get a message from: foo!bar to: hedrick@topaz.arpa I issue the "r" command, and get something like to: foo!bar, foo!hedrick@topaz.arpa There is code that tries to eliminate your own name in this case. However it looks only for "hedrick", not "hedrick@topaz". Further exploration shows that before doing this comparison a route-optimization routine is called. This is intended to turn foo!bar!baz!foo!user into foo!user. It is also supposed to turn hedrick@topaz into just plain hedrick. Unfortunately, it does not recognize topaz.arpa, just topaz. It turns out that this is because our system name is set to topaz. (If we set it to topaz.arpa, UUCP and other software do odd things.) I did the obvious, which is to modify the routine that sets up the internal host name to append .arpa *if there is no domain already*. (Shortly we are going to be topaz.rutgers.edu, so we don't want .arpa stuck on forever.) At that point, I was shocked to see a reply go to something like arpa:hedrick@topaz. I looked a bit more into that route optimization code, and concluded that I would never understand it in finite time. I replaced it with a simple version that understands only normal RFC822 syntax, and everything works. The only change is in the module optim.c. < is the new version, > the old. The majority of this code is in the routine arpafix, or something like that, which is responsible for path optimization of addresses involving Internet. The idea is that anything@local-host should be treated simply as anything. It is then passed back through the optimizer again. This is so that foo!bar!baz!foo!user@local-host will turn into foo!user. We replace lots of complex tests with the simple test for whether the host after the last @ or % is the local host. And when we recycle through the optimizer, we use a local address of daemon, instead of host:LOCAL:daemon, or whatever monstrosity was there before. (This latter is what was causing the stray colon.) It is possible that our code does not handle some odd case that the original code does handle, but it seems to do the right thing in the cases that I understand. I believe that there are more horrors in optim.c just waiting to pounce on you. But I am reluctant to do anything to it until I see an actual problem. **** the following is a global declaration. It can go anywhere before **** the module arpafix 22,23d21 < char localhost[64]; < **** here is the main body of the change, in arpafix. 191c189,192 < if (!icequal(cp,localhost)) --- > arpamach = netlook(cp, '@'); > if (arpamach == 0) { > if (debug) > fprintf(stderr, "machine %s unknown, uses: %s\n", cp, name); 192a194,200 > } > if (((nettype(arpamach) & nettype(LOCAL)) & ~AN) == 0) { > if (debug) > fprintf(stderr, "machine %s known but remote, uses: %s\n", > cp, name); > return(name); > } 198c206,214 < strcpy(fakepath, "daemon"); --- > fake[0] = arpamach; > fake[1] = ':'; > fake[2] = LOCAL; > fake[3] = ':'; > fake[4] = 0; > prefer(fake); > strcpy(fakepath, netname(fake[0])); > stradd(fakepath, fake[1]); > strcat(fakepath, "daemon"); **** the following is once-only code that sets up the internal host name. 695d710 < 698a714 > static char host[64]; 700,702c716 < gethostname(localhost, sizeof localhost); < if (!any('.',localhost)) < strcat(localhost,".arpa"); --- > gethostname(host, sizeof host); 710c724 < np->nt_machine = localhost; --- > np->nt_machine = host;