[comp.mail.elm] configurable delimiters needed in aliases file for x.400 addresses

ianh@bhpmrl.oz.au (Ian Hoyle) (07/11/90)

It would be nice to have user configurable delimiters used for aliases. This
is because embedded ='s in x.400 addresses break the alias expansion
producing incorrect addresses. eg

bhp = bhp keylink = /C=AU/ADMD=TELEMEMO/O=BHP/G=BHP/S=MELBOURNE/@murtoa

will produce a To: field of

To: MELBOURNE/@murtoa (bhp keylink = /C=AU/ADMD=TELEMEMO/O=BHP/G=BHP/S)

which is clearly wrong. Instead of being forced to use ='s why not let the
delimiter be set as an option, say a '#'.

			ian
--
                Ian Hoyle
     /\/\       Image Processing & Data Analysis Group
    / / /\      BHP Melbourne Research Laboratories
   / / /  \     245 Wellington Rd, Mulgrave, 3170
  / / / /\ \    AUSTRALIA
  \ \/ / / /
   \  / / /     Phone   :  +61-3-560-7066
    \/\/\/      FAX     :  +61-3-561-6709
                E-mail  :  ianh@bhpmrl.oz.au

peter@ficc.ferranti.com (Peter da Silva) (07/12/90)

In article <1585@merlin.bhpmrl.oz.au> ianh@bhpmrl.oz.au (Ian Hoyle) writes:
> bhp = bhp keylink = /C=AU/ADMD=TELEMEMO/O=BHP/G=BHP/S=MELBOURNE/@murtoa

THAT's what the famous X.400 addresses look like?

This unreadable gibberish is supposed to be a universal standard for
E-mail addressing? I think I prefer "frog!wasp::joe%bee.bitnet@toad.org".
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.
<peter@ficc.ferranti.com>

andrew@stl.stc.co.uk (Andrew Macpherson) (07/19/90)

In article <1585@merlin.bhpmrl.oz.au> ianh@bhpmrl.oz.au (Ian Hoyle) writes:
| It would be nice to have user configurable delimiters used for aliases. This
| is because embedded ='s in x.400 addresses break the alias expansion
| producing incorrect addresses. eg
| 
| bhp = bhp keylink = /C=AU/ADMD=TELEMEMO/O=BHP/G=BHP/S=MELBOURNE/@murtoa
| 
| will produce a To: field of
| 
| To: MELBOURNE/@murtoa (bhp keylink = /C=AU/ADMD=TELEMEMO/O=BHP/G=BHP/S)
| 
| which is clearly wrong. Instead of being forced to use ='s why not let the
| delimiter be set as an option, say a '#'.
| 

Actually all that is needed is to correctly skip the comment field.  It is
extremely dissapointing to have one's fixes ignored, but I have supplied Syd
with the fix to filter for this over half a year ago.

