pkgsrc/mail/gld/patches/patch-ae
wiz f133114add Update to 1.6:
16/09/2005 : V 1.6

	- Removed the algorithm lightgreydomain as the new mxgrey
	  does better and simpler

	- Removed the UPDATE option, now gld always update triplets.

	- Fixed a minor flaw in the MXGREY algorithm.

	- Now you can configure MXGREY to consider an ip as a safe
	  MX after X succesful greylists instead of only 1 . (read
	  gld.conf for details)

	- Now gld updates the counters only when mail is not
	  greylisted

	- Added Training mode, read gld.conf for details

	- Now gld verify that if you supply a custom smtp code,
	  it's a 4XX code otherwise gld discard it and use 450 .

	- If gld cannot connect to MySQL server on startup
	  it will not refuse to run anymore, but will set keepdbopen
	  to 0 and accept to run .

	- The sample config file provided now only listen to loopback
	  only accept connection from localhost and runs as nobody/
	  nobody.

	WARNING: if you were using lightgreydomain algorithm, it
	has been discontinued use MXGREY in place, please read
	gld.conf for details.
2006-03-02 21:03:39 +00:00

95 lines
2.6 KiB
Text

$NetBSD: patch-ae,v 1.2 2006/03/02 21:03:39 wiz Exp $
--- sockets.c.orig 2004-10-12 14:39:34.000000000 +0200
+++ sockets.c
@@ -540,7 +540,7 @@ int CloseSocket(int s)
/* */
/************************************************/
-int DnsIp(char *host,char *ip)
+int DnsIp(char *host,char *ip, size_t len)
{
struct hostent *hostptr;
struct in_addr *ptr;
@@ -552,7 +552,11 @@ if(hostptr->h_addrtype != AF_INET) retur
ptr=(struct in_addr *) *hostptr->h_addr_list;
-if(ip!=NULL) strcpy(ip,(char *)inet_ntoa(*ptr));
+if(ip!=NULL)
+ {
+ strncpy(ip,(char *)inet_ntoa(*ptr), len - 1);
+ ip[len-1] = '\0';
+ }
return(0);
}
@@ -572,13 +576,14 @@ return(0);
/* */
/************************************************/
-int DnsFQDN(char *host,char *fqdn)
+int DnsFQDN(char *host,char *fqdn, size_t len)
{
struct hostent *hostptr;
if((hostptr=(struct hostent *)gethostbyname(host))==NULL) return(S_HOST_ERR);
-strcpy(fqdn,hostptr->h_name);
+strncpy(fqdn,hostptr->h_name, len-1);
+fqdn[len-1] = '\0';
return(0);
}
@@ -599,7 +604,7 @@ return(0);
/* */
/************************************************/
-int DnsName(char *ip,char *fqdn)
+int DnsName(char *ip,char *fqdn, size_t len)
{
struct hostent *hostptr;
@@ -609,7 +614,8 @@ addr.s_addr=inet_addr(ip);
if((hostptr=(struct hostent *)gethostbyaddr((char *)&addr,sizeof(struct in_addr),AF_INET))==NULL) return(S_HOST_ERR);
-strcpy(fqdn,hostptr->h_name);
+strncpy(fqdn,hostptr->h_name, len-1);
+fqdn[len-1] = '\0';
return(0);
}
@@ -631,20 +637,27 @@ return(0);
/* */
/************************************************/
-void GetPeerIp(int sock,char *ipfrom,char *hostfrom)
+void GetPeerIp(int sock,char *ipfrom, size_t lip, char *hostfrom, size_t hip)
{
struct sockaddr_in from;
size_t foo=sizeof(struct sockaddr_in);
struct hostent *hostptr;
-strcpy(ipfrom,"???.???.???.???");
-strcpy(hostfrom,"?????");
+strncpy(ipfrom,"???.???.???.???", lip-1);
+ipfrom[lip-1] = '\0';
+strncpy(hostfrom,"?????", hip-1);
+hostfrom[hip-1] = '\0';
if (getpeername(sock,(struct sockaddr *)&from, &foo) == 0)
{
- strcpy(ipfrom,(char *)inet_ntoa(from.sin_addr));
+ strncpy(ipfrom,(char *)inet_ntoa(from.sin_addr), lip-1);
+ ipfrom[lip-1] = '\0';
hostptr=(struct hostent *)gethostbyaddr((char *)&from.sin_addr,sizeof(struct in_addr),AF_INET);
- if(hostptr!=NULL) strcpy(hostfrom,hostptr->h_name);
+ if(hostptr!=NULL)
+ {
+ strncpy(hostfrom,hostptr->h_name, hip-1);
+ hostfrom[hip-1] = '\0';
+ }
}
}