phase=0;
proceed=true;
while (proceed==true) {
- //(void) rou_alert(0,"%s JMPDBG phase='%d'",OPEP,phase);
+ (void) rou_dbglive(9,OPEP,"phase='%d'",phase);
switch (phase) {
case 0 : //Extracting recipient email
if ((tra!=(TRATYP *)0)&&(tra->rcptto!=(char *)0)&&(strlen(tra->rcptto)>0))
argv[6]=rootdir;
argv[7]=buffer;
}
- (void) rou_alert(0,"%s JMPDBG starting sender=<%s> todo= <%s>",
- OPEP,execpath,buffer);
+ (void) rou_dbglive(2,OPEP,"Starting sender=<%s> todo= <%s>",execpath,buffer);
if (execv(execpath,argv)<0) {
(void) rou_alert(0,"%s Unable to exec process=<%s> (error=<%s> Bug?)",
OPEP,execpath,strerror(errno));
phase=0;
proceed=true;
while (proceed==true) {
- //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
+ (void) rou_dbglive(9,OPEP,"phase='%d'",phase);
switch (phase) {
case 0 : //create the new attachement file
if ((qout=eml_createqfile(sessata,(char *)0))==(FILE *)0) {
extracted=false;
if ((line!=(char *)0)&&(strlen(line)>0)) {
- (void) rou_alert(0,"%s JMPDBG scan header <%s>",OPEP,line);
+ (void) rou_dbglive(0,OPEP,"scaning header <%s>",line);
for (int i=0;(extracted==false)&&(look[i]!=(char *)0);i++) {
int max;
#undef OPEP
}
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to get the SPF domain/peerip status */
+/* return the SPF status. */
+/* */
+/********************************************************/
+PUBLIC SPFENU spf_getspf(char *domain,char *peerip)
+
+{
+#define OPEP "gesspf.c:spf_getspf"
+
+SPFENU spf;
+AFNTYP **afns;
+
+spf=spf_unknown;
+afns=afn_getipnums(peerip);
+if (afns!=(AFNTYP **)0) {
+ int try;
+
+ try=0;
+ for (int i=0;afns[i]!=(AFNTYP *)0;i++) {
+ spf=spf_getstatus(&try,domain,afns[i]);
+ (void) rou_dbglive(9,OPEP,"SPF[%d] for [%s]=<%s>",
+ i,afns[i]->strnumip,spf_spfASCII(spf));
+ }
+ afns=(AFNTYP **)rou_freelist((void **)afns,(genfree_t)afn_freeipnum);
+ }
+return spf;
+
+#undef OPEP
+}
#define GESSPF
#include "subafn.h"
+#include "gesspf.h"
typedef enum {
spf_pass, //OK if condition apply
//procedure to return spf status as an ASCII string
extern const char *spf_spfASCII(SPFENU spf);
-//get the SPF status for a specific domain and a remote peer IP
+//get the SPF status for a specific domain and an IP
extern SPFENU spf_getstatus(int *try,char *domain,AFNTYP *afnnum);
+//get the SPF status for a specific domain according remote peer ipnumer
+extern SPFENU spf_getspf(char *domain,char *peerip);
+
#endif
proceed=true;
phase=0;
while (proceed==true) {
+ (void) rou_dbglive(9,OPEP,"Phase='%d'",phase);
switch (phase) {
case 0 : //do we have an originator
if ((mailfrom==(char *)0)||(strlen(mailfrom)<3)) {
break;
}
break;
- case 5 : //everything ok
+ case 5 : //Checking if the SPF is good from the originator
+ break;
+ case 6 : //everything ok
contact->mailfrom=strdup(mailfrom);
(void) eml_transmit(contact,true,"%d 2.1.3 %s sender ok",
CMDOK,contact->mailfrom);
#include "devsoc.h"
#include "devsql.h"
#include "gestcp.h"
+#include "gesspf.h"
#include "geseml.h"
typedef struct {
SOCPTR *socptr; //established contact socket context
SQLPTR *sqlptr; //established contact database access
int delay; //communication max delay
- _Bool isgoodfqdn; //Remoted presented a valid fqdn
+ _Bool isgoodfqdn; //Remote presented a valid fqdn
char *fqdn; //fully qualified domain from peer
int credit; //Credits to be added or removed from contact
RELTYP privilege; //onnection privilege
char *termend; //contact ending condition
SESTYP *session; //SMTP current session information
char *mailfrom; //current mail from originator
+ SPFENU isgoodspf; //remote mail spf status
RCPTYP **recipients; //List of email recipient
LOGPTR *logptr; //reference to session log
char *transout; //data to be flush out to remote