[comp.mail.elm] elm 2.2 PL20 sysalias unofficial patch

david@wubios.wustl.edu (David J. Camp) (08/29/89)

Forwarded note:

From david Tue Aug 29 00:19:12 1989
Subject: sysalias patch
To: elm@dsi.com (elm bug reports)
Date: Tue, 29 Aug 89 0:19:12 CDT
Cc: phil@wubios.WUstl.EDU (J. Philip Miller)
Favorite-Ice-Cream: Chocolate
X-Mailer: ELM [version 2.2 PL10]
Status: OR

Hello,  I would like to join the development group and submit the
following patch to prevent user aliases from being used when a system
alias is being expanded.  I added a new argument to expand_group() and
add_alias_address(), but I think I found all the places they are
referenced.  I made changes to answer.c just to keep things consistent,
although they should have no effect.  I only tested this briefly, and
did not test answer at all.

Please let me know if there is anything else you want me to do.
-David-

Bitnet:   david@wubios.wustl                ^      Mr. David J. Camp
Internet: david%wubios@wucs1.wustl.edu    < * >    Box 8067, Biostatistics
uucp:     uunet!wucs1!wubios!david          v      660 South Euclid
Washington University (314) 36-23635               Saint Louis, MO 63110

*** src/addr_util.c~	Mon Aug 21 06:34:10 1989
--- src/addr_util.c	Mon Aug 28 23:10:49 1989
***************
*** 327,333 ****
                      full_to[0] != '\0'? ", " : "", expand_system(word, 1));
  #endif
  	  }
! 	  else if ((ptr = get_alias_address(word, 1, 0)) != NULL) {
  	    sprintf(full_to, "%s%s%s", full_to, 
                      full_to[0] != '\0'? ", " : "", ptr);
  	    expanded_information++;
--- 327,333 ----
                      full_to[0] != '\0'? ", " : "", expand_system(word, 1));
  #endif
  	  }
