OSSP CVS Repository

ossp - Check-in [270]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 270
Date: 2001-Jan-15 17:29:11 (local)
2001-Jan-15 16:29:11 (UTC)
User:simons
Branch:
Comment: Implemented spooling mechanism for requests and postings that need an acknowledgement to be processed. The code is there, it just isn't called yet.
Tickets:
Inspections:
Files:
ossp-pkg/petidomo/Makefile.in      1.21 -> 1.22     6 inserted, 11 deleted
ossp-pkg/petidomo/config.c      1.11 -> 1.12     5 inserted, 2 deleted
ossp-pkg/petidomo/petidomo.h      1.7 -> 1.8     12 inserted, 3 deleted
ossp-pkg/petidomo/queue_command.c      added-> 1.1
ossp-pkg/petidomo/queue_posting.c      added-> 1.1

ossp-pkg/petidomo/Makefile.in 1.21 -> 1.22

--- Makefile.in  2001/01/11 14:11:33     1.21
+++ Makefile.in  2001/01/15 16:29:11     1.22
@@ -9,14 +9,6 @@
 datadir         = @datadir@/petidomo
 sysconfdir      = @sysconfdir@
 localstatedir   = @localstatedir@/petidomo
-# delete me
-#sharedstatedir = @sharedstatedir@
-#sbindir        = @sbindir@
-#libdir                 = @libdir@/petidomo
-#infodir        = @infodir@
-#mandir                 = @mandir@
-#includedir     = @includedir@
-# delete me
 
 CC              = @CC@
 AR              = ar
@@ -27,13 +19,15 @@
 
 CFLAGS          = @CFLAGS@
 CPPFLAGS        = @CPPFLAGS@ @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\" -DLIBEXECDIR=\"$(libexecdir)\" \
-                  -DDATADIR=\"$(datadir)\" -DLOCALSTATEDIR=\"$(localstatedir)\"
+                  -DDATADIR=\"$(datadir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" \
+                 -DBINDIR=\"$(bindir)\"
 LDFLAGS         = @LDFLAGS@
 
 OBJS            = acl.o archive.o authen.o config.o generate_cookie.o \
                   filter.o handleacl.o help.o hermes.o index.o io.o listserv.o \
                   mailer.o members.o parsearray.o password.o rfcparse.o \
-                  subscribe.o tool.o unsubscribe.o main.o
+                  subscribe.o tool.o unsubscribe.o main.o queue_command.o \
+                  queue_posting.o
 LIBS            = librfc822/librfc822.a libmpools/libmpools.a liblists/liblists.a libargv/libargv.a \
                   libconfigfile/libconfigfile.a libtext/libtext.a
 
@@ -67,7 +61,8 @@
 install:        petidomo
         @if [ ! -d $(bindir) ]; then $(INSTALL) -d $(bindir); fi
         @if [ ! -d $(sysconfdir) ]; then $(INSTALL) -d $(sysconfdir); fi
-        @if [ ! -d $(localstatedir) ]; then $(INSTALL) -d $(localstatedir); fi
+        @if [ ! -d $(localstatedir)/lists ]; then $(INSTALL) -d $(localstatedir)/lists; fi
+        @if [ ! -d $(localstatedir)/ack_queue ]; then $(INSTALL) -d $(localstatedir)/ack_queue; fi
         @if [ ! -d $(datadir) ]; then $(INSTALL) -d $(datadir); fi
         @if [ ! -d $(libexecdir) ]; then $(INSTALL) -d $(libexecdir); fi
         $(INSTALL) -s -m 555 petidomo $(bindir)


ossp-pkg/petidomo/config.c 1.11 -> 1.12

--- config.c     2001/01/11 14:17:53     1.11
+++ config.c     2001/01/15 16:29:11     1.12
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/Attic/config.c,v $
-   $Revision: 1.11 $
+   $Revision: 1.12 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -40,7 +40,8 @@
 static char*  help_file       = DATADIR "/petidomo.conf";
 static char*  acl_file        = SYSCONFDIR "/petidomo.acl";
 static char*  index_file      = LOCALSTATEDIR "/index";
-static char*  list_dir        = LOCALSTATEDIR;
+static char*  list_dir        = LOCALSTATEDIR "/lists";
+static char*  ack_queue_dir   = LOCALSTATEDIR "/ack_queue";
 
 int InitPetidomo(const char* masterconfig_path)
     {
@@ -58,6 +59,7 @@
         { "Acl_File", CF_STRING, &acl_file },
         { "Index_File", CF_STRING, &index_file },
         { "List_Directory", CF_STRING, &list_dir },
+        { "Ack_Queue_Directory", CF_STRING, &ack_queue_dir },
         { NULL, 0, NULL}
         };
 
@@ -116,6 +118,7 @@
     MasterConfig->acl_file = acl_file;
     MasterConfig->index_file = index_file;
     MasterConfig->list_dir = list_dir;
+    MasterConfig->ack_queue_dir = ack_queue_dir;
 
     return 0;
     }


ossp-pkg/petidomo/petidomo.h 1.7 -> 1.8

--- petidomo.h   2001/01/11 14:17:53     1.7
+++ petidomo.h   2001/01/15 16:29:11     1.8
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v $
-   $Revision: 1.7 $
+   $Revision: 1.8 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -57,6 +57,7 @@
     char *    mta;
     char *    mta_options;
     char *    list_dir;