When one gets an acknowledgement, a promise that ones offering will be
looked at, and then nothing happens one simply says `to hell with it,
someone else will complain eventually'.

Anyway, here you go.  This is for elm2.2

*** /usr/net/src/elm2.2/utils/newalias.c	Sat Feb 24 11:47:50 1990
--- /usr/net/src/elm2.2/utils/newalias.oc	Sat Feb 24 11:47:50 1990
***************
*** 223,230 ****
  
  	char aliases[LONG_STRING], address[LONG_STRING];
  	char comment[LONG_STRING];
! 	char *ch;
! 	int  first, last, i = 0;
  
  	remove_all(' ', TAB, buffer);
  
--- 223,229 ----
  
  	char aliases[LONG_STRING], address[LONG_STRING];
  	char comment[LONG_STRING];
! 	int  first, last, i = 0, j = 0;
  
  	remove_all(' ', TAB, buffer);
  
***************
*** 232,252 ****
  	  aliases[i] = buffer[i];
  	aliases[i] = '\0';
  
! 	first = ++i;
  
- 	if ((ch = index(&buffer[first], '=')) != NULL)
- 	  last = (ch - buffer) + 1;
- 	else
- 	  last = first;
- 	
- 	strcpy(address, &buffer[last]);
- 
  	comment[0] = '\0';	/* default to nothing at all... */
  
! 	if (first < last) {
  	  extract_comment(comment, buffer, first, last); 
  	}
  
  	add_to_table(data, aliases, comment, address, table, size);
  }
  
--- 231,248 ----
  	  aliases[i] = buffer[i];
  	aliases[i] = '\0';
  
! 	for (i=strlen(buffer)-1; buffer[i] != '=' && i > 0; i--)
! 	  address[j++] = buffer[i];
! 	address[j] = '\0';
  
  	comment[0] = '\0';	/* default to nothing at all... */
  
! 	if ((first=strlen(aliases)+1) < (last=(strlen(buffer) - j))) {
  	  extract_comment(comment, buffer, first, last); 
  	}
  
+ 	reverse(address);
+ 
  	add_to_table(data, aliases, comment, address, table, size);
  }
  
***************
*** 357,403 ****
  	   Hacked (literally) to NOT remove ANY characters from within the
  	   equals fields.  This will only be used if the line contains TWO
  	   equalss (and comments with equalss in them are the kiss of death!)
- 	   Since we may need '=' in an RFC 987 address, now really look for
- 	   the first two equals, Guaranteed to blow up if there are equals
- 	   in the comment.
- 	   
- 	   Also track Quotes, to allow for horrors such as /ADMD="Gold 400"
- 	   (Genuine I'm afraid) even though this will almost cerrtainly
- 	   blow up elsewhere.  NB Quotes must ballance!
  	 */
  
  	char buffer[LONG_STRING];
! 	char *ch;
! 	register int i = 0, j = 0, first_equals = -1, second_equals = -1;
! 	register int quoted = 0;
  	
  	for (i = 0; string[i] != '\0' && i < LONG_STRING; i++) {
  	  if (string[i] != c1 && string[i] != c2)
  	    buffer[j++] = string[i];
  
- 	  if (string[i] == '"' && (i == 0 || string[i-1] != '\\'))
- 	    quoted = !quoted;
- 
- 	  if (i == second_equals && quoted) {
- 	    printf("Can't cope with = inside comment\n>>%s<<\n",
- 	      string);
- 	    quoted = 0;
- 	  }
- 
  	  if (first_equals == -1 && string[i] == '=') {
  	    first_equals = i;
! 	    if ((ch = index(&string[first_equals + 1], '=')) != NULL)
! 	      second_equals = (ch - string);
! 	    else
! 	      second_equals = first_equals;
  	  }
! 	  else if (quoted || (i > first_equals && i < second_equals))
  	   if (string[i] == c1 || string[i] == c2)
  	     buffer[j++] = string[i];
  	}
  	
- 	if (quoted)
- 	  printf("Warning: unbalanced quotes '\"'\n>>%s<<\n", string);
  	buffer[j] = '\0';
  	strcpy(string, buffer);
  }
--- 353,377 ----
  	   Hacked (literally) to NOT remove ANY characters from within the
  	   equals fields.  This will only be used if the line contains TWO
  	   equalss (and comments with equalss in them are the kiss of death!)
  	 */
  
  	char buffer[LONG_STRING];
! 	register int i = 0, j = 0, first_equals = -1, last_equals = -1;
  	
  	for (i = 0; string[i] != '\0' && i < LONG_STRING; i++) {
  	  if (string[i] != c1 && string[i] != c2)
  	    buffer[j++] = string[i];
  
  	  if (first_equals == -1 && string[i] == '=') {
  	    first_equals = i;
! 	    for (last_equals=strlen(string);string[last_equals] != '='; 
! 		last_equals--) ;
  	  }
! 	  else if (i > first_equals && i < last_equals)
  	   if (string[i] == c1 || string[i] == c2)
  	     buffer[j++] = string[i];
  	}
  	
  	buffer[j] = '\0';
  	strcpy(string, buffer);
  }
-- 
Andrew Macpherson         | Drug Trafficing in Malaya:
PSI%234237100122::andrew  |   Think of it as evolution in action!
Andrew.Macpherson@stl.stc.co.uk

chip@chinacat.Unicom.COM (Chip Rosenthal) (07/19/90)

In article <3221@stl.stc.co.uk>
    "Andrew Macpherson" <andrew@stl.stc.co.uk> writes:
>Actually all that is needed is to correctly skip the comment field.  It is
>extremely dissapointing to have one's fixes ignored, but I have supplied Syd
>with the fix to filter for this over half a year ago.

I doubt it was ignored.  Half a year ago, 2.3 was closed for beta testing.
A bunch of my changes are sitting in Syd's mailbox deferred for the 2.4
release.  Also, I wouldn't expect to see these exact changes in 2.4
either.  I believe a general quoting mechanism is going to be introduced
to insultate any of the special characters.
-- 
Chip Rosenthal                            |  You aren't some icon carved out
chip@chinacat.Unicom.COM                  |  of soap, sent down here to clean
Unicom Systems Development, 512-482-8260  |  up my reputation.  -John Hiatt