! 	  else if ((ptr = get_alias_address(word, 1, 0, 0)) != NULL) {
  	    sprintf(full_to, "%s%s%s", full_to, 
                      full_to[0] != '\0'? ", " : "", ptr);
  	    expanded_information++;
*** src/alias.c~	Mon Aug 21 06:32:14 1989
--- src/alias.c	Mon Aug 28 23:11:14 1989
***************
*** 114,120 ****
  	optionally_enter(name, LINES-2, strlen(buffer), FALSE, FALSE);
  	if (strlen(name) == 0) 
  	  return(0);
! 	if ((address = get_alias_address(name, 0, 0)) != NULL) {
  	  dprint(3, (debugfile, 
  		 "Attempt to add a duplicate alias [%s] in add_alias\n",
  		 address)); 
--- 114,120 ----
  	optionally_enter(name, LINES-2, strlen(buffer), FALSE, FALSE);
  	if (strlen(name) == 0) 
  	  return(0);
! 	if ((address = get_alias_address(name, 0, 0, 0)) != NULL) {
  	  dprint(3, (debugfile, 
  		 "Attempt to add a duplicate alias [%s] in add_alias\n",
  		 address)); 
***************
*** 168,174 ****
  	optionally_enter(name, LINES-2, strlen(buffer), FALSE, FALSE);
  	if (strlen(name) == 0) 
  	  return(0);
!         if ((address = get_alias_address(name, 0, 0))!=NULL)
          {
                  if (address[0] == '!')
                  {
--- 168,174 ----
  	optionally_enter(name, LINES-2, strlen(buffer), FALSE, FALSE);
  	if (strlen(name) == 0) 
  	  return(0);
!         if ((address = get_alias_address(name, 0, 0, 0))!=NULL)
          {
                  if (address[0] == '!')
                  {
***************
*** 226,232 ****
  	optionally_enter(name, LINES-2, strlen(buffer), FALSE, FALSE);
  	if (strlen(name) == 0)	/* cancelled... */
  	  return(0);
! 	if ((address = get_alias_address(name, 0, 0)) != NULL) {
  	 dprint(3, (debugfile,
  	         "Attempt to add a duplicate alias [%s] in add_current_alias\n",
  		 address)); 
--- 226,232 ----
  	optionally_enter(name, LINES-2, strlen(buffer), FALSE, FALSE);
  	if (strlen(name) == 0)	/* cancelled... */
  	  return(0);
! 	if ((address = get_alias_address(name, 0, 0, 0)) != NULL) {
  	 dprint(3, (debugfile,
  	         "Attempt to add a duplicate alias [%s] in add_current_alias\n",
  		 address)); 
***************
*** 437,443 ****
  		      optionally_enter(name, LINES-2, strlen(buffer),
  			FALSE, FALSE);
  
! 		      if ((address = get_alias_address(name, 0, 0))!=NULL) {
  	                if (address[0] == '!') {
  	                  address[0] = ' ';
  	                  PutLine1(LINES-1,0,"Group alias:%-60.60s", address);
--- 437,443 ----
  		      optionally_enter(name, LINES-2, strlen(buffer),
  			FALSE, FALSE);
  
! 		      if ((address = get_alias_address(name, 0, 0, 0))!=NULL) {
  	                if (address[0] == '!') {
  	                  address[0] = ' ';
  	                  PutLine1(LINES-1,0,"Group alias:%-60.60s", address);
***************
*** 487,493 ****
  		      *name = '\0';
  		      optionally_enter(name, LINES-2, strlen(buffer),
  			FALSE, FALSE);
! 		      if ((address = get_alias_address(name, 1, 0)) != NULL) {
  	                ClearScreen();
  			PutLine1(3,0,"Aliased address:\n\r%s", address);
  	                PutLine0(LINES-1,0,"Press <return> to continue.");
--- 487,493 ----
  		      *name = '\0';
  		      optionally_enter(name, LINES-2, strlen(buffer),
  			FALSE, FALSE);
! 		      if ((address = get_alias_address(name, 1, 0, 0)) != NULL) {
  	                ClearScreen();
  			PutLine1(3,0,"Aliased address:\n\r%s", address);
  	                PutLine0(LINES-1,0,"Press <return> to continue.");
*** src/aliaslib.c~	Mon Aug 21 06:32:16 1989
--- src/aliaslib.c	Mon Aug 28 23:08:55 1989
***************
*** 30,38 ****
  char *get_token(), *strpbrk();
  long lseek();
  
! char *get_alias_address(name, mailing, depth)
  char *name;
  int   mailing, depth;
  {
  	/** return the line from either datafile that corresponds 
  	    to the specified name.  If 'mailing' specified, then
--- 30,39 ----
  char *get_token(), *strpbrk();
  long lseek();
  
! char *get_alias_address(name, mailing, depth, sysalias)
  char *name;
  int   mailing, depth;
+ int sysalias;
  {
  	/** return the line from either datafile that corresponds 
  	    to the specified name.  If 'mailing' specified, then
***************
*** 51,67 ****
  	  read_in_aliases = TRUE;
  	}
  
! 	if (user_files) 
  	  if ((loc = find(name, user_hash_table, MAX_UALIASES)) >= 0) {
  	    lseek(user_data, user_hash_table[loc].byte, 0L);
  	    get_line(user_data, buffer);
  	    if (buffer[0] == '!' && mailing)
! 	      return(expand_group(buffer, depth));
  	    else if (strpbrk(buffer,"!@:") != NULL)	/* has a hostname */
  #ifdef DONT_TOUCH_ADDRESSES
  	      return((char *) buffer);
  #else
! 	      return(expand_system(buffer, TRUE));
  #endif
  	    else
  	      return((char *) buffer);
--- 52,68 ----
  	  read_in_aliases = TRUE;
  	}
  
! 	if (user_files && ! sysalias)
  	  if ((loc = find(name, user_hash_table, MAX_UALIASES)) >= 0) {
  	    lseek(user_data, user_hash_table[loc].byte, 0L);
  	    get_line(user_data, buffer);
  	    if (buffer[0] == '!' && mailing)
! 	      return(expand_group(buffer, depth, sysalias));
  	    else if (strpbrk(buffer,"!@:") != NULL)	/* has a hostname */
  #ifdef DONT_TOUCH_ADDRESSES
  	      return((char *) buffer);
  #else
! 	      return(expand_system(buffer, TRUE, sysalias));
  #endif
  	    else
  	      return((char *) buffer);
***************
*** 72,78 ****
  	    lseek(system_data, system_hash_table[loc].byte, 0L);
  	    get_line(system_data, buffer);
  	    if (buffer[0] == '!' && mailing)
! 	      return(expand_group(buffer, depth));
  	    else if (strpbrk(buffer,"!@:") != NULL)	/* has a hostname */
  #ifdef DONT_TOUCH_ADDRESSES
  	      return((char *) buffer);
--- 73,79 ----
  	    lseek(system_data, system_hash_table[loc].byte, 0L);
  	    get_line(system_data, buffer);
  	    if (buffer[0] == '!' && mailing)
! 	      return(expand_group(buffer, depth, 1 ));
  	    else if (strpbrk(buffer,"!@:") != NULL)	/* has a hostname */
  #ifdef DONT_TOUCH_ADDRESSES
  	      return((char *) buffer);
***************
*** 103,111 ****
  	return( (char *) buffer);
  }
  	      
! char *expand_group(members, depth)
  char *members;
  int  depth;
  {
  	/** Given a group of names separated by commas, this routine
  	    will return a string that is the full addresses of each
--- 104,113 ----
  	return( (char *) buffer);
  }
  	      
! char *expand_group(members, depth, sysalias)
  char *members;
  int  depth;
+ int sysalias;
  {
  	/** Given a group of names separated by commas, this routine
  	    will return a string that is the full addresses of each
***************
*** 123,129 ****
  	depth++;				/* one deeper!       */
  
  	while ((word = get_token(bufptr, "!, ", depth)) != NULL) {
! 	  if ((address = get_alias_address(word, 1, depth)) == NULL) {
  	    if (! valid_name(word)) {
  	      dprint(3, (debugfile, "Encountered illegal address %s in %s\n",
  			word, "expand_group"));
--- 125,131 ----
  	depth++;				/* one deeper!       */
  
  	while ((word = get_token(bufptr, "!, ", depth)) != NULL) {
! 	  if ((address = get_alias_address(word, 1, depth, sysalias)) == NULL) {
  	    if (! valid_name(word)) {
  	      dprint(3, (debugfile, "Encountered illegal address %s in %s\n",
  			word, "expand_group"));
*** utils/answer.c~	Mon Aug 21 06:35:30 1989
--- utils/answer.c	Mon Aug 28 23:32:57 1989
***************
*** 87,93 ****
  	  if (translate(user_name, name) == 0)
  	    goto prompt;
  
! 	  address = get_alias_address(name, 1, 0);
  
  	  printf("address '%s'\n", address);
  
--- 87,93 ----
  	  if (translate(user_name, name) == 0)
  	    goto prompt;
  
! 	  address = get_alias_address(name, 1, 0, 0);
  
  	  printf("address '%s'\n", address);
  
***************
*** 182,190 ****
  	  return;
  }
  
! char *get_alias_address(name, mailing, depth)
  char *name;
  int   mailing, depth;
  {
  	/** return the line from either datafile that corresponds 
  	    to the specified name.  If 'mailing' specified, then
--- 182,191 ----
  	  return;
  }
  
! char *get_alias_address(name, mailing, depth, sysalias)
  char *name;
  int   mailing, depth;
+ int sysalias;
  {
  	/** return the line from either datafile that corresponds 
  	    to the specified name.  If 'mailing' specified, then
***************
*** 199,205 ****
  	  lseek(user_data, user_hash_table[loc].byte, 0L);
  	  get_line(user_data, buffer);
  	  if (buffer[0] == '!' && mailing)
! 	    return( (char *) expand_group(buffer, depth));
  	  else
  	    return( (char *) buffer);
  	}
--- 200,206 ----
  	  lseek(user_data, user_hash_table[loc].byte, 0L);
  	  get_line(user_data, buffer);
  	  if (buffer[0] == '!' && mailing)
! 	    return( (char *) expand_group(buffer, depth, sysalias));
  	  else
  	    return( (char *) buffer);
  	}
***************
*** 207,215 ****
  	return( (char *) NULL);
  }
  
! char *expand_group(members, depth)
  char *members;
  int   depth;
  {
  	/** given a group of names separated by commas, this routine
  	    will return a string that is the full addresses of each
--- 208,217 ----
  	return( (char *) NULL);
  }
  
! char *expand_group(members, depth, sysalias)
  char *members;
  int   depth;
+ int sysalias;
  {
  	/** given a group of names separated by commas, this routine
  	    will return a string that is the full addresses of each
***************
*** 225,231 ****
  	depth++;		/* one more deeply into stack */
  
  	while ((word = (char *) get_token(bufptr, "!, ", depth)) != NULL) {
! 	  if ((address = (char *) get_alias_address(word, 1, depth)) == NULL) {
  	    fprintf(stderr, "Alias %s not found for group expansion!", word);
  	    return( (char *) NULL);
  	  }
--- 227,234 ----
  	depth++;		/* one more deeply into stack */
  
  	while ((word = (char *) get_token(bufptr, "!, ", depth)) != NULL) {
! 	  if ((address = (char *) get_alias_address(word, 1, depth,
!               sysalias)) == NULL) {
  	    fprintf(stderr, "Alias %s not found for group expansion!", word);
  	    return( (char *) NULL);
  	  }

-- 
Bitnet:   david@wubios.wustl                ^      Mr. David J. Camp
Internet: david%wubios@wucs1.wustl.edu    < * >    Box 8067, Biostatistics
uucp:     uunet!wucs1!wubios!david          v      660 South Euclid
Washington University (314) 36-23635               Saint Louis, MO 63110

indra@hobbes.amd.com (Indra Singhal) (09/01/89)

I am not sure how everyone else feels, but posting unofficial patches on the net
is a sure way of causing confusion.

I suggest all patches go to Syd for verification. It would definitely be
appropriate to describe what a patch does and mention that it is being verified
and is available to whoever MUST have it before it becomes official.  The
unofficial patches that way get to only those who really need it.

Comments?

iNDRA | indra@amdcad.AMD.COM                 (408) 749-5445
      | {ames decwrl gatech pyramid sun uunet}!amdcad!indra
      | MS 167; Box 3453; Sunnyvale, CA 94088

cudcv@warwick.ac.uk (Rob McMahon) (09/01/89)

In article <27062@amdcad.AMD.COM> indra@hobbes.AMD.COM (Indra Singhal) writes:
>I am not sure how everyone else feels, but posting unofficial patches on the
>net is a sure way of causing confusion.

I strongly disagree with this.  It is clear which are official patches and
which are unofficial, if you don't want to apply unofficial patches, there's
no need to.  The `patch' program makes it easy to uninstall a patch when an
official fix comes round (provided you keep the original patch around of
course), or there's no problem if you use RCS or s.t. to keep things under
control.

Please, keep your patches coming.

Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

pmm@mips.COM (Paul M. Moriarty) (09/02/89)

In article <193@titania.warwick.ac.uk> cudcv@warwick.ac.uk (Rob McMahon) writes:
>In article <27062@amdcad.AMD.COM> indra@hobbes.AMD.COM (Indra Singhal) writes:
>>I am not sure how everyone else feels, but posting unofficial patches on the
>>net is a sure way of causing confusion.
>
>I strongly disagree with this.  It is clear which are official patches and
>which are unofficial, if you don't want to apply unofficial patches, there's
>no need to.  The `patch' program makes it easy to uninstall a patch when an
>official fix comes round (provided you keep the original patch around of
>course), or there's no problem if you use RCS or s.t. to keep things under
>control.

I'd have to agree with Indra on this one. It is potentially confusing
to post unofficial patches, particularly when those patches do not
update /hdrs/patchlevel.h. 

I'd say it would be better to post a not to say that you have an unofficial
patch that does whatever and request that interested parties send mail to
you requesting the patch.

>
>Please, keep your patches coming.

Please, by e-mail

-- 
Paul M. Moriarty        pmm@mips.com          {ames,decwrl}!mips!pmm 
Computer Center SysAdmin
MIPS Computer Systems, Inc.   

rob@PacBell.COM (Rob Bernardo) (09/03/89)

In article <193@titania.warwick.ac.uk> cudcv@warwick.ac.uk (Rob McMahon) writes:
+In article <27062@amdcad.AMD.COM> indra@hobbes.AMD.COM (Indra Singhal) writes:
+>I am not sure how everyone else feels, but posting unofficial patches on the
+>net is a sure way of causing confusion.
+
+I strongly disagree with this.  It is clear which are official patches and
+which are unofficial, if you don't want to apply unofficial patches, there's
+no need to.  The `patch' program makes it easy to uninstall a patch when an
+official fix comes round (provided you keep the original patch around of
+course), or there's no problem if you use RCS or s.t. to keep things under
+control.

There's a problem with unofficial patches and support of ELM. If an unofficial
patch breaks something unrelated to the issue it addresses (quite easy to
do -- I know from experience :-) ), this can cause a headache when the
resulting bug is reported to the ELM development team, esp. if reported
by a user who is unaware that the ELM they are using contains an unofficial
patch.
-- 
Rob Bernardo      ...![backbone]!pacbell!pbhyf!rob -or- rob@pbhyf.PacBell.COM
  Product engineer, UNIX/C Reusable Code Library        Editor, "Go `C' UNIX"
  Office: (415) 823-2417                Pacific * Bell, San Ramon, California
  Residence: (415) 827-4301                     R BAR JB, Concord, California