Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!wuarchive!wugate!wubios!david From: david@wubios.wustl.edu (David J. Camp) Newsgroups: comp.mail.elm Subject: elm 2.2 PL20 sysalias unofficial patch Keywords: elm 2.2 PL10 sysalias unofficial patch Message-ID: <870@wubios.wustl.edu> Date: 29 Aug 89 05:22:02 GMT Sender: david@wubios (David J. Camp) Organization: Washington University (St. Louis) Lines: 354 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 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 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