summaryrefslogtreecommitdiff
path: root/mail/qmailadmin/files/extra-ezmlm-idx7.patch
blob: be4cd42dcbd26ca58dc89e870cbe9cb9418cccde (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
Index: mailinglist.c
===================================================================
--- mailinglist.c	(revision 312)
+++ mailinglist.c	(working copy)
@@ -59,6 +59,10 @@
 #define REPLYTO_LIST 2
 #define REPLYTO_ADDRESS 3
 
+#define GROUP_SUBSCRIBER 0
+#define GROUP_MODERATOR 1
+#define GROUP_DIGEST 2
+
 void set_options();
 void default_options();
 
@@ -533,7 +537,7 @@
     arguments[argc++]=TmpBuf3;
     arguments[argc++]=ActionUser;
     arguments[argc++]=Domain;
-    arguments[argc]=NULL;
+    arguments[argc]=(char *) NULL;
 
     execv(TmpBuf1, arguments);
     exit(127);
@@ -541,29 +545,6 @@
     wait(&pid);
   }
 
-  /* 
-   * ezmlm-make -e leaves .qmail-listname-(accept||reject) links for some reason.
-   * (causing file permission errors in "show mailing lists") Also, it doesn't 
-   * delete dir/digest/ when turning off digests.  This section cleans up...
-   */
-  if(listopt['M'-'A'] == 'M') { /* moderation off */
-    sprintf(tmp, "%s/.qmail-%s-accept-default", RealDir, dotqmail_name);
-    unlink (tmp);
-    sprintf(tmp, "%s/.qmail-%s-reject-default", RealDir, dotqmail_name);
-    unlink (tmp);
-  }
-  if(listopt['D'-'A'] == 'D') { /* digest off */
-    sprintf(tmp, "%s/.qmail-%s-digest-return-default", RealDir, dotqmail_name);
-    unlink (tmp);
-    sprintf(tmp, "%s/.qmail-%s-digest-owner", RealDir, dotqmail_name);
-    unlink (tmp);
-
-    /* delete the digest directory */
-    sprintf(tmp, "%s/%s/digest", RealDir, ActionUser);
-    vdelfiles(tmp);
-    chdir(RealDir);
-  }
-
   /* Check for prefix setting */
   GetValue(TmpCGI, tmp, "prefix=", sizeof(tmp));
   
@@ -617,10 +598,10 @@
 #ifdef EZMLMIDX
   /* if this is a new list, add owner as subscriber */
   if (newlist && (*list_owner != '\0')) {
-    ezmlm_sub ("", list_owner);
+    ezmlm_sub (GROUP_SUBSCRIBER, list_owner);
     if (listopt['M'-'A'] == 'm') { /* moderation on */
       /* add owner as moderator/remote admin as well */
-      ezmlm_sub ("mod", list_owner);
+      ezmlm_sub (GROUP_MODERATOR, list_owner);
     }
   }
 #endif
@@ -680,14 +661,14 @@
     close(handles[0]);
     dup2(handles[1],fileno(stdout));
     sprintf(TmpBuf1, "%s/ezmlm-list", EZMLMDIR);
