*** /tmp/T0a01036	Mon Feb  2 18:06:59 1998
--- smap.c	Mon Feb  2 17:53:27 1998
***************
*** 10,16 ****
  /*
   *	Author: Marcus J. Ranum, Trusted Information Systems, Inc.
   */
! static	char	RcsId[] = "$Header: /src/SysAdm/TISTools/fwtk-2.0/fwtk/smap-hagan/RCS/smap.c,v 1.19.1.1 1998/02/01 00:49:58 marcg Exp $";
  
  /*
   *      Modified: 09 October 1996, Bruce R. Ellis
--- 10,16 ----
  /*
   *	Author: Marcus J. Ranum, Trusted Information Systems, Inc.
   */
! static	char	RcsId[] = "$Header: /src/SysAdm/TISTools/fwtk-2.0/fwtk/smap-hagan/RCS/smap.c,v 1.23 1998/02/03 00:38:23 marcg Exp $";
  
  /*
   *      Modified: 09 October 1996, Bruce R. Ellis
***************
*** 146,153 ****
--- 146,158 ----
  static  void	add_file_list();
  static	void	smap_exit();
  static	void	waitwaitwait();
+ #ifdef __STDC__
  static  int 	InCheckList(char *str,Cfg *cfp, char *list);
  static  int 	CheckDirEntry(Cfg *cfp);
+ #else  /* __STDC__ */
+ static  int 	InCheckList();
+ static  int 	CheckDirEntry();
+ #endif /* __STDC__ */
  
  struct file_list {
  	struct file_list *next;
***************
*** 597,603 ****
  				if(check_from_address || require_full_email) {
  			  		site = 1 + strchr(ruser,'@');
  			  		if(require_full_email && (site == (char *)1) && (!from_host_local)) {
! 			    			printf("%d Liar\r\n",LYING_ERRNO);
  			    			fflush(stdout);
  			    			syslog(LLEV,"security: bad from address, %s, from %s/%s",safestring(ruser),
  				   			rladdr,riaddr);
--- 603,609 ----
  				if(check_from_address || require_full_email) {
  			  		site = 1 + strchr(ruser,'@');
  			  		if(require_full_email && (site == (char *)1) && (!from_host_local)) {
! 			    			printf("%d Improbable sender\r\n",LYING_ERRNO);
  			    			fflush(stdout);
  			    			syslog(LLEV,"security: bad from address, %s, from %s/%s",safestring(ruser),
  				   			rladdr,riaddr);
***************
*** 722,729 ****
  				smap_exit(1);
  			}
  
! #ifdef	SPECIALDOMAIN
! 			if(!checkvalid(q)) {
  				syslog(LLEV,"securityalert: rejecting recip %.512s",q);
  				fflush(stdout);
  				continue;
--- 728,735 ----
  				smap_exit(1);
  			}
  
! #ifdef	WHITEHOUSE_GOV
! 			if(!checkvalid(q, (Cfg *) 0)) {
  				syslog(LLEV,"securityalert: rejecting recip %.512s",q);
  				fflush(stdout);
  				continue;
***************
*** 1010,1016 ****
--- 1016,1027 ----
   *	Check if Number of Files in security directory is ok 
   */	
  
+ #ifdef __STDC__ 
  static int CheckDirEntry(Cfg *cfp)
+ #else   /* __STDC__ */
+ static int CheckDirEntry(cfp)
+ Cfg *cfp;
+ #endif  /* __STDC__ */
  {
  	Cfg cf;
  	DIR *dir;
***************
*** 1029,1035 ****
--- 1040,1052 ----
  *	do a substring compare
  */
  
+ #ifdef __STDC__ 
  static int chkstr(char *teststr, char *str)
+ #else   /* __STDC__ */
+ static int chkstr(teststr, str)
+ char *teststr;
+ char *str;
+ #endif  /* __STDC__ */
  {
  	int i;
  	int len = strlen(str);
***************
*** 1052,1058 ****
--- 1069,1082 ----
  *	Check if From Address is in the List for allowed broken from-headers
  */
  
+ #ifdef __STDC__ 
  static int InCheckList(char *str,Cfg *cfp,char *list)
+ #else   /* __STDC__ */
+ static int InCheckList(str, cfp, list)
+ char *str;
+ Cfg *cfp;
+ char *list;
+ #endif  /* __STDC__ */
  {
  	Cfg	*cf;
  	int	x;
***************
*** 1197,1207 ****
  		}
  		if(x == '\n') {
  			/* back up over carriage returns */
! 			if(s > buf && *(s - 1) == '\r') {
  				s--;
! 				if (buf[0] == '.' && s == buf+1)
! 					endline = 1;
! 			}
  			break;
  		}
  		*s++ = x;
--- 1221,1231 ----
  		}
  		if(x == '\n') {
  			/* back up over carriage returns */
! 			if(s > buf && *(s - 1) == '\r') 
  				s--;
! 			/* detect last line of message */
! 			if (buf[0] == '.' && s == buf+1)
! 				endline = 1;
  			break;
  		}
  		*s++ = x;
***************
*** 1279,1287 ****
  	int cstat;
  
  #ifdef SYSV
- 	while (wait3(&cstat, WNOHANG, (struct rusage *)0) > 0)
- #else
  	while (waitpid(-1, &cstat, WNOHANG) > 0)
  #endif
  		;
  }
--- 1303,1311 ----
  	int cstat;
  
  #ifdef SYSV
  	while (waitpid(-1, &cstat, WNOHANG) > 0)
+ #else
+ 	while (wait3(&cstat, WNOHANG, (struct rusage *)0) > 0)
  #endif
  		;
  }
***************
*** 1298,1304 ****
  
  char	*bad = "550 Recipient must be in form of: user, user@eop.gov, or user@whitehouse.gov\r\n";
  
! checkvalid(r,cfp)
  char	*r;
  Cfg     *cfp;
  {
--- 1322,1328 ----
  
  char	*bad = "550 Recipient must be in form of: user, user@eop.gov, or user@whitehouse.gov\r\n";
  
! static int checkvalid(r,cfp)
  char	*r;
  Cfg     *cfp;
  {
***************
*** 1349,1355 ****
  	free(chsavp);
  	return(1);
  bomb:
! 	printf(bad);
  	free(chsavp);
  	return(0);
  }
--- 1373,1379 ----
  	free(chsavp);
  	return(1);
  bomb:
! 	if ( cfp == (Cfg *)0 ) printf(bad);
  	free(chsavp);
  	return(0);
  }
***************
*** 1363,1370 ****
   * check to see if the connector is in the list of spam hosts
   *
   */	
! 
! check_spamhost(Cfg *cfp)
  {
  	Cfg	*cf;
  	int	x;
--- 1387,1398 ----
   * check to see if the connector is in the list of spam hosts
   *
   */	
! #ifdef __STDC__
! static int check_spamhost(Cfg *cfp)
! #else  /* __STDC__ */
! static int check_spamhost(cfp)
! Cfg *cfp;
! #endif /* __STDC__ */
  {
  	Cfg	*cf;
  	int	x;
***************
*** 1397,1403 ****
   *
   */	
  
! check_spamdomain(const char *domain, Cfg *cfp)
  {
  	Cfg	*cf;
  	int	x;
--- 1425,1437 ----
   *
   */	
  
! #ifdef __STDC__
! static int check_spamdomain(const char *domain, Cfg *cfp)
! #else  /* __STDC__ */
! check_spamdomain(domain, cfp)
! char *domain;
! Cfg *cfp;
! #endif /* __STDC__ */
  {
  	Cfg	*cf;
  	int	x;
***************
*** 1431,1437 ****
   *
   */	
  
! check_hostname(Cfg *cfp)
  {
  	Cfg	*cf;
  	int	x;
--- 1465,1476 ----
   *
   */	
  
! #ifdef __STDC__
! static int check_hostname(Cfg *cfp)
! #else  /* __STDC__ */
! static int check_hostname(cfp)
! Cfg *cfp;
! #endif /* __STDC__ */
  {
  	Cfg	*cf;
  	int	x;
***************
*** 1466,1472 ****
   *
   */	
  
! check_domain(char *atp,Cfg *cfp)
  {
  	Cfg	*cf;
  	int	x;
--- 1505,1517 ----
   *
   */	
  
! #ifdef __STDC__
! static int check_domain(char *atp,Cfg *cfp)
! #else  /* __STDC__ */
! static int check_domain(atp, cfp)
! char *atp;
! Cfg *cfp;
! #endif /* __STDC__ */
  {
  	Cfg	*cf;
  	int	x;
***************
*** 1484,1491 ****
  					syslog(LLEV,"deny host=%s/%s use of gateway",rladdr,riaddr);
  					return(FALSE);
  				}
- 				return(TRUE);
  				syslog(LLEV,"permit host=%s/%s use of gateway",rladdr,riaddr);
  			}
  		}
  
--- 1529,1536 ----
  					syslog(LLEV,"deny host=%s/%s use of gateway",rladdr,riaddr);
  					return(FALSE);
  				}
  				syslog(LLEV,"permit host=%s/%s use of gateway",rladdr,riaddr);
+ 				return(TRUE);
  			}
  		}
  
