Postfix3.3.1
master_ent.c
[詳解]
1 /*++
2 /* NAME
3 /* master_ent 3
4 /* SUMMARY
5 /* Postfix master - config file access
6 /* SYNOPSIS
7 /* #include "master.h"
8 /*
9 /* void fset_master_ent(path)
10 /* char *path;
11 /*
12 /* void set_master_ent()
13 /*
14 /* MASTER_SERV *get_master_ent()
15 /*
16 /* void end_master_ent()
17 /*
18 /* void print_master_ent(entry)
19 /* MASTER_SERV *entry;
20 /*
21 /* void free_master_ent(entry)
22 /* MASTER_SERV *entry;
23 /* DESCRIPTION
24 /* This module implements a simple programmatic interface
25 /* for accessing Postfix master process configuration files.
26 /*
27 /* fset_master_ent() specifies the location of the master process
28 /* configuration file. The pathname is copied.
29 /*
30 /* set_master_ent() opens the configuration file. It is an error
31 /* to call this routine while the configuration file is still open.
32 /* It is an error to open a configuration file without specifying
33 /* its name to fset_master_ent().
34 /*
35 /* get_master_ent() reads the next entry from an open configuration
36 /* file and returns the parsed result. A null result means the end
37 /* of file was reached.
38 /*
39 /* print_master_ent() prints the specified service entry.
40 /*
41 /* end_master_ent() closes an open configuration file. It is an error
42 /* to call this routine when the configuration file is not open.
43 /*
44 /* free_master_ent() destroys the memory used for a parsed configuration
45 /* file entry.
46 /* DIAGNOSTICS
47 /* Panics: interface violations. Fatal errors: memory allocation
48 /* failure.
49 /* BUGS
50 /* SEE ALSO
51 /* LICENSE
52 /* .ad
53 /* .fi
54 /* The Secure Mailer license must be distributed with this software.
55 /* AUTHOR(S)
56 /* Wietse Venema
57 /* IBM T.J. Watson Research
58 /* P.O. Box 704
59 /* Yorktown Heights, NY 10598, USA
60 /*--*/
61 
62 /* System libraries. */
63 
64 #include <sys_defs.h>
65 #include <netinet/in.h>
66 #include <stdarg.h>
67 #include <string.h>
68 #include <stdlib.h>
69 #include <unistd.h>
70 #include <ctype.h>
71 #include <fcntl.h>
72 
73 #ifdef STRCASECMP_IN_STRINGS_H
74 #include <strings.h>
75 #endif
76 
77 /* Utility libraries. */
78 
79 #include <msg.h>
80 #include <mymalloc.h>
81 #include <vstring.h>
82 #include <vstream.h>
83 #include <argv.h>
84 #include <stringops.h>
85 #include <readlline.h>
86 #include <inet_addr_list.h>
87 #include <host_port.h>
88 #include <inet_addr_host.h>
89 #include <sock_addr.h>
90 #include <inet_proto.h>
91 
92 /* Global library. */
93 
94 #include <match_service.h>
95 #include <mail_proto.h>
96 #include <mail_params.h>
97 #include <own_inet_addr.h>
98 #include <wildcard_inet_addr.h>
99 #include <mail_conf.h>
100 
101 /* Local stuff. */
102 
103 #include "master_proto.h"
104 #include "master.h"
105 
106 static char *master_path; /* config file name */
107 static VSTREAM *master_fp; /* config file pointer */
108 static int master_line_last; /* config file line number */
109 static int master_line; /* config file line number */
110 static ARGV *master_disable; /* disabled service patterns */
111 
112 static char master_blanks[] = CHARS_SPACE; /* field delimiters */
113 
114 /* fset_master_ent - specify configuration file pathname */
115 
116 void fset_master_ent(char *path)
117 {
118  if (master_path != 0)
119  myfree(master_path);
120  master_path = mystrdup(path);
121 }
122 
123 /* set_master_ent - open configuration file */
124 
126 {
127  const char *myname = "set_master_ent";
128  char *disable;
129 
130  if (master_fp != 0)
131  msg_panic("%s: configuration file still open", myname);
132  if (master_path == 0)
133  msg_panic("%s: no configuration file specified", myname);
134  if ((master_fp = vstream_fopen(master_path, O_RDONLY, 0)) == 0)
135  msg_fatal("open %s: %m", master_path);
136  master_line_last = 0;
137  if (master_disable != 0)
138  msg_panic("%s: service disable list still exists", myname);
139  if (inet_proto_info()->ai_family_list[0] == 0) {
140  msg_warn("all network protocols are disabled (%s = %s)",
142  msg_warn("disabling all type \"inet\" services in master.cf");
143  disable = concatenate(MASTER_XPORT_NAME_INET, ",",
144  var_master_disable, (char *) 0);
145  master_disable = match_service_init(disable);
146  myfree(disable);
147  } else
148  master_disable = match_service_init(var_master_disable);
149 }
150 
151 /* end_master_ent - close configuration file */
152 
154 {
155  const char *myname = "end_master_ent";
156 
157  if (master_fp == 0)
158  msg_panic("%s: configuration file not open", myname);
159  if (vstream_fclose(master_fp) != 0)
160  msg_fatal("%s: close configuration file: %m", myname);
161  master_fp = 0;
162  if (master_disable == 0)
163  msg_panic("%s: no service disable list", myname);
164  match_service_free(master_disable);
165  master_disable = 0;
166 }
167 
168 /* master_conf_context - plot the target range */
169 
170 static const char *master_conf_context(void)
171 {
172  static VSTRING *context_buf = 0;
173 
174  if (context_buf == 0)
175  context_buf = vstring_alloc(100);
176  vstring_sprintf(context_buf, "%s: line %d", master_path, master_line);
177  return (vstring_str(context_buf));
178 }
179 
180 /* fatal_with_context - print fatal error with file/line context */
181 
182 static NORETURN PRINTFLIKE(1, 2) fatal_with_context(char *format,...)
183 {
184  const char *myname = "fatal_with_context";
185  VSTRING *vp = vstring_alloc(100);
186  va_list ap;
187 
188  if (master_path == 0)
189  msg_panic("%s: no configuration file specified", myname);
190 
191  va_start(ap, format);
192  vstring_vsprintf(vp, format, ap);
193  va_end(ap);
194  msg_fatal("%s: %s", master_conf_context(), vstring_str(vp));
195 }
196 
197 /* fatal_invalid_field - report invalid field value */
198 
199 static NORETURN fatal_invalid_field(char *name, char *value)
200 {
201  fatal_with_context("field \"%s\": bad value: \"%s\"", name, value);
202 }
203 
204 /* get_str_ent - extract string field */
205 
206 static char *get_str_ent(char **bufp, char *name, char *def_val)
207 {
208  char *value;
209 
210  if ((value = mystrtok(bufp, master_blanks)) == 0)
211  fatal_with_context("missing \"%s\" field", name);
212  if (strcmp(value, "-") == 0) {
213  if (def_val == 0)
214  fatal_with_context("field \"%s\" has no default value", name);
215  if (warn_compat_break_chroot && strcmp(name, "chroot") == 0)
216  msg_info("%s: using backwards-compatible default setting "
217  "%s=%s", master_conf_context(), name, def_val);
218  return (def_val);
219  } else {
220  return (value);
221  }
222 }
223 
224 /* get_bool_ent - extract boolean field */
225 
226 static int get_bool_ent(char **bufp, char *name, char *def_val)
227 {
228  char *value;
229 
230  value = get_str_ent(bufp, name, def_val);
231  if (strcmp("y", value) == 0) {
232  return (1);
233  } else if (strcmp("n", value) == 0) {
234  return (0);
235  } else {
236  fatal_invalid_field(name, value);
237  }
238  /* NOTREACHED */
239 }
240 
241 /* get_int_ent - extract integer field */
242 
243 static int get_int_ent(char **bufp, char *name, char *def_val, int min_val)
244 {
245  char *value;
246  int n;
247 
248  value = get_str_ent(bufp, name, def_val);
249  if (!ISDIGIT(*value) || (n = atoi(value)) < min_val)
250  fatal_invalid_field(name, value);
251  return (n);
252 }
253 
254 /* get_master_ent - read entry from configuration file */
255 
257 {
258  VSTRING *buf = vstring_alloc(100);
259  VSTRING *junk = vstring_alloc(100);
260  MASTER_SERV *serv;
261  char *cp;
262  char *name;
263  char *host = 0;
264  char *port = 0;
265  char *transport;
266  int private;
267  int unprivileged; /* passed on to child */
268  int chroot; /* passed on to child */
269  char *command;
270  int n;
271  char *bufp;
272  char *atmp;
273  const char *parse_err;
274  static char *saved_interfaces = 0;
275  char *err;
276 
277  if (master_fp == 0)
278  msg_panic("get_master_ent: config file not open");
279  if (master_disable == 0)
280  msg_panic("get_master_ent: no service disable list");
281 
282  /*
283  * XXX We cannot change the inet_interfaces setting for a running master
284  * process. Listening sockets are inherited by child processes so that
285  * closing and reopening those sockets in the master does not work.
286  *
287  * Another problem is that library routines still cache results that are
288  * based on the old inet_interfaces setting. It is too much trouble to
289  * recompute everything.
290  *
291  * In order to keep our data structures consistent we ignore changes in
292  * inet_interfaces settings, and issue a warning instead.
293  */
294  if (saved_interfaces == 0)
295  saved_interfaces = mystrdup(var_inet_interfaces);
296 
297  /*
298  * Skip blank lines and comment lines.
299  */
300  for (;;) {
301  if (readllines(buf, master_fp, &master_line_last, &master_line) == 0) {
302  vstring_free(buf);
303  vstring_free(junk);
304  return (0);
305  }
306  bufp = vstring_str(buf);
307  if ((cp = mystrtok(&bufp, master_blanks)) == 0)
308  continue;
309  name = cp;
310  transport = get_str_ent(&bufp, "transport type", (char *) 0);
311  vstring_sprintf(junk, "%s/%s", name, transport);
312  if (match_service_match(master_disable, vstring_str(junk)) == 0)
313  break;
314  }
315 
316  /*
317  * Parse one logical line from the configuration file. Initialize service
318  * structure members in order.
319  */
320  serv = (MASTER_SERV *) mymalloc(sizeof(MASTER_SERV));
321  serv->next = 0;
322 
323  /*
324  * Flags member.
325  */
326  serv->flags = 0;
327 
328  /*
329  * All servers busy warning timer.
330  */
331  serv->busy_warn_time = 0;
332 
333  /*
334  * Service name. Syntax is transport-specific.
335  */
336  serv->ext_name = mystrdup(name);
337 
338  /*
339  * Transport type: inet (wild-card listen or virtual) or unix.
340  */
341 #define STR_SAME !strcmp
342 
343  if (STR_SAME(transport, MASTER_XPORT_NAME_INET)) {
344  if (!STR_SAME(saved_interfaces, var_inet_interfaces)) {
345  msg_warn("service %s: ignoring %s change",
347  msg_warn("to change %s, stop and start Postfix",
349  }
350  serv->type = MASTER_SERV_TYPE_INET;
351  atmp = mystrdup(name);
352  if ((parse_err = host_port(atmp, &host, "", &port, (char *) 0)) != 0)
353  fatal_with_context("%s in \"%s\"", parse_err, name);
354  if (*host) {
355  serv->flags |= MASTER_FLAG_INETHOST;/* host:port */
357  mymalloc(sizeof(*MASTER_INET_ADDRLIST(serv)));
359  if (inet_addr_host(MASTER_INET_ADDRLIST(serv), host) == 0)
360  fatal_with_context("bad hostname or network address: %s", name);
362  serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
363  } else {
364  MASTER_INET_ADDRLIST(serv) =
365  strcasecmp(saved_interfaces, INET_INTERFACES_ALL) ?
366  own_inet_addr_list() : /* virtual */
367  wildcard_inet_addr_list(); /* wild-card */
369  serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
370  }
371  MASTER_INET_PORT(serv) = mystrdup(port);
372  for (n = 0; /* see below */ ; n++) {
373  if (n >= MASTER_INET_ADDRLIST(serv)->used) {
374  serv->flags |= MASTER_FLAG_LOCAL_ONLY;
375  break;
376  }
378  break;
379  }
380  } else if (STR_SAME(transport, MASTER_XPORT_NAME_UNIX)) {
381  serv->type = MASTER_SERV_TYPE_UNIX;
382  serv->listen_fd_count = 1;
383  serv->flags |= MASTER_FLAG_LOCAL_ONLY;
384  } else if (STR_SAME(transport, MASTER_XPORT_NAME_FIFO)) {
385  serv->type = MASTER_SERV_TYPE_FIFO;
386  serv->listen_fd_count = 1;
387  serv->flags |= MASTER_FLAG_LOCAL_ONLY;
388 #ifdef MASTER_SERV_TYPE_PASS
389  } else if (STR_SAME(transport, MASTER_XPORT_NAME_PASS)) {
390  serv->type = MASTER_SERV_TYPE_PASS;
391  serv->listen_fd_count = 1;
392  /* If this is a connection screener, remote clients are likely. */
393 #endif
394  } else {
395  fatal_with_context("bad transport type: %s", transport);
396  }
397 
398  /*
399  * Service class: public or private.
400  */
401  private = get_bool_ent(&bufp, "private", "y");
402 
403  /*
404  * Derive an internal service name. The name may depend on service
405  * attributes such as privacy.
406  */
407  if (serv->type == MASTER_SERV_TYPE_INET) {
408  MAI_HOSTADDR_STR host_addr;
409  MAI_SERVPORT_STR serv_port;
410  struct addrinfo *res0;
411 
412  if (private)
413  fatal_with_context("inet service cannot be private");
414 
415  /*
416  * Canonicalize endpoint names so that we correctly handle "reload"
417  * requests after someone changes "25" into "smtp" or vice versa.
418  */
419  if (*host == 0)
420  host = 0;
421  /* Canonicalize numeric host and numeric or symbolic service. */
422  if (hostaddr_to_sockaddr(host, port, 0, &res0) == 0) {
423  SOCKADDR_TO_HOSTADDR(res0->ai_addr, res0->ai_addrlen,
424  host ? &host_addr : (MAI_HOSTADDR_STR *) 0,
425  &serv_port, 0);
426  serv->name = (host ? concatenate("[", host_addr.buf, "]:",
427  serv_port.buf, (char *) 0) :
428  mystrdup(serv_port.buf));
429  freeaddrinfo(res0);
430  }
431  /* Canonicalize numeric or symbolic service. */
432  else if (hostaddr_to_sockaddr((char *) 0, port, 0, &res0) == 0) {
433  SOCKADDR_TO_HOSTADDR(res0->ai_addr, res0->ai_addrlen,
434  (MAI_HOSTADDR_STR *) 0, &serv_port, 0);
435  serv->name = (host ? concatenate("[", host, "]:",
436  serv_port.buf, (char *) 0) :
437  mystrdup(serv_port.buf));
438  freeaddrinfo(res0);
439  }
440  /* Bad service name? */
441  else
442  serv->name = mystrdup(name);
443  myfree(atmp);
444  } else if (serv->type == MASTER_SERV_TYPE_UNIX) {
445  serv->name = mail_pathname(private ? MAIL_CLASS_PRIVATE :
446  MAIL_CLASS_PUBLIC, name);
447  } else if (serv->type == MASTER_SERV_TYPE_FIFO) {
448  serv->name = mail_pathname(private ? MAIL_CLASS_PRIVATE :
449  MAIL_CLASS_PUBLIC, name);
450 #ifdef MASTER_SERV_TYPE_PASS
451  } else if (serv->type == MASTER_SERV_TYPE_PASS) {
452  serv->name = mail_pathname(private ? MAIL_CLASS_PRIVATE :
453  MAIL_CLASS_PUBLIC, name);
454 #endif
455  } else {
456  msg_panic("bad transport type: %d", serv->type);
457  }
458 
459  /*
460  * Listen socket(s). XXX We pre-allocate storage because the number of
461  * sockets is frozen anyway once we build the command-line vector below.
462  */
463  if (serv->listen_fd_count == 0) {
464  fatal_with_context("no valid IP address found: %s", name);
465  }
466  serv->listen_fd = (int *) mymalloc(sizeof(int) * serv->listen_fd_count);
467  for (n = 0; n < serv->listen_fd_count; n++)
468  serv->listen_fd[n] = -1;
469 
470  /*
471  * Privilege level. Default is to restrict process privileges to those of
472  * the mail owner.
473  */
474  unprivileged = get_bool_ent(&bufp, "unprivileged", "y");
475 
476  /*
477  * Chroot. Default is to restrict file system access to the mail queue.
478  * XXX Chroot cannot imply unprivileged service (for example, the pickup
479  * service runs chrooted but needs privileges to open files as the user).
480  */
481  chroot = get_bool_ent(&bufp, "chroot", var_compat_level < 1 ? "y" : "n");
482 
483  /*
484  * Wakeup timer. XXX should we require that var_proc_limit == 1? Right
485  * now, the only services that have a wakeup timer also happen to be the
486  * services that have at most one running instance: local pickup and
487  * local delivery.
488  */
489  serv->wakeup_time = get_int_ent(&bufp, "wakeup_time", "0", 0);
490 
491  /*
492  * Find out if the wakeup time is conditional, i.e., wakeup triggers
493  * should not be sent until the service has actually been used.
494  */
495  if (serv->wakeup_time > 0 && bufp[*bufp ? -2 : -1] == '?')
496  serv->flags |= MASTER_FLAG_CONDWAKE;
497 
498  /*
499  * Concurrency limit. Zero means no limit.
500  */
501  vstring_sprintf(junk, "%d", var_proc_limit);
502  serv->max_proc = get_int_ent(&bufp, "max_proc", vstring_str(junk), 0);
503 
504  /*
505  * Path to command,
506  */
507  command = get_str_ent(&bufp, "command", (char *) 0);
508  serv->path = concatenate(var_daemon_dir, "/", command, (char *) 0);
509 
510  /*
511  * Idle and total process count.
512  */
513  serv->avail_proc = 0;
514  serv->total_proc = 0;
515 
516  /*
517  * Backoff time in case a service is broken.
518  */
520 
521  /*
522  * Shared channel for child status updates.
523  */
524  serv->status_fd[0] = serv->status_fd[1] = -1;
525 
526  /*
527  * Child process structures.
528  */
529  serv->children = 0;
530 
531  /*
532  * Command-line vector. Add "-n service_name" when the process name
533  * basename differs from the service name. Always add the transport.
534  */
535  serv->args = argv_alloc(0);
536  argv_add(serv->args, command, (char *) 0);
537  if (serv->max_proc == 1)
538  argv_add(serv->args, "-l", (char *) 0);
539  if (serv->max_proc == 0)
540  argv_add(serv->args, "-z", (char *) 0);
541  if (strcmp(basename(command), name) != 0)
542  argv_add(serv->args, "-n", name, (char *) 0);
543  argv_add(serv->args, "-t", transport, (char *) 0);
544  if (master_detach == 0)
545  argv_add(serv->args, "-d", (char *) 0);
546  if (msg_verbose)
547  argv_add(serv->args, "-v", (char *) 0);
548  if (unprivileged)
549  argv_add(serv->args, "-u", (char *) 0);
550  if (chroot)
551  argv_add(serv->args, "-c", (char *) 0);
552  if ((serv->flags & MASTER_FLAG_LOCAL_ONLY) == 0 && serv->max_proc > 1) {
553  argv_add(serv->args, "-o", "stress=" CONFIG_BOOL_YES, (char *) 0);
554  serv->stress_param_val =
555  serv->args->argv[serv->args->argc - 1] + sizeof("stress=") - 1;
556  serv->stress_param_val[0] = 0;
557  } else
558  serv->stress_param_val = 0;
559  serv->stress_expire_time = 0;
560  if (serv->listen_fd_count > 1)
561  argv_add(serv->args, "-s",
562  vstring_str(vstring_sprintf(junk, "%d", serv->listen_fd_count)),
563  (char *) 0);
564  while ((cp = mystrtokq(&bufp, master_blanks, CHARS_BRACE)) != 0) {
565  if (*cp == CHARS_BRACE[0]
566  && (err = extpar(&cp, CHARS_BRACE, EXTPAR_FLAG_STRIP)) != 0)
567  fatal_with_context("%s", err);
568  argv_add(serv->args, cp, (char *) 0);
569  }
570  argv_terminate(serv->args);
571 
572  /*
573  * Cleanup.
574  */
575  vstring_free(buf);
576  vstring_free(junk);
577  return (serv);
578 }
579 
580 /* print_master_ent - show service entry contents */
581 
583 {
584  char **cpp;
585 
586  msg_info("====start service entry");
587  msg_info("flags: %d", serv->flags);
588  msg_info("name: %s", serv->name);
589  msg_info("type: %s",
595 #endif
596  "unknown transport type");
597  msg_info("listen_fd_count: %d", serv->listen_fd_count);
598  msg_info("wakeup: %d", serv->wakeup_time);
599  msg_info("max_proc: %d", serv->max_proc);
600  msg_info("path: %s", serv->path);
601  for (cpp = serv->args->argv; *cpp; cpp++)
602  msg_info("arg[%d]: %s", (int) (cpp - serv->args->argv), *cpp);
603  msg_info("avail_proc: %d", serv->avail_proc);
604  msg_info("total_proc: %d", serv->total_proc);
605  msg_info("throttle_delay: %d", serv->throttle_delay);
606  msg_info("status_fd %d %d", serv->status_fd[0], serv->status_fd[1]);
607  msg_info("children: 0x%lx", (long) serv->children);
608  msg_info("next: 0x%lx", (long) serv->next);
609  msg_info("====end service entry");
610 }
611 
612 /* free_master_ent - destroy process entry */
613 
615 {
616 
617  /*
618  * Undo what get_master_ent() created.
619  */
620  if (serv->flags & MASTER_FLAG_INETHOST) {
622  myfree((void *) MASTER_INET_ADDRLIST(serv));
623  }
624  if (serv->type == MASTER_SERV_TYPE_INET)
625  myfree(MASTER_INET_PORT(serv));
626  myfree(serv->ext_name);
627  myfree(serv->name);
628  myfree(serv->path);
629  argv_free(serv->args);
630  myfree((void *) serv->listen_fd);
631  myfree((void *) serv);
632 }
int msg_verbose
Definition: msg.c:177
void myfree(void *ptr)
Definition: mymalloc.c:207
void freeaddrinfo(struct addrinfo *ai)
Definition: myaddrinfo.c:742
int listen_fd_count
Definition: master.h:35
#define CHARS_BRACE
Definition: sys_defs.h:1763
void inet_addr_list_uniq(INET_ADDR_LIST *list)
char * mystrdup(const char *str)
Definition: mymalloc.c:225
char * extpar(char **bp, const char *parens, int flags)
Definition: extpar.c:77
void set_master_ent()
Definition: master_ent.c:125
ARGV * argv_free(ARGV *argvp)
Definition: argv.c:136
ARGV * match_service_init(const char *patterns)
Definition: match_service.c:99
#define NORETURN
Definition: sys_defs.h:1583
Definition: argv.h:17
NORETURN msg_panic(const char *fmt,...)
Definition: msg.c:295
#define vstring_str(vp)
Definition: vstring.h:71
void inet_addr_list_free(INET_ADDR_LIST *list)
int status_fd[2]
Definition: master.h:52
#define inet_proto_info()
Definition: inet_proto.h:29
#define MASTER_FLAG_LOCAL_ONLY
Definition: master.h:66
MASTER_SERV * get_master_ent()
Definition: master_ent.c:256
int match_service_match(ARGV *list, const char *name_type)
int master_detach
Definition: master.c:237
#define MASTER_SERV_TYPE_PASS
Definition: master.h:81
char ** argv
Definition: argv.h:20
#define EXTPAR_FLAG_STRIP
Definition: stringops.h:57
int warn_compat_break_chroot
Definition: mail_params.c:365
#define SOCKADDR_TO_HOSTADDR(sa, salen, host, port, sock)
Definition: myaddrinfo.h:197
void argv_add(ARGV *argvp,...)
Definition: argv.c:197
#define MASTER_INET_ADDRLIST(s)
Definition: master.h:41
char * mystrtokq(char **src, const char *sep, const char *parens)
Definition: mystrtok.c:80
#define VAR_INET_INTERFACES
Definition: mail_params.h:176
#define MASTER_XPORT_NAME_PASS
Definition: master_proto.h:18
void fset_master_ent(char *path)
Definition: master_ent.c:116
char * mystrtok(char **src, const char *sep)
Definition: mystrtok.c:54
ARGV * argv_alloc(ssize_t len)
Definition: argv.c:149
char * ext_name
Definition: master.h:29
void free_master_ent(MASTER_SERV *serv)
Definition: master_ent.c:614
char * var_master_disable
Definition: master_vars.c:51
int wakeup_time
Definition: master.h:33
int total_proc
Definition: master.h:50
int hostaddr_to_sockaddr(const char *hostaddr, const char *service, int socktype, struct addrinfo **res)
Definition: myaddrinfo.c:464
int var_proc_limit
Definition: mail_params.c:317
VSTREAM * vstream_fopen(const char *path, int flags, mode_t mode)
Definition: vstream.c:1241
char * name
Definition: master.h:30
char * stress_param_val
Definition: master.h:47
#define MAIL_CLASS_PUBLIC
Definition: mail_proto.h:95
time_t busy_warn_time
Definition: master.h:32
char buf[MAI_HOSTADDR_STRSIZE]
Definition: myaddrinfo.h:146
VSTRING * vstring_vsprintf(VSTRING *vp, const char *format, va_list ap)
Definition: vstring.c:614
void end_master_ent()
Definition: master_ent.c:153
int type
Definition: master.h:31
int avail_proc
Definition: master.h:49
#define STR_SAME
#define ISDIGIT(c)
Definition: sys_defs.h:1748
int var_throttle_time
Definition: master_vars.c:50
int vstream_fclose(VSTREAM *stream)
Definition: vstream.c:1268
int flags
Definition: master.h:28
char * path
Definition: master.h:45
char * mail_pathname(const char *service_class, const char *service_name)
Definition: mail_pathname.c:41
int sock_addr_in_loopback(const struct sockaddr *sa)
Definition: sock_addr.c:156
struct MASTER_SERV * next
Definition: master.h:54
#define SOCK_ADDR_PTR(ptr)
Definition: sock_addr.h:24
void msg_warn(const char *fmt,...)
Definition: msg.c:215
#define MASTER_SERV_TYPE_UNIX
Definition: master.h:78
void match_service_free(ARGV *list)
VSTRING * vstring_alloc(ssize_t len)
Definition: vstring.c:353
#define CHARS_SPACE
Definition: sys_defs.h:1762
#define VAR_INET_PROTOCOLS
Definition: mail_params.h:994
VSTRING * vstring_sprintf(VSTRING *vp, const char *format,...)
Definition: vstring.c:602
INET_ADDR_LIST * wildcard_inet_addr_list(void)
#define MASTER_XPORT_NAME_FIFO
Definition: master_proto.h:16
#define MASTER_XPORT_NAME_INET
Definition: master_proto.h:17
void inet_addr_list_init(INET_ADDR_LIST *list)
time_t stress_expire_time
Definition: master.h:48
NORETURN msg_fatal(const char *fmt,...)
Definition: msg.c:249
#define CONFIG_BOOL_YES
Definition: mail_conf.h:30
#define MASTER_XPORT_NAME_UNIX
Definition: master_proto.h:15
#define MASTER_SERV_TYPE_INET
Definition: master.h:79
VSTRING * readllines(VSTRING *buf, VSTREAM *fp, int *lineno, int *first_line)
Definition: readlline.c:82
void print_master_ent(MASTER_SERV *serv)
Definition: master_ent.c:582
char * concatenate(const char *arg0,...)
Definition: concatenate.c:42
int var_compat_level
Definition: mail_params.c:347
int max_proc
Definition: master.h:44
#define INET_INTERFACES_ALL
Definition: mail_params.h:177
int strcasecmp(const char *s1, const char *s2)
Definition: strcasecmp.c:41
INET_ADDR_LIST * own_inet_addr_list(void)
const char * host_port(char *buf, char **host, char *def_host, char **port, char *def_service)
Definition: host_port.c:115
VSTRING * vstring_free(VSTRING *vp)
Definition: vstring.c:380
char * var_daemon_dir
Definition: mail_params.c:242
struct ARGV * args
Definition: master.h:46
int inet_addr_host(INET_ADDR_LIST *addr_list, const char *hostname)
char * var_inet_protocols
Definition: mail_params.c:260
#define PRINTFLIKE(x, y)
Definition: sys_defs.h:1600
#define MASTER_INET_PORT(s)
Definition: master.h:42
ssize_t argc
Definition: argv.h:19
int * listen_fd
Definition: master.h:34
char buf[MAI_SERVPORT_STRSIZE]
Definition: myaddrinfo.h:154
#define MASTER_SERV_TYPE_FIFO
Definition: master.h:80
struct BINHASH * children
Definition: master.h:53
char * var_inet_interfaces
Definition: mail_params.c:258
#define basename
Definition: stringops.h:36
#define MASTER_FLAG_INETHOST
Definition: master.h:65
#define MAIL_CLASS_PRIVATE
Definition: mail_proto.h:96
int throttle_delay
Definition: master.h:51
#define MASTER_FLAG_CONDWAKE
Definition: master.h:64
void * mymalloc(ssize_t len)
Definition: mymalloc.c:150
void argv_terminate(ARGV *argvp)
Definition: argv.c:242
void msg_info(const char *fmt,...)
Definition: msg.c:199