579 #include <sys/stat.h>
629 static const int pcf_incompat_options[] = {
651 static const int pcf_compat_options[][2] = {
679 static const NAME_MASK pcf_compat_names[] = {
707 static void usage(
const char *progname)
710 " [-a (server SASL types)]"
711 " [-A (client SASL types)]"
712 " [-b (bounce templates)]"
715 " [-d (parameter defaults)]"
716 " [-e (edit configuration)]"
718 " [-F (master.cf fields)]"
724 " [-n (non-default parameters)]"
725 " [-o name=value (override parameter value)]"
726 " [-p (main.cf, default)]"
727 " [-P (master.cf parameters)]"
728 " [-t (bounce templates)]"
729 " [-T compile-version|run-version|public-key-algorithms]"
731 " [-x (expand parameter values)]"
733 " [-# (comment-out)]"
734 " [name...]", progname);
739 static void pcf_check_exclusive_options(
int optval)
741 const char *myname =
"pcf_check_exclusive_options";
746 for (op = pcf_incompat_options; (oval = *op) != 0; op++) {
748 for (mask = ~0U; (mask & oval) != 0; mask >>= 1) {
749 if ((mask & oval) != oval)
758 static void pcf_check_compat_options(
int optval)
760 const char *myname =
"pcf_check_compat_options";
766 for (op = pcf_compat_options; op[0][0] != 0; op++) {
767 if ((optval & *op[0]) != 0
768 && (excess = (optval & ~((*op)[0] | (*op)[1]))) != 0)
769 msg_fatal(
"with option %s, do not specify %s",
781 int main(
int argc,
char **argv)
788 static const NAME_MASK param_class_table[] = {
795 ARGV *override_params = 0;
796 const char *pcf_tls_arg = 0;
813 for (fd = 0; fd < 3; fd++)
814 if (
fstat(fd, &st) == -1
815 && (close(fd), open(
"/dev/null", O_RDWR, 0)) != fd)
826 while ((ch =
GETOPT(argc, argv,
"aAbc:C:deEfFhHlmMno:pPtT:vxX#")) > 0) {
839 argv_add(ext_argv,
"bounce",
"-SVnexpand_templates", (
char *) 0);
884 if (override_params == 0)
886 argv_add(override_params, optarg, (
char *) 0);
899 argv_add(ext_argv,
"bounce",
"-SVndump_templates", (
char *) 0);
903 msg_fatal(
"At most one -T <mode> option may be specified");
905 pcf_tls_arg = optarg;
939 #define PCF_MAIN_OR_MASTER \
940 (PCF_MAIN_PARAM | PCF_MASTER_ENTRY | PCF_MASTER_FLD | PCF_MASTER_PARAM)
945 && argv[optind] && strchr(argv[optind],
'='))
955 msg_fatal(
"-e requires name=value argument");
962 if (argv[optind + 1])
963 msg_fatal(
"options -b and -t require at most one template file");
966 argv[optind], (
char *) 0),
1001 if (override_params)
1053 if (override_params)
void pcf_register_builtin_parameters(const char *, pid_t)
MAIL_VERSION_STAMP_DECLARE
#define str_name_mask(tag, table, mask)
PCF_MASTER_ENT * pcf_master_table
#define PCF_SHOW_SASL_SERV
void pcf_set_parameters(char **)
NORETURN mail_run_replace(const char *dir, char **argv)
#define PCF_FAIL_ON_OPEN_ERROR
void const char void pcf_flag_unused_main_parameters(void)
void pcf_show_master_params(VSTREAM *, int, int, char **)
void argv_add(ARGV *argvp,...)
void pcf_edit_master(int, int, char **)
ARGV * argv_alloc(ssize_t len)
#define PCF_EXP_DSN_TEMPL
void pcf_show_master_fields(VSTREAM *, int, int, char **)
void mail_conf_read(void)
int main(int argc, char **argv)
void pcf_read_master(int)
const char * str_name_mask_opt(VSTRING *buf, const char *context, const NAME_MASK *table, int mask, int flags)
#define PCF_PARAM_FLAG_SERVICE
#define PCF_SHOW_SASL_CLNT
void pcf_show_locks(void)
VSTRING * vstring_alloc(ssize_t len)
void mail_dict_init(void)
#define MAIL_VERSION_STAMP_ALLOCATE
void pcf_read_parameters(void)
#define PCF_WARN_ON_OPEN_ERROR
void pcf_edit_main(int, int, char **)
NORETURN msg_fatal(const char *fmt,...)
int vstream_fflush(VSTREAM *stream)
char * concatenate(const char *arg0,...)
#define GETOPT(argc, argv, str)
#define PCF_PARAM_FLAG_BUILTIN
#define PCF_PARAM_MASK_CLASS
#define PCF_PARAM_FLAG_USER
void pcf_flag_unused_master_parameters(void)
void pcf_show_parameters(VSTREAM *, int, int, char **)
VSTRING * vstring_free(VSTRING *vp)
#define PCF_DUMP_DSN_TEMPL
PCF_PARAM_TABLE * pcf_param_table
void msg_vstream_init(const char *name, VSTREAM *vp)
#define NAME_MASK_ANY_CASE
void pcf_register_user_parameters(void)
#define PCF_MAIN_OR_MASTER
#define name_mask_opt(tag, table, str, flags)
void pcf_show_master_entries(VSTREAM *, int, int, char **)
void pcf_register_service_parameters(void)
void pcf_show_tls(const char *)