Postfix3.3.1
postconf_other.c
[詳解]
1 /*++
2 /* NAME
3 /* postconf_other 3
4 /* SUMMARY
5 /* support for miscellaneous information categories
6 /* SYNOPSIS
7 /* #include <postconf.h>
8 /*
9 /* void pcf_show_maps()
10 /*
11 /* void pcf_show_locks()
12 /*
13 /* void pcf_show_sasl(mode)
14 /* int mode;
15 /*
16 /* void pcf_show_tls(what)
17 /* const char *what;
18 /* DESCRIPTION
19 /* pcf_show_maps() lists the available map (lookup table)
20 /* types.
21 /*
22 /* pcf_show_locks() lists the available mailbox lock types.
23 /*
24 /* pcf_show_sasl() shows the available SASL authentication
25 /* plugin types.
26 /*
27 /* pcf_show_tls() reports the "compile-version" or "run-version"
28 /* of the TLS library, or the supported public-key algorithms.
29 /*
30 /* Arguments:
31 /* .IP mode
32 /* Show server information if the PCF_SHOW_SASL_SERV flag is
33 /* set, otherwise show client information.
34 /* .IP what
35 /* One of the literals "compile-version", "run-version" or
36 /* "public-key-algorithms".
37 /* DIAGNOSTICS
38 /* Problems are reported to the standard error stream.
39 /* LICENSE
40 /* .ad
41 /* .fi
42 /* The Secure Mailer license must be distributed with this software.
43 /* AUTHOR(S)
44 /* Wietse Venema
45 /* IBM T.J. Watson Research
46 /* P.O. Box 704
47 /* Yorktown Heights, NY 10598, USA
48 /*
49 /* Wietse Venema
50 /* Google, Inc.
51 /* 111 8th Avenue
52 /* New York, NY 10011, USA
53 /*--*/
54 
55 /* System library. */
56 
57 #include <sys_defs.h>
58 
59 /* Utility library. */
60 
61 #include <vstream.h>
62 #include <argv.h>
63 #include <dict.h>
64 #include <msg.h>
65 
66 /* Global library. */
67 
68 #include <mbox_conf.h>
69 
70 /* XSASL library. */
71 
72 #include <xsasl.h>
73 
74 /* TLS library. */
75 
76 #include <tls.h>
77 
78 /* Application-specific. */
79 
80 #include <postconf.h>
81 
82 /* pcf_show_maps - show available maps */
83 
84 void pcf_show_maps(void)
85 {
86  ARGV *maps_argv;
87  int i;
88 
89  maps_argv = dict_mapnames();
90  for (i = 0; i < maps_argv->argc; i++)
91  vstream_printf("%s\n", maps_argv->argv[i]);
92  argv_free(maps_argv);
93 }
94 
95 /* pcf_show_locks - show available mailbox locking methods */
96 
97 void pcf_show_locks(void)
98 {
99  ARGV *locks_argv;
100  int i;
101 
102  locks_argv = mbox_lock_names();
103  for (i = 0; i < locks_argv->argc; i++)
104  vstream_printf("%s\n", locks_argv->argv[i]);
105  argv_free(locks_argv);
106 }
107 
108 /* pcf_show_sasl - show SASL plug-in types */
109 
110 void pcf_show_sasl(int what)
111 {
112  ARGV *sasl_argv;
113  int i;
114 
115  sasl_argv = (what & PCF_SHOW_SASL_SERV) ? xsasl_server_types() :
117  for (i = 0; i < sasl_argv->argc; i++)
118  vstream_printf("%s\n", sasl_argv->argv[i]);
119  argv_free(sasl_argv);
120 }
121 
122 /* pcf_show_tls - show TLS support */
123 
124 void pcf_show_tls(const char *what)
125 {
126 #ifdef USE_TLS
127  if (strcmp(what, "compile-version") == 0)
128  vstream_printf("%s\n", tls_compile_version());
129  else if (strcmp(what, "run-version") == 0)
130  vstream_printf("%s\n", tls_run_version());
131  else if (strcmp(what, "public-key-algorithms") == 0) {
132  const char **cpp;
133 
134  for (cpp = tls_pkey_algorithms(); *cpp; cpp++)
135  vstream_printf("%s\n", *cpp);
136  } else {
137  msg_warn("unknown 'postconf -T' mode: %s", what);
138  exit(1);
139  }
140 #endif /* USE_TLS */
141 }
void pcf_show_maps(void)
ARGV * argv_free(ARGV *argvp)
Definition: argv.c:136
Definition: argv.h:17
#define PCF_SHOW_SASL_SERV
Definition: postconf.h:34
char ** argv
Definition: argv.h:20
void pcf_show_locks(void)
ARGV * xsasl_server_types(void)
Definition: xsasl_server.c:262
VSTREAM * vstream_printf(const char *fmt,...)
Definition: vstream.c:1335
void msg_warn(const char *fmt,...)
Definition: msg.c:215
ARGV * xsasl_client_types(void)
Definition: xsasl_client.c:232
ARGV * dict_mapnames(void)
Definition: dict_open.c:527
ssize_t argc
Definition: argv.h:19
void pcf_show_sasl(int what)
void pcf_show_tls(const char *what)
ARGV * mbox_lock_names(void)
Definition: mbox_conf.c:90