Mercurial > hg > mlmmj
annotate src/mlmmj-sub.c @ 741:b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
and document \uNNNN substitution
Also, the interface to prepstdreply() has changed; there is no longer a
customheaders argument, which was never used anyway, and is now essentially
redundant due to this patch.
author | Ben Schmidt |
---|---|
date | Mon, 20 Sep 2010 01:44:58 +1000 |
parents | e5286b45f9ca |
children | c7d0a386aef5 |
rev | line source |
---|---|
34 | 1 /* Copyright (C) 2002, 2003 Mads Martin Joergensen <mmj at mmj.dk> |
2 * | |
3 * $Id$ | |
4 * | |
225 | 5 * Permission is hereby granted, free of charge, to any person obtaining a copy |
6 * of this software and associated documentation files (the "Software"), to | |
7 * deal in the Software without restriction, including without limitation the | |
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
9 * sell copies of the Software, and to permit persons to whom the Software is | |
10 * furnished to do so, subject to the following conditions: | |
11 * | |
12 * The above copyright notice and this permission notice shall be included in | |
13 * all copies or substantial portions of the Software. | |
14 * | |
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
21 * IN THE SOFTWARE. | |
34 | 22 */ |
23 | |
24 #include <stdlib.h> | |
25 #include <stdio.h> | |
26 #include <string.h> | |
27 #include <errno.h> | |
28 #include <syslog.h> | |
29 #include <sys/types.h> | |
30 #include <unistd.h> | |
31 #include <sys/stat.h> | |
32 #include <fcntl.h> | |
37 | 33 #include <libgen.h> |
291 | 34 #include <sys/wait.h> |
532 | 35 #include <ctype.h> |
34 | 36 |
37 #include "mlmmj.h" | |
38 #include "mlmmj-sub.h" | |
39 #include "mylocking.h" | |
40 #include "wrappers.h" | |
41 #include "getlistaddr.h" | |
520 | 42 #include "getlistdelim.h" |
34 | 43 #include "strgen.h" |
44 #include "subscriberfuncs.h" | |
45 #include "log_error.h" | |
178 | 46 #include "mygetline.h" |
291 | 47 #include "statctrl.h" |
48 #include "prepstdreply.h" | |
245 | 49 #include "memory.h" |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
50 #include "ctrlvalues.h" |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
51 #include "chomp.h" |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
52 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
53 void moderate_sub(const char *listdir, const char *listaddr, |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
54 const char *listdelim, const char *subaddr, |
541 | 55 const char *mlmmjsend, enum subtype typesub) |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
56 { |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
57 int i, fd, status, nosubmodmails = 0; |
539 | 58 char *a = NULL, *queuefilename, *from, *listname, *listfqdn, *str; |
59 char *modfilename, *randomstr, *mods, *to, *replyto, *moderators = NULL; | |
541 | 60 char *modfilebase; |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
61 struct strlist *submods; |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
62 pid_t childpid, pid; |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
63 char *maildata[6] = { "subaddr", NULL, "moderateaddr", NULL, |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
64 "moderators", NULL }; |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
65 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
66 /* generate the file in moderation/ */ |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
67 switch(typesub) { |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
68 default: |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
69 case SUB_NORMAL: |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
70 str = concatstr(4, subaddr, "\n", "SUB_NORMAL", "\n"); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
71 break; |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
72 case SUB_DIGEST: |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
73 str = concatstr(4, subaddr, "\n", "SUB_DIGEST", "\n"); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
74 break; |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
75 case SUB_NOMAIL: |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
76 str = concatstr(4, subaddr, "\n", "SUB_NOMAIL", "\n"); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
77 break; |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
78 } |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
79 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
80 randomstr = random_str(); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
81 modfilename = concatstr(3, listdir, "/moderation/subscribe", |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
82 randomstr); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
83 myfree(randomstr); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
84 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
85 fd = open(modfilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
86 while(fd < 0 && errno == EEXIST) { |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
87 myfree(modfilename); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
88 randomstr = random_str(); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
89 modfilename = concatstr(3, listdir, "/moderation/subscribe", |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
90 randomstr); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
91 myfree(randomstr); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
92 fd = open(modfilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
93 } |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
94 if(fd < 0) { |
539 | 95 log_error(LOG_ARGS, "could not create %s" |
96 "ignoring request: %s", str); | |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
97 exit(EXIT_FAILURE); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
98 } |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
99 if(writen(fd, str, strlen(str)) < 0) { |
539 | 100 log_error(LOG_ARGS, "could not write to %s" |
101 "ignoring request: %s", str); | |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
102 exit(EXIT_FAILURE); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
103 } |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
104 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
105 close(fd); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
106 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
107 myfree(str); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
108 |
541 | 109 submods = ctrlvalues(listdir, "submod"); |
110 mods = concatstr(2, listdir, "/control/submod"); | |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
111 /* check to see if there's adresses in the submod control file */ |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
112 for(i = 0; i < submods->count; i++) |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
113 a = strchr(submods->strs[i], '@'); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
114 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
115 /* no addresses in submod control file, use owner */ |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
116 if(a == NULL) { |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
117 /* free the submods struct from above */ |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
118 for(i = 0; i < submods->count; i++) |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
119 myfree(submods->strs[i]); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
120 myfree(submods->strs); |
541 | 121 myfree(submods); |
122 submods = ctrlvalues(listdir, "owner"); | |
123 myfree(mods); | |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
124 mods = concatstr(2, listdir, "/control/owner"); |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
125 } |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
126 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
127 /* send mail to moderators about request pending */ |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
128 listdelim = getlistdelim(listdir); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
129 listfqdn = genlistfqdn(listaddr); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
130 listname = genlistname(listaddr); |
541 | 131 modfilebase = mybasename(modfilename); |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
132 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
133 from = concatstr(4, listname, listdelim, "owner@", listfqdn); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
134 to = concatstr(3, listname, "-moderators@", listfqdn); |
541 | 135 replyto = concatstr(6, listname, listdelim, "moderate-", modfilebase, |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
136 "@", listfqdn); |
541 | 137 myfree(modfilebase); |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
138 for(i = 0; i < submods->count; i++) { |
541 | 139 printf("%s", submods->strs[i]); |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
140 str = moderators; |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
141 moderators = concatstr(3, moderators, submods->strs[i], "\n"); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
142 myfree(str); |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
143 } |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
144 |
539 | 145 maildata[1] = mystrdup(subaddr); |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
146 maildata[3] = replyto; |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
147 maildata[5] = moderators; |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
148 |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
149 queuefilename = prepstdreply(listdir, "submod-moderator", |
741
b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
Ben Schmidt
parents:
728
diff
changeset
|
150 "$listowner$", to, replyto, 3, maildata, NULL); |
539 | 151 |
152 myfree(maildata[1]); | |
541 | 153 |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
154 /* we might need to exec more than one mlmmj-send */ |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
155 |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
156 nosubmodmails = statctrl(listdir,"nosubmodmails"); |
541 | 157 |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
158 if (nosubmodmails) |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
159 childpid = -1; |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
160 else { |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
161 childpid = fork(); |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
162 if(childpid < 0) |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
163 log_error(LOG_ARGS, "Could not fork; requester not notified"); |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
164 } |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
165 |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
166 if(childpid != 0) { |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
167 if(childpid > 0) { |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
168 do /* Parent waits for the child */ |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
169 pid = waitpid(childpid, &status, 0); |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
170 while(pid == -1 && errno == EINTR); |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
171 } |
539 | 172 execl(mlmmjsend, mlmmjsend, |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
173 "-a", |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
174 "-l", "4", |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
175 "-L", listdir, |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
176 "-s", mods, |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
177 "-F", from, |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
178 "-R", replyto, |
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
179 "-m", queuefilename, (char *)NULL); |
539 | 180 log_error(LOG_ARGS, "execl() of '%s' failed", mlmmjsend); |
642
a5e0c3976086
Fixed missing exit()s in case of failed execl() calls (Ansgar Burchardt)
mortenp
parents:
562
diff
changeset
|
181 exit(EXIT_FAILURE); |
539 | 182 } |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
183 |
539 | 184 myfree(to); |
185 myfree(replyto); | |
186 myfree(moderators); | |
187 | |
541 | 188 /* send mail to requester that the list is submod'ed */ |
189 | |
539 | 190 from = concatstr(4, listname, listdelim, "bounces-help@", listfqdn); |
191 queuefilename = prepstdreply(listdir, "submod-requester", "$listowner$", | |
741
b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
Ben Schmidt
parents:
728
diff
changeset
|
192 subaddr, NULL, 0, NULL, NULL); |
539 | 193 |
194 myfree(listname); | |
195 myfree(listfqdn); | |
196 execl(mlmmjsend, mlmmjsend, | |
197 "-l", "1", | |
198 "-L", listdir, | |
199 "-T", subaddr, | |
200 "-F", from, | |
201 "-m", queuefilename, (char *)NULL); | |
202 log_error(LOG_ARGS, "execl() of '%s' failed", mlmmjsend); | |
642
a5e0c3976086
Fixed missing exit()s in case of failed execl() calls (Ansgar Burchardt)
mortenp
parents:
562
diff
changeset
|
203 exit(EXIT_FAILURE); |
538
c3d11ce2455e
First iteration of subscription moderation. CVS is hereby broken until further notice
mmj
parents:
532
diff
changeset
|
204 } |
34 | 205 |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
206 void getaddrandtype(const char *listdir, const char *modstr, |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
207 char **addrptr, enum subtype *subtypeptr) |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
208 { |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
209 int fd; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
210 char *readaddr, *readtype, *modfilename; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
211 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
212 modfilename = concatstr(3, listdir, "/moderation/", modstr); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
213 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
214 fd = open(modfilename, O_RDONLY); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
215 if(fd < 0) { |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
216 log_error(LOG_ARGS, "Could not open %s", modfilename); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
217 exit(EXIT_FAILURE); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
218 } |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
219 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
220 readaddr = mygetline(fd); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
221 readtype = mygetline(fd); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
222 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
223 close(fd); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
224 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
225 if(readaddr == NULL || readtype == NULL) { |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
226 log_error(LOG_ARGS, "Could not parse %s", modfilename); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
227 exit(EXIT_FAILURE); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
228 } |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
229 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
230 chomp(readaddr); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
231 *addrptr = readaddr; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
232 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
233 if(strncmp(readtype, "SUB_NORMAL", 10) == 0) { |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
234 *subtypeptr = SUB_NORMAL; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
235 goto freedone; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
236 } |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
237 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
238 if(strncmp(readtype, "SUB_DIGEST", 10) == 0) { |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
239 *subtypeptr = SUB_DIGEST; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
240 goto freedone; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
241 } |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
242 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
243 if(strncmp(readtype, "SUB_NOMAIL", 10) == 0) { |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
244 *subtypeptr = SUB_NOMAIL; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
245 goto freedone; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
246 } |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
247 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
248 log_error(LOG_ARGS, "Type %s not valid in %s", readtype, |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
249 modfilename); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
250 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
251 freedone: |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
252 myfree(readtype); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
253 unlink(modfilename); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
254 myfree(modfilename); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
255 } |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
256 |
37 | 257 void confirm_sub(const char *listdir, const char *listaddr, |
520 | 258 const char *listdelim, const char *subaddr, |
541 | 259 const char *mlmmjsend, enum subtype typesub) |
34 | 260 { |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
261 char *queuefilename, *fromaddr, *listname, *listfqdn, *listtext; |
34 | 262 |
263 listname = genlistname(listaddr); | |
264 listfqdn = genlistfqdn(listaddr); | |
276 | 265 |
520 | 266 fromaddr = concatstr(4, listname, listdelim, "bounces-help@", listfqdn); |
34 | 267 |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
268 myfree(listname); |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
269 myfree(listfqdn); |
34 | 270 |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
271 switch(typesub) { |
366 | 272 default: |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
273 case SUB_NORMAL: |
364 | 274 listtext = mystrdup("sub-ok"); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
275 break; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
276 case SUB_DIGEST: |
364 | 277 listtext = mystrdup("sub-ok-digest"); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
278 break; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
279 case SUB_NOMAIL: |
364 | 280 listtext = mystrdup("sub-ok-nomail"); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
281 break; |
338 | 282 } |
283 | |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
284 queuefilename = prepstdreply(listdir, listtext, "$helpaddr$", |
741
b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
Ben Schmidt
parents:
728
diff
changeset
|
285 subaddr, NULL, 0, NULL, NULL); |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
286 MY_ASSERT(queuefilename); |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
287 myfree(listtext); |
34 | 288 |
37 | 289 execlp(mlmmjsend, mlmmjsend, |
71 | 290 "-l", "1", |
529
d65b467b647d
Pass on listdir to mlmmjsend so we can get the smtpport and relayhost also
mmj
parents:
520
diff
changeset
|
291 "-L", listdir, |
34 | 292 "-T", subaddr, |
293 "-F", fromaddr, | |
435 | 294 "-m", queuefilename, (char *)NULL); |
39 | 295 log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend); |
34 | 296 exit(EXIT_FAILURE); |
297 } | |
298 | |
291 | 299 void notify_sub(const char *listdir, const char *listaddr, |
520 | 300 const char *listdelim, const char *subaddr, |
301 const char *mlmmjsend, enum subtype typesub) | |
291 | 302 { |
363
000cf869301c
Further fixups to new prepstdreply. Seems to work now, needs more testing though
mmj
parents:
359
diff
changeset
|
303 char *maildata[2] = { "newsub", NULL }; |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
304 char *listfqdn, *listname, *fromaddr, *tostr; |
432 | 305 char *queuefilename = NULL, *listtext = NULL; |
291 | 306 |
307 listname = genlistname(listaddr); | |
308 listfqdn = genlistfqdn(listaddr); | |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
309 |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
310 maildata[1] = mystrdup(subaddr); |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
311 |
520 | 312 fromaddr = concatstr(4, listname, listdelim, "bounces-help@", listfqdn); |
313 tostr = concatstr(4, listname, listdelim, "owner@", listfqdn); | |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
314 |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
315 myfree(listname); |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
316 myfree(listfqdn); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
317 |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
318 switch(typesub) { |
366 | 319 default: |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
320 case SUB_NORMAL: |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
321 listtext = mystrdup("notifysub"); |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
322 break; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
323 case SUB_DIGEST: |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
324 listtext = mystrdup("notifysub-digest"); |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
325 break; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
326 case SUB_NOMAIL: |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
327 listtext = mystrdup("notifysub-nomail"); |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
328 break; |
338 | 329 } |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
330 |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
331 queuefilename = prepstdreply(listdir, listtext, "$listowner$", |
741
b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
Ben Schmidt
parents:
728
diff
changeset
|
332 "$listowner$", NULL, 1, maildata, NULL); |
291 | 333 MY_ASSERT(queuefilename) |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
334 myfree(listtext); |
291 | 335 myfree(maildata[1]); |
336 execlp(mlmmjsend, mlmmjsend, | |
337 "-l", "1", | |
529
d65b467b647d
Pass on listdir to mlmmjsend so we can get the smtpport and relayhost also
mmj
parents:
520
diff
changeset
|
338 "-L", listdir, |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
339 "-T", tostr, |
291 | 340 "-F", fromaddr, |
435 | 341 "-m", queuefilename, (char *)NULL); |
291 | 342 |
343 log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend); | |
344 exit(EXIT_FAILURE); | |
345 } | |
346 | |
34 | 347 void generate_subconfirm(const char *listdir, const char *listaddr, |
520 | 348 const char *listdelim, const char *subaddr, |
349 const char *mlmmjsend, enum subtype typesub) | |
34 | 350 { |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
351 int subconffd; |
276 | 352 char *confirmaddr, *listname, *listfqdn, *confirmfilename = NULL; |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
353 char *listtext, *queuefilename = NULL, *fromaddr; |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
354 char *randomstr = NULL, *tmpstr; |
363
000cf869301c
Further fixups to new prepstdreply. Seems to work now, needs more testing though
mmj
parents:
359
diff
changeset
|
355 char *maildata[4] = { "subaddr", NULL, "confaddr", NULL }; |
34 | 356 |
357 listname = genlistname(listaddr); | |
358 listfqdn = genlistfqdn(listaddr); | |
359 | |
276 | 360 do { |
361 myfree(confirmfilename); | |
362 myfree(randomstr); | |
277 | 363 randomstr = random_plus_addr(subaddr); |
276 | 364 confirmfilename = concatstr(3, listdir, "/subconf/", |
365 randomstr); | |
366 | |
367 subconffd = open(confirmfilename, O_RDWR|O_CREAT|O_EXCL, | |
368 S_IRUSR|S_IWUSR); | |
369 | |
370 } while ((subconffd < 0) && (errno == EEXIST)); | |
371 | |
372 if(subconffd < 0) { | |
39 | 373 log_error(LOG_ARGS, "Could not open '%s'", confirmfilename); |
245 | 374 myfree(confirmfilename); |
277 | 375 myfree(randomstr); |
34 | 376 exit(EXIT_FAILURE); |
377 } | |
178 | 378 |
276 | 379 myfree(confirmfilename); |
380 | |
178 | 381 if(writen(subconffd, subaddr, strlen(subaddr)) < 0) { |
382 log_error(LOG_ARGS, "Could not write to subconffd"); | |
277 | 383 myfree(confirmfilename); |
384 myfree(randomstr); | |
178 | 385 exit(EXIT_FAILURE); |
386 } | |
276 | 387 |
178 | 388 close(subconffd); |
34 | 389 |
520 | 390 fromaddr = concatstr(6, listname, listdelim, "bounces-confsub-", |
391 randomstr, "@", listfqdn); | |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
392 |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
393 switch(typesub) { |
366 | 394 default: |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
395 case SUB_NORMAL: |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
396 listtext = mystrdup("sub-confirm"); |
520 | 397 tmpstr = mystrdup("confsub-"); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
398 break; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
399 case SUB_DIGEST: |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
400 listtext = mystrdup("sub-confirm-digest"); |
520 | 401 tmpstr = mystrdup("confsub-digest-"); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
402 break; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
403 case SUB_NOMAIL: |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
404 listtext = mystrdup("sub-confirm-nomail"); |
520 | 405 tmpstr = mystrdup("confsub-nomail-"); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
406 break; |
338 | 407 } |
276 | 408 |
520 | 409 confirmaddr = concatstr(6, listname, listdelim, tmpstr, randomstr, "@", |
410 listfqdn); | |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
411 |
338 | 412 myfree(randomstr); |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
413 myfree(tmpstr); |
34 | 414 |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
415 maildata[1] = mystrdup(subaddr); |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
416 maildata[3] = mystrdup(confirmaddr); |
338 | 417 |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
418 queuefilename = prepstdreply(listdir, listtext, "$helpaddr$", subaddr, |
741
b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
Ben Schmidt
parents:
728
diff
changeset
|
419 confirmaddr, 2, maildata, NULL); |
34 | 420 |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
421 myfree(maildata[1]); |
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
355
diff
changeset
|
422 myfree(maildata[3]); |
44 | 423 |
245 | 424 myfree(listname); |
425 myfree(listfqdn); | |
34 | 426 |
37 | 427 execlp(mlmmjsend, mlmmjsend, |
69 | 428 "-l", "1", |
529
d65b467b647d
Pass on listdir to mlmmjsend so we can get the smtpport and relayhost also
mmj
parents:
520
diff
changeset
|
429 "-L", listdir, |
34 | 430 "-T", subaddr, |
431 "-F", fromaddr, | |
435 | 432 "-m", queuefilename, (char *)NULL); |
39 | 433 log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend); |
34 | 434 exit(EXIT_FAILURE); |
435 } | |
436 | |
437 static void print_help(const char *prg) | |
438 { | |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
439 printf("Usage: %s -L /path/to/list [-a john@doe.org | -m str]\n" |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
440 " [-c] [-C] [-f] [-h] [-L] [-d | -n] [-s] [-U] [-V]\n" |
102 | 441 " -a: Email address to subscribe \n" |
442 " -c: Send welcome mail\n" | |
443 " -C: Request mail confirmation\n" | |
338 | 444 " -d: Subscribe to digest of list\n" |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
445 " -f: Force subscription (do not moderate)\n" |
102 | 446 " -h: This help\n" |
447 " -L: Full path to list directory\n" | |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
448 " -m: moderation string\n" |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
449 " -n: Subscribe to no mail version of list\n", prg); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
450 printf(" -s: Don't send a mail to subscriber if already subscribed\n" |
218 | 451 " -U: Don't switch to the user id of the listdir owner\n" |
102 | 452 " -V: Print version\n" |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
453 "When no options are specified, subscription may be " |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
454 "moderated;\nto ensure a silent subscription, use -f\n"); |
34 | 455 exit(EXIT_SUCCESS); |
456 } | |
457 | |
499 | 458 void generate_subscribed(const char *listdir, const char *subaddr, |
459 const char *mlmmjsend) | |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
460 { |
499 | 461 char *queuefilename, *fromaddr, *listname, *listfqdn, *listaddr; |
520 | 462 char *listdelim = getlistdelim(listdir); |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
463 |
499 | 464 listaddr = getlistaddr(listdir); |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
465 listname = genlistname(listaddr); |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
466 listfqdn = genlistfqdn(listaddr); |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
467 |
520 | 468 fromaddr = concatstr(4, listname, listdelim, "bounces-help@", listfqdn); |
469 myfree(listdelim); | |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
470 |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
471 queuefilename = prepstdreply(listdir, "sub-subscribed", "$helpaddr$", |
741
b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
Ben Schmidt
parents:
728
diff
changeset
|
472 subaddr, NULL, 0, NULL, NULL); |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
473 MY_ASSERT(queuefilename); |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
474 |
499 | 475 myfree(listaddr); |
476 myfree(listname); | |
477 myfree(listfqdn); | |
478 | |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
479 execlp(mlmmjsend, mlmmjsend, |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
480 "-l", "1", |
529
d65b467b647d
Pass on listdir to mlmmjsend so we can get the smtpport and relayhost also
mmj
parents:
520
diff
changeset
|
481 "-L", listdir, |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
482 "-T", subaddr, |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
483 "-F", fromaddr, |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
484 "-m", queuefilename, (char *)NULL); |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
485 log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend); |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
486 |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
487 exit(EXIT_FAILURE); |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
488 } |
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
489 |
34 | 490 int main(int argc, char **argv) |
491 { | |
520 | 492 char *listaddr, *listdelim, *listdir = NULL, *address = NULL; |
493 char *subfilename = NULL, *mlmmjsend, *bindir, chstr[2], *subdir; | |
532 | 494 char *subddirname = NULL, *sublockname, *lowcaseaddr; |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
495 char *modstr = NULL; |
291 | 496 int subconfirm = 0, confirmsub = 0, opt, subfilefd, lock, notifysub; |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
497 int changeuid = 1, status, digest = 0, nomail = 0, i = 0, submod = 0; |
517 | 498 int groupwritable = 0, sublock, sublockfd, nogensubscribed = 0, subbed; |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
499 int force = 0; |
44 | 500 size_t len; |
218 | 501 struct stat st; |
291 | 502 pid_t pid, childpid; |
342 | 503 uid_t uid; |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
504 enum subtype typesub = SUB_NORMAL; |
34 | 505 |
208
688011dbc4b7
Add a macro to make sure mlmmj binaries are invoked with full path
mmj
parents:
181
diff
changeset
|
506 CHECKFULLPATH(argv[0]); |
688011dbc4b7
Add a macro to make sure mlmmj binaries are invoked with full path
mmj
parents:
181
diff
changeset
|
507 |
688011dbc4b7
Add a macro to make sure mlmmj binaries are invoked with full path
mmj
parents:
181
diff
changeset
|
508 log_set_name(argv[0]); |
688011dbc4b7
Add a macro to make sure mlmmj binaries are invoked with full path
mmj
parents:
181
diff
changeset
|
509 |
117
9a39dff171fa
added mydirname() and mybasename() which doesn't mess with their argument, and
mortenp
parents:
102
diff
changeset
|
510 bindir = mydirname(argv[0]); |
9a39dff171fa
added mydirname() and mybasename() which doesn't mess with their argument, and
mortenp
parents:
102
diff
changeset
|
511 mlmmjsend = concatstr(2, bindir, "/mlmmj-send"); |
245 | 512 myfree(bindir); |
34 | 513 |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
514 while ((opt = getopt(argc, argv, "hcCdfm:nsVUL:a:")) != -1) { |
34 | 515 switch(opt) { |
516 case 'a': | |
517 address = optarg; | |
518 break; | |
519 case 'c': | |
520 confirmsub = 1; | |
521 break; | |
522 case 'C': | |
523 subconfirm = 1; | |
524 break; | |
338 | 525 case 'd': |
526 digest = 1; | |
527 break; | |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
528 case 'f': |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
529 force = 1; |
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
530 break; |
34 | 531 case 'h': |
532 print_help(argv[0]); | |
533 break; | |
534 case 'L': | |
535 listdir = optarg; | |
536 break; | |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
537 case 'm': |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
538 modstr = optarg; |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
539 break; |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
540 case 'n': |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
541 nomail = 1; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
542 break; |
509 | 543 case 's': |
544 nogensubscribed = 1; | |
545 break; | |
218 | 546 case 'U': |
547 changeuid = 0; | |
548 break; | |
34 | 549 case 'V': |
550 print_version(argv[0]); | |
551 exit(0); | |
552 } | |
553 } | |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
554 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
555 if(listdir == NULL) { |
562 | 556 fprintf(stderr, "You have to specify -L\n"); |
34 | 557 fprintf(stderr, "%s -h for help\n", argv[0]); |
558 exit(EXIT_FAILURE); | |
559 } | |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
560 |
562 | 561 if(address == NULL && modstr == NULL) { |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
562 fprintf(stderr, "You have to specify -a or -m\n"); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
563 fprintf(stderr, "%s -h for help\n", argv[0]); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
564 exit(EXIT_FAILURE); |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
565 } |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
566 |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
567 if(modstr) |
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
568 getaddrandtype(listdir, modstr, &address, &typesub); |
34 | 569 |
456
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
570 if(strchr(address, '@') == NULL) { |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
571 log_error(LOG_ARGS, "No '@' sign in '%s', not subscribing", |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
572 address); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
573 exit(EXIT_SUCCESS); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
574 } |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
575 |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
576 if(digest && nomail) { |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
577 fprintf(stderr, "Specify either -d or -n, not both\n"); |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
578 fprintf(stderr, "%s -h for help\n", argv[0]); |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
579 exit(EXIT_FAILURE); |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
580 } |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
581 |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
582 if(digest) |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
583 typesub = SUB_DIGEST; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
584 if(nomail) |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
585 typesub = SUB_NOMAIL; |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
586 |
34 | 587 if(confirmsub && subconfirm) { |
588 fprintf(stderr, "Cannot specify both -C and -c\n"); | |
589 fprintf(stderr, "%s -h for help\n", argv[0]); | |
590 exit(EXIT_FAILURE); | |
591 } | |
592 | |
532 | 593 /* Make the address lowercase */ |
594 lowcaseaddr = mystrdup(address); | |
595 i = 0; | |
596 while(lowcaseaddr[i]) { | |
597 lowcaseaddr[i] = tolower(lowcaseaddr[i]); | |
598 i++; | |
599 } | |
600 address = lowcaseaddr; | |
601 | |
34 | 602 /* get the list address */ |
69 | 603 listaddr = getlistaddr(listdir); |
34 | 604 if(strncasecmp(listaddr, address, strlen(listaddr)) == 0) { |
605 printf("Cannot subscribe the list address to the list\n"); | |
606 exit(EXIT_SUCCESS); /* XXX is this success? */ | |
607 } | |
608 | |
517 | 609 switch(typesub) { |
610 default: | |
611 case SUB_NORMAL: | |
612 subdir = "/subscribers.d/"; | |
613 break; | |
614 case SUB_DIGEST: | |
615 subdir = "/digesters.d/"; | |
616 break; | |
617 case SUB_NOMAIL: | |
618 subdir = "/nomailsubs.d/"; | |
619 break; | |
620 } | |
621 | |
622 subddirname = concatstr(2, listdir, subdir); | |
355 | 623 if (stat(subddirname, &st) == 0) { |
624 if(st.st_mode & S_IWGRP) { | |
625 groupwritable = S_IRGRP|S_IWGRP; | |
626 umask(S_IWOTH); | |
627 setgid(st.st_gid); | |
628 } | |
629 } | |
630 | |
218 | 631 if(changeuid) { |
342 | 632 uid = getuid(); |
633 if(!uid && stat(listdir, &st) == 0) { | |
218 | 634 printf("Changing to uid %d, owner of %s.\n", |
635 (int)st.st_uid, listdir); | |
636 if(setuid(st.st_uid) < 0) { | |
637 perror("setuid"); | |
638 fprintf(stderr, "Continuing as uid %d\n", | |
342 | 639 (int)uid); |
218 | 640 } |
641 } | |
642 } | |
643 | |
81
f435923b65e4
mlmmj-{,un}sub have been brought up to speed in a coordinated effort
mortenp
parents:
71
diff
changeset
|
644 chstr[0] = address[0]; |
f435923b65e4
mlmmj-{,un}sub have been brought up to speed in a coordinated effort
mortenp
parents:
71
diff
changeset
|
645 chstr[1] = '\0'; |
343
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
646 |
6d1f589dee87
This is post crash commit of working copy mmj. Will test compile etc.
mmj
parents:
342
diff
changeset
|
647 subfilename = concatstr(3, listdir, subdir, chstr); |
34 | 648 |
456
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
649 sublockname = concatstr(5, listdir, subdir, ".", chstr, ".lock"); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
650 sublockfd = open(sublockname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
651 if(sublockfd < 0) { |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
652 log_error(LOG_ARGS, "Error opening lock file %s", |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
653 sublockname); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
654 myfree(sublockname); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
655 exit(EXIT_FAILURE); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
656 } |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
657 |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
658 sublock = myexcllock(sublockfd); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
659 if(sublock < 0) { |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
660 log_error(LOG_ARGS, "Error locking '%s' file", |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
661 sublockname); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
662 myfree(sublockname); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
663 close(sublockfd); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
664 exit(EXIT_FAILURE); |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
665 } |
160dab909572
Add .filename.lock file to lock against. Only allow addresses with a @ in them. 1.2.3
mmj
parents:
435
diff
changeset
|
666 |
355 | 667 subfilefd = open(subfilename, O_RDWR|O_CREAT, |
668 S_IRUSR|S_IWUSR|groupwritable); | |
34 | 669 if(subfilefd == -1) { |
39 | 670 log_error(LOG_ARGS, "Could not open '%s'", subfilename); |
465 | 671 myfree(sublockname); |
34 | 672 exit(EXIT_FAILURE); |
673 } | |
674 | |
675 lock = myexcllock(subfilefd); | |
676 if(lock) { | |
39 | 677 log_error(LOG_ARGS, "Error locking subscriber file"); |
34 | 678 close(subfilefd); |
465 | 679 close(sublockfd); |
680 myfree(sublockname); | |
34 | 681 exit(EXIT_FAILURE); |
682 } | |
517 | 683 subbed = is_subbed_in(subddirname, address); |
520 | 684 listdelim = getlistdelim(listdir); |
560
3258e74426b3
Subscriber moderation finished. Will test it all later tonight, but
mmj
parents:
553
diff
changeset
|
685 if(modstr == NULL) |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
686 submod = !force && statctrl(listdir, "submod"); |
541 | 687 |
517 | 688 if(subbed) { |
462 | 689 if(subconfirm) { |
690 close(subfilefd); | |
465 | 691 close(sublockfd); |
462 | 692 unlink(sublockname); |
465 | 693 myfree(sublockname); |
520 | 694 generate_subconfirm(listdir, listaddr, listdelim, |
695 address, mlmmjsend, typesub); | |
462 | 696 } else { |
541 | 697 if(submod) { |
698 close(subfilefd); | |
699 close(sublockfd); | |
700 unlink(sublockname); | |
701 myfree(sublockname); | |
702 moderate_sub(listdir, listaddr, listdelim, | |
703 address, mlmmjsend, typesub); | |
704 } | |
34 | 705 lseek(subfilefd, 0L, SEEK_END); |
706 len = strlen(address); | |
707 address[len] = '\n'; | |
708 writen(subfilefd, address, len + 1); | |
709 address[len] = 0; | |
462 | 710 close(subfilefd); |
465 | 711 close(sublockfd); |
462 | 712 unlink(sublockname); |
34 | 713 } |
714 } else { | |
412 | 715 close(subfilefd); |
245 | 716 myfree(subfilename); |
465 | 717 close(sublockfd); |
718 unlink(sublockname); | |
719 myfree(sublockname); | |
495
c5e975579329
patch for warning people already subbed they are and same with unsub
mmj
parents:
465
diff
changeset
|
720 |
509 | 721 if(!nogensubscribed) |
722 generate_subscribed(listdir, address, mlmmjsend); | |
34 | 723 |
724 return EXIT_SUCCESS; | |
725 } | |
726 | |
465 | 727 close(sublockfd); |
728 unlink(sublockname); | |
729 myfree(sublockname); | |
730 | |
291 | 731 if(confirmsub) { |
732 childpid = fork(); | |
733 | |
734 if(childpid < 0) { | |
728
e5286b45f9ca
Fixed documentation regarding silent subscription, and added
Ben Schmidt
parents:
660
diff
changeset
|
735 log_error(LOG_ARGS, "Could not fork; owner not notified"); |
520 | 736 confirm_sub(listdir, listaddr, listdelim, address, |
541 | 737 mlmmjsend, typesub); |
291 | 738 } |
739 | |
740 if(childpid > 0) { | |
741 do /* Parent waits for the child */ | |
742 pid = waitpid(childpid, &status, 0); | |
743 while(pid == -1 && errno == EINTR); | |
744 } | |
745 | |
746 /* child confirms subscription */ | |
747 if(childpid == 0) | |
520 | 748 confirm_sub(listdir, listaddr, listdelim, address, |
541 | 749 mlmmjsend, typesub); |
291 | 750 } |
751 | |
752 notifysub = statctrl(listdir, "notifysub"); | |
753 | |
754 /* Notify list owner about subscription */ | |
755 if (notifysub) | |
520 | 756 notify_sub(listdir, listaddr, listdelim, address, mlmmjsend, |
757 typesub); | |
34 | 758 |
245 | 759 myfree(listaddr); |
520 | 760 myfree(listdelim); |
216 | 761 |
34 | 762 return EXIT_SUCCESS; |
763 } |