OSSP CVS Repository

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

Check-in Number: 360
Date: 2001-Jan-21 13:00:35 (local)
2001-Jan-21 12:00:35 (UTC)
User:rse
Branch:
Comment: Provide a "petidomo --mode=dump <listname>" and use this in petidomo-kickout instead of directly fiddling with Petidomo's files.
Tickets:
Inspections:
Files:
ossp-pkg/petidomo/main.c      1.18 -> 1.19     25 inserted, 2 deleted
ossp-pkg/petidomo/petidomo-kickout      1.1 -> 1.2     9 inserted, 15 deleted

ossp-pkg/petidomo/main.c 1.18 -> 1.19

--- main.c       2001/01/20 13:52:41     1.18
+++ main.c       2001/01/21 12:00:35     1.19
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/main.c,v $
-   $Revision: 1.18 $
+   $Revision: 1.19 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -48,7 +48,7 @@
     char *        incoming_mail;
     argv_t        args[] =
         {
-        {ARGV_MAND, "mode", ARGV_CHAR_P, &mode, "mode", "listserv, deliver, or approve."},
+        {ARGV_MAND, "mode", ARGV_CHAR_P, &mode, "mode", "listserv, deliver, approve or dump."},
         {ARGV_MAYBE, "listname", ARGV_CHAR_P, &listname, "listname", "Default mailing list."},
         {ARGV_MAYBE, "masterconf", ARGV_CHAR_P, &masterconfig_path, "masterconf", "Path to petidomo.conf."},
         {ARGV_MAYBE, "approved", ARGV_BOOL, &g_is_approved, "approved", "approved flag."},
@@ -90,6 +90,29 @@
     argv_version_string = (char *)petidomo_version.v_gnu;
     argv_process(args, argc, argv);
 
+    /* Member Dump Mode */
+    if (strcasecmp(mode, "dump") == 0) {
+        char *cp;
+        const struct List_Config *ListConfig;
+        if (listname == NULL) {
+            fprintf(stderr, "petidomo: dump mode requires a list name argument\n");
+            exit(1);
+        }
+        if (InitPetidomo(masterconfig_path) != 0) {
+            fprintf(stderr, "petidomo: failed load master configuration.\n");
+            exit(1);
+        }
+        MasterConfig = getMasterConfig();
+        ListConfig = getListConfig(listname);
+        if ((cp = loadfile(ListConfig->address_file)) == NULL) {
+            fprintf(stderr, "petidomo: failed to open file \"%s\"\n", ListConfig->address_file);
+            exit(1);
+        }
+        fwrite(cp, strlen(cp), 1, stdout);
+        free(cp);
+        exit(0);
+    }
+
     /* Log a few helpful facts about this Petidomo instance. */
 
     syslog(LOG_DEBUG, "%s starting up; mode=%s, listname=%s, masterconf=%s, approved=%s, ruid=%d, euid=%d, gid=%d, egid=%d",


ossp-pkg/petidomo/petidomo-kickout 1.1 -> 1.2

--- petidomo-kickout     2001/01/18 15:31:30     1.1
+++ petidomo-kickout     2001/01/21 12:00:35     1.2
@@ -20,10 +20,6 @@
     }
 }
 
-#   locate the Petidomo basedir
-my $basedir = `petidomo --version 2>&1`;
-$basedir =~ s|^.+\((\S+)\).*$|$1|s;
-
 #   read config 
 my $list = {};
 open(FP, "<$config") || die "No ~/.petidomo file found";
@@ -32,17 +28,16 @@
     if (m|^\s*(\S+)\s+(\S+)|) {
         my ($l, $pw) = ($1, $2);
         $l =~ s|@[^@]+$||;
-        if (-f "$basedir/$l.list") {
-            $list->{$l} = {};
-            $list->{$l}->{PASSWORD} = $pw;
-            $list->{$l}->{MEMBERS} = [];
-            open(LST, "<$basedir/$l.list");
-            while (<LST>) {
-                s|\n$||s;
-                push(@{$list->{$l}->{MEMBERS}}, $_);
-            }
-            close(LST);
+        $list->{$l} = {};
+        $list->{$l}->{PASSWORD} = $pw;
+        $list->{$l}->{MEMBERS} = [];
+        next if ($l eq 'petidomo');
+        open(DUMP, "./petidomo --masterconf=../test/petidomo.conf --mode=dump $l |") || die "fuck";
+        while (<DUMP>) {
+            s|\n$||s;
+            push(@{$list->{$l}->{MEMBERS}}, $_);
         }
+        close(DUMP);
     }
 }
 close(FP);
@@ -70,6 +65,5 @@
         }
     }
 }
-sleep(1);
 exit(0);
 

CVSTrac 2.0.1