53 if (unlink(
intdfn) == -1)
return;
57 if (unlink(
messfn) == -1)
return;
72static unsigned int receivedfmt(
char *s)
78 i = fmt_str(s,
"Received: (qmail "); len += i;
if (s) s += i;
79 i = fmt_ulong(s,
mypid); len += i;
if (s) s += i;
80 i = fmt_str(s,
" invoked "); len += i;
if (s) s += i;
82 i = fmt_str(s,
"by alias"); len += i;
if (s) s += i;
84 i = fmt_str(s,
"from network"); len += i;
if (s) s += i;
86 i = fmt_str(s,
"for bounce"); len += i;
if (s) s += i;
88 i = fmt_str(s,
"by uid "); len += i;
if (s) s += i;
89 i = fmt_ulong(s,
uid); len += i;
if (s) s += i;
91 i = fmt_str(s,
"); "); len += i;
if (s) s += i;
104unsigned int pidfmt(
char *s,
unsigned long seq)
110 i = fmt_str(s,
"pid/"); len += i;
if (s) s += i;
111 i = fmt_ulong(s,
mypid); len += i;
if (s) s += i;
112 i = fmt_str(s,
"."); len += i;
if (s) s += i;
113 i = fmt_ulong(s,
starttime); len += i;
if (s) s += i;
114 i = fmt_str(s,
"."); len += i;
if (s) s += i;
115 i = fmt_ulong(s,seq); len += i;
if (s) s += i;
116 ++len;
if (s) *s++ = 0;
121char *
fnnum(
char *dirslash,
int flagsplit)
137 len =
pidfmt((
char *) 0,seq);
141 for (seq = 1; seq < 10; ++seq) {
142 if (
pidfmt((
char *) 0,seq) > len)
die(81);
157 char *qhpsiargs[6] = { 0, 0, 0, 0, 0, 0 };
163 unsigned int qhpsiminsize = 0;
164 unsigned int qhpsimaxsize = 0;
169 size = (
unsigned int) st.st_size;
171 x = env_get(
"QHPSIMINSIZE");
172 if (x) { scan_ulong(x,&u); qhpsiminsize = (
int) u; }
173 if (qhpsiminsize)
if (
size < qhpsiminsize)
return;
174 x = env_get(
"QHPSIMAXSIZE");
175 if (x) { scan_ulong(x,&u); qhpsimaxsize = (
int) u; }
176 if (qhpsimaxsize)
if (
size > qhpsimaxsize)
return;
179 switch (child = fork()) {
185 qhpsiargs[2] = env_get(
"QHPSIARG1");
186 if (!qhpsiargs[2]) qhpsiargs[2] = 0;
187 qhpsiargs[3] = env_get(
"QHPSIARG2");
188 if (!qhpsiargs[3]) qhpsiargs[3] = 0;
189 qhpsiargs[4] = env_get(
"QHPSIARG3");
190 if (!qhpsiargs[4]) qhpsiargs[4] = 0;
191 x = env_get(
"QHPSIRC");
192 if (x) { scan_ulong(x,&u); qhpsirc = (
int) u; }
193 execvp(*qhpsiargs,qhpsiargs);
196 if (wait_pid(&wstat,child) == -1)
die_qhpsi();
198 childrc = wait_exitcode(wstat);
199 if (childrc == qhpsirc) {
cleanup();
die(32); }
215 if (chdir(
"queue") == -1)
die(62);
221 qhpsi = env_get(
"QHPSI");
249 switch (buffer_copy(&
bo,&
bi)) {
272 if (ch !=
'F')
die(91);
274 for (len = 0; len <
ADDR; ++len) {
286 if (ch ==
'Q') {
qhpsi = 0;
break; }
287 if (ch !=
'T')
die(91);
289 for (len = 0; len <
ADDR; ++len) {
303 if ((
fd = open(
todofn,O_RDONLY)) < 0 || fsync(
fd) < 0 || close(
fd))
die(66);
unsigned int date822fmt(char *s, struct datetime *dt)
void datetime_tai(struct datetime *dt, datetime_sec t)
unsigned int fmtqfn(char *s, char *dirslash, unsigned long id, int flagsplit)
unsigned int pidfmt(char *s, unsigned long seq)
char * fnnum(char *dirslash, int flagsplit)
void qhpsiprog(char *arg)
char outbuf[BUFSIZE_LINE]