home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / elm-2.4-pl20.tar.Z / elm-2.4-pl20.tar / lib / okay_addr.c < prev    next >
C/C++ Source or Header  |  1992-10-03  |  2KB  |  72 lines

  1. static char rcsid[] = "@(#)$Id: okay_addr.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  2.  
  3. /*******************************************************************************
  4.  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  5.  *
  6.  *            Copyright (c) 1988-1992 USENET Community Trust
  7.  *            Copyright (c) 1986,1987 Dave Taylor
  8.  *******************************************************************************
  9.  * Bug reports, patches, comments, suggestions should be sent to:
  10.  *
  11.  *    Syd Weinstein, Elm Coordinator
  12.  *    elm@DSI.COM            dsinc!elm
  13.  *
  14.  *******************************************************************************
  15.  * $Log: okay_addr.c,v $
  16.  * Revision 5.1  1992/10/03  22:41:36  syd
  17.  * Initial checkin as of 2.4 Release at PL0
  18.  *
  19.  *
  20.  ******************************************************************************/
  21.  
  22. /** 
  23.  
  24. **/
  25.  
  26. #include "headers.h"
  27.  
  28.  
  29. int
  30. okay_address(address, return_address)
  31. char *address, *return_address;
  32. {
  33.     /** This routine checks to ensure that the address we just got
  34.         from the "To:" or "Cc:" line isn't us AND isn't the person    
  35.         who sent the message.  Returns true iff neither is the case **/
  36.  
  37.     char our_address[SLEN];
  38.     struct addr_rec  *alternatives;
  39.  
  40.     if (in_list(address, return_address))
  41.       return(FALSE);
  42.  
  43.     if(in_list(address, username))
  44.       return(FALSE);
  45.  
  46.     sprintf(our_address, "%s!%s", hostname, username);
  47.     if (in_list(address, our_address))
  48.       return(FALSE);
  49.  
  50.     sprintf(our_address, "%s!%s", hostfullname, username);
  51.     if (in_list(address, our_address))
  52.       return(FALSE);
  53.  
  54.     sprintf(our_address, "%s@%s", username, hostname);
  55.     if (in_list(address, our_address))
  56.       return(FALSE);
  57.  
  58.     sprintf(our_address, "%s@%s", username, hostfullname);
  59.     if (in_list(address, our_address))
  60.       return(FALSE);
  61.  
  62.     alternatives = alternative_addresses;
  63.  
  64.     while (alternatives != NULL) {
  65.       if (in_list(address, alternatives->address))
  66.         return(FALSE);
  67.       alternatives = alternatives->next;
  68.     }
  69.  
  70.     return(TRUE);
  71. }
  72.