Index: ossp-pkg/petidomo/approve.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/approve.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/petidomo/approve.c,v' 2>/dev/null --- approve.c 2001/01/19 14:56:33 1.4 +++ approve.c 2001/01/20 14:30:50 1.5 @@ -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; + }