f133114add
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.
81 lines
3.2 KiB
Text
81 lines
3.2 KiB
Text
$NetBSD: patch-ac,v 1.2 2006/03/02 21:03:39 wiz Exp $
|
|
|
|
--- cnf.c.orig 2005-09-16 12:02:44.000000000 +0200
|
|
+++ cnf.c
|
|
@@ -36,11 +36,16 @@ if(fic==(FILE *)NULL) return(-1);
|
|
|
|
// We set the default values
|
|
|
|
-strcpy(conf->sqlhost,"localhost");
|
|
-strcpy(conf->sqluser,"myuser");
|
|
-strcpy(conf->sqldb,"mydb");
|
|
-strcpy(conf->sqlpasswd,"mypasswd");
|
|
-strcpy(conf->message,"Greylisted");
|
|
+strncpy(conf->sqlhost,"localhost",sizeof(conf->sqlhost)-1);
|
|
+conf->sqlhost[sizeof(conf->sqlhost)-1] = '\0';
|
|
+strncpy(conf->sqluser,"myuser",sizeof(conf->sqluser)-1);
|
|
+conf->sqluser[sizeof(conf->sqluser)-1] = '\0';
|
|
+strncpy(conf->sqldb,"mydb",sizeof(conf->sqldb)-1);
|
|
+conf->sqldb[sizeof(conf->sqldb)-1] = '\0';
|
|
+strncpy(conf->sqlpasswd,"mypasswd",sizeof(conf->sqlpasswd)-1);
|
|
+conf->sqlpasswd[sizeof(conf->sqlpasswd)-1] = '\0';
|
|
+strncpy(conf->message,"Greylisted",sizeof(conf->message)-1);
|
|
+conf->message[sizeof(conf->message)-1] = '\0';
|
|
conf->training=0;
|
|
conf->port=2525;
|
|
conf->maxcon=100;
|
|
@@ -72,14 +77,46 @@ while(fgets(buffer,1024,fic)!=NULL)
|
|
buffer[strlen(buffer)-1]=0;
|
|
*p=0;
|
|
if(strcmp(buffer,"CLIENTS")==0) ReadClients(conf,p+1);
|
|
- if(strcmp(buffer,"USER")==0) strcpy(conf->user,p+1);
|
|
- if(strcmp(buffer,"GROUP")==0) strcpy(conf->grp,p+1);
|
|
- if(strcmp(buffer,"DNSWL")==0) strcpy(conf->dnswl,p+1);
|
|
- if(strcmp(buffer,"SQLHOST")==0) strcpy(conf->sqlhost,p+1);
|
|
- if(strcmp(buffer,"SQLUSER")==0) strcpy(conf->sqluser,p+1);
|
|
- if(strcmp(buffer,"SQLDB")==0) strcpy(conf->sqldb,p+1);
|
|
- if(strcmp(buffer,"SQLPASSWD")==0) strcpy(conf->sqlpasswd,p+1);
|
|
- if(strcmp(buffer,"MESSAGE")==0) strcpy(conf->message,p+1);
|
|
+ if(strcmp(buffer,"USER")==0)
|
|
+ {
|
|
+ strncpy(conf->user,p+1,sizeof(conf->user)-1);
|
|
+ conf->user[sizeof(conf->user)-1] = '\0';
|
|
+ }
|
|
+ if(strcmp(buffer,"GROUP")==0)
|
|
+ {
|
|
+ strncpy(conf->grp,p+1,sizeof(conf->grp)-1);
|
|
+ conf->grp[sizeof(conf->grp)-1] = '\0';
|
|
+ }
|
|
+ if(strcmp(buffer,"DNSWL")==0)
|
|
+ {
|
|
+ strncpy(conf->dnswl,p+1,sizeof(conf->dnswl)-1);
|
|
+ conf->dnswl[sizeof(conf->dnswl)-1] = '\0';
|
|
+ }
|
|
+ if(strcmp(buffer,"SQLHOST")==0)
|
|
+ {
|
|
+ strncpy(conf->sqlhost,p+1,sizeof(conf->sqlhost)-1);
|
|
+ conf->sqlhost[sizeof(conf->sqlhost)-1] = '\0';
|
|
+ }
|
|
+ if(strcmp(buffer,"SQLUSER")==0)
|
|
+ {
|
|
+ strncpy(conf->sqluser,p+1,sizeof(conf->sqluser)-1);
|
|
+ conf->sqluser[sizeof(conf->sqluser)-1] = '\0';
|
|
+ }
|
|
+ if(strcmp(buffer,"SQLDB")==0)
|
|
+ {
|
|
+ strncpy(conf->sqldb,p+1,sizeof(conf->sqldb)-1);
|
|
+ conf->sqldb[sizeof(conf->sqldb)-1] = '\0';
|
|
+ }
|
|
+ if(strcmp(buffer,"SQLPASSWD")==0)
|
|
+ {
|
|
+ strncpy(conf->sqlpasswd,p+1,sizeof(conf->sqlpasswd)-1);
|
|
+ conf->sqlpasswd[sizeof(conf->sqlpasswd)-1] = '\0';
|
|
+ }
|
|
+ if(strcmp(buffer,"MESSAGE")==0)
|
|
+ {
|
|
+ strncpy(conf->message,p+1,sizeof(conf->message)-1);
|
|
+ conf->message[sizeof(conf->message)-1] = '\0';
|
|
+ }
|
|
if(strcmp(buffer,"PORT")==0) conf->port=atoi(p+1);
|
|
if(strcmp(buffer,"MAXCON")==0) conf->maxcon=atoi(p+1);
|
|
if(strcmp(buffer,"TRAINING")==0) conf->training=atoi(p+1);
|