s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
qmail-qmaint.c
Go to the documentation of this file.
1/*
2 Based on an implementation of queue-fix 1.2 by Eric Huss
3*/
4#include <unistd.h>
5#include <sys/stat.h>
6#include <pwd.h>
7#include <grp.h>
8#include "stralloc.h"
9#include "direntry.h"
10#include "fmt.h"
11#include "fmtqfn.h"
12#include "error.h"
13#include "buffer.h"
14#include "getln.h"
15#include "str.h"
16#include "open.h"
17#include "fifo.h"
18#include "scan.h"
19#include "readsubdir.h"
20#include "logmsg.h"
21#include "exit.h"
22#include "auto_qmail.h"
23#include "auto_split.h"
24#include "auto_uids.h"
25
26#define WHO "qmail-qmaint"
27
28stralloc queue_dir = {0}; /*the root queue dir with trailing slash*/
29stralloc check_dir = {0}; /*the current directory being checked*/
30stralloc temp_dirname = {0}; /*temporary used for checking directories */
31stralloc temp_filename = {0}; /*temporary used for checking individuals*/
32stralloc old_name = {0}; /*used in rename*/
33stralloc new_name = {0}; /*used in rename*/
34stralloc mess_dir = {0}; /*used for renaming in mess dir*/
35stralloc query = {0}; /*used in interactive query function*/
36
37char strnum[FMT_ULONG];
44
50
51void die_make(char *name)
52{
53 logmsg(WHO,111,ERROR,B("Failed to make: ",name));
54}
55
56void die_user(char *user)
57{
58 logmsg(WHO,111,ERROR,B("Failed to determine uid of: ",user));
59}
60
61void die_group(char *group)
62{
63 logmsg(WHO,111,ERROR,B("Failed to determine gid of: ",group));
64}
65
67{
68 logmsg(WHO,111,ERROR,"Failed while checking directory structure. \nEnsure the given queue exists and you have permission to access it.");
69}
70
72{
73 logmsg(WHO,110,ERROR,"Failed to reconstruct queue. \nEnsure the queue exists and you have permission to modify it.");
74}
75
77{
78 logmsg(WHO,110,ERROR,"Out of memory.");
79}
80
81/*returns 1==yes, 0==no*/
82
84{
85 int match;
86
87 if (getln(buffer_0,&query,&match,'\n')) return 0;
88 if (!match) return 0;
89 if (query.s[0] == 'y' || query.s[0] == 'Y' || query.s[0] == '\n') return 1;
90 return 0;
91}
92
93/*gid may be -1 on files for "unknown*/
94
95#define DIRS logmsg(WHO,0,WARN,"It looks like some directories don't exist, should I create them? (Y/n)")
96#define FILES logmsg(WHO,0,WARN,"It looks like some files don't exist, should I create them? (Y/n)")
97
98#define PERMS logmsg(WHO,0,WARN,B("It looks like permissions are wrong for ",name," should I fix them? (Y/n)"))
99#define CPERMS logmsg(WHO,0,WARN,B("Changing permissions: ",name," => ",pnum))
100
101#define OWNER logmsg(WHO,0,WARN,B("It looks like ownerships are wrong for ",name," should I fix them? (Y/n)"))
102#define COWNER logmsg(WHO,0,WARN,B("Changing ownership: ",name," => ",unum,"/",gnum))
103
104int check_item(char *name,int uid,int gid,int perm,char type,int size)
105{
106 struct stat st;
107 int fd;
108 char num[12];
109 char unum[12];
110 char gnum[12];
111 char pnum[12];
112
113 /*check for existence and proper credentials*/
114
115 strnum[fmt_ulong(unum,uid)] = 0;
116 strnum[fmt_ulong(gnum,gid)] = 0;
117 strnum[fmt_ulong(pnum,perm)] = 0;
118
119 switch (type) {
120 case 'd': /*directory*/
121 if (stat(name,&st)) {
122 if (errno != ENOENT) return -1;
124 DIRS; if (!confirm()) return -1;
125 flag_dircreate = 1;
126 }
127 /*create it*/
128 logmsg(WHO,0,INFO,B("Creating directory: ",name));
129 if (mkdir(name,perm)) die_make(name);
130 CPERMS; if (chmod(name,perm)) die_make(name);
131 COWNER; if (chown(name,uid,gid)) die_make(name);
132 return 0;
133 }
134 /*check the values*/
135 if (st.st_uid != uid || st.st_gid != gid) {
136 if (!flag_permfix && flag_interactive) { OWNER; if (!confirm()) return -1; flag_permfix = 1; }
137 COWNER; if (chown(name,uid,gid)) die_make(name);
138 }
139 if ((st.st_mode & 07777) != perm) {
140 if (!flag_permfix && flag_interactive) { PERMS; if (!confirm()) return -1; flag_permfix = 1; }
141 CPERMS; if (chmod(name,perm)) die_make(name);
142 }
143 return 0;
144 case 'f': /*regular file*/
145 if (stat(name,&st)) return -1;
146 /*check the values*/
147 if (st.st_uid != uid || (st.st_gid != gid && gid != -1)) {
148 if (!flag_permfix && flag_interactive) { OWNER; if (!confirm()) return -1; flag_permfix = 1; }
149 COWNER; if (chown(name,uid,gid)) die_make(name);
150 }
151 if ((st.st_mode & 07777) != perm) {
152 if (!flag_permfix && flag_interactive) { PERMS; if (!confirm()) return -1; flag_permfix = 1; }
153 CPERMS; if (chmod(name,perm)) die_make(name);
154 }
155 return 0;
156 case 'z': /*regular file with a size*/
157 if (stat(name,&st)) {
158 if (errno != ENOENT) return -1;
160 FILES; if (!confirm()) return -1;
161 flag_filecreate = 1;
162 }
163 /*create it*/
164
165 strnum[fmt_ulong(num,size)] = 0;
166 logmsg(WHO,0,INFO,B("Creating: ",name," with size ",num));
167 fd = open_trunc(name);
168 if (fd == -1) die_make(name);
169 while (size--) { if (write(fd,"",1)!=1) die_make(name); }
170 close(fd);
171 CPERMS; if (chmod(name,perm)) die_make(name);
172 COWNER; if (chown(name,uid,gid)) die_make(name);
173 return 0;
174 }
175 /*check the values*/
176 if (st.st_uid != uid || (st.st_gid != gid && gid != -1)) {
177 if (!flag_permfix && flag_interactive) { OWNER; if (!confirm()) return -1; flag_permfix = 1; }
178 COWNER; if (chown(name,uid,gid)) die_make(name);
179 }
180 if ((st.st_mode & 07777) != perm) {
181 if (!flag_permfix && flag_interactive) { PERMS; if (!confirm()) return -1; flag_permfix = 1; }
182 CPERMS; if (chmod(name,perm)) die_make(name);
183 }
184 if (st.st_size != size) {
185 logmsg(WHO,0,WARN,B("File ",name," has not the right size. I will not fix it, please investigate."));
186 }
187 return 0;
188 case 'p': /*a named pipe*/
189 if (stat(name,&st)) {
190 if (errno != ENOENT) return -1;
192 FILES; if (!confirm()) return -1;
193 flag_filecreate = 1;
194 }
195 /*create it*/
196 logmsg(WHO,INFO,0,B("Creating fifo: ",name));
197 if (fifo_make(name,perm)) die_make(name);
198 CPERMS; if (chmod(name,perm)) die_make(name);
199 COWNER; if (chown(name,uid,gid)) die_make(name);
200 return 0;
201 }
202 /*check the values*/
203 if (st.st_uid != uid || (st.st_gid != gid && gid != -1)) {
204 if (!flag_permfix && flag_interactive) { OWNER; if (!confirm()) return -1; flag_permfix = 1; }
205 COWNER; if (chown(name,uid,gid)) die_make(name);
206 }
207 if ((st.st_mode & 07777) != perm) {
208 if (!flag_permfix && flag_interactive) { PERMS; if (!confirm()) return -1; flag_permfix = 1; }
209 CPERMS; if (chmod(name,perm)) die_make(name);
210 }
211 return 0;
212 }
213
214 return 0;
215}
216
217int check_files(char * directory,int uid,int gid,int perm)
218{
219 DIR *dir;
220 direntry *d;
221
222 dir = opendir(directory);
223
224 if (!dir) return -1;
225 while ((d = readdir(dir))) {
226 if (d->d_name[0] == '.') continue;
227 if (!stralloc_copys(&temp_filename,directory)) die_nomem();
228 if (!stralloc_append(&temp_filename,"/")) die_nomem();
229 if (!stralloc_cats(&temp_filename,d->d_name)) die_nomem();
230 if (!stralloc_0(&temp_filename)) die_nomem();
231 if (check_item(temp_filename.s,uid,gid,perm,'f',0)) { closedir(dir); return -1; }
232 }
233 closedir(dir);
234 return 0;
235}
236
237void warn_files(char * directory)
238{
239 DIR *dir;
240 direntry *d;
241 int found = 0;
242
243 dir = opendir(directory);
244 if (!dir) return;
245
246 while ((d = readdir(dir))) {
247 if (d->d_name[0] == '.') continue;
248 found = 1;
249 break;
250 }
251
252 closedir(dir);
253
254 if (found)
255 logmsg(WHO,0,WARN,B("Found files in ",directory," that shouldn't be there. I will not remove them. You should consider checking it out."));
256}
257
258int check_splits(char * directory,int dir_uid,int dir_gid,int dir_perm,int file_gid,int file_perm)
259{
260 DIR *dir;
261 direntry *d;
262 int i;
263
264 for (i = 0; i < split_num ; i++) {
265 strnum[fmt_ulong(strnum,i)] = 0;
266 if (!stralloc_copys(&temp_dirname,directory)) die_nomem();
267 if (!stralloc_append(&temp_dirname,"/")) die_nomem();
268 if (!stralloc_cats(&temp_dirname,strnum)) die_nomem();
269 if (!stralloc_0(&temp_dirname)) die_nomem();
270
271 /*check the split dir*/
272 if (check_item(temp_dirname.s,dir_uid,dir_gid,dir_perm,'d',0)) return -1;
273
274 /*check its contents*/
275 dir = opendir(temp_dirname.s);
276 if (!dir) return -1;
277 while ((d = readdir(dir))) {
278 if (d->d_name[0] == '.') continue;
280 if (!stralloc_append(&temp_filename,"/")) die_nomem();
281 if (!stralloc_cats(&temp_filename,d->d_name)) die_nomem();
282 if (!stralloc_0(&temp_filename)) die_nomem();
283 if (check_item(temp_filename.s,dir_uid,file_gid,file_perm,'f',0)) { closedir(dir); return -1; }
284 }
285 closedir(dir);
286 }
287
288 return 0;
289}
290
291int rename_mess(char *dir, char *part, char *new_part, char *old_filename, char *new_filename)
292{
293
295 logmsg(WHO,0,INFO,"It looks like some files need to be renamed, should I rename them? (Y/n)\n");
296 if (!confirm()) return -1;
297 flag_namefix = 1;
298 }
299
300 /*prepare the old filename*/
301 if (!stralloc_copy(&old_name,&queue_dir)) die_nomem();
302 if (!stralloc_cats(&old_name,dir)) die_nomem();
303 if (!stralloc_cats(&old_name,part)) die_nomem();
304 if (!stralloc_append(&old_name,"/")) die_nomem();
305 if (!stralloc_cats(&old_name,old_filename)) die_nomem();
306 if (!stralloc_0(&old_name)) die_nomem();
307
308 /*prepare the new filename*/
309 if (!stralloc_copy(&new_name,&queue_dir)) die_nomem();
310 if (!stralloc_cats(&new_name,dir)) die_nomem();
311 if (!stralloc_cats(&new_name,new_part)) die_nomem();
312 if (!stralloc_append(&new_name,"/")) die_nomem();
313 if (!stralloc_cats(&new_name,new_filename)) die_nomem();
314 if (!stralloc_0(&new_name)) die_nomem();
315
316 logmsg(WHO,0,INFO,B("Renaming ",old_name.s," to ",new_name.s));
317 if (rename(old_name.s,new_name.s)) {
318 if (errno != ENOENT) return -1;
319 }
320
321 return 0;
322}
323
324int fix_part(char *part)
325{
326 DIR *dir;
327 direntry *d;
328 struct stat st;
329 char inode[FMT_ULONG];
330 char new_part[FMT_ULONG];
331 int old_inode;
332 int part_num;
333 int correct_part_num;
334
335 scan_uint(part,&part_num);
336
337 if (!stralloc_copy(&mess_dir,&queue_dir)) die_nomem();
338 if (!stralloc_cats(&mess_dir,"mess/")) die_nomem();
339 if (!stralloc_cats(&mess_dir,part)) die_nomem();
340 if (!stralloc_0(&mess_dir)) die_nomem();
341
342 dir = opendir(mess_dir.s);
343 if (!dir) return -1;
344
345 while ((d = readdir(dir))) {
346 if (d->d_name[0] == '.') continue;
347 /*check from mess*/
349 if (!stralloc_append(&temp_filename,"/")) die_nomem();
350 if (!stralloc_cats(&temp_filename,d->d_name)) die_nomem();
351 if (!stralloc_0(&temp_filename)) die_nomem();
352 if (stat(temp_filename.s,&st)) { closedir(dir); return -1; }
353
354 /*check that filename == inode number*/
355 /*check that inode%auto_split == part_num*/
356 scan_uint(d->d_name,&old_inode);
357 correct_part_num = st.st_ino % split_num;
358 if (st.st_ino != old_inode || part_num != correct_part_num) {
359 /*rename*/
360 inode[fmt_ulong(inode,st.st_ino)] = 0;
361 new_part[fmt_ulong(new_part,correct_part_num)] = 0;
362 if (rename_mess("mess/",part,new_part,d->d_name,inode)) { closedir(dir); return -1; }
363 if (rename_mess("info/",part,new_part,d->d_name,inode)) { closedir(dir); return -1; }
364 if (rename_mess("local/",part,new_part,d->d_name,inode)) { closedir(dir); return -1; }
365 if (rename_mess("remote/",part,new_part,d->d_name,inode)) { closedir(dir); return -1; }
366 if (rename_mess("todo/",part,new_part,d->d_name,inode)) { closedir(dir); return -1; }
367 if (rename_mess("intd/",part,new_part,d->d_name,inode)) { closedir(dir); return -1; }
368
369 if (rename_mess("bounce","","",d->d_name,inode)) { closedir(dir); return -1; }
370 }
371 }
372
373 closedir(dir);
374 return 0;
375}
376
378{
379 int i;
380
381 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
382 if (!stralloc_cats(&check_dir,"mess")) die_nomem();
383 if (!stralloc_0(&check_dir)) die_nomem();
384
385 for (i = 0; i < split_num; i++) {
386 strnum[fmt_ulong(strnum,i)] = 0;
387 if (fix_part(strnum)) return -1;
388 }
389
390 return 0;
391}
392
394{
395 /*check root existence*/
396 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
397 if (!stralloc_0(&check_dir)) die_nomem();
398 if (check_item(check_dir.s,qmailq_uid,qmail_gid,0750,'d',0)) return -1;
399
400 /*check the bigtodo queue */
401 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
402 if (!stralloc_cats(&check_dir,"info")) die_nomem();
403 if (!stralloc_0(&check_dir)) die_nomem();
404 if (check_item(check_dir.s,qmails_uid,qmail_gid,0700,'d',0)) return -1;
405 if (check_splits(check_dir.s,qmails_uid,qmail_gid,0700,qmail_gid,0600)) return -1;
406
407 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
408 if (!stralloc_cats(&check_dir,"mess")) die_nomem();
409 if (!stralloc_0(&check_dir)) die_nomem();
410 if (check_item(check_dir.s,qmailq_uid,qmail_gid,0750,'d',0)) return -1;
411 if (check_splits(check_dir.s,qmailq_uid,qmail_gid,0750,-1,0644)) return -1;
412
413 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
414 if (!stralloc_cats(&check_dir,"remote")) die_nomem();
415 if (!stralloc_0(&check_dir)) die_nomem();
416 if (check_item(check_dir.s,qmails_uid,qmail_gid,0700,'d',0)) return -1;
417 if (check_splits(check_dir.s,qmails_uid,qmail_gid,0700,qmail_gid,0600)) return -1;
418
419 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
420 if (!stralloc_cats(&check_dir,"local")) die_nomem();
421 if (!stralloc_0(&check_dir)) die_nomem();
422 if (check_item(check_dir.s,qmails_uid,qmail_gid,0700,'d',0)) return -1;
423 if (check_splits(check_dir.s,qmails_uid,qmail_gid,0700,qmail_gid,0600)) return -1;
424
425 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
426 if (!stralloc_cats(&check_dir,"intd")) die_nomem();
427 if (!stralloc_0(&check_dir)) die_nomem();
428 if (check_item(check_dir.s,qmailq_uid,qmail_gid,0700,'d',0)) return -1;
429 if (check_splits(check_dir.s,qmailq_uid,qmail_gid,0700,qmail_gid,0600)) return -1;
430
431 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
432 if (!stralloc_cats(&check_dir,"todo")) die_nomem();
433 if (!stralloc_0(&check_dir)) die_nomem();
434 if (check_item(check_dir.s,qmailq_uid,qmail_gid,0750,'d',0)) return -1;
435 if (check_splits(check_dir.s,qmailq_uid,qmail_gid,0750,-1,0644)) return -1;
436
437 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
438 if (!stralloc_cats(&check_dir,"dkim")) die_nomem();
439 if (!stralloc_0(&check_dir)) die_nomem();
440 if (check_item(check_dir.s,qmailq_uid,qmail_gid,0750,'d',0)) return -1;
441 if (check_splits(check_dir.s,qmailq_uid,qmail_gid,0750,qmail_gid,0644)) return -1;
442
443 /*check the others*/
444 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
445 if (!stralloc_cats(&check_dir,"bounce")) die_nomem();
446 if (!stralloc_0(&check_dir)) die_nomem();
447 if (check_item(check_dir.s,qmails_uid,qmail_gid,0700,'d',0)) return -1;
448 if (check_files(check_dir.s,qmails_uid,qmail_gid,0600)) return -1;
449
450 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
451 if (!stralloc_cats(&check_dir,"pid")) die_nomem();
452 if (!stralloc_0(&check_dir)) die_nomem();
453 if (check_item(check_dir.s,qmailq_uid,qmail_gid,0700,'d',0)) return -1;
454
456
457 /*lock has special files that must exist*/
458 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
459 if (!stralloc_cats(&check_dir,"lock")) die_nomem();
460 if (!stralloc_0(&check_dir)) die_nomem();
461 if (check_item(check_dir.s,qmailq_uid,qmail_gid,0750,'d',0)) return -1;
462
463 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
464 if (!stralloc_cats(&check_dir,"lock/sendmutex")) die_nomem();
465 if (!stralloc_0(&check_dir)) die_nomem();
466 if (check_item(check_dir.s,qmails_uid,qmail_gid,0600,'z',0)) return -1;
467
468 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
469 if (!stralloc_cats(&check_dir,"lock/tcpto")) die_nomem();
470 if (!stralloc_0(&check_dir)) die_nomem();
471 if (check_item(check_dir.s,qmailr_uid,qmail_gid,0644,'z',1024)) return -1;
472
473 if (!stralloc_copy(&check_dir,&queue_dir)) die_nomem();
474 if (!stralloc_cats(&check_dir,"lock/trigger")) die_nomem();
475 if (!stralloc_0(&check_dir)) die_nomem();
476 if (check_item(check_dir.s,qmails_uid,qmail_gid,0622,'p',0)) return -1;
477
478 return 0;
479}
480
481/* stolen from qmail-send */
482
483stralloc fn = {0};
484
485void fnmake_init() { while (!stralloc_ready(&fn,FMTQFN)) die_nomem(); }
486void fnmake_local(unsigned long id) { fn.len = fmtqfn(fn.s,"local/",id,1); }
487void fnmake_remote(unsigned long id) { fn.len = fmtqfn(fn.s,"remote/",id,1); }
488void fnmake_mess(unsigned long id) { fn.len = fmtqfn(fn.s,"mess/",id,1); }
489void fnmake_dkim(unsigned long id) { fn.len = fmtqfn(fn.s,"dkim/",id,1); }
490void fnmake_info(unsigned long id) { fn.len = fmtqfn(fn.s,"info/",id,1); }
491void fnmake_bounce(unsigned long id) { fn.len = fmtqfn(fn.s,"bounce/",id,0); }
492
493void warn_unlink(unsigned long id)
494{
495 char foo[FMT_ULONG];
496 foo[fmt_ulong(foo,id)] = 0;
497 logmsg(WHO,99,WARN,B("no such file to unlink #",foo));
498}
499
500void err_unlink(unsigned long id)
501{
502 char foo[FMT_ULONG];
503 foo[fmt_ulong(foo,id)] = 0;
504 logmsg(WHO,100,ERROR,B("trouble with unlinking #",foo));
505}
506
508{
509 logmsg(WHO,110,FATAL,"unable to chdir");
510}
511
512int delete_msg(unsigned long id)
513{
514 struct stat st;
515 int bounce = 1;
516
517 if (chdir(auto_qmail) == -1) err_chdir();
518 if (chdir("queue") == -1) err_chdir();
519 fnmake_init();
520
521 fnmake_mess(id); // regular message pre-processed
522 if (stat(fn.s,&st) == -1) err_unlink(id);
523 else bounce = 0;
524 if (!bounce && unlink(fn.s) == -1)
525 if (errno != ENOENT) err_unlink(id);
526
527 fnmake_info(id); // not delivered yet
528 if (!stat(fn.s,&st))
529 if (unlink(fn.s) == -1)
530 if (errno != ENOENT) err_unlink(id);
531
532 if (bounce) {
533 fnmake_bounce(id);
534 if (!stat(fn.s,&st)) { warn_unlink(id); return 1; }
535 if (unlink(fn.s) == -1)
536 if (errno != ENOENT) err_unlink(id);
537 }
538
539 fnmake_remote(id);
540 if (!stat(fn.s,&st))
541 if (unlink(fn.s) == -1)
542 if (errno != ENOENT) err_unlink(id);
543
544 fnmake_local(id);
545 if (!stat(fn.s,&st))
546 if (unlink(fn.s) == -1)
547 if (errno != ENOENT) err_unlink(id);
548
549 return 0;
550}
551
552int main(int argc, char **argv)
553{
554 char *mess = 0;
555 unsigned long id = 0;
556
557 if (argc > 1) {
558 if (!str_diff(argv[1],"-i")) {
560 } else if (!str_diff(argv[1],"-d")) {
561 if (!argv[2]) logmsg(WHO,111,USAGE,"qmail-qmaint [-i] || [-d messid]");
562 mess = argv[2];
563 flag_delete = 1;
564 scan_ulong(mess,&id);
565 }
566 }
567
569 if (!stralloc_cats(&queue_dir,"/queue/")) die_nomem();
570
571 logmsg(WHO,0,INFO,B("Checking s/qmail queue at: ",auto_qmail,"/queue/"));
572
573 /* get constants */
574
580
581 /*check that all the proper directories exist with proper credentials*/
582
583 if (check_dirs()) die_check();
584
585 if (flag_delete) {
586 if (!delete_msg(id))
587 logmsg(WHO,0,INFO,B("file ",mess," from queue deleted."));
588 } else
589 if (fix_names()) die_check();
590
591 logmsg(WHO,0,INFO,"done.");
592
593 _exit (0);
594}
char auto_qmail[]
int auto_split
int auto_gidq
int auto_uidr
int auto_uidq
int auto_uids
int main()
Definition: chkshsgr.c:6
char num[FMT_ULONG]
Definition: chkspawn.c:8
int stralloc_copys(stralloc *, char const *)
void _exit()
int rename(const char *, const char *)
buffer mess
Definition: fastforward.c:65
int fifo_make(char *fn, int mode)
Definition: fifo.c:8
unsigned int fmtqfn(char *s, char *dirslash, unsigned long id, int flagsplit)
Definition: fmtqfn.c:5
#define FMTQFN
Definition: fmtqfn.h:6
int match
Definition: matchup.c:195
ulongalloc uid
Definition: matchup.c:58
stralloc user
int fd
void perm()
Definition: qmail-inject.c:63
stralloc foo
Definition: qmail-local.c:74
stralloc check_dir
Definition: qmail-qmaint.c:29
void warn_files(char *directory)
Definition: qmail-qmaint.c:237
int qmails_uid
Definition: qmail-qmaint.c:46
void die_check()
Definition: qmail-qmaint.c:66
int qmail_gid
Definition: qmail-qmaint.c:48
int flag_interactive
Definition: qmail-qmaint.c:38
void fnmake_local(unsigned long id)
Definition: qmail-qmaint.c:486
void fnmake_info(unsigned long id)
Definition: qmail-qmaint.c:490
stralloc queue_dir
Definition: qmail-qmaint.c:28
void die_nomem()
Definition: qmail-qmaint.c:76
stralloc fn
Definition: qmail-qmaint.c:483
void fnmake_remote(unsigned long id)
Definition: qmail-qmaint.c:487
#define OWNER
Definition: qmail-qmaint.c:101
stralloc temp_dirname
Definition: qmail-qmaint.c:30
int flag_delete
Definition: qmail-qmaint.c:43
stralloc temp_filename
Definition: qmail-qmaint.c:31
void die_user(char *user)
Definition: qmail-qmaint.c:56
char strnum[FMT_ULONG]
Definition: qmail-qmaint.c:37
void die_make(char *name)
Definition: qmail-qmaint.c:51
int check_splits(char *directory, int dir_uid, int dir_gid, int dir_perm, int file_gid, int file_perm)
Definition: qmail-qmaint.c:258
int check_files(char *directory, int uid, int gid, int perm)
Definition: qmail-qmaint.c:217
void die_group(char *group)
Definition: qmail-qmaint.c:61
int flag_permfix
Definition: qmail-qmaint.c:41
int fix_part(char *part)
Definition: qmail-qmaint.c:324
void warn_unlink(unsigned long id)
Definition: qmail-qmaint.c:493
stralloc new_name
Definition: qmail-qmaint.c:33
int qmailr_uid
Definition: qmail-qmaint.c:47
int check_item(char *name, int uid, int gid, int perm, char type, int size)
Definition: qmail-qmaint.c:104
stralloc mess_dir
Definition: qmail-qmaint.c:34
void fnmake_mess(unsigned long id)
Definition: qmail-qmaint.c:488
void die_recon()
Definition: qmail-qmaint.c:71
#define CPERMS
Definition: qmail-qmaint.c:99
int rename_mess(char *dir, char *part, char *new_part, char *old_filename, char *new_filename)
Definition: qmail-qmaint.c:291
void err_unlink(unsigned long id)
Definition: qmail-qmaint.c:500
int confirm()
Definition: qmail-qmaint.c:83
int delete_msg(unsigned long id)
Definition: qmail-qmaint.c:512
void err_chdir()
Definition: qmail-qmaint.c:507
stralloc query
Definition: qmail-qmaint.c:35
int qmailq_uid
Definition: qmail-qmaint.c:45
int split_num
Definition: qmail-qmaint.c:49
void fnmake_bounce(unsigned long id)
Definition: qmail-qmaint.c:491
void fnmake_dkim(unsigned long id)
Definition: qmail-qmaint.c:489
#define COWNER
Definition: qmail-qmaint.c:102
int flag_dircreate
Definition: qmail-qmaint.c:39
#define DIRS
Definition: qmail-qmaint.c:95
int check_dirs()
Definition: qmail-qmaint.c:393
void fnmake_init()
Definition: qmail-qmaint.c:485
#define WHO
Definition: qmail-qmaint.c:26
int flag_filecreate
Definition: qmail-qmaint.c:40
int flag_namefix
Definition: qmail-qmaint.c:42
stralloc old_name
Definition: qmail-qmaint.c:32
#define FILES
Definition: qmail-qmaint.c:96
int fix_names()
Definition: qmail-qmaint.c:377
#define PERMS
Definition: qmail-qmaint.c:98
unsigned long size
Definition: qmail-qread.c:55
struct del * d[CHANNELS]
Definition: qmail-send.c:720
void write()