39#define WHO "ezmlm-store"
58static void die_usage() {
logmsg(
WHO,100,USAGE,
"ezmlm-store [-cCmMpPrRsSvV] dir"); }
69static char strnum[FMT_ULONG];
75stralloc outhost = {0};
76stralloc outlocal = {0};
92stralloc sendopt = {0};
131 d = 2 + str_chr(
act->s + 1,
'-');
132 cookie(hash,key.s,key.len,
act->s + d,
"",
"a");
133 *(
act->s +
act->len - 1) =
'.';
158 if (!stralloc_copys(&sendopt,
"-"))
die_nomem();
160 while ((
opt = getoptb(argc,argv,
"bBcCmMpPrRsSvVyY")) != opteof)
180 default: die_usage();
183 sender = env_get(
"SENDER");
186 if (!*sender || str_equal(sender,
"#@[]"))
191 if (!
dir) die_usage();
193 if (chdir(
dir) == -1)
226 switch (openreadclose(
"key",&key,32)) {
238 ?
"Delivered-To: confirm to "
239 :
"Delivered-To: moderator for "))
die_nomem();
261 if (!stralloc_copyb(&fnbase,strnum,fmt_ulong(strnum,
when)))
die_nomem();
262 if (!stralloc_append(&fnbase,
"."))
die_nomem();
263 if (!stralloc_catb(&fnbase,strnum,fmt_ulong(strnum,
pid)))
die_nomem();
266 if (stat(
fnmsg.s,&st) == -1)
if (errno == ENOENT)
break;
307 hdr_add2(
"List-ID: ",line.s,line.len);
318 strnum[fmt_ulong(strnum,(
unsigned long)
when)] = 0;
320 if (!stralloc_copy(&line,&outlocal))
die_nomem();
321 if (!stralloc_cats(&line,
"-allow-tc."))
die_nomem();
322 if (!stralloc_cats(&line,strnum))
die_nomem();
323 if (!stralloc_append(&line,
"."))
die_nomem();
325 if (!stralloc_append(&line,
"-"))
die_nomem();
326 i = str_rchr(sender,
'@');
327 if (!stralloc_catb(&line,sender,i))
die_nomem();
329 if (!stralloc_append(&line,
"="))
die_nomem();
330 if (!stralloc_cats(&line,sender + i + 1))
die_nomem();
404 if (getln(&
bi,&line,&
match,
'\n') == -1)
407 if (line.len == 1) flaginheader = 0;
414 if (case_startb(line.s,line.len,
"mailing-list:")) {
423 if (buffer_put(&
bo,line.s,line.len) == -1) die_msg();
433 if (buffer_flush(&
bo) == -1) die_msg();
434 if (fsync(
fdmsg) == -1) die_msg();
436 if (close(
fdmsg) == -1) die_msg();
443 if (!stralloc_copy(&line,&outlocal))
die_nomem();
444 if (!stralloc_cats(&line,
"-return-@"))
die_nomem();
445 if (!stralloc_cat(&line,&outhost))
die_nomem();
int issub()
Returns (char *) to match if userhost is in the subscriber database dbname, 0 otherwise....
int quote(stralloc *saout, const stralloc *sain)
const char auto_version[]
void wrap_exitcode(int pid)
void wrap_execbin(const char *program, struct stralloc *opts, const char *dir)
Error messages. If you translate these, I would urge you to keep the English version as well....
#define ERR_TMP_QMAIL_QUEUE
int lockfile(const char *)
const char * qmail_close(struct qmail *)
void qmail_puts(struct qmail *, const char *)
void qmail_put(struct qmail *, const char *, int)
void qmail_from(struct qmail *, const char *)
void qmail_to(struct qmail *, const char *)
unsigned long qmail_qp(struct qmail *)
int qmail_open(struct qmail *, const stralloc *)
charset, outhost, outlocal and flagcd are shared
void closesql(void)
close connection to SQL server, if open
unsigned long putsubs(const char *dir, unsigned long hash_lo, unsigned long hash_hi, int subwrite(), int flagsql)
int getconf_line(stralloc *sa, const char *fn, int flagrequired, const char *dir)
void ezcopy(struct qmail *qqp, const char *fn, char q)
void set_cpoutlocal(const stralloc *ln)
void set_cptarget(const char *tg)
void set_cpouthost(const stralloc *ln)
void set_cpconfirm(const char *cf)
int subto(char *s, unsigned int l)
void hdr_from(const char *append)
void hdr_boundary(int last)
void hdr_datemsgid(unsigned long when)
void cookie(char *hash, const char *key, unsigned int keylen, const char *date, const char *addr, const char *action)
ssize_t qqwrite(int fd, char *buf, unsigned int len)
void hdr_transferenc(void)
void hdr_add2(const char *start, const char *value, unsigned int len)
void hdr_add2s(const char *start, const char *value)
void encode_b64(const unsigned char *indata, unsigned int n, stralloc *outdata, int control)
void hdr_ctype(enum ctype ctype)
void hdr_mime(enum ctype ctype)
void makeacthash(stralloc *act)
int subto(char *s, unsigned int l)
ssize_t qqwrite(int fd, char *buf, unsigned int len)
const char * logmsg(const char *dir, unsigned long num, unsigned long listno, unsigned long subs, int done)