diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 52 |
1 files changed, 37 insertions, 15 deletions
@@ -34,20 +34,20 @@ | |||
34 | #include <netdb.h> | 34 | #include <netdb.h> |
35 | 35 | ||
36 | #include <mailutils/mailutils.h> | 36 | #include <mailutils/mailutils.h> |
37 | #include <mailutils/server.h> | 37 | #include <mailutils/server.h> |
38 | #include <mailutils/syslog.h> | 38 | #include <mailutils/syslog.h> |
39 | #include <mailutils/libargp.h> | 39 | #include <mailutils/libargp.h> |
40 | #include <mailutils/dbm.h> | ||
40 | 41 | ||
41 | #include "mailfromd.h" | 42 | #include "mailfromd.h" |
42 | #include "callout.h" | 43 | #include "callout.h" |
43 | #include "srvman.h" | 44 | #include "srvman.h" |
44 | #include "inttostr.h" | 45 | #include "inttostr.h" |
45 | #include "srvcfg.h" | 46 | #include "srvcfg.h" |
46 | #include "filenames.h" | 47 | #include "filenames.h" |
47 | #include "mf-dbm.h" | ||
48 | #include "builtin.h" | 48 | #include "builtin.h" |
49 | #include "prog.h" | 49 | #include "prog.h" |
50 | 50 | ||
51 | 51 | ||
52 | /* Configurable options */ | 52 | /* Configurable options */ |
53 | 53 | ||
@@ -915,17 +915,16 @@ struct mu_cfg_param mf_cfg_param[] = { | |||
915 | cb_relayed_domain_file, | 915 | cb_relayed_domain_file, |
916 | N_("Read relayed domain names from the file"), | 916 | N_("Read relayed domain names from the file"), |
917 | N_("file: string") }, | 917 | N_("file: string") }, |
918 | 918 | ||
919 | { "database", mu_cfg_section, NULL }, | 919 | { "database", mu_cfg_section, NULL }, |
920 | 920 | ||
921 | { "lock-retry-count", mu_cfg_size, &lock_retry_count_option, 0, NULL, | 921 | { "lock-retry-count", mu_cfg_callback, 0, 0, config_cb_ignore, |
922 | N_("Retry acquiring DBM file lock this number of times.") }, | 922 | N_("Ignored for backward compatibility.") }, |
923 | { "lock-retry-timeout", mu_cfg_callback, &lock_retry_timeout_option, 0, | 923 | { "lock-retry-timeout", mu_cfg_callback, 0,0, config_cb_ignore, |
924 | config_cb_time_t, | 924 | N_("Ignored for backward compatibility."), |
925 | N_("Set the time span between the two DBM locking attempts."), | ||
926 | N_("time") }, | 925 | N_("time") }, |
927 | 926 | ||
928 | { "max-match-mx", mu_cfg_size, &max_match_mx, 0, NULL, | 927 | { "max-match-mx", mu_cfg_size, &max_match_mx, 0, NULL, |
929 | N_("Maximum number of MXs used by MFL \"mx match\" operation.") }, | 928 | N_("Maximum number of MXs used by MFL \"mx match\" operation.") }, |
930 | 929 | ||
931 | { "runtime", mu_cfg_section, NULL }, | 930 | { "runtime", mu_cfg_section, NULL }, |
@@ -1000,12 +999,43 @@ db_format_enumerator(struct db_format *fmt, void *data) | |||
1000 | } else | 999 | } else |
1001 | printf("%s expiration: %lu\n", fmt->name, | 1000 | printf("%s expiration: %lu\n", fmt->name, |
1002 | fmt->expire_interval); | 1001 | fmt->expire_interval); |
1003 | return 0; | 1002 | return 0; |
1004 | } | 1003 | } |
1005 | 1004 | ||
1005 | static void | ||
1006 | list_db_formats(const char *pfx) | ||
1007 | { | ||
1008 | mu_iterator_t itr; | ||
1009 | int rc; | ||
1010 | const char *defdb = DEFAULT_DB_TYPE; | ||
1011 | printf("%s", pfx); | ||
1012 | |||
1013 | rc = mu_dbm_impl_iterator(&itr); | ||
1014 | if (rc) { | ||
1015 | printf("%s\n", _("unknown")); | ||
1016 | mu_error("%s", mu_strerror(rc)); | ||
1017 | } else { | ||
1018 | int i; | ||
1019 | for (mu_iterator_first(itr), i = 0; !mu_iterator_is_done(itr); | ||
1020 | mu_iterator_next(itr), i++) { | ||
1021 | struct mu_dbm_impl *impl; | ||
1022 | |||
1023 | mu_iterator_current(itr, (void**)&impl); | ||
1024 | if (i) | ||
1025 | printf(", "); | ||
1026 | else if (!defdb) | ||
1027 | defdb = impl->_dbm_name; | ||
1028 | printf("%s", impl->_dbm_name); | ||
1029 | } | ||
1030 | putchar('\n'); | ||
1031 | mu_iterator_destroy(&itr); | ||
1032 | } | ||
1033 | printf("default database type: %s\n", defdb); | ||
1034 | } | ||
1035 | |||
1006 | void | 1036 | void |
1007 | mailfromd_show_defaults() | 1037 | mailfromd_show_defaults() |
1008 | { | 1038 | { |
1009 | printf("version: %s\n", VERSION); | 1039 | printf("version: %s\n", VERSION); |
1010 | printf("script file: %s\n", script_file); | 1040 | printf("script file: %s\n", script_file); |
1011 | printf("preprocessor: %s\n", ext_pp ? ext_pp : "none"); | 1041 | printf("preprocessor: %s\n", ext_pp ? ext_pp : "none"); |
@@ -1017,20 +1047,13 @@ mailfromd_show_defaults() | |||
1017 | #if DEFAULT_SYSLOG_ASYNC == 1 | 1047 | #if DEFAULT_SYSLOG_ASYNC == 1 |
1018 | printf("default syslog: non-blocking\n"); | 1048 | printf("default syslog: non-blocking\n"); |
1019 | #else | 1049 | #else |
1020 | printf("default syslog: blocking\n"); | 1050 | printf("default syslog: blocking\n"); |
1021 | #endif | 1051 | #endif |
1022 | #endif | 1052 | #endif |
1023 | printf("database format: "); | 1053 | list_db_formats("supported databases: "); |
1024 | #if defined WITH_GDBM | ||
1025 | printf("GDBM"); | ||
1026 | #elif defined WITH_BDB | ||
1027 | printf("Berkeley DB %d.x", WITH_BDB); | ||
1028 | #endif | ||
1029 | printf("\n"); | ||
1030 | |||
1031 | printf("Optional features: "); | 1054 | printf("Optional features: "); |
1032 | #if defined WITH_GEOIP | 1055 | #if defined WITH_GEOIP |
1033 | printf(" GeoIP"); | 1056 | printf(" GeoIP"); |
1034 | #endif | 1057 | #endif |
1035 | #if defined WITH_DSPAM | 1058 | #if defined WITH_DSPAM |
1036 | printf(" DSPAM"); | 1059 | printf(" DSPAM"); |
@@ -1190,13 +1213,12 @@ main(int argc, char **argv) | |||
1190 | debug_init(modnames); | 1213 | debug_init(modnames); |
1191 | libcallout_init(); | 1214 | libcallout_init(); |
1192 | init_string_space(); | 1215 | init_string_space(); |
1193 | init_symbols(); | 1216 | init_symbols(); |
1194 | builtin_setup(); | 1217 | builtin_setup(); |
1195 | mf_runtime_param_finish(); | 1218 | mf_runtime_param_finish(); |
1196 | libdbm_init(); | ||
1197 | db_format_setup(); | 1219 | db_format_setup(); |
1198 | include_path_setup(); | 1220 | include_path_setup(); |
1199 | pragma_setup(); | 1221 | pragma_setup(); |
1200 | mf_optcache_add(option_cache, 0, MF_OCF_NULL|MF_OCF_STATIC); | 1222 | mf_optcache_add(option_cache, 0, MF_OCF_NULL|MF_OCF_STATIC); |
1201 | mf_server_save_cmdline(argc, argv); | 1223 | mf_server_save_cmdline(argc, argv); |
1202 | 1224 | ||