Postfix3.3.1
postqueue.c
[詳解]
1 /*++
2 /* NAME
3 /* postqueue 1
4 /* SUMMARY
5 /* Postfix queue control
6 /* SYNOPSIS
7 /* .ti -4
8 /* \fBTo flush the mail queue\fR:
9 /*
10 /* \fBpostqueue\fR [\fB-v\fR] [\fB-c \fIconfig_dir\fR] \fB-f\fR
11 /*
12 /* \fBpostqueue\fR [\fB-v\fR] [\fB-c \fIconfig_dir\fR] \fB-i \fIqueue_id\fR
13 /*
14 /* \fBpostqueue\fR [\fB-v\fR] [\fB-c \fIconfig_dir\fR] \fB-s \fIsite\fR
15 /*
16 /* .ti -4
17 /* \fBTo list the mail queue\fR:
18 /*
19 /* \fBpostqueue\fR [\fB-v\fR] [\fB-c \fIconfig_dir\fR] \fB-j\fR
20 /*
21 /* \fBpostqueue\fR [\fB-v\fR] [\fB-c \fIconfig_dir\fR] \fB-p\fR
22 /* DESCRIPTION
23 /* The \fBpostqueue\fR(1) command implements the Postfix user interface
24 /* for queue management. It implements operations that are
25 /* traditionally available via the \fBsendmail\fR(1) command.
26 /* See the \fBpostsuper\fR(1) command for queue operations
27 /* that require super-user privileges such as deleting a message
28 /* from the queue or changing the status of a message.
29 /*
30 /* The following options are recognized:
31 /* .IP "\fB-c \fIconfig_dir\fR"
32 /* The \fBmain.cf\fR configuration file is in the named directory
33 /* instead of the default configuration directory. See also the
34 /* MAIL_CONFIG environment setting below.
35 /* .IP \fB-f\fR
36 /* Flush the queue: attempt to deliver all queued mail.
37 /*
38 /* This option implements the traditional "\fBsendmail -q\fR" command,
39 /* by contacting the Postfix \fBqmgr\fR(8) daemon.
40 /*
41 /* Warning: flushing undeliverable mail frequently will result in
42 /* poor delivery performance of all other mail.
43 /* .IP "\fB-i \fIqueue_id\fR"
44 /* Schedule immediate delivery of deferred mail with the
45 /* specified queue ID.
46 /*
47 /* This option implements the traditional \fBsendmail -qI\fR
48 /* command, by contacting the \fBflush\fR(8) server.
49 /*
50 /* This feature is available with Postfix version 2.4 and later.
51 /* .IP "\fB-j\fR"
52 /* Produce a queue listing in JSON format, based on output
53 /* from the showq(8) daemon. The result is a stream of zero
54 /* or more JSON objects, one per queue file. Each object is
55 /* followed by a newline character to support simple streaming
56 /* parsers. See "\fBJSON OBJECT FORMAT\fR" below for details.
57 /*
58 /* This feature is available in Postfix 3.1 and later.
59 /* .IP \fB-p\fR
60 /* Produce a traditional sendmail-style queue listing.
61 /* This option implements the traditional \fBmailq\fR command,
62 /* by contacting the Postfix \fBshowq\fR(8) daemon.
63 /*
64 /* Each queue entry shows the queue file ID, message
65 /* size, arrival time, sender, and the recipients that still need to
66 /* be delivered. If mail could not be delivered upon the last attempt,
67 /* the reason for failure is shown. The queue ID string
68 /* is followed by an optional status character:
69 /* .RS
70 /* .IP \fB*\fR
71 /* The message is in the \fBactive\fR queue, i.e. the message is
72 /* selected for delivery.
73 /* .IP \fB!\fR
74 /* The message is in the \fBhold\fR queue, i.e. no further delivery
75 /* attempt will be made until the mail is taken off hold.
76 /* .RE
77 /* .IP "\fB-s \fIsite\fR"
78 /* Schedule immediate delivery of all mail that is queued for the named
79 /* \fIsite\fR. A numerical site must be specified as a valid RFC 5321
80 /* address literal enclosed in [], just like in email addresses.
81 /* The site must be eligible for the "fast flush" service.
82 /* See \fBflush\fR(8) for more information about the "fast flush"
83 /* service.
84 /*
85 /* This option implements the traditional "\fBsendmail -qR\fIsite\fR"
86 /* command, by contacting the Postfix \fBflush\fR(8) daemon.
87 /* .IP \fB-v\fR
88 /* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
89 /* options make the software increasingly verbose. As of Postfix 2.3,
90 /* this option is available for the super-user only.
91 /* JSON OBJECT FORMAT
92 /* .ad
93 /* .fi
94 /* Each JSON object represents one queue file; it is emitted
95 /* as a single text line followed by a newline character.
96 /*
97 /* Object members have string values unless indicated otherwise.
98 /* Programs should ignore object members that are not listed
99 /* here; the list of members is expected to grow over time.
100 /* .IP \fBqueue_name\fR
101 /* The name of the queue where the message was found. Note
102 /* that the contents of the mail queue may change while it is
103 /* being listed; some messages may appear more than once, and
104 /* some messages may be missed.
105 /* .IP \fBqueue_id\fR
106 /* The queue file name. The queue_id may be reused within a
107 /* Postfix instance unless "enable_long_queue_ids = true" and
108 /* time is monotonic. Even then, the queue_id is not expected
109 /* to be unique between different Postfix instances. Management
110 /* tools that require a unique name should combine the queue_id
111 /* with the myhostname setting of the Postfix instance.
112 /* .IP \fBarrival_time\fR
113 /* The number of seconds since the start of the UNIX epoch.
114 /* .IP \fBmessage_size\fR
115 /* The number of bytes in the message header and body. This
116 /* number does not include message envelope information. It
117 /* is approximately equal to the number of bytes that would
118 /* be transmitted via SMTP including the <CR><LF> line endings.
119 /* .IP \fBsender\fR
120 /* The envelope sender address.
121 /* .IP \fBrecipients\fR
122 /* An array containing zero or more objects with members:
123 /* .RS
124 /* .IP \fBaddress\fR
125 /* One recipient address.
126 /* .IP \fBdelay_reason\fR
127 /* If present, the reason for delayed delivery. Delayed
128 /* recipients may have no delay reason, for example, while
129 /* delivery is in progress, or after the system was stopped
130 /* before it could record the reason.
131 /* .RE
132 /* SECURITY
133 /* .ad
134 /* .fi
135 /* This program is designed to run with set-group ID privileges, so
136 /* that it can connect to Postfix daemon processes.
137 /* STANDARDS
138 /* RFC 7159 (JSON notation)
139 /* DIAGNOSTICS
140 /* Problems are logged to \fBsyslogd\fR(8) and to the standard error
141 /* stream.
142 /* ENVIRONMENT
143 /* .ad
144 /* .fi
145 /* .IP MAIL_CONFIG
146 /* Directory with the \fBmain.cf\fR file. In order to avoid exploitation
147 /* of set-group ID privileges, a non-standard directory is allowed only
148 /* if:
149 /* .RS
150 /* .IP \(bu
151 /* The name is listed in the standard \fBmain.cf\fR file with the
152 /* \fBalternate_config_directories\fR configuration parameter.
153 /* .IP \(bu
154 /* The command is invoked by the super-user.
155 /* .RE
156 /* CONFIGURATION PARAMETERS
157 /* .ad
158 /* .fi
159 /* The following \fBmain.cf\fR parameters are especially relevant to
160 /* this program.
161 /* The text below provides only a parameter summary. See
162 /* \fBpostconf\fR(5) for more details including examples.
163 /* .IP "\fBalternate_config_directories (empty)\fR"
164 /* A list of non-default Postfix configuration directories that may
165 /* be specified with "-c config_directory" on the command line (in the
166 /* case of \fBsendmail\fR(1), with the "-C" option), or via the MAIL_CONFIG
167 /* environment parameter.
168 /* .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
169 /* The default location of the Postfix main.cf and master.cf
170 /* configuration files.
171 /* .IP "\fBcommand_directory (see 'postconf -d' output)\fR"
172 /* The location of all postfix administrative commands.
173 /* .IP "\fBfast_flush_domains ($relay_domains)\fR"
174 /* Optional list of destinations that are eligible for per-destination
175 /* logfiles with mail that is queued to those destinations.
176 /* .IP "\fBimport_environment (see 'postconf -d' output)\fR"
177 /* The list of environment parameters that a privileged Postfix
178 /* process will import from a non-Postfix parent process, or name=value
179 /* environment overrides.
180 /* .IP "\fBqueue_directory (see 'postconf -d' output)\fR"
181 /* The location of the Postfix top-level queue directory.
182 /* .IP "\fBsyslog_facility (mail)\fR"
183 /* The syslog facility of Postfix logging.
184 /* .IP "\fBsyslog_name (see 'postconf -d' output)\fR"
185 /* A prefix that is prepended to the process name in syslog
186 /* records, so that, for example, "smtpd" becomes "prefix/smtpd".
187 /* .IP "\fBtrigger_timeout (10s)\fR"
188 /* The time limit for sending a trigger to a Postfix daemon (for
189 /* example, the \fBpickup\fR(8) or \fBqmgr\fR(8) daemon).
190 /* .PP
191 /* Available in Postfix version 2.2 and later:
192 /* .IP "\fBauthorized_flush_users (static:anyone)\fR"
193 /* List of users who are authorized to flush the queue.
194 /* .IP "\fBauthorized_mailq_users (static:anyone)\fR"
195 /* List of users who are authorized to view the queue.
196 /* FILES
197 /* /var/spool/postfix, mail queue
198 /* SEE ALSO
199 /* qmgr(8), queue manager
200 /* showq(8), list mail queue
201 /* flush(8), fast flush service
202 /* sendmail(1), Sendmail-compatible user interface
203 /* postsuper(1), privileged queue operations
204 /* README FILES
205 /* .ad
206 /* .fi
207 /* Use "\fBpostconf readme_directory\fR" or
208 /* "\fBpostconf html_directory\fR" to locate this information.
209 /* .na
210 /* .nf
211 /* ETRN_README, Postfix ETRN howto
212 /* LICENSE
213 /* .ad
214 /* .fi
215 /* The Secure Mailer license must be distributed with this software.
216 /* HISTORY
217 /* .ad
218 /* .fi
219 /* The postqueue command was introduced with Postfix version 1.1.
220 /* AUTHOR(S)
221 /* Wietse Venema
222 /* IBM T.J. Watson Research
223 /* P.O. Box 704
224 /* Yorktown Heights, NY 10598, USA
225 /*
226 /* Wietse Venema
227 /* Google, Inc.
228 /* 111 8th Avenue
229 /* New York, NY 10011, USA
230 /*--*/
231 
232 /* System library. */
233 
234 #include <sys_defs.h>
235 #include <sys/stat.h>
236 #include <unistd.h>
237 #include <string.h>
238 #include <stdlib.h>
239 #include <signal.h>
240 #include <sysexits.h>
241 #include <errno.h>
242 
243 /* Utility library. */
244 
245 #include <msg.h>
246 #include <mymalloc.h>
247 #include <clean_env.h>
248 #include <vstream.h>
249 #include <msg_vstream.h>
250 #include <msg_syslog.h>
251 #include <argv.h>
252 #include <safe.h>
253 #include <connect.h>
254 #include <valid_hostname.h>
255 #include <warn_stat.h>
256 #include <events.h>
257 #include <stringops.h>
258 
259 /* Global library. */
260 
261 #include <mail_proto.h>
262 #include <mail_params.h>
263 #include <mail_version.h>
264 #include <mail_conf.h>
265 #include <mail_task.h>
266 #include <mail_run.h>
267 #include <mail_flush.h>
268 #include <mail_queue.h>
269 #include <flush_clnt.h>
270 #include <smtp_stream.h>
271 #include <user_acl.h>
272 #include <valid_mailhost_addr.h>
273 #include <mail_dict.h>
274 #include <mail_parm_split.h>
275 
276 /* Application-specific. */
277 
278 #include <postqueue.h>
279 
280  /*
281  * WARNING WARNING WARNING
282  *
283  * This software is designed to run set-gid. In order to avoid exploitation of
284  * privilege, this software should not run any external commands, nor should
285  * it take any information from the user, unless that information can be
286  * properly sanitized. To get an idea of how much information a process can
287  * inherit from a potentially hostile user, examine all the members of the
288  * process structure (typically, in /usr/include/sys/proc.h): the current
289  * directory, open files, timers, signals, environment, command line, umask,
290  * and so on.
291  */
292 
293  /*
294  * Modes of operation.
295  *
296  * XXX To support flush by recipient domain, or for destinations that have no
297  * mapping to logfile, the server has to defend against resource exhaustion
298  * attacks. A malicious user could fork off a postqueue client that starts
299  * an expensive requests and then kills the client immediately; this way she
300  * could create a high Postfix load on the system without ever exceeding her
301  * own per-user process limit. To prevent this, either the server needs to
302  * establish frequent proof of client liveliness with challenge/response, or
303  * the client needs to restrict expensive requests to privileged users only.
304  *
305  * We don't have this problem with queue listings. The showq server detects an
306  * EPIPE error after reporting a few queue entries.
307  */
308 #define PQ_MODE_DEFAULT 0 /* noop */
309 #define PQ_MODE_MAILQ_LIST 1 /* list mail queue */
310 #define PQ_MODE_FLUSH_QUEUE 2 /* flush queue */
311 #define PQ_MODE_FLUSH_SITE 3 /* flush site */
312 #define PQ_MODE_FLUSH_FILE 4 /* flush message */
313 #define PQ_MODE_JSON_LIST 5 /* JSON-format queue listing */
314 
315  /*
316  * Silly little macros (SLMs).
317  */
318 #define STR vstring_str
319 
320  /*
321  * Queue manipulation access lists.
322  */
325 
326 static const CONFIG_STR_TABLE str_table[] = {
329  0,
330 };
331 
332 /* show_queue - show queue status */
333 
334 static void show_queue(int mode)
335 {
336  const char *errstr;
337  VSTREAM *showq;
338  int n;
339  uid_t uid = getuid();
340 
341  if (uid != 0 && uid != var_owner_uid
343  uid)) != 0)
345  "User %s(%ld) is not allowed to view the mail queue",
346  errstr, (long) uid);
347 
348  /*
349  * Connect to the show queue service.
350  */
352  switch (mode) {
353  case PQ_MODE_MAILQ_LIST:
354  showq_compat(showq);
355  break;
356  case PQ_MODE_JSON_LIST:
357  showq_json(showq);
358  break;
359  default:
360  msg_panic("show_queue: unknown mode %d", mode);
361  }
362  if (vstream_fclose(showq))
363  msg_warn("close: %m");
364  }
365 
366  /*
367  * Don't assume that the mail system is down when the user has
368  * insufficient permission to access the showq socket.
369  */
370  else if (errno == EACCES) {
372  "Connect to the %s %s service: %m",
374  }
375 
376  /*
377  * When the mail system is down, the superuser can still access the queue
378  * directly. Just run the showq program in stand-alone mode.
379  */
380  else if (geteuid() == 0) {
381  char *showq_path;
382  ARGV *argv;
383  int stat;
384 
385  msg_warn("Mail system is down -- accessing queue directly");
386  showq_path = concatenate(var_daemon_dir, "/", var_showq_service,
387  (char *) 0);
388  argv = argv_alloc(6);
389  argv_add(argv, showq_path, "-u", "-S", (char *) 0);
390  for (n = 0; n < msg_verbose; n++)
391  argv_add(argv, "-v", (char *) 0);
392  argv_terminate(argv);
393  if ((showq = vstream_popen(O_RDONLY,
395  CA_VSTREAM_POPEN_END)) == 0) {
396  stat = -1;
397  } else {
398  switch (mode) {
399  case PQ_MODE_MAILQ_LIST:
400  showq_compat(showq);
401  break;
402  case PQ_MODE_JSON_LIST:
403  showq_json(showq);
404  break;
405  default:
406  msg_panic("show_queue: unknown mode %d", mode);
407  }
408  stat = vstream_pclose(showq);
409  }
410  argv_free(argv);
411  if (stat != 0)
413  "Error running %s", showq_path);
414  myfree(showq_path);
415  }
416 
417  /*
418  * When the mail system is down, unprivileged users are stuck, because by
419  * design the mail system contains no set_uid programs. The only way for
420  * an unprivileged user to cross protection boundaries is to talk to the
421  * showq daemon.
422  */
423  else {
425  "Queue report unavailable - mail system is down");
426  }
427 }
428 
429 /* flush_queue - force delivery */
430 
431 static void flush_queue(void)
432 {
433  const char *errstr;
434  uid_t uid = getuid();
435 
436  if (uid != 0 && uid != var_owner_uid
438  uid)) != 0)
440  "User %s(%ld) is not allowed to flush the mail queue",
441  errstr, (long) uid);
442 
443  /*
444  * Trigger the flush queue service.
445  */
446  if (mail_flush_deferred() < 0)
448  "Cannot flush mail queue - mail system is down");
449  if (mail_flush_maildrop() < 0)
451  "Cannot flush mail queue - mail system is down");
452  event_drain(2);
453 }
454 
455 /* flush_site - flush mail for site */
456 
457 static void flush_site(const char *site)
458 {
459  int status;
460  const char *errstr;
461  uid_t uid = getuid();
462 
463  if (uid != 0 && uid != var_owner_uid
465  uid)) != 0)
467  "User %s(%ld) is not allowed to flush the mail queue",
468  errstr, (long) uid);
469 
470  flush_init();
471 
472  switch (status = flush_send_site(site)) {
473  case FLUSH_STAT_OK:
474  exit(0);
475  case FLUSH_STAT_BAD:
476  msg_fatal_status(EX_USAGE, "Invalid request: \"%s\"", site);
477  case FLUSH_STAT_FAIL:
479  "Cannot flush mail queue - mail system is down");
480  case FLUSH_STAT_DENY:
482  "Flush service is not configured for destination \"%s\"",
483  site);
484  default:
486  "Unknown flush server reply status %d", status);
487  }
488 }
489 
490 /* flush_file - flush mail with specific queue ID */
491 
492 static void flush_file(const char *queue_id)
493 {
494  int status;
495  const char *errstr;
496  uid_t uid = getuid();
497 
498  if (uid != 0 && uid != var_owner_uid
500  uid)) != 0)
502  "User %s(%ld) is not allowed to flush the mail queue",
503  errstr, (long) uid);
504 
505  switch (status = flush_send_file(queue_id)) {
506  case FLUSH_STAT_OK:
507  exit(0);
508  case FLUSH_STAT_BAD:
509  msg_fatal_status(EX_USAGE, "Invalid request: \"%s\"", queue_id);
510  case FLUSH_STAT_FAIL:
512  "Cannot flush mail queue - mail system is down");
513  default:
515  "Unexpected flush server reply status %d", status);
516  }
517 }
518 
519 /* unavailable - sanitize exit status from library run-time errors */
520 
521 static void unavailable(void)
522 {
523  exit(EX_UNAVAILABLE);
524 }
525 
526 /* usage - scream and die */
527 
528 static NORETURN usage(void)
529 {
530  msg_fatal_status(EX_USAGE, "usage: postqueue -f | postqueue -i queueid | postqueue -j | postqueue -p | postqueue -s site");
531 }
532 
534 
535 /* main - the main program */
536 
537 int main(int argc, char **argv)
538 {
539  struct stat st;
540  char *slash;
541  int c;
542  int fd;
543  int mode = PQ_MODE_DEFAULT;
544  char *site_to_flush = 0;
545  char *id_to_flush = 0;
546  ARGV *import_env;
547  int bad_site;
548 
549  /*
550  * Fingerprint executables and core dumps.
551  */
553 
554  /*
555  * Be consistent with file permissions.
556  */
557  umask(022);
558 
559  /*
560  * To minimize confusion, make sure that the standard file descriptors
561  * are open before opening anything else. XXX Work around for 44BSD where
562  * fstat can return EBADF on an open file descriptor.
563  */
564  for (fd = 0; fd < 3; fd++)
565  if (fstat(fd, &st) == -1
566  && (close(fd), open("/dev/null", O_RDWR, 0)) != fd)
567  msg_fatal_status(EX_UNAVAILABLE, "open /dev/null: %m");
568 
569  /*
570  * Initialize. Set up logging, read the global configuration file and
571  * extract configuration information. Set up signal handlers so that we
572  * can clean up incomplete output.
573  * Censor the process name: it is provided by the user.
574  */
575  argv[0] = "postqueue";
576  msg_vstream_init(argv[0], VSTREAM_ERR);
577  msg_cleanup(unavailable);
578  msg_syslog_init(mail_task("postqueue"), LOG_PID, LOG_FACILITY);
580 
581  /*
582  * Check the Postfix library version as soon as we enable logging.
583  */
585 
586  /*
587  * Parse JCL. This program is set-gid and must sanitize all command-line
588  * parameters. The configuration directory argument is validated by the
589  * mail configuration read routine. Don't do complex things until we have
590  * completed initializations.
591  */
592  while ((c = GETOPT(argc, argv, "c:fi:jps:v")) > 0) {
593  switch (c) {
594  case 'c': /* non-default configuration */
595  if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
596  msg_fatal_status(EX_UNAVAILABLE, "out of memory");
597  break;
598  case 'f': /* flush queue */
599  if (mode != PQ_MODE_DEFAULT)
600  usage();
601  mode = PQ_MODE_FLUSH_QUEUE;
602  break;
603  case 'i': /* flush queue file */
604  if (mode != PQ_MODE_DEFAULT)
605  usage();
606  mode = PQ_MODE_FLUSH_FILE;
607  id_to_flush = optarg;
608  break;
609  case 'j':
610  if (mode != PQ_MODE_DEFAULT)
611  usage();
612  mode = PQ_MODE_JSON_LIST;
613  break;
614  case 'p': /* traditional mailq */
615  if (mode != PQ_MODE_DEFAULT)
616  usage();
617  mode = PQ_MODE_MAILQ_LIST;
618  break;
619  case 's': /* flush site */
620  if (mode != PQ_MODE_DEFAULT)
621  usage();
622  mode = PQ_MODE_FLUSH_SITE;
623  site_to_flush = optarg;
624  break;
625  case 'v':
626  if (geteuid() == 0)
627  msg_verbose++;
628  break;
629  default:
630  usage();
631  }
632  }
633  if (argc > optind)
634  usage();
635 
636  /*
637  * Further initialization...
638  */
639  mail_conf_read();
640  /* Re-evaluate mail_task() after reading main.cf. */
641  msg_syslog_init(mail_task("postqueue"), LOG_PID, LOG_FACILITY);
642  mail_dict_init(); /* proxy, sql, ldap */
643  get_mail_conf_str_table(str_table);
644 
645  /*
646  * This program is designed to be set-gid, which makes it a potential
647  * target for attack. Strip and optionally override the process
648  * environment so that we don't have to trust the C library.
649  */
651  clean_env(import_env->argv);
652  argv_free(import_env);
653 
654  if (chdir(var_queue_dir))
656 
657  signal(SIGPIPE, SIG_IGN);
658 
659  /* End of initializations. */
660 
661  /*
662  * Further input validation.
663  */
664  if (site_to_flush != 0) {
665  bad_site = 0;
666  if (*site_to_flush == '[') {
667  bad_site = !valid_mailhost_literal(site_to_flush, DONT_GRIPE);
668  } else {
669  bad_site = !valid_hostname(site_to_flush, DONT_GRIPE);
670  }
671  if (bad_site)
673  "Cannot flush mail queue - invalid destination: \"%.100s%s\"",
674  site_to_flush, strlen(site_to_flush) > 100 ? "..." : "");
675  }
676  if (id_to_flush != 0) {
677  if (!mail_queue_id_ok(id_to_flush))
679  "Cannot flush queue ID - invalid name: \"%.100s%s\"",
680  id_to_flush, strlen(id_to_flush) > 100 ? "..." : "");
681  }
682 
683  /*
684  * Start processing.
685  */
686  switch (mode) {
687  default:
688  msg_panic("unknown operation mode: %d", mode);
689  /* NOTREACHED */
690  case PQ_MODE_MAILQ_LIST:
691  case PQ_MODE_JSON_LIST:
692  show_queue(mode);
693  exit(0);
694  break;
695  case PQ_MODE_FLUSH_SITE:
696  flush_site(site_to_flush);
697  exit(0);
698  break;
699  case PQ_MODE_FLUSH_FILE:
700  flush_file(id_to_flush);
701  exit(0);
702  break;
703  case PQ_MODE_FLUSH_QUEUE:
704  flush_queue();
705  exit(0);
706  break;
707  case PQ_MODE_DEFAULT:
708  usage();
709  /* NOTREACHED */
710  }
711 }
int msg_verbose
Definition: msg.c:177
char * var_mail_name
Definition: mail_params.c:230
void myfree(void *ptr)
Definition: mymalloc.c:207
const char * mail_task(const char *argv0)
Definition: mail_task.c:49
char * var_procname
Definition: mail_params.c:252
char * mystrdup(const char *str)
Definition: mymalloc.c:225
char * var_import_environ
Definition: mail_params.c:296
#define DEF_SHOWQ_ACL
Definition: mail_params.h:114
int mail_queue_id_ok(const char *queue_id)
Definition: mail_queue.c:296
void set_mail_conf_str(const char *, const char *)
ARGV * argv_free(ARGV *argvp)
Definition: argv.c:136
#define NORETURN
Definition: sys_defs.h:1583
Definition: argv.h:17
#define VAR_IMPORT_ENVIRON
Definition: mail_params.h:2506
NORETURN msg_panic(const char *fmt,...)
Definition: msg.c:295
VSTREAM * mail_connect(const char *class, const char *name, int block_mode)
Definition: mail_connect.c:79
#define stat(p, s)
Definition: warn_stat.h:18
#define PQ_MODE_FLUSH_FILE
Definition: postqueue.c:312
#define VAR_PROCNAME
Definition: mail_params.h:2435
#define LOG_FACILITY
Definition: mail_params.h:357
#define PQ_MODE_DEFAULT
Definition: postqueue.c:308
#define FLUSH_STAT_FAIL
Definition: flush_clnt.h:36
#define CA_VSTREAM_POPEN_ARGV(v)
Definition: vstream.h:204
char ** argv
Definition: argv.h:20
void argv_add(ARGV *argvp,...)
Definition: argv.c:197
#define PQ_MODE_FLUSH_QUEUE
Definition: postqueue.c:310
#define FLUSH_STAT_BAD
Definition: flush_clnt.h:38
ARGV * argv_alloc(ssize_t len)
Definition: argv.c:149
void flush_init(void)
Definition: flush_clnt.c:104
void mail_conf_read(void)
Definition: mail_conf.c:178
int vstream_pclose(VSTREAM *)
void clean_env(char **preserve_list)
Definition: clean_env.c:59
int valid_hostname(const char *name, int gripe)
#define MAIL_CLASS_PUBLIC
Definition: mail_proto.h:95
MAIL_VERSION_STAMP_DECLARE
Definition: postqueue.c:533
#define EX_NOPERM
Definition: sys_exits.h:44
#define CONF_ENV_PATH
Definition: mail_conf.h:22
char * var_showq_service
Definition: mail_params.c:307
#define EX_SOFTWARE
Definition: sys_exits.h:37
ARGV * mail_parm_split(const char *name, const char *value)
uid_t var_owner_uid
Definition: mail_params.c:234
int valid_mailhost_literal(const char *addr, int gripe)
int vstream_fclose(VSTREAM *stream)
Definition: vstream.c:1268
void msg_warn(const char *fmt,...)
Definition: msg.c:215
int mail_flush_deferred(void)
Definition: mail_flush.c:53
void mail_dict_init(void)
Definition: mail_dict.c:81
#define CA_VSTREAM_POPEN_END
Definition: vstream.h:202
char * var_flush_acl
Definition: postqueue.c:323
#define PQ_MODE_JSON_LIST
Definition: postqueue.c:313
int flush_send_file(const char *queue_id)
Definition: flush_clnt.c:201
#define VAR_SHOWQ_ACL
Definition: mail_params.h:113
int mail_flush_maildrop(void)
Definition: mail_flush.c:71
#define MAIL_VERSION_STAMP_ALLOCATE
Definition: mail_version.h:67
#define FLUSH_STAT_DENY
Definition: flush_clnt.h:39
void get_mail_conf_str_table(const CONFIG_STR_TABLE *)
void showq_json(VSTREAM *)
Definition: showq_json.c:202
#define MAIL_VERSION_CHECK
Definition: mail_version.h:90
#define VAR_FLUSH_ACL
Definition: mail_params.h:109
char * concatenate(const char *arg0,...)
Definition: concatenate.c:42
#define GETOPT(argc, argv, str)
Definition: sys_defs.h:1313
void msg_syslog_init(const char *name, int logopt, int facility)
Definition: msg_syslog.c:173
#define PQ_MODE_MAILQ_LIST
Definition: postqueue.c:309
char * var_showq_acl
Definition: postqueue.c:324
int main(int argc, char **argv)
Definition: postqueue.c:537
#define DEF_FLUSH_ACL
Definition: mail_params.h:110
#define EX_UNAVAILABLE
Definition: sys_exits.h:36
#define PQ_MODE_FLUSH_SITE
Definition: postqueue.c:311
char * var_daemon_dir
Definition: mail_params.c:242
const char * check_user_acl_byuid(const char *pname, const char *acl, uid_t uid)
Definition: user_acl.c:65
#define EX_USAGE
Definition: sys_exits.h:31
char * var_queue_dir
Definition: mail_params.c:246
void msg_vstream_init(const char *name, VSTREAM *vp)
Definition: msg_vstream.c:77
#define FLUSH_STAT_OK
Definition: flush_clnt.h:37
void event_drain(int time_limit)
Definition: events.c:657
NORETURN msg_fatal_status(int status, const char *fmt,...)
Definition: msg.c:272
VSTREAM VSTREAM const char VSTREAM * vstream_popen(int,...)
void showq_compat(VSTREAM *)
Definition: showq_compat.c:174
#define BLOCKING
Definition: iostuff.h:48
#define EX_OSERR
Definition: sys_exits.h:38
MSG_CLEANUP_FN msg_cleanup(MSG_CLEANUP_FN cleanup_fn)
Definition: msg.c:317
int flush_send_site(const char *site)
Definition: flush_clnt.c:165
#define VSTREAM_ERR
Definition: vstream.h:68
#define fstat(f, s)
Definition: warn_stat.h:20
#define DONT_GRIPE
Definition: haproxy_srvr.h:31
void argv_terminate(ARGV *argvp)
Definition: argv.c:242