+    char *    ack_queue_dir;
     char *    help_file;
     char *    acl_file;
     char *    index_file;
@@ -176,7 +177,7 @@
 
 /********** listserv.c **********/
 
-int listserv_main(char *incoming_mail, char *default_list);
+int listserv_main(char *incoming_mail, char *default_list, char);
 
 /********** mailer.c **********/
 
@@ -206,7 +207,7 @@
 
 /********** hermes.c **********/
 
-int hermes_main(char *incoming_mail, const char *listname);
+int hermes_main(char *incoming_mail, const char *listname, char);
 
 /********** subscribe.c **********/
 
@@ -225,4 +226,12 @@
 
 char* generate_cookie(const char*);
 
+/********** queue_posting.c **********/
+
+void queue_posting(const struct Mail* mail, const char* listname);
+
+/********** queue_command.c **********/
+
+void queue_command(const struct Mail* mail, const char* command);
+
 #endif /* !defined(__PETIDOMO_H__) */


ossp-pkg/petidomo/queue_command.c -> 1.1

*** /dev/null    Mon Apr 29 03:15:36 2024
--- -    Mon Apr 29 03:18:42 2024
***************
*** 0 ****
--- 1,57 ----
+ /*
+    $Source: /v/ossp/cvs/ossp-pkg/petidomo/Attic/queue_command.c,v $
+    $Revision: 1.1 $
+ 
+    Copyright (C) 2000 by Peter Simons <simons@computer.org>.
+ 
+    This file is part of OpenPetidomo.
+ 
+    OpenPetidomo is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2, or (at your option)
+    any later version.
+ 
+    OpenPetidomo is distributed in the hope that it will be useful, but
+    WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    General Public License for more details.
+ */
+ 
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "libtext/text.h"
+ #include "petidomo.h"
+ 
+ void queue_command(const struct Mail* mail, const char* command)
+     {
+     const struct PD_Config   * MasterConfig = getMasterConfig();
+     char*   buffer;
+     char*   cookie;
+     FILE*   fh;
+ 
+     cookie = generate_cookie(mail->Header);
+     buffer = text_easy_sprintf("%s/%s", MasterConfig->ack_queue_dir, cookie);
+     fh = fopen(buffer, "w");
+     if (fh == NULL)
+        {
+        syslog(LOG_ERR, "Opening ack spool file \"%s\" failed: %m", buffer);
+        exit(1);
+        }
+     fprintf(fh, "#! /bin/sh\n");
+     fprintf(fh, "\n");
+     fprintf(fh, BINDIR "/petidomo --mode=listserv --approved <<[end-of-mail-marker]\n");
+     fprintf(fh, "Sender: %s\n", mail->Envelope);
+     fprintf(fh, "From: %s\n", mail->From);
+     if (mail->Reply_To)
+        fprintf(fh, "Reply-To: %s\n", mail->Reply_To);
+     if (mail->Message_Id)
+        fprintf(fh, "Message-Id: %s\n", mail->Message_Id);
+     if (mail->Approve)
+        fprintf(fh, "Approve: %s\n", mail->Approve);
+     fprintf(fh, "\n");
+     fprintf(fh, "%s\n", command);
+     fprintf(fh, "[end-of-mail-marker]\n");
+     fclose(fh);
+     chmod(buffer, 0755);
+     free(buffer);
+     }


ossp-pkg/petidomo/queue_posting.c -> 1.1

*** /dev/null    Mon Apr 29 03:15:36 2024
--- -    Mon Apr 29 03:18:42 2024
***************
*** 0 ****
--- 1,49 ----
+ /*
+    $Source: /v/ossp/cvs/ossp-pkg/petidomo/Attic/queue_posting.c,v $
+    $Revision: 1.1 $
+ 
+    Copyright (C) 2000 by Peter Simons <simons@computer.org>.
+ 
+    This file is part of OpenPetidomo.
+ 
+    OpenPetidomo is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2, or (at your option)
+    any later version.
+ 
+    OpenPetidomo is distributed in the hope that it will be useful, but
+    WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    General Public License for more details.
+ */
+ 
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "libtext/text.h"
+ #include "petidomo.h"
+ 
+ void queue_posting(const struct Mail* mail, const char* listname)
+     {
+     const struct PD_Config   * MasterConfig = getMasterConfig();
+     char*   buffer;
+     char*   cookie;
+     FILE*   fh;
+ 
+     cookie = generate_cookie(mail->Header);
+     buffer = text_easy_sprintf("%s/%s", MasterConfig->ack_queue_dir, cookie);
+     fh = fopen(buffer, "w");
+     if (fh == NULL)
+        {
+        syslog(LOG_ERR, "Opening ack spool file \"%s\" failed: %m", buffer);
+        exit(1);
+        }
+     fprintf(fh, "#! /bin/sh\n");
+     fprintf(fh, "\n");
+     fprintf(fh, BINDIR "/petidomo --mode=deliver --listname=%s --approved <<[end-of-mail-marker]\n", listname);
+     fprintf(fh, "%s\n", mail->Header);
+     fprintf(fh, "%s", mail->Body);
+     fprintf(fh, "[end-of-mail-marker]\n");
+     fclose(fh);
+     chmod(buffer, 0755);
+     free(buffer);
+     }

CVSTrac 2.0.1