From: Jean-Marc Pigeon (Delson) Date: Wed, 14 Aug 2024 13:27:48 +0000 (-0400) Subject: Adding unidns.c module X-Git-Tag: tag-0.4.2-end~35 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=4cbf68ed259e32cda51148646f623dab13dc5edf;p=jmp%2Fmailleur Adding unidns.c module --- diff --git a/app/Makefile b/app/Makefile index 1246d9b..18bdbc5 100644 --- a/app/Makefile +++ b/app/Makefile @@ -21,10 +21,12 @@ clean : #Equivalences #-------------------------------------------------------------------- EXE= \ + chkdns \ emlrec \ maild \ SRC= \ + chkdns.c \ emlrec.c \ maild.c \ @@ -42,18 +44,25 @@ LIBS = $(LIBAI) \ #-------------------------------------------------------------------- #Dependances #-------------------------------------------------------------------- +emlrec : toremake emlrec.o + @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) + maild : toremake maild.o @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) -emlrec : toremake emlrec.o +chkdns : toremake chkdns.o @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) +chkdns.o: chkdns.c \ + ../lib/unidns.h \ + ../lib/subrou.h + emlrec.o: emlrec.c \ ../lib/modrec.h \ ../lib/unisig.h \ ../lib/uniprc.h \ ../lib/unipar.h \ - ../lib/subrou.h \ + ../lib/subrou.h maild.o : maild.c \ ../lib/uniprc.h \ diff --git a/app/chkdns.c b/app/chkdns.c new file mode 100644 index 0000000..16d349d --- /dev/null +++ b/app/chkdns.c @@ -0,0 +1,54 @@ +// vim: smarttab tabstop=8 shiftwidth=2 expandtab +/********************************************************/ +/* */ +/* Main SMTP Daemon */ +/* */ +/********************************************************/ +#include +#include +#include + +#include "subrou.h" +#include "unidns.h" + +/* + +*/ +/********************************************************/ +/* */ +/* Main routine */ +/* Return an SPF status according arguments*/ +/* 1 - Domain name */ +/* 2 - IP */ +/* */ +/********************************************************/ +int main(int argc,char *argv[]) + +{ +int status; +int phase; +_Bool proceed; + +status=0; +phase=0; +proceed=true; +while (proceed==true) { + switch (phase) { + case 0 : //checking parameters + break; + case 1 : //initialising process + (void) rou_modesubrou(true); + break; + case 2 : //doing main tash + break; + case 3 : //doing main tash + (void) rou_modesubrou(false); + break; + default : //end of task + proceed=false; + break; + } + phase++; + } +(void) exit(status); +} diff --git a/lib/Makefile b/lib/Makefile index 1b4db65..e333e5a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -20,7 +20,7 @@ OBJS= \ lvleml.o \ gestcp.o \ devlog.o devsoc.o \ - unieml.o \ + unidns.o unieml.o \ unipar.o uniprc.o unisig.o unitls.o \ subrou.o @@ -61,6 +61,10 @@ devsoc.o: \ unitls.h \ devsoc.h devsoc.c +unidns.o: \ + subrou.h \ + unidns.h unidns.c + unieml.o: \ subrou.h \ unieml.h unieml.c diff --git a/lib/subrou.c b/lib/subrou.c index e0a62b8..93186e7 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -20,8 +20,8 @@ //version definition -#define VERSION "0.4.1" -#define RELEASE "6" +#define VERSION "0.4.2" +#define RELEASE "1" //Public variables PUBLIC int debug=0; //debug level diff --git a/lib/unidns.c b/lib/unidns.c new file mode 100644 index 0000000..8052851 --- /dev/null +++ b/lib/unidns.c @@ -0,0 +1,53 @@ +// vim: smarttab tabstop=8 shiftwidth=2 expandtab +/********************************************************/ +/* */ +/* Implement all routine to manage SMTP low level */ +/* exchange. */ +/* */ +/********************************************************/ +#include +#include +#include +#include + +#include "subrou.h" +#include "unidns.h" + +static _Bool modopen; //module open/close status + +/* +^L +*/ +/********************************************************/ +/* */ +/* Procedure to "open/close" module and do */ +/* homework purpose */ +/* return zero if everything right */ +/* */ +/********************************************************/ +int dns_modeunidns(_Bool mode) + +{ +#define OPEP "unidoc.c:soc_modeunisoc" + +int status; + +status=0; +if (mode!=modopen) { + (void) rou_modesubrou(mode); + switch ((int)mode) { + case true : + break; + case false : + break; + default : + (void) fprintf(stderr,"Calling %s with wrong mode='%d' (Bug?!):", + OPEP,(int)mode); + status=-1; + break; + } + modopen=mode; + } +return status; +#undef OPEP +} diff --git a/lib/unidns.h b/lib/unidns.h new file mode 100644 index 0000000..fbfdbd9 --- /dev/null +++ b/lib/unidns.h @@ -0,0 +1,14 @@ +// vim: smarttab tabstop=8 shiftwidth=2 expandtab +/********************************************************/ +/* */ +/* Define all procedure to check SPF entry within */ +/* DNS record. */ +/* */ +/********************************************************/ +#ifndef UNIDNS +#define UNIDNS + +//homework to be done before starting/stopping module. +extern int dns_modeunidns(_Bool mode); + +#endif diff --git a/lib/unieml.c b/lib/unieml.c index 6e98a93..df4d934 100644 --- a/lib/unieml.c +++ b/lib/unieml.c @@ -118,6 +118,7 @@ int status; status=0; if (mode!=modopen) { + (void) rou_modesubrou(mode); switch ((int)mode) { case true : break;