39#define WHO "ezmlm-confirm"
49static void die_usage() {
logmsg(
WHO,100,USAGE,B(
"ezmlm-confirm [-cCmMrRvV] dir [/path/ezmlm-send]")); }
53static stralloc key = {0};
55static stralloc
to = {0};
56static stralloc sendopt = {0};
60static stralloc line = {0};
61static stralloc fnbase = {0};
62static stralloc
fnmsg = {0};
64static const char *
dir;
68stralloc outhost = {0};
69stralloc outlocal = {0};
82static int checkfile(
const char *
fn)
87 if (stat(
fnmsg.s,&st) == 0)
return 1;
99static char qqbuf[256];
103static char textbuf[1024];
117 if (case_startb(line.s,line.len,
"return-path:")) {
118 x = 12 + byte_chr(line.s + 12,line.len - 12,
'<');
120 y = byte_rchr(line.s + x,line.len - x,
'>');
121 if (y + x != line.len) {
122 if (!stralloc_copyb(&
to,line.s + x + 1,y - 1))
die_nomem();
138 const char *replyto = (
char *) 0;
139 unsigned int start,confnum;
148 if (!stralloc_copys(&sendopt,
"-"))
die_nomem();
149 while ((
opt = getopt(argc,argv,
"cCmMrRt:T:vV")) != opteof)
160 case 'T':
if (optarg) replyto = optarg;
break;
163 default: die_usage();
166 dir = argv[optind++];
167 if (!
dir) die_usage();
169 sender = env_get(
"SENDER");
171 local = env_get(
"LOCAL");
173 def = env_get(
"DEFAULT");
178 if (!sender[str_chr(sender,
'@')])
180 if (str_equal(sender,
"#@[]"))
183 if (chdir(
dir) == -1)
186 switch (openreadclose(
"key",&key,32)) {
207 start = str_chr(
action,
'-');
209 confnum = 1 + start + str_chr(
action + start + 1,
'.');
211 confnum += 1 + str_chr(
action + confnum + 1,
'.');
213 if (!stralloc_copyb(&fnbase,
action+start+1,confnum-start-1))
die_nomem();
215 cookie(hash,key.s,key.len,fnbase.s,
"",
"a");
228 logmsg(
WHO,0,INFO,
"info: post rejected");
238 buffer_init(&bt,buffer_unixread,
fd,textbuf,
sizeof(textbuf));
240 if (getln(&bt,&line,&
match,
'\n') == -1 || !
match)
243 env_put2(
"SENDER",
to.s);
244 if (seek_begin(
fd) == -1)
const char auto_version[]
void wrap_execsh(const char *command)
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....
int lockfile(const char *)
void qmail_put(struct qmail *, const char *, int)
charset, outhost, outlocal and flagcd are shared
int getconf_line(stralloc *sa, const char *fn, int flagrequired, const char *dir)
void set_cpoutlocal(const stralloc *ln)
void set_cpouthost(const stralloc *ln)
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 maketo()
expects line to be a return-path line. If it is and the format is valid to is set to to the sender....
const char * logmsg(const char *dir, unsigned long num, unsigned long listno, unsigned long subs, int done)