51 if (unlink(
intdfn) == -1)
return;
55 if (unlink(
messfn) == -1)
return;
70static unsigned int receivedfmt(
char *s)
76 i = fmt_str(s,
"Received: (qmail "); len += i;
if (s) s += i;
77 i = fmt_ulong(s,
mypid); len += i;
if (s) s += i;
78 i = fmt_str(s,
" invoked "); len += i;
if (s) s += i;
80 i = fmt_str(s,
"by alias"); len += i;
if (s) s += i;
82 i = fmt_str(s,
"from network"); len += i;
if (s) s += i;
84 i = fmt_str(s,
"for bounce"); len += i;
if (s) s += i;
86 i = fmt_str(s,
"by uid "); len += i;
if (s) s += i;
87 i = fmt_ulong(s,
uid); len += i;
if (s) s += i;
89 i = fmt_str(s,
"); "); len += i;
if (s) s += i;
102unsigned int pidfmt(
char *s,
unsigned long seq)
108 i = fmt_str(s,
"pid/"); len += i;
if (s) s += i;
109 i = fmt_ulong(s,
mypid); len += i;
if (s) s += i;
110 i = fmt_str(s,
"."); len += i;
if (s) s += i;
111 i = fmt_ulong(s,
starttime); len += i;
if (s) s += i;
112 i = fmt_str(s,
"."); len += i;
if (s) s += i;
113 i = fmt_ulong(s,seq); len += i;
if (s) s += i;
114 ++len;
if (s) *s++ = 0;
119char *
fnnum(
char *dirslash,
int flagsplit)
135 len =
pidfmt((
char *) 0,seq);
139 for (seq = 1; seq < 10; ++seq) {
140 if (
pidfmt((
char *) 0,seq) > len)
die(81);
155 char *qhpsiargs[6] = { 0, 0, 0, 0, 0, 0 };
161 unsigned int qhpsiminsize = 0;
162 unsigned int qhpsimaxsize = 0;
167 size = (
unsigned int) st.st_size;
169 x = env_get(
"QHPSIMINSIZE");
170 if (x) { scan_ulong(x,&u); qhpsiminsize = (
int) u; }
171 if (qhpsiminsize)
if (
size < qhpsiminsize)
return;
172 x = env_get(
"QHPSIMAXSIZE");
173 if (x) { scan_ulong(x,&u); qhpsimaxsize = (
int) u; }
174 if (qhpsimaxsize)
if (
size > qhpsimaxsize)
return;
177 switch (child = fork()) {
183 qhpsiargs[2] = env_get(
"QHPSIARG1");
184 if (!qhpsiargs[2]) qhpsiargs[2] = 0;
185 qhpsiargs[3] = env_get(
"QHPSIARG2");
186 if (!qhpsiargs[3]) qhpsiargs[3] = 0;
187 qhpsiargs[4] = env_get(
"QHPSIARG3");
188 if (!qhpsiargs[4]) qhpsiargs[4] = 0;
189 x = env_get(
"QHPSIRC");
190 if (x) { scan_ulong(x,&u); qhpsirc = (
int) u; }
191 execvp(*qhpsiargs,qhpsiargs);
194 if (wait_pid(&wstat,child) == -1)
die_qhpsi();
196 childrc = wait_exitcode(wstat);
197 if (childrc == qhpsirc) {
cleanup();
die(32); }
213 if (chdir(
"queue") == -1)
die(62);
219 qhpsi = env_get(
"QHPSI");
247 switch (buffer_copy(&
bo,&
bi)) {
270 if (ch !=
'F')
die(91);
272 for (len = 0; len <
ADDR; ++len) {
284 if (ch ==
'Q') {
qhpsi = 0;
break; }
285 if (ch !=
'T')
die(91);
287 for (len = 0; len <
ADDR; ++len) {
301 if ((
fd = open(
todofn,O_RDONLY)) < 0 || fsync(
fd) < 0 || close(
fd))
die(66);
unsigned int date822fmt(char *s, struct datetime *dt)
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)