]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding unidns.c module
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 14 Aug 2024 13:27:48 +0000 (09:27 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 14 Aug 2024 13:27:48 +0000 (09:27 -0400)
app/Makefile
app/chkdns.c [new file with mode: 0644]
lib/Makefile
lib/subrou.c
lib/unidns.c [new file with mode: 0644]
lib/unidns.h [new file with mode: 0644]
lib/unieml.c

index 1246d9b745824eb179dfe62cdbf30648060c5fec..18bdbc5d72a26ac179d36df7f73debc5e9027255 100644 (file)
@@ -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 (file)
index 0000000..16d349d
--- /dev/null
@@ -0,0 +1,54 @@
+// vim: smarttab tabstop=8 shiftwidth=2 expandtab
+/********************************************************/
+/*                                                     */
+/*     Main SMTP Daemon                                */
+/*                                                     */
+/********************************************************/
+#include       <stdio.h>
+#include       <stdlib.h>
+#include       <unistd.h>
+
+#include       "subrou.h"
+#include       "unidns.h"
+
+/*
+\f
+*/
+/********************************************************/
+/*                                                     */
+/*     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);
+}
index 1b4db65993494a3ee6c8a1227320cb02c78ba7b6..e333e5a3d702bd49f96a27fdf73adfae8c7c7ff2 100644 (file)
@@ -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
index e0a62b8691fa580c9b4a6624bb725f7ecc5885d9..93186e70ce8b10882ab6fac07b3b617ee340926a 100644 (file)
@@ -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 (file)
index 0000000..8052851
--- /dev/null
@@ -0,0 +1,53 @@
+// vim: smarttab tabstop=8 shiftwidth=2 expandtab
+/********************************************************/
+/*                                                     */
+/*     Implement all routine to manage SMTP low level  */
+/*     exchange.                                       */
+/*                                                     */
+/********************************************************/
+#include        <stdbool.h>
+#include        <stdio.h>
+#include        <string.h>
+#include        <unistd.h>
+
+#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 (file)
index 0000000..fbfdbd9
--- /dev/null
@@ -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
index 6e98a938ce8ddbd26ac7bb7e4ee462cf33c8b6ce..df4d934d21c1e6383cabeb8f94b90247d02c0a5c 100644 (file)
@@ -118,6 +118,7 @@ int status;
 
 status=0;
 if (mode!=modopen) {
+  (void) rou_modesubrou(mode);
   switch ((int)mode) {
     case true     :
       break;