summaryrefslogtreecommitdiff
path: root/pop3d/pop3d.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-11-07 22:32:26 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-11-07 22:32:26 +0000
commit6bd4a8b2ed555986e20ad09e11d6a95470a9be71 (patch)
treefd4460349b8bdf053639bcc9db9870ddb7350e18 /pop3d/pop3d.c
parent6c26e9b60fc16d4b4afa64f6a2128ada847c7084 (diff)
downloadmailutils-6bd4a8b2ed555986e20ad09e11d6a95470a9be71.tar.gz
mailutils-6bd4a8b2ed555986e20ad09e11d6a95470a9be71.tar.bz2
* include/mailutils/argp.h (mu_argp_set_config_param): New
function. * include/mailutils/cfg.h (mu_cfg_time): New value (struct mu_cfg_section): Rewamp using lists. (enum mu_cfg_cont_type, struct mu_cfg_cont): New types. (mu_config_create_container, mu_config_clone_container) (mu_config_destroy_container): New functions. (mu_parse_config): New function. * include/mailutils/mu_auth.h (mu_authentication_clear_list) (mu_authorization_clear_list): New functions. * mailbox/cfg_lexer.c: Add missing includes (mu_config_create_container, mu_config_clone_container) (mu_config_destroy_container): New functions. (mu_parse_config): New function. (_mu_config_register_section): New function. (mu_config_register_section): New function. (_mu_parse_config): Fully implement system-wide/per-user configuration semantics. (mu_parse_config): Take two more arguments. * mailbox/cfg_parser.h: Remove automatically generated file. * mailbox/cfg_parser.y (find_container): New function (find_subsection,find_param): Rewrite using find_container (parse_param): Implement new data type mu_cfg_time (time_t value). (_scan_tree_helper): Complain about unknown sections only if MU_CONFIG_VERBOSE environment variable is set. * mailbox/mu_argp.c (assign_string): Bugfix. (mu_argp_set_config_param): New function. (mu_argp_parse): Remove eventual `lt-' prefix from program names. * mailbox/mu_auth.c: New options --clear-authorization and --clear-authentication. (mu_authorization_clear_list,mu_authentication_clear_list): New functions. * include/mailutils/refcount.h (struct _mu_refcount): Move ro refcount.c (mu_refcount_inc,mu_refcount_dec): Change return value. (mu_refcount_value): New function. * mailbox/refcount.c (struct _mu_refcount): Moved from refcount.h (mu_refcount_value): New function. (mu_refcount_create,mu_refcount_destroy,mu_refcount_inc) (mu_refcount_dec): Fix monitor usage. (mu_refcount_inc,mu_refcount_dec): Fix return type. * mailbox/Makefile.am (libmailutils_la_SOURCES): Add refcount.c * dotlock/dotlock.c, imap4d/imap4d.c, mail.local/main.c, mail.remote/mail.remote.c, mimeview/mimeview.c, movemail/movemail.c, pop3d/pop3d.c, pop3d/signal.c, readmsg/readmsg.c, sieve/sieve.c: Implement new configuration. * testsuite/lib/mailutils.exp: Set MU_CONFIG_FLAVOR envar to `none' to avoid reading configuration files.
Diffstat (limited to 'pop3d/pop3d.c')
-rw-r--r--pop3d/pop3d.c63
1 files changed, 49 insertions, 14 deletions
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c
index 668e9d25c..0e72efb83 100644
--- a/pop3d/pop3d.c
+++ b/pop3d/pop3d.c
@@ -74,39 +74,33 @@ static char doc[] = N_("GNU pop3d -- the POP3 daemon");
static struct argp_option options[] = {
#define GRP 0
- { NULL, 0, NULL, 0,
- N_("General options"), GRP },
- {"undelete", 'u', NULL, 0,
+ {"undelete", 'u', NULL, OPTION_HIDDEN,
N_("Undelete all messages on startup"), GRP+1},
- {"expire", OPT_EXPIRE, N_("DAYS"), 0,
+ {"expire", OPT_EXPIRE, N_("DAYS"), OPTION_HIDDEN,
N_("Expire read messages after the given number of days"), GRP+1},
- {"delete-expired", OPT_EXPIRE_ON_EXIT, NULL, 0,
+ {"delete-expired", OPT_EXPIRE_ON_EXIT, NULL, OPTION_HIDDEN,
N_("Delete expired messages upon closing the mailbox"), GRP+1},
#ifdef WITH_TLS
- {"tls-required", OPT_TLS_REQUIRED, NULL, 0,
+ {"tls-required", OPT_TLS_REQUIRED, NULL, OPTION_HIDDEN,
N_("Always require STLS before entering authentication phase")},
#endif
#undef GRP
#define GRP 10
#ifdef ENABLE_LOGIN_DELAY
- { NULL, 0, NULL, 0,
- N_("Login delay control"), GRP },
- {"login-delay", OPT_LOGIN_DELAY, N_("SECONDS"), 0,
+ {"login-delay", OPT_LOGIN_DELAY, N_("SECONDS"), OPTION_HIDDEN,
N_("Allowed delay between the two successive logins"), GRP+1},
- {"stat-file", OPT_STAT_FILE, N_("FILENAME"), 0,
+ {"stat-file", OPT_STAT_FILE, N_("FILENAME"), OPTION_HIDDEN,
N_("Name of login statistics file"), GRP+1},
#endif
#undef GRP
#define GRP 20
- { NULL, 0, NULL, 0,
- N_("Bulletin control"), GRP },
- { "bulletin-source", OPT_BULLETIN_SOURCE, N_("MBOX"), 0,
+ { "bulletin-source", OPT_BULLETIN_SOURCE, N_("MBOX"), OPTION_HIDDEN,
N_("Set source mailbox to get bulletins from"), GRP+1 },
#ifdef USE_DBM
- { "bulletin-db", OPT_BULLETIN_DB, N_("FILE"), 0,
+ { "bulletin-db", OPT_BULLETIN_DB, N_("FILE"), OPTION_HIDDEN,
N_("Set the bulletin database file name"), GRP+1 },
#endif
#undef GRP
@@ -114,6 +108,43 @@ static struct argp_option options[] = {
{NULL, 0, NULL, 0, NULL, 0}
};
+#ifdef WITH_TLS
+static int
+cb_tls_expired (mu_cfg_locus_t *locus, void *data, char *arg)
+{
+ initial_state = INITIAL;
+ return 0;
+}
+#endif
+
+static int
+cb_bulletin_source (mu_cfg_locus_t *locus, void *data, char *arg)
+{
+ set_bulletin_source (arg);
+ return 0;
+}
+
+static int
+cb_bulletin_db (mu_cfg_locus_t *locus, void *data, char *arg)
+{
+ set_bulletin_source (arg);
+ return 0;
+}
+
+static struct mu_cfg_param pop3d_cfg_param[] = {
+ { "undelete", mu_cfg_int, &undelete_on_startup },
+ { "expire", mu_cfg_time, &expire },
+ { "delete-expired", mu_cfg_int, &expire_on_exit },
+#ifdef WITH_TLS
+ { "tls-required", mu_cfg_callback, NULL, cb_tls_expired },
+#endif
+ { "login-delay", mu_cfg_time, &login_delay },
+ { "stat-file", mu_cfg_string, &login_stat_file },
+ { "bulletin-source", mu_cfg_callback, NULL, cb_bulletin_source },
+ { "bulletin-db", mu_cfg_callback, NULL, cb_bulletin_db },
+ { NULL }
+};
+
static struct argp argp = {
options,
pop3d_parse_opt,
@@ -221,8 +252,12 @@ main (int argc, char **argv)
#ifdef WITH_TLS
mu_tls_init_argp ();
#endif /* WITH_TLS */
+ mu_argp_set_config_param (pop3d_cfg_param);
mu_argp_parse (&argp, &argc, &argv, 0, pop3d_argp_capa, NULL, &daemon_param);
+ if (expire == 0)
+ expire_on_exit = 1;
+
#ifdef USE_LIBPAM
if (!pam_service)
pam_service = "gnu-pop3d";

Return to:

Send suggestions and report system problems to the System administrator.