-    if(mod == 1) {
-        sprintf(TmpBuf2, "%s/%s/mod", RealDir, ActionUser);
-    } else if(mod == 2) {
-        sprintf(TmpBuf2, "%s/%s/digest", RealDir, ActionUser);
+    sprintf(TmpBuf2, "%s/%s", RealDir, ActionUser);
+    if(mod == GROUP_MODERATOR) {
+        execl(TmpBuf1, "ezmlm-list", TmpBuf2, "mod", (char *)NULL);
+    } else if(mod == GROUP_DIGEST) {
+        execl(TmpBuf1, "ezmlm-list", TmpBuf2, "digest", (char *)NULL);
     } else {
-        sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
+    	execl(TmpBuf1, "ezmlm-list", TmpBuf2, (char *)NULL);
     }
-    execl(TmpBuf1, "ezmlm-list", TmpBuf2, NULL);
     exit(127);
   } else {
     close(handles[1]);
@@ -790,7 +771,7 @@
 void addlistdig() { addlistgroup( "add_listdig.html" ); }
 
 /* returns 0 for success */
-int ezmlm_sub (char *dir, char *email)
+int ezmlm_sub (int mod, char *email)
 {
  int pid;
  char subpath[MAX_BUFF];
@@ -799,9 +780,14 @@
   pid=fork();
   if (pid==0) {
     snprintf(subpath, sizeof(subpath), "%s/ezmlm-sub", EZMLMDIR);
-    snprintf(listpath, sizeof(listpath), "%s/%s/%s",
-      RealDir, ActionUser, dir);
-    execl(subpath, "ezmlm-sub", listpath, email, NULL);
+    snprintf(listpath, sizeof(listpath), "%s/%s", RealDir, ActionUser);
+    if (mod == GROUP_MODERATOR) {
+        execl(subpath, "ezmlm-sub", listpath, "mod", email, (char *)NULL);
+    } else if (mod == GROUP_DIGEST) {
+        execl(subpath, "ezmlm-sub", listpath, "digest", email, (char *)NULL);
+    } else {
+        execl(subpath, "ezmlm-sub", listpath, email, (char *)NULL);
+    }
     exit(127);
   } else wait(&pid);
 
@@ -824,9 +810,9 @@
 
   if ( check_email_addr(Newu) ) {
     snprinth (StatusMessage, sizeof(StatusMessage), "%s %H\n", html_text[148], Newu);
-    if (mod == 1) {
+    if (mod == GROUP_MODERATOR) {
       addlistmod();
-    } else if (mod == 2) {
+    } else if (mod == GROUP_DIGEST) {
       addlistdig();
     } else {
       addlistuser();
@@ -835,18 +821,16 @@
     exit(0);
   }
 
-  if(mod == 1 ) {
-    ezmlm_sub ("mod", Newu);
+  ezmlm_sub (mod, Newu);
+  if(mod == GROUP_MODERATOR ) {
     snprinth (StatusMessage, sizeof(StatusMessage), "%H %s %H@%H\n", Newu, 
         html_text[194], ActionUser, Domain);
     send_template( "add_listmod.html" );
-  } else if(mod == 2) {
-    ezmlm_sub ("digest", Newu);
+  } else if(mod == GROUP_DIGEST) {
     snprinth (StatusMessage, sizeof(StatusMessage), "%H %s %H@%H\n", Newu, 
         html_text[240], ActionUser, Domain);
     send_template( "add_listdig.html" );
   } else {
-    ezmlm_sub ("", Newu);
     snprinth (StatusMessage, sizeof(StatusMessage), "%H %s %H@%H\n", Newu, 
         html_text[193], ActionUser, Domain);
     send_template( "add_listuser.html" );
@@ -888,21 +872,21 @@
   pid=fork();
   if (pid==0) {
     sprintf(TmpBuf1, "%s/ezmlm-unsub", EZMLMDIR);
-    if(mod == 1) {
-        sprintf(TmpBuf2, "%s/%s/mod", RealDir, ActionUser);
-    } else if(mod == 2 ) {
-        sprintf(TmpBuf2, "%s/%s/digest", RealDir, ActionUser);
+    sprintf(TmpBuf2, "%s/%s", RealDir, ActionUser);
+    if(mod == GROUP_MODERATOR) {
+        execl(TmpBuf1, "ezmlm-unsub", TmpBuf2, "mod", Newu, (char *)NULL);
+    } else if(mod == GROUP_DIGEST ) {
+        execl(TmpBuf1, "ezmlm-unsub", TmpBuf2, "digest", Newu, (char *)NULL);
     } else {
-        sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
+        execl(TmpBuf1, "ezmlm-unsub", TmpBuf2, Newu, (char *)NULL);
     }
-    execl(TmpBuf1, "ezmlm-unsub", TmpBuf2, Newu, NULL);
     exit(127);
   } else wait(&pid);
 
-  if(mod == 1) {
+  if(mod == GROUP_MODERATOR) {
     snprinth (StatusMessage, sizeof(StatusMessage), "%H %s %H@%H\n", Newu, html_text[197],
         ActionUser, Domain);
-  } else if(mod == 2) {
+  } else if(mod == GROUP_DIGEST) {
     snprinth (StatusMessage, sizeof(StatusMessage), "%H %s %H@%H\n", Newu, html_text[242],
         ActionUser, Domain);
   } else {
@@ -1092,42 +1076,96 @@
   // default to false for lowercase letters
   for (c = 'a'; c <= 'z'; checkopt[(int) c++] = 0);
 
-  // figure out some options in the -default file
+  // ------ newer configuration reads
+
+  // -s: Subscription moderation. touching dir/modsub
+  sprintf(TmpBuf, "%s/modsub", ActionUser);
+  checkopt['s'] = file_exists(TmpBuf);
+  // -h: Help  subscription. Don't require confirmation. Not recommented!
+  sprintf(TmpBuf, "%s/nosubconfirm", ActionUser);
+  checkopt['h'] = file_exists(TmpBuf);
+  // -j Jump off. Unsubscribe  does not require confirmation.
+  sprintf(TmpBuf, "%s/nounsubconfirm", ActionUser);
+  checkopt['j'] = file_exists(TmpBuf);
+
+  // -m: Message  moderation. touch dir/modpost
+  sprintf(TmpBuf, "%s/modpost", ActionUser);   // valid for newer ezmlm-versions
+  checkopt['m'] = file_exists(TmpBuf);
+  // -o: Reject others than; applicable to message moderated lists only
+  sprintf(TmpBuf, "%s/modpostonly", ActionUser);
+  checkopt['o'] = file_exists(TmpBuf);
+  // -u: User posts only. subscribers, digest-subscribers and dir/allow
+  sprintf(TmpBuf, "%s/subpostonly", ActionUser);
+  checkopt['u'] = file_exists(TmpBuf);
+
+  // -f: Subject Prefix. outgoing subject will be pre-fixed with the list name
+  sprintf(TmpBuf, "%s/prefix", ActionUser);
+  checkopt['f'] = file_exists(TmpBuf);
+  // -t: Message Trailer. create dir/text/trailer
+  sprintf(TmpBuf, "%s/addtrailer", ActionUser);
+  checkopt['t'] = file_exists(TmpBuf);
+
+  // -a: Archived: touch dir/archived and dir/indexed
+  sprintf(TmpBuf, "%s/archived", ActionUser);
+  checkopt['a'] = file_exists(TmpBuf);
+  // -i: indexed for WWW archive access
+  sprintf(TmpBuf, "%s/threaded", ActionUser);
+  checkopt['i'] = file_exists(TmpBuf);
+  // -p: Public archive. touch dir/public
+  sprintf(TmpBuf, "%s/public", ActionUser);
+  checkopt['p'] = file_exists(TmpBuf);
+  // -g: Guard archive. Access requests from unrecognized SENDERs will be rejected.
+  sprintf(TmpBuf, "%s/subgetonly", ActionUser);
+  checkopt['g'] = file_exists(TmpBuf);
+  // -b: Block archive. Only moderators are allowed to access the archive.
+  sprintf(TmpBuf, "%s/modgetonly", ActionUser);
+  checkopt['b'] = file_exists(TmpBuf);
+
+  // -d: Digest
+  sprintf(TmpBuf, "%s/digested", ActionUser);
+  checkopt['d'] = file_exists(TmpBuf);
+
+  // -r: Remote admin. touching dir/remote
+  sprintf(TmpBuf, "%s/remote", ActionUser);
+  checkopt['r'] = file_exists(TmpBuf);
+  // -l List subscribers. administrators can request a subscriber
+  sprintf(TmpBuf, "%s/modcanlist", ActionUser);
+  checkopt['l'] = file_exists(TmpBuf);
+  // -n New text file. administrators may edit texts
+  sprintf(TmpBuf, "%s/modcanedit", ActionUser);
+  checkopt['n'] = file_exists(TmpBuf);
+
+  // ------ end of newer configuration reads
+
+  // ------ read in old ezmlm's values
+  // figure out some options in the -default file;
   sprintf(TmpBuf, ".qmail-%s-default", dotqmail_name);
   if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
     while(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
+      // -b: Block archive. Only moderators are allowed to access the archive.
       if((get_ezmlmidx_line_arguments(TmpBuf2, "ezmlm-get", 'P')) > 0) {
         checkopt['b'] = 1;
       }
+      // -g: Guard archive. Access requests from unrecognized SENDERs will be rejected.
       if((get_ezmlmidx_line_arguments(TmpBuf2, "ezmlm-get", 's')) > 0) {
         checkopt['g'] = 1;
       }
+      // -h: Help  subscription. Don't require confirmation. Not recommented!
       if((get_ezmlmidx_line_arguments(TmpBuf2, "ezmlm-manage", 'S')) > 0) {
         checkopt['h'] = 1;
       }
+      // -j Jump off. Unsubscribe  does not require confirmation.
       if((get_ezmlmidx_line_arguments(TmpBuf2, "ezmlm-manage", 'U')) > 0) {
         checkopt['j'] = 1;
       }
+      // -l List subscribers. administrators can request a subscriber
       if((get_ezmlmidx_line_arguments(TmpBuf2, "ezmlm-manage", 'l')) > 0) {
         checkopt['l'] = 1;
       }
+      // -n New text file. administrators may edit texts
       if((get_ezmlmidx_line_arguments(TmpBuf2, "ezmlm-manage", 'e')) > 0) {
         checkopt['n'] = 1;
       }
-      if((strstr(TmpBuf2, "ezmlm-request")) != 0) {
-        checkopt['q'] = 1;
-      }
-    }
-    fclose(fs);
-  }
-
-  // figure out some options in the -accept-default file
-  sprintf(TmpBuf, ".qmail-%s-accept-default", dotqmail_name);
-  if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
-    while(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
-      if(strstr(TmpBuf2, "ezmlm-archive") !=0) {
-        checkopt['i'] = 1;
-      }
     }
     fclose(fs);
   }
@@ -1136,43 +1174,21 @@
   sprintf(TmpBuf, ".qmail-%s", dotqmail_name);
   if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
     while(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
+      // -o: Reject others than; applicable to message moderated lists only
       if((get_ezmlmidx_line_arguments(TmpBuf2, "ezmlm-store", 'P')) > 0) {
         checkopt['o'] = 1;
       }
-      if((strstr(TmpBuf2, "ezmlm-gate")) != 0 || (strstr(TmpBuf2, "ezmlm-issubn")) != 0) {
-        checkopt['u'] = 1;
-      }
-      if(strstr(TmpBuf2, "ezmlm-archive") !=0) {
-        checkopt['i'] = 1;
-      }
     }
     fclose(fs);
   }
 
-  sprintf(TmpBuf, ".qmail-%s-accept-default", dotqmail_name);
-  checkopt['m'] = file_exists(TmpBuf);
-
-  sprintf(TmpBuf, "%s/archived", ActionUser);
-  checkopt['a'] = file_exists(TmpBuf);
-  
-  sprintf(TmpBuf, "%s/digest/bouncer", ActionUser);
-  checkopt['d'] = file_exists(TmpBuf);
-  
-  sprintf(TmpBuf, "%s/prefix", ActionUser);
-  checkopt['f'] = file_exists(TmpBuf);
-
-  sprintf(TmpBuf, "%s/public", ActionUser);
-  checkopt['p'] = file_exists(TmpBuf);
-  
-  sprintf(TmpBuf, "%s/remote", ActionUser);
-  checkopt['r'] = file_exists(TmpBuf);
-  
-  sprintf(TmpBuf, "%s/modsub", ActionUser);
-  checkopt['s'] = file_exists(TmpBuf);
-  
+  // -t: Message Trailer. create dir/text/trailer
   sprintf(TmpBuf, "%s/text/trailer", ActionUser);
-  checkopt['t'] = file_exists(TmpBuf);
-  
+  if (file_exists(TmpBuf)) {
+    checkopt['t'] = 1;
+  }
+  // ------ end of read in old ezmlm's values
+
   /* update the uppercase option letters (just the opposite of the lowercase) */
   for (c = 'A'; c <= 'Z'; c++)
   {
@@ -1208,7 +1224,7 @@
   checkopt['n'] = 0; /* Remote admins can edit text files */
   checkopt['o'] = 0; /* Others rejected (for Moderated lists only */
   checkopt['p'] = 1; /* Public */
-  checkopt['q'] = 1; /* Service listname-request */
+  checkopt['q'] = 1; /* Service listname-request, no longer supported */
   checkopt['r'] = 0; /* Remote Administration */
   checkopt['s'] = 0; /* Subscriptions are moderated */
   checkopt['t'] = 0; /* Add Trailer to outgoing messages */
@@ -1293,12 +1309,7 @@
   build_option_str ("CHECKBOX", "opt5", "d", html_text[271]);
   sprintf (TmpBuf, html_text[272], listname);
   printf ("<SMALL>(%s)</SMALL>", TmpBuf);
-  printf ("<BR>\n");
-  sprintf (TmpBuf, html_text[273], listname);
-  build_option_str ("CHECKBOX", "opt6", "q", TmpBuf);
-  printf ("<BR>\n");
-  sprintf (TmpBuf, html_text[274], listname, listname, listname);
-  printf ("&nbsp; &nbsp; <SMALL>(%s)</SMALL></P>", TmpBuf);
+  printf ("</P>");
 
   /* Remote Administration */
   printf ("<P><B><U>%s</U></B><BR>\n", html_text[275]);
Index: mailinglist.h
--- mailinglist.h	(revision 312)
+++ mailinglist.h	(working copy)
@@ -13,7 +13,7 @@
 void dellistgroupnow(int mod);
 void delmailinglist();
 void delmailinglistnow();
-int ezmlm_sub (char *dir, char *email);
+int ezmlm_sub (int mod, char *email);
 void modmailinglist();
 void modmailinglistnow();
 void show_list_group(char *template);