#------------------------------------------------
#The list of public blacklist serveur
BLACKLISTER=/etc/mailleur/blacklister.conf
+#the list of IP from which we accept to releay email
+RELAYABLE=/etc/mailleur/relayable.conf
#------------------------------------------------
#------------------------------------------------
#The list of public blacklist serveur
BLACKLISTER=/etc/mailleur/blacklister.conf
+#the list of IP from which we accept to releay email
+RELAYABLE=/etc/mailleur/relayable.conf
#------------------------------------------------
-#list of IP number which are relayable
-127.0.0.1/32
+#--------------------------------------------------------
+##Private address block which email can be relayed from
+127.0.0.0/8 #local loop number
+192.168.254.0/24 #local network
+#--------------------------------------------------------
+#Setup you own list
if (contact!=(CONTYP *)0) {
(void) freesessid(contact);
- (void) sql_droplinks(contact->sqlptr);
contact->sqlptr=sql_closesql(contact->sqlptr);
contact->logptr=log_closelog(contact->logptr);
contact->recipients=(RCPTYP **)rou_freelist((void **)contact->recipients,
if (contact->sqlptr==(SQLPTR *)0) {
(void) rou_alert(0,"%s Unable to contact database",OPEP);
(void) sleep(2);//delay to avoid avalanche
- (void) free(contact);
+ (void) eml_dropcontact(contact);
contact=(CONTYP *)0;
phase=999; //no contact possible.
}
break;
case 2 : //waiting from contact
- (void) sql_droplinks(contact->sqlptr);
if ((contact->socptr=soc_accept(socptr,pos))==(SOCPTR *)0) {
(void) rou_alert(3,"%s Unable to open contact",OPEP);
contact=freecontact(contact);
char *locserv; //local service port
char *peername; //socket remote peer FQDN
char *peerip; //socket remote peer IP
+ char **relayok; //List of IP which are relayable
int numreset; //number of SMTP reset received
char *mainsesid; //session main ID
SESTYP *session; //SMTP current session information
/* exchange. */
/* */
/********************************************************/
+#include <arpa/inet.h>
#include <sys/file.h>
#include <dirent.h>
#include <errno.h>
*/
/********************************************************/
/* */
+/* Procedure to load a list of IP from which email */
+/* to a NONE local domain can be accepted and */
+/* relayed. */
+/* */
+/********************************************************/
+PUBLIC char **eml_load_relayed(char *relayedfile)
+
+{
+#define OPEP "unieml.c:eml_load_relayed,"
+
+char **list;
+char *filename;
+FILE *relays;
+int phase;
+_Bool proceed;
+
+list=(char **)0;
+filename=(char *)0;
+relays=(FILE *)0;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ switch (phase) {
+ case 0 : //Check if we have a ffilename
+ if ((relayedfile==(char *)0)||(strlen(relayedfile)==0)) {
+ (void) rou_alert(0,"%s No file name config?)",OPEP);
+ phase=999; //*no need to go further
+ }
+ break;
+ case 1 : //let open the relayable file
+ filename=rou_apppath(relayedfile);
+ if ((relays=fopen(filename,"r"))==(FILE *)0) {
+ (void) rou_alert(0,"%s Unable to open file <%s> (error=<%s>, config?)",
+ OPEP,filename,strerror(errno));
+ phase=999; //No need to go further
+ }
+ break;
+ case 2 : { //scanning relayable contents
+ char line[300];
+
+ while (fgets(line,sizeof(line)-1,relays)!=(char *)0) {
+ struct sockaddr_in sa;
+
+ (void) rou_clean_conf_line(line);
+ if (strlen(line)==0)
+ continue;
+ if (inet_pton(AF_INET,line,&(sa.sin_addr))<=0) {
+ (void) rou_alert(0,"%s <%s> not a valie IP (error=<%s>, config?)",
+ OPEP,line,strerror(errno));
+ continue;
+ }
+ list=(char **)rou_addlist((void **)list,strdup(line));
+ }
+ }
+ break;
+ case 3 : //closing file
+ (void) fclose(relays);
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+filename=rou_freestr(filename);
+return list;
+
+#undef OPEP
+}
+/*
+^L
+*/
+/********************************************************/
+/* */
/* Procedure to list all file with a specific */
/* extension with the queue directory. */
/* Return a list or NULL if no file. */
//procedure to close a file within the queue directory
extern FILE *eml_closeqfile(FILE *qfile);
+//Procedure to load the list of IP/Network from
+//which incoming email can be relayed to another domain MX
+extern char **eml_load_relayed(char *relayedfile);
+
//Procedure to list all file within queue directory
//and with a specific extenstion
extern char **eml_getqfilelist(char **dnames,const char *ext);