From: Jean-Marc Pigeon (Delson) Date: Sat, 21 Jun 2025 14:18:29 +0000 (-0400) Subject: Backtracing the multiple afn implementation X-Git-Tag: tag-0.9~58 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=9aea7822cca7db4ae40e102261712e8ffa4e934f;p=jmp%2Fmailleur Backtracing the multiple afn implementation --- diff --git a/conf/mailleur.conf b/conf/mailleur.conf index 027555b..6e21209 100644 --- a/conf/mailleur.conf +++ b/conf/mailleur.conf @@ -1,5 +1,10 @@ #file used to set environment configuration #------------------------------------------------ +#Defining application name +APPNAME=mailleur +#defining local default domain +DFLTDOMAIN="localdomain" +#------------------------------------------------ #list of listening port to do SMTP protocole #format #protocol:ipnum:port:iteration[,protocol:ipnum:port:iteration]++ @@ -15,11 +20,6 @@ #Defaults SMTPPORTS=":::5,smtps::465:3,smtp::587:2" #------------------------------------------------ -#Defining application name -APPNAME=mailleur -#defining default domain -DFLTDOMAIN="localdomain" -#------------------------------------------------ #Defining SERVER mode Certificate data CA_ROOT_SRV="/etc/pki/mailleur/root-safe_CA.pem" CA_CERT_SRV="/etc/pki/mailleur/mailleur-cert.pem" diff --git a/conf/mailleur.conf.dvl b/conf/mailleur.conf.dvl index c3b73cb..7e674d0 100644 --- a/conf/mailleur.conf.dvl +++ b/conf/mailleur.conf.dvl @@ -1,6 +1,11 @@ #file used to set environment configuration #Used for developpement purpose ONLY #------------------------------------------------ +#Defining application name +APPNAME=mailleur +#defining local default domain +DFLTDOMAIN="example.com"" +#------------------------------------------------ #list of listening port to do SMTP protocole #format #protocol:ipnum:port:iteration[,protocol:ipnum:port:iteration]++ @@ -9,32 +14,29 @@ #:ipnum::: -> smtp:ipnum:25:2 #::,smtps::465:2 -> smtp:0.0.0.0:25:2 + smtps::465:2 #:: -> smtp:0.0.0.0:25:2 -#SMTPPORTS " "::" -#SMTPPORTS = ":127.127.10.25:1025:,smtps:127.127.10.25:1026:1" -SMTPPORTS = ":127.127.10.25:1025:" -#SMTPPORTS = "smtps:127.127.10.25:1065:1" -#------------------------------------------------ -#defining default domain -DFLTDOMAIN = "example.com" +SMTPPORTS="::1025" +#SMTPPORTS=":127.127.10.25:1025:,smtps:127.127.10.25:1026:1" +#SMTPPORTS=":127.127.10.25:1025:" +#SMTPPORTS="smtps:127.127.10.25:1065:1" #------------------------------------------------ #Defining SERVER mode Certificate data -CA_ROOT_SRV = "./certs/root-safe_CA.pem" -CA_CERT_SRV = "./certs/mailleur_server-chain-cert_x509.pem" -CA_KEY_SRV = "./certs/mailleur_server-key.pem" -CA_VERIFY_SRV = 0 #to check PEER/client remote certificate +CA_ROOT_SRV="./certs/root-safe_CA.pem" +CA_CERT_SRV="./certs/mailleur_server-chain-cert_x509.pem" +CA_KEY_SRV="./certs/mailleur_server-key.pem" +CA_VERIFY_SRV=0 #to check PEER/client remote certificate #------------------------------------------------ #Defining CLIENT mode Certificate data -CA_ROOT_CLT = "./certs/root-safe_CA.pem" -CA_CERT_CLT = "./certs/localhost-chain-cert.pem" -CA_KEY_CLT = "./certs/localhost-key.pem" -CA_VERIFY_CLT = 0 #to check PEER/server remote certificate +CA_ROOT_CLT="./certs/root-safe_CA.pem" +CA_CERT_CLT="./certs/localhost-chain-cert.pem" +CA_KEY_CLT="./certs/localhost-key.pem" +CA_VERIFY_CLT=0 #to check PEER/server remote certificate #------------------------------------------------ #Configured for Postgresql database -DB_TYPE = POSTGRESQL -DB_NAME = mailleur -DB_HOST = localhost -DB_PORT = 5432 +DB_TYPE=POSTGRESQL +DB_NAME=mailleur +DB_HOST=localhost +DB_PORT=5432 #------------------------------------------------ #Dovecot storage directory -DOV_MAILDIR = "/var/spool/mailleur/mails" +DOV_MAILDIR="/var/spool/mailleur/mails" #------------------------------------------------ diff --git a/lib/Makefile b/lib/Makefile index 7593d0a..d663038 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -143,6 +143,11 @@ toremake: Makefile #-------------------------------------------------------------------- .PHONY: clean #-------------------------------------------------------------------- +#to set the compiled default library +ifeq ($(strip $(DB)),) +DB=1 +endif +#-------------------------------------------------------------------- CC = gcc LD = gcc CFLAGS = -Wall -D_GNU_SOURCE \ diff --git a/lib/unitls.c b/lib/unitls.c index c2cd20d..5e443ae 100644 --- a/lib/unitls.c +++ b/lib/unitls.c @@ -459,13 +459,13 @@ while (proceed==true) { *ptr='\000'; ptr++; } - for (int j=0;j<3;j++) { + for (int j=0;(j<3)&&(seq!=(char *)0);j++) { char *sofar; - if ((sofar=strchr(seq,':'))==(char *)0) - break; - *sofar='\000'; - sofar++; + if ((sofar=strchr(seq,':'))!=(char *)0) { + *sofar='\000'; + sofar++; + } switch (j) { case 0 : //extracting protocol if ((proto=tls_getprotocol(seq))==pro_unknwn) { @@ -483,7 +483,7 @@ while (proceed==true) { case 2 : if (strlen(seq)>0) port=seq; - if (strlen(sofar)>0) + if ((sofar!=(char *)0)&&(strlen(sofar)>0)) iteration=atoi(sofar); break; } diff --git a/shell/test-spf.sh b/shell/test-spf.sh index 1ea0d79..ba9b9d9 100755 --- a/shell/test-spf.sh +++ b/shell/test-spf.sh @@ -10,7 +10,7 @@ while [ $# -gt 0 ] numfile=$((numfile+1)) numline=0 echo "scanning \"$1\" test file" - cat $1 | while read line + while read line do numline=$((numline+1)) data=`echo $line | grep -o '^[^#]*'` @@ -21,11 +21,15 @@ while [ $# -gt 0 ] domain=`echo $data | cut -d ' ' -f2` ipnum=`echo $data | cut -d ' ' -f3` result=`bin/chkspf $domain $ipnum` + echo -n "done bin/chkspf $domain $ipnum " if [ "$result" != "$expect" ] ; then - echo "error: line $numline, Expected:=$expect Result:=$result" + echo "Fail!" numerr=$((numerr+1)) + echo -e "\tError=$numerr\tline $numline, Expected:=$expect Result:=$result" + else + echo "Success" fi - done + done < $1 shift done echo "number of test file scanned: $numfile, total error reported: $numerr";