]> SAFE projects GIT repository - jmp/mailleur/commitdiff
session is update properly
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 29 Jun 2025 12:32:07 +0000 (08:32 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 29 Jun 2025 12:32:07 +0000 (08:32 -0400)
data-feed/feed03.tst
lib/geseml.c
lib/lvleml.c
lib/unieml.h

index 3c37c46d4a3e3ffd703fcdbf09b87f83a1987f72..94131cf319ddada4b528172298dcc54cc92348fc 100644 (file)
@@ -31,8 +31,8 @@ R:250 2.1.0 opening new session...
 #-------------------------------------------------------------------------
 S:HELO example.com
 R:250 mailleur.example.com, link (cleartext) ready,...
-S:MAIL FROM: <trouble@mailref1.example.com>
-R:250 2.1.3 trouble@mailref1.example.com.. sender ok
+S:MAIL FROM: <postmaster@mailref1.example.com>
+R:250 2.1.3 postmaster@mailref1.example.com.. sender ok
 S:RCPT TO: <user2@mailref1.example.com>
 R:250 2.6.4 Address accepted <user2@mailref1.example.com>
 S:RCPT TO: <user1@mailref1.example.com>
index 7510dfacb2f6d6eb8eb689781d1425fc0044af93..624471f5fb04f4b8b0c405606cd9172baeb6ed35 100644 (file)
@@ -830,7 +830,7 @@ while (proceed==true) {
         }
       break;
     case 1      :       //Preparing attachement email
-      (void) fprintf(qout,"From: %s Email daemon <%s>\n",APPNAME,orig);
+      (void) fprintf(qout,"%s%s Email daemon <%s>\n",EFROM,APPNAME,orig);
       (void) fprintf(qout,"To: <%s>\n",tra->mailfrom);
       (void) fprintf(qout,"Date: %s\n",rou_ascsysstamp(time((time_t *)0)));
       (void) fprintf(qout,"Subject: %s\n",*(tra->resp)+4);
index 4657b19b431018c988443e18e2844e93a0087621..0aca99ce00f084c02956b713bbd1df41322fc333 100644 (file)
@@ -58,7 +58,6 @@ static void getsessid(CONTYP *contact)
 if (contact!=(CONTYP *)0) {
   char *newsid;
 
-  (void) freesessid(contact);
   contact->session=(SESTYP *)calloc(1,sizeof(SESTYP));
   newsid=eml_getcursesid(contact->mainsesid,contact->numreset);
   contact->session=(SESTYP *)calloc(1,sizeof(SESTYP));
@@ -549,10 +548,11 @@ static _Bool getdata(CONTYP *contact)
 
 {
 #define        OPEP    "lvleml.c:getdata,"
-#define EXTMP  "tmp"
+#define EXTMP   "tmp"
 
 _Bool done;
 FILE *queue;
+_Bool inheader;
 _Bool completed;
 u_long total;
 TIMESPEC start;
@@ -561,6 +561,7 @@ _Bool proceed;
 
 done=false;
 queue=(FILE *)0;
+inheader=true;
 completed=false;
 total=0;
 phase=0;
@@ -603,6 +604,19 @@ while (proceed==true) {
           break;        //exiting loop
           }
         total+=got;
+        if (inheader==true) {
+          if (strlen(line)==0)
+            inheader=false;
+          else {        //extracting the sfrom
+            int max;
+
+            max=strlen(EFROM);
+            if (strncasecmp(line,EFROM,max)==0) {
+              contact->session->efrom=rou_freestr(contact->session->efrom);  
+              contact->session->efrom=strdup(line+max);
+              }
+            }
+          }
         if (strcmp(line,".")==0) {
           completed=true;
           }
@@ -909,11 +923,12 @@ static _Bool doreset(CONTYP *contact,char *parameter)
 
 (void) transmit(contact,true,"%d-%s flushed session %s",
                               CMDOK,LOCSEQ,contact->session->sessid);
+(void) freesessid(contact);
 contact->numreset++;
+(void) getsessid(contact);
 contact->recipients=(RCPTYP **)rou_freelist((void **)(contact->recipients),
                                             (genfree_t)eml_freerecipient);
 contact->mailfrom=rou_freestr(contact->mailfrom);
-(void) getsessid(contact);
 (void) transmit(contact,true,"%d %s opening new session %s",
                               CMDOK,LOCSEQ,contact->session->sessid);
 return true;
@@ -1574,6 +1589,7 @@ while (proceed==true) {
   code=eml_getcode(line);
   switch (code) {
     case c_data         :       //Peer request to transfer email corps.
+
       proceed=getdata(contact);
       break;
     case c_helo         :       //HELO SMTP protocol
index ba172943305e77080eff5cf07a2be56dc1072ddd..962240d1cb6d875f5039c110cd0d43be9ceec6bd 100644 (file)
@@ -10,6 +10,8 @@
 
 #include        <stdio.h>
 
+#define EFROM   "From: "        //Then email header from
+
 #define MXMSIZE 52428800        //52 Megabytes
 #define CRLF    "\r\n"          //EOL within SMTP protocol
 #define        SIGNON  220             //signon information