s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
qmail-todo.c
Go to the documentation of this file.
1#include <sys/types.h>
2#include <sys/stat.h>
3#include <unistd.h>
4#include "alloc.h"
5#include "auto_qmail.h"
6#include "byte.h"
7#include "constmap.h"
8#include "control.h"
9#include "direntry.h"
10#include "error.h"
11#include "exit.h"
12#include "fmt.h"
13#include "fmtqfn.h"
14#include "getln.h"
15#include "open.h"
16#include "ndelay.h"
17#include "now.h"
18#include "readsubdir.h"
19#include "buffer.h"
20#include "scan.h"
21#include "select.h"
22#include "str.h"
23#include "sig.h"
24#include "stralloc.h"
25#include "trigger.h"
26#include "qsutil.h"
27#include "sendtodo.h"
28
29stralloc percenthack = {0};
31stralloc locals = {0};
33stralloc vdoms = {0};
35stralloc envnoathost = {0};
36
37char strnum[FMT_ULONG];
38
39/* XXX not good, if qmail-send.c changes this has to be updated */
40#define CHANNELS 2
41char *chanaddr[CHANNELS] = { "local/", "remote/" };
42
45
46void sendlog1(char *x);
47void sendlog3(char *x,char *y,char *z);
48
49void sigterm(void)
50{
51 if (flagquitasap == 0)
52 sendlog1("status: qmail-todo stop processing asap\n");
53 flagquitasap = 1;
54}
55
56int flagreadasap = 0; void sighup(void) { flagreadasap = 1; }
57int flagsendalive = 1; void senddied(void) { flagsendalive = 0; }
58
60{
61 sendlog1("alert: qmail-todo lost connection to qmail-clean ... exiting\n");
62 flagquitasap = 1;
63}
64
65
66/* this file is not so long ------------------------------------- FILENAMES */
67
68stralloc fn = {0};
69
70void fnmake_init(void)
71{
72 while (!stralloc_ready(&fn,FMTQFN)) nomem();
73}
74
75void fnmake_info(unsigned long id) { fn.len = fmtqfn(fn.s,"info/",id,1); }
76void fnmake_todo(unsigned long id) { fn.len = fmtqfn(fn.s,"todo/",id,1); }
77void fnmake_mess(unsigned long id) { fn.len = fmtqfn(fn.s,"mess/",id,1); }
78void fnmake_chanaddr(unsigned long id,int c) { fn.len = fmtqfn(fn.s,chanaddr[c],id,1); }
79
80
81/* this file is not so long ------------------------------------- REWRITING */
82
83stralloc rwline = {0};
84
85/* 1 if by land, 2 if by sea, 0 if out of memory. not allowed to barf. */
86/* may trash recip. must set up rwline, between a T and a \0. */
87
88int rewrite(char *recip)
89{
90 int i;
91 int j;
92 char *x;
93 static stralloc addr = {0};
94 int at;
95
96 if (!stralloc_copys(&rwline,"T")) return 0;
97 if (!stralloc_copys(&addr,recip)) return 0;
98
99 i = byte_rchr(addr.s,addr.len,'@');
100 if (i == addr.len) {
101 if (!stralloc_cats(&addr,"@")) return 0;
102 if (!stralloc_cat(&addr,&envnoathost)) return 0;
103 }
104
105 while (constmap(&mappercenthack,addr.s + i + 1,addr.len - i - 1)) {
106 j = byte_rchr(addr.s,i,'%');
107 if (j == i) break;
108 addr.len = i;
109 i = j;
110 addr.s[i] = '@';
111 }
112
113 at = byte_rchr(addr.s,addr.len,'@');
114
115 if (constmap(&maplocals,addr.s + at + 1,addr.len - at - 1)) {
116 if (!stralloc_cat(&rwline,&addr)) return 0;
117 if (!stralloc_0(&rwline)) return 0;
118 return 1;
119 }
120
121 for (i = 0; i <= addr.len; ++i)
122 if (!i || (i == at + 1) || (i == addr.len) || ((i > at) && (addr.s[i] == '.')))
123 if ((x = constmap(&mapvdoms,addr.s + i,addr.len - i))) {
124 if (!*x) break;
125 if (!stralloc_cats(&rwline,x)) return 0;
126 if (!stralloc_cats(&rwline,"-")) return 0;
127 if (!stralloc_cat(&rwline,&addr)) return 0;
128 if (!stralloc_0(&rwline)) return 0;
129 return 1;
130 }
131
132 if (!stralloc_cat(&rwline,&addr)) return 0;
133 if (!stralloc_0(&rwline)) return 0;
134 return 2;
135}
136
137/* this file is not so long --------------------------------- COMMUNICATION */
138
139buffer toqc; char toqcbuf[1024];
140buffer fromqc; char fromqcbuf[1024];
141stralloc comm_buf = {0};
143int fdout = -1;
144int fdin = -1;
145
146void sendlog1(char* x)
147{
148 int pos;
149
150 pos = comm_buf.len;
151 if (!stralloc_cats(&comm_buf,"L")) goto FAIL;
152 if (!stralloc_cats(&comm_buf,x)) goto FAIL;
153 if (!stralloc_0(&comm_buf)) goto FAIL;
154 return;
155
156 FAIL:
157 /* either all or nothing */
158 comm_buf.len = pos;
159}
160
161void sendlog3(char* x, char *y, char *z)
162{
163 int pos;
164
165 pos = comm_buf.len;
166 if (!stralloc_cats(&comm_buf,"L")) goto FAIL;
167 if (!stralloc_cats(&comm_buf,x)) goto FAIL;
168 if (!stralloc_cats(&comm_buf,y)) goto FAIL;
169 if (!stralloc_cats(&comm_buf,z)) goto FAIL;
170 if (!stralloc_0(&comm_buf)) goto FAIL;
171 return;
172
173 FAIL:
174 /* either all or nothing */
175 comm_buf.len = pos;
176}
177
178void comm_init(void)
179{
180 buffer_init(&toqc,write,2,toqcbuf,sizeof(toqcbuf));
181 buffer_init(&fromqc,read,3,fromqcbuf,sizeof(fromqcbuf));
182
183 fdout = 1; /* stdout */
184 fdin = 0; /* stdin */
185 if (ndelay_on(fdout) == -1)
186 /* this is so stupid: NDELAY semantics should be default on write */
187 senddied(); /* drastic, but better than risking deadlock */
188
189 while (!stralloc_ready(&comm_buf,1024)) nomem();
190}
191
193{
194 /* XXX: could allow a bigger buffer; say 10 recipients */
195 /* XXX: returns true if there is something in the buffer */
196 if (!flagsendalive) return 0;
197 if (comm_buf.s && comm_buf.len) return 1;
198 return 0;
199}
200
201void comm_write(unsigned long id, int local, int remote)
202{
203 int pos;
204 char *s;
205
206 if (local && remote) s="B";
207 else if (local) s="L";
208 else if (remote) s="R";
209 else s="X";
210
211 pos = comm_buf.len;
212 strnum[fmt_ulong(strnum,id)] = 0;
213 if (!stralloc_cats(&comm_buf,"D")) goto FAIL;
214 if (!stralloc_cats(&comm_buf,s)) goto FAIL;
215 if (!stralloc_cats(&comm_buf,strnum)) goto FAIL;
216 if (!stralloc_0(&comm_buf)) goto FAIL;
217 return;
218
219 FAIL:
220 /* either all or nothing */
221 comm_buf.len = pos;
222}
223
224void comm_info(unsigned long id, unsigned long size, char* from, unsigned long pid, unsigned long uid)
225{
226 int pos;
227 int i;
228
229 pos = comm_buf.len;
230 if (!stralloc_cats(&comm_buf,"Linfo msg ")) goto FAIL;
231 strnum[fmt_ulong(strnum,id)] = 0;
232 if (!stralloc_cats(&comm_buf,strnum)) goto FAIL;
233 if (!stralloc_cats(&comm_buf,": bytes ")) goto FAIL;
234 strnum[fmt_ulong(strnum,size)] = 0;
235 if (!stralloc_cats(&comm_buf,strnum)) goto FAIL;
236 if (!stralloc_cats(&comm_buf," from <")) goto FAIL;
237 i = comm_buf.len;
238 if (!stralloc_cats(&comm_buf,from)) goto FAIL;
239
240 for (; i < comm_buf.len; ++i)
241 if (comm_buf.s[i] == '\n')
242 comm_buf.s[i] = '/';
243 else
244 if (!issafe(comm_buf.s[i]))
245 comm_buf.s[i] = '_';
246
247 if (!stralloc_cats(&comm_buf,"> qp ")) goto FAIL;
248 strnum[fmt_ulong(strnum,pid)] = 0;
249 if (!stralloc_cats(&comm_buf,strnum)) goto FAIL;
250 if (!stralloc_cats(&comm_buf," uid ")) goto FAIL;
251 strnum[fmt_ulong(strnum,uid)] = 0;
252 if (!stralloc_cats(&comm_buf,strnum)) goto FAIL;
253 if (!stralloc_cats(&comm_buf,"\n")) goto FAIL;
254 if (!stralloc_0(&comm_buf)) goto FAIL;
255 return;
256
257 FAIL:
258 /* either all or nothing */
259 comm_buf.len = pos;
260}
261
262void comm_exit(void)
263{
264 /* if it FAILs exit, we have already stoped */
265 if (!stralloc_cats(&comm_buf,"X")) _exit(1);
266 if (!stralloc_0(&comm_buf)) _exit(1);
267}
268
269void comm_selprep(int *nfds, fd_set *wfds, fd_set *rfds)
270{
271 if (flagsendalive) {
272 if (flagquitasap && comm_canwrite() == 0)
273 comm_exit();
274 if (comm_canwrite()) {
275 FD_SET(fdout,wfds);
276 if (*nfds <= fdout)
277 *nfds = fdout + 1;
278 }
279 FD_SET(fdin,rfds);
280 if (*nfds <= fdin)
281 *nfds = fdin + 1;
282 }
283}
284
285void comm_do(fd_set *wfds, fd_set *rfds)
286{
287 /* first write then read */
288 if (flagsendalive)
289 if (comm_canwrite())
290 if (FD_ISSET(fdout,wfds)) {
291 int w;
292 int len;
293 len = comm_buf.len;
294 w = write(fdout,comm_buf.s + comm_pos,len - comm_pos);
295 if (w <= 0) {
296 if ((w == -1) && (errno == EPIPE))
297 senddied();
298 } else {
299 comm_pos += w;
300 if (comm_pos == len) {
301 comm_buf.len = 0;
302 comm_pos = 0;
303 }
304 }
305 }
306 if (flagsendalive)
307 if (FD_ISSET(fdin,rfds)) {
308 /* there are only two messages 'H' and 'X' */
309 char c;
310 int r;
311 r = read(fdin, &c, 1);
312 if (r <= 0) {
313 if ((r == -1) && (errno != EINTR))
314 senddied();
315 } else {
316 switch (c) {
317 case 'H':
318 sighup();
319 break;
320 case 'X':
321 sigterm();
322 break;
323 default:
324 sendlog1("warning: qmail-todo: qmail-send speaks an obscure dialect\n");
325 break;
326 }
327 }
328 }
329}
330
331/* this file is not so long ------------------------------------------ TODO */
332
334int flagtododir; /* if 0, have to opendir again */
336stralloc todoline = {0};
337char todobuf[BUFFER_INSIZE];
338char todobufinfo[512];
340
341void todo_init(void)
342{
343 flagtododir = 0;
344 nexttodorun = now();
345 trigger_set();
346}
347
348void todo_selprep(int *nfds, fd_set *rfds, datetime_sec *wakeup)
349{
350 if (flagquitasap) return;
351 trigger_selprep(nfds,rfds);
352 if (flagtododir) *wakeup = 0;
353 if (*wakeup > nexttodorun) *wakeup = nexttodorun;
354}
355
356void todo_do(fd_set *rfds)
357{
358 struct stat st;
359 buffer bi;
360 int fd;
361 buffer bo;
362 int fdnumber;
363 buffer bchan[CHANNELS];
364 int fdchan[CHANNELS];
365 int flagchan[CHANNELS];
366 char ch;
367 int match;
368 unsigned long id;
369 int c;
370 unsigned long uid;
371 unsigned long pid;
372
373 fd = -1;
374 fdnumber = -1;
375 for (c = 0; c < CHANNELS; ++c)
376 fdchan[c] = -1;
377
378 if (flagquitasap) return;
379
380 if (!flagtododir) {
381 if (!trigger_pulled(rfds)) {
382 if (recent < nexttodorun) return;
383 }
384 trigger_set();
386 flagtododir = 1;
388 }
389
390 switch (readsubdir_next(&todosubdir,&id)) {
391 case 1: break;
392 case 0: flagtododir = 0;
393 default: return;
394 }
395
396 fnmake_todo(id);
397
398 fd = open_read(fn.s);
399 if (fd == -1) { sendlog3("warning: qmail-todo: unable to open ",fn.s,"\n"); return; }
400
401 fnmake_mess(id);
402 /* just for the statistics */
403 if (stat(fn.s,&st) == -1)
404 { sendlog3("warning: qmail-todo: unable to stat ",fn.s," for mess\n"); goto FAIL; }
405
406 for (c = 0; c < CHANNELS; ++c) {
407 fnmake_chanaddr(id,c);
408 if (unlink(fn.s) == -1) if (errno != ENOENT)
409 { sendlog3("warning: qmail-todo: unable to unlink ",fn.s," for mess\n"); goto FAIL; }
410 }
411
412 fnmake_info(id);
413 if (unlink(fn.s) == -1) if (errno != ENOENT)
414 { sendlog3("warning: qmail-todo: unable to unlink ",fn.s," for info\n"); goto FAIL; }
415
416 fdnumber = open_excl(fn.s);
417 if (fdnumber == -1)
418 { sendlog3("warning: qmail-todo: unable to create ",fn.s," for info\n"); goto FAIL; }
419
420 strnum[fmt_ulong(strnum,id)] = 0;
421 sendlog3("new msg ",strnum,"\n");
422
423 for (c = 0; c < CHANNELS; ++c)
424 flagchan[c] = 0;
425
426 buffer_init(&bi,read,fd,todobuf,sizeof(todobuf));
427 buffer_init(&bo,write,fdnumber,todobufinfo,sizeof(todobufinfo));
428
429 uid = 0;
430 pid = 0;
431
432 for (;;) {
433 if (getln(&bi,&todoline,&match,'\0') == -1) {
434 /* perhaps we're out of memory, perhaps an I/O error */
435 fnmake_todo(id);
436 sendlog3("warning: qmail-todo: trouble reading ",fn.s,"\n"); goto FAIL;
437 }
438 if (!match) break;
439
440 switch (todoline.s[0]) {
441 case 'u':
442 scan_ulong(todoline.s + 1,&uid); break;
443 case 'p':
444 scan_ulong(todoline.s + 1,&pid); break;
445 case 'F':
446 if (buffer_putflush(&bo,todoline.s,todoline.len) == -1) {
447 fnmake_info(id);
448 sendlog3("warning: qmail-todo: trouble writing to ",fn.s," for todo\n"); goto FAIL;
449 }
450 comm_info(id,(unsigned long) st.st_size,todoline.s + 1,pid,uid);
451 break;
452 case 'T':
453 switch (rewrite(todoline.s + 1)) {
454 case 0: nomem(); goto FAIL;
455 case 2: c = 1; break;
456 default: c = 0; break;
457 }
458 if (fdchan[c] == -1) {
459 fnmake_chanaddr(id,c);
460 fdchan[c] = open_excl(fn.s);
461 if (fdchan[c] == -1)
462 { sendlog3("warning: qmail-todo: unable to create ",fn.s," for delivery\n"); goto FAIL; }
463 buffer_init(&bchan[c],write,fdchan[c],todobufchan[c],sizeof(todobufchan[c]));
464 flagchan[c] = 1;
465 }
466 if (buffer_put(&bchan[c],rwline.s,rwline.len) == -1) {
467 fnmake_chanaddr(id,c);
468 sendlog3("warning: qmail-todo: trouble writing to ",fn.s," for delivery\n"); goto FAIL;
469 }
470 break;
471 default:
472 fnmake_todo(id);
473 sendlog3("warning: qmail-todo: unknown record type in ",fn.s,"\n"); goto FAIL;
474 }
475 }
476
477 close(fd); fd = -1;
478
479 fnmake_info(id);
480 if (buffer_flush(&bo) == -1)
481 { sendlog3("warning: qmail-todo: trouble writing to ",fn.s," for info\n"); goto FAIL; }
482 if (fsync(fdnumber) == -1)
483 { sendlog3("warning: qmail-todo: trouble fsyncing ",fn.s," for info\n"); goto FAIL; }
484 close(fdnumber); fdnumber = -1;
485
486 for (c = 0; c < CHANNELS; ++c)
487 if (fdchan[c] != -1) {
488 fnmake_chanaddr(id,c);
489 if (buffer_flush(&bchan[c]) == -1) { sendlog3("warning: qmail-todo: trouble writing to ",fn.s," in channel\n"); goto FAIL; }
490 if (fsync(fdchan[c]) == -1) { sendlog3("warning: qmail-todo: trouble fsyncing ",fn.s," in channel\n"); goto FAIL; }
491 close(fdchan[c]); fdchan[c] = -1;
492 }
493
494 fnmake_todo(id);
495 if (buffer_putflush(&toqc,fn.s,fn.len) == -1) { cleandied(); return; }
496 if (buffer_get(&fromqc,&ch,1) != 1) { cleandied(); return; }
497
498 if (ch != '+') {
499 sendlog3("warning: qmail-clean unable to clean up ",fn.s,"\n");
500 return;
501 }
502
503 comm_write(id,flagchan[0],flagchan[1]);
504 return;
505
506 FAIL:
507 if (fd != -1) close(fd);
508 if (fdnumber != -1) close(fdnumber);
509 for (c = 0; c < CHANNELS; ++c)
510 if (fdchan[c] != -1) close(fdchan[c]);
511}
512
513/* this file is too long ---------------------------------------------- MAIN */
514
515int getcontrols(void)
516{
517 if (control_init() == -1) return 0;
518 if (control_rldef(&envnoathost,"control/envnoathost",1,"envnoathost") != 1) return 0;
519 if (control_readfile(&locals,"control/locals",1) != 1) return 0;
520 if (!constmap_init(&maplocals,locals.s,locals.len,0)) return 0;
521 switch (control_readfile(&percenthack,"control/percenthack",0)) {
522 case -1: return 0;
523 case 0: if (!constmap_init(&mappercenthack,"",0,0)) return 0; break;
524 case 1: if (!constmap_init(&mappercenthack,percenthack.s,percenthack.len,0)) return 0; break;
525 }
526 switch (control_readfile(&vdoms,"control/virtualdomains",0)) {
527 case -1: return 0;
528 case 0: if (!constmap_init(&mapvdoms,"",0,1)) return 0; break;
529 case 1: if (!constmap_init(&mapvdoms,vdoms.s,vdoms.len,1)) return 0; break;
530 }
531 return 1;
532}
533
534stralloc newlocals = {0};
535stralloc newvdoms = {0};
536
538{
539 int r;
540
541 if (control_readfile(&newlocals,"control/locals",1) != 1)
542 { sendlog1("alert: qmail-todo: unable to reread control/locals\n"); return; }
543 r = control_readfile(&newvdoms,"control/virtualdomains",0);
544 if (r == -1)
545 { sendlog1("alert: qmail-todo: unable to reread control/virtualdomains\n"); return; }
546
549
550 while (!stralloc_copy(&locals,&newlocals)) nomem();
551 while (!constmap_init(&maplocals,locals.s,locals.len,0)) nomem();
552
553 if (r) {
554 while (!stralloc_copy(&vdoms,&newvdoms)) nomem();
555 while (!constmap_init(&mapvdoms,vdoms.s,vdoms.len,1)) nomem();
556 }
557 else
558 while (!constmap_init(&mapvdoms,"",0,1)) nomem();
559}
560
561void reread(void)
562{
563 if (chdir(auto_qmail) == -1) {
564 sendlog1("alert: qmail-todo: unable to reread controls: unable to switch to home directory\n");
565 return;
566 }
567
569 while (chdir("queue") == -1) {
570 sendlog1("alert: qmail-todo: unable to switch back to queue directory; HELP! sleeping...\n");
571 sleep(10);
572 }
573}
574
575int main()
576{
577 datetime_sec wakeup;
578 fd_set rfds;
579 fd_set wfds;
580 int nfds;
581 struct timeval tv;
582 int r;
583 char c;
584
585 if (chdir(auto_qmail) == -1)
586 { sendlog1("alert: qmail-todo: cannot start: unable to switch to home directory\n"); _exit(110); }
587 if (!getcontrols())
588 { sendlog1("alert: qmail-todo: cannot start: unable to read controls\n"); _exit(112); }
589 if (chdir("queue") == -1)
590 { sendlog1("alert: qmail-todo: cannot start: unable to switch to queue directory\n"); _exit(110); }
591 sig_pipeignore();
592 umask(077);
593
594 fnmake_init();
595 todo_init();
596 comm_init();
597
598 do {
599 r = read(fdin, &c, 1);
600 if ((r == -1) && (errno != EINTR))
601 _exit(100); /* read failed probably qmail-send died */
602 } while ((r =! 1)); /* we assume it is a 'S' */
603
604 for (;;) {
605 recent = now();
606 if (flagreadasap) { flagreadasap = 0; reread(); }
607 if (!flagsendalive) {
608 /* qmail-send finaly exited, so do the same. */
609 if (flagquitasap) _exit(0);
610 /* qmail-send died. We can not log and we can not work therefor _exit(1). */
611 _exit(1);
612 }
613
614 wakeup = recent + SLEEP_FOREVER;
615 FD_ZERO(&rfds);
616 FD_ZERO(&wfds);
617 nfds = 1;
618
619 todo_selprep(&nfds,&rfds,&wakeup);
620 comm_selprep(&nfds,&wfds,&rfds);
621
622 if (wakeup <= recent) tv.tv_sec = 0;
623 else tv.tv_sec = wakeup - recent + SLEEP_FUZZ;
624 tv.tv_usec = 0;
625
626 if (select(nfds,&rfds,&wfds,(fd_set *) 0,&tv) == -1)
627 if (errno == EINTR)
628 ;
629 else
630 sendlog1("warning: qmail-todo: trouble in select\n");
631 else {
632 recent = now();
633
634 todo_do(&rfds);
635 comm_do(&wfds, &rfds);
636 }
637 }
638 /* NOTREACHED */
639 _exit(1);
640}
641
char auto_qmail[]
void nomem()
Definition: columnt.c:16
buffer bo
Definition: columnt.c:14
buffer bi
Definition: condredirect.c:23
int constmap_init(struct constmap *cm, char *s, int len, int flagcolon)
Definition: constmap.c:35
void constmap_free()
int control_rldef(stralloc *sa, char *fn, int flagme, char *def)
Definition: control.c:41
int control_readfile(stralloc *sa, char *fn, int flagme)
Definition: control.c:86
int control_init(void)
Definition: control.c:32
long datetime_sec
Definition: datetime.h:15
int stralloc_copys(stralloc *, char const *)
void _exit()
unsigned int fmtqfn(char *s, char *dirslash, unsigned long id, int flagsplit)
Definition: fmtqfn.c:5
#define FMTQFN
Definition: fmtqfn.h:6
void z(char *, char *, int, int, int, int)
Definition: install.c:101
void c(char *, char *, char *, int, int, int)
Definition: install.c:57
int match
Definition: matchup.c:195
ulongalloc uid
Definition: matchup.c:58
datetime_sec now()
Definition: now.c:5
int fd
char * local
Definition: qmail-getpw.c:18
int remote
Definition: qmail-mrtg.c:27
unsigned long size
Definition: qmail-qread.c:55
unsigned long id
Definition: qmail-qread.c:52
stralloc recip
Definition: qmail-remote.c:99
int j
Definition: qmail-send.c:920
stralloc addr
Definition: qmail-smtpd.c:521
char toqcbuf[1024]
Definition: qmail-todo.c:139
datetime_sec recent
Definition: qmail-todo.c:43
void sendlog1(char *x)
Definition: qmail-todo.c:146
void cleandied()
Definition: qmail-todo.c:59
void sighup(void)
Definition: qmail-todo.c:56
stralloc comm_buf
Definition: qmail-todo.c:141
int getcontrols(void)
Definition: qmail-todo.c:515
readsubdir todosubdir
Definition: qmail-todo.c:335
#define CHANNELS
Definition: qmail-todo.c:40
int flagreadasap
Definition: qmail-todo.c:56
void fnmake_todo(unsigned long id)
Definition: qmail-todo.c:76
void fnmake_info(unsigned long id)
Definition: qmail-todo.c:75
buffer toqc
Definition: qmail-todo.c:139
stralloc fn
Definition: qmail-todo.c:68
int comm_pos
Definition: qmail-todo.c:142
char * chanaddr[CHANNELS]
Definition: qmail-todo.c:41
char strnum[FMT_ULONG]
Definition: qmail-todo.c:37
stralloc vdoms
Definition: qmail-todo.c:33
void todo_init(void)
Definition: qmail-todo.c:341
int rewrite(char *recip)
Definition: qmail-todo.c:88
int fdin
Definition: qmail-todo.c:144
char todobufinfo[512]
Definition: qmail-todo.c:338
void comm_init(void)
Definition: qmail-todo.c:178
void comm_write(unsigned long id, int local, int remote)
Definition: qmail-todo.c:201
datetime_sec nexttodorun
Definition: qmail-todo.c:333
void comm_exit(void)
Definition: qmail-todo.c:262
stralloc envnoathost
Definition: qmail-todo.c:35
stralloc todoline
Definition: qmail-todo.c:336
void regetcontrols(void)
Definition: qmail-todo.c:537
stralloc locals
Definition: qmail-todo.c:31
int fdout
Definition: qmail-todo.c:143
stralloc percenthack
Definition: qmail-todo.c:29
struct constmap mappercenthack
Definition: qmail-todo.c:30
void fnmake_mess(unsigned long id)
Definition: qmail-todo.c:77
void todo_do(fd_set *rfds)
Definition: qmail-todo.c:356
int flagtododir
Definition: qmail-todo.c:334
char todobufchan[CHANNELS][1024]
Definition: qmail-todo.c:339
stralloc newlocals
Definition: qmail-todo.c:534
stralloc rwline
Definition: qmail-todo.c:83
void comm_do(fd_set *wfds, fd_set *rfds)
Definition: qmail-todo.c:285
void sigterm(void)
Definition: qmail-todo.c:49
char fromqcbuf[1024]
Definition: qmail-todo.c:140
int comm_canwrite(void)
Definition: qmail-todo.c:192
buffer fromqc
Definition: qmail-todo.c:140
void todo_selprep(int *nfds, fd_set *rfds, datetime_sec *wakeup)
Definition: qmail-todo.c:348
void comm_info(unsigned long id, unsigned long size, char *from, unsigned long pid, unsigned long uid)
Definition: qmail-todo.c:224
stralloc newvdoms
Definition: qmail-todo.c:535
void reread(void)
Definition: qmail-todo.c:561
int flagsendalive
Definition: qmail-todo.c:57
struct constmap maplocals
Definition: qmail-todo.c:32
void fnmake_chanaddr(unsigned long id, int c)
Definition: qmail-todo.c:78
void senddied(void)
Definition: qmail-todo.c:57
int main()
Definition: qmail-todo.c:575
void comm_selprep(int *nfds, fd_set *wfds, fd_set *rfds)
Definition: qmail-todo.c:269
void fnmake_init(void)
Definition: qmail-todo.c:70
void sendlog3(char *x, char *y, char *z)
Definition: qmail-todo.c:161
char todobuf[BUFFER_INSIZE]
Definition: qmail-todo.c:337
int flagquitasap
Definition: qmail-todo.c:44
struct constmap mapvdoms
Definition: qmail-todo.c:34
void pausedir(char *)
Definition: qsutil.c:58
int issafe(char)
Definition: qsutil.c:64
int readsubdir_next()
void readsubdir_init()
#define SLEEP_FOREVER
Definition: sendtodo.h:9
#define SLEEP_TODO
Definition: sendtodo.h:7
#define SLEEP_FUZZ
Definition: sendtodo.h:8
void write()
int trigger_pulled()
void trigger_set()
Definition: trigger.c:9
void trigger_selprep()