OSSP CVS Repository

ossp - Difference in ossp-pkg/petidomo/approve.c versions 1.4 and 1.5
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/petidomo/approve.c 1.4 -> 1.5

--- approve.c    2001/01/19 14:56:33     1.4
+++ approve.c    2001/01/20 14:30:50     1.5
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/approve.c,v $
-   $Revision: 1.4 $
+   $Revision: 1.5 $
 
    Copyright (C) 2000 by Peter Simons <simons@computer.org>.
 
@@ -26,13 +26,17 @@
 
 #include "petidomo.h"
 
-int approve_main(char* mail)
+void approve_main(char* mail)
     {
     const struct PD_Config* MasterConfig = getMasterConfig();
+    struct Mail*   MailStruct;
+    char*          originator;
     static const char* cookie_regex = "[0-9a-f]{32}";
     regex_t preg;
     regmatch_t match[3];
     int offset;
+    int number_of_hits            = 0;
+    int number_of_successful_hits = 0;
 
     if (chdir(MasterConfig->ack_queue_dir) == -1)
         {
@@ -55,6 +59,8 @@
         char* dst = buffer;
         unsigned int i;
 
+        ++number_of_hits;
+
         /* Copy found string into buffer. */
 
         src = mail + offset + match[0].rm_so;
@@ -73,6 +79,7 @@
             {
             char cmd[128];
 
+            ++number_of_successful_hits;
             sprintf(cmd, "/bin/sh %s && /bin/rm -f %s", buffer, buffer);
             if (((signed char)system(cmd)) == -1)
                 {
@@ -80,8 +87,22 @@
                 exit(1);
                 }
             }
+        }
+
+    /* Report results back to the originator */
+
+    if (ParseMail(&MailStruct, mail, MasterConfig->fqdn) != 0)
+        {
+        syslog(LOG_ERR, "Parsing the incoming mail failed.");
+        exit(-1);
+        }
 
+    if (MailStruct->From == NULL)
+        {
+        syslog(LOG_NOTICE, "Received mail without From: line.");
+        return;
         }
 
-    return 0;
+    originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From;
+
     }

CVSTrac 2.0.1