Commit d39f4c2d d39f4c2db3ea8bc387cde7dcc2825598aa166ff6 by Sergey Poznyakoff

Improve configuration parsing (step 1).

Remove obsolete options (these have been made hidden in
v. 2.0).  Handle "include" and "program" after parsing
the sources, not while reducing the tree, as was
previously.  Retain, however, old functions for compatibility,
making them deprecated.  Add "query" mode to mailutils-config.

* include/mailutils/cfg.h (mu_cfg_node_tag): Remove
(mu_cfg_statement): Rename to mu_cfg_node_statement.
(mu_cfg_tree): New member: tail.
(mu_cfg_perror): Change signature.
(mu_cfg_vperror, mu_cfg_parse_error): New protos.
(MU_CFG_PATH_DELIM, MU_CFG_PATH_DELIM_STR): New defines.
(MU_PARSE_CONFIG_PLAIN,MU_CFG_FMT_LOCUS): New constant.
(MU_CFG_DEPRECATED): New macro.
(mu_parse_config,mu_get_config): Deprecated.
(mu_cfg_format_parse_tree): Change signature.
(mu_cfg_format_node, mu_cfg_parse_file): New protos.
(mu_cfg_tree_free): Remove stale proto.
(mu_cfg_find_node, mu_cfg_create_subtree): New protos.
* include/mailutils/libcfg.h (mu_libcfg_parse_config): New proto.
(mu_parse_config_files): Deprecated.

* include/mailutils/mutil.h (mu_make_file_name): New proto.
(mu_retrieve_fp, mu_register_retriever)
(mu_retrieve): Remove unused prototypes.
* include/mailutils/opool.h (mu_opool_union): New proto.

* libmu_argp/Makefile.am (libmu_argp_a_SOURCES): Remove
sources (see below):
* po/POTFILES.in: Likewise.
* libmu_argp/gsasl.c: Remove.
* libmu_argp/pam.c: Remove.
* libmu_argp/radius.c: Remove.
* libmu_argp/sql.c: Remove.
* libmu_argp/tls.c: Remove.
* libmu_argp/virtdomain.c: Remove.

* config/mailutils-config.c: New option --query (-q)
(main): Handle query mode.

* comsat/comsat.c: Define MU_CFG_COMPATIBILITY to suppress
deprecation warnings.

* bootstrap.conf (XGETTEXT_OPTIONS): Add mu_cfg
error reporting functions.

* mailbox/Makefile.am (libmailutils_la_SOURCES): Add
mkfilename.c
* mailbox/mkfilename.c: New file.

* imap4d/imap4d.c: Remove obsolete option (hidden since 2.0)
* libmu_argp/auth.c: Likewise.
* libmu_argp/cmdline.c: Likewise.
* libmu_argp/tls.c: Likewise.
* pop3d/pop3d.c: Likewise.
* libmu_argp/common.c: Likewise.
(mu_common_argp_options): New option --set.

* libmu_argp/muinit.c (mu_app_init): Rewrite using parse
tree as a principal entity.
* libmu_cfg/init.c (mu_libcfg_parse_config): New function.
* mailbox/cfg_driver.c (make_file_name): Remove.
(_cb_include): Use mu_make_file_name.
(mu_build_container): Use deprecated code only unless MU_PARSE_CONFIG_PLAIN
flag is set.
(mu_cfg_tree_reduce): Do nothing if the tree is NULL.
* mailbox/cfg_format.c (format_node): Print locus optionally.
(mu_cfg_format_parse_tree): Take additional argument.
(mu_cfg_format_node): New function.
* mailbox/cfg_lexer.l: Update calls to diagnostic functions.
(mu_cfg_parse_file): New function.
(mu_get_config): Rewrite.
* mailbox/cfg_parser.y (parse_tree): Replace with
parse_head, parse_tail. All usages updated.
(mu_cfg_free_node): New function.
(mu_cfg_vperror): New function.
(mu_cfg_perror,mu_cfg_parse_error): New function.
(mu_cfg_tree_union): New function.
(mu_cfg_tree_postprocess): New function.
(mu_cfg_find_section): Use MU_CFG_PATH_DELIM instead
of hardcoded slash.
(mu_cfg_value_eq): New function.
(mu_cfg_find_node): New function. Redesign of an old idea.
(mu_cfg_create_subtree): New function.
* mailbox/opool.c (mu_opool_union): New function.

* frm/testsuite/frm/test.exp: use --set option instead of
the obsolete --mail-folder.
* messages/testsuite/messages/test.exp: Likewise.
* sieve/testsuite/sieve/action.exp: Likewise.
* mail/testsuite/lib/mail.exp: use --set option instead of
the obsolete --mail-spool.
* mailbox/testsuite/lib/mailbox.exp: Likewise.
* testsuite/lib/mailutils.exp: Likewise.
* mailbox/mutil.c (mu_register_retriever)
(mu_retrieve): Remove unused functions.

Minor fix:

* frm/common.c (frm_abort): Initialize URL
before usage.
(frm_scan): Don't call frm_abort on a mailbox
that was not opened successfully.
1 parent 6dad17fe
...@@ -53,6 +53,9 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\ ...@@ -53,6 +53,9 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
53 --flag=mh_getyn:1:c-format\\\ 53 --flag=mh_getyn:1:c-format\\\
54 --flag=mh_getyn_interactive:1:c-format\\\ 54 --flag=mh_getyn_interactive:1:c-format\\\
55 --flag=mh_error:1:c-format\\\ 55 --flag=mh_error:1:c-format\\\
56 --flag=mu_cfg_perror:3:c-format\\\
57 --flag=mu_cfg_parse_error:1:c-format\\\
58 --flag=mu_cfg_format_error:3:c-format\\\
56 --flag=ali_parse_error:1:c-format\\\ 59 --flag=ali_parse_error:1:c-format\\\
57 --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\ 60 --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\
58 --flag=argp_error:2:c-format\\\ 61 --flag=argp_error:2:c-format\\\
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
18 MA 02110-1301 USA */ 18 MA 02110-1301 USA */
19 19
20 #include "comsat.h" 20 #include "comsat.h"
21 #define MU_CFG_COMPATIBILITY /* This source uses deprecated cfg interfaces */
22 #include "mailutils/libcfg.h"
21 #include "mailutils/libargp.h" 23 #include "mailutils/libargp.h"
22 24
23 #ifndef PATH_DEV 25 #ifndef PATH_DEV
......
...@@ -39,6 +39,9 @@ static struct argp_option options[] = { ...@@ -39,6 +39,9 @@ static struct argp_option options[] = {
39 N_("print a list of configuration options used to build mailutils; " 39 N_("print a list of configuration options used to build mailutils; "
40 "optional arguments are interpreted as a list of configuration " 40 "optional arguments are interpreted as a list of configuration "
41 "options to check for"), 0}, 41 "options to check for"), 0},
42 {"query", 'q', N_("FILE"), OPTION_ARG_OPTIONAL,
43 N_("query configuration values from FILE (default mailutils.rc)"),
44 0 },
42 {"verbose", 'v', NULL, 0, 45 {"verbose", 'v', NULL, 0,
43 N_("increase output verbosity"), 0}, 46 N_("increase output verbosity"), 0},
44 {0, 0, 0, 0} 47 {0, 0, 0, 0}
...@@ -48,11 +51,13 @@ enum config_mode { ...@@ -48,11 +51,13 @@ enum config_mode {
48 MODE_VOID, 51 MODE_VOID,
49 MODE_COMPILE, 52 MODE_COMPILE,
50 MODE_LINK, 53 MODE_LINK,
51 MODE_INFO 54 MODE_INFO,
55 MODE_QUERY
52 }; 56 };
53 57
54 enum config_mode mode; 58 enum config_mode mode;
55 int verbose; 59 int verbose;
60 char *query_config_file;
56 61
57 static error_t 62 static error_t
58 parse_opt (int key, char *arg, struct argp_state *state) 63 parse_opt (int key, char *arg, struct argp_state *state)
...@@ -71,6 +76,12 @@ parse_opt (int key, char *arg, struct argp_state *state) ...@@ -71,6 +76,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
71 mode = MODE_INFO; 76 mode = MODE_INFO;
72 break; 77 break;
73 78
79 case 'q':
80 if (arg)
81 query_config_file = arg;
82 mode = MODE_QUERY;
83 break;
84
74 case 'v': 85 case 'v':
75 verbose++; 86 verbose++;
76 break; 87 break;
...@@ -170,13 +181,28 @@ int ...@@ -170,13 +181,28 @@ int
170 main (int argc, char **argv) 181 main (int argc, char **argv)
171 { 182 {
172 int index; 183 int index;
184 int i, rc;
185 struct argp *myargp;
186 char **excapa;
187 mu_cfg_tree_t *tree = NULL;
188 mu_stream_t stream;
189 int fmtflags = 0;
173 190
174 mu_argp_init (program_version, NULL); 191 mu_argp_init (program_version, NULL);
175 if (mu_app_init (&argp, argp_capa, NULL, argc, argv, 0, &index, NULL)) 192
193 mu_set_program_name (argv[0]);
194 mu_libargp_init ();
195 for (i = 0; argp_capa[i]; i++)
196 mu_gocs_register_std (argp_capa[i]); /*FIXME*/
197 myargp = mu_argp_build (&argp, &excapa);
198
199 if (argp_parse (myargp, argc, argv, 0, &index, NULL))
176 { 200 {
177 argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name); 201 argp_help (myargp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
178 return 1; 202 return 1;
179 } 203 }
204 mu_argp_done (myargp);
205 mu_set_program_name (program_invocation_name);
180 206
181 argc -= index; 207 argc -= index;
182 argv += index; 208 argv += index;
...@@ -298,6 +324,44 @@ main (int argc, char **argv) ...@@ -298,6 +324,44 @@ main (int argc, char **argv)
298 return found == argc ? 0 : 1; 324 return found == argc ? 0 : 1;
299 } 325 }
300 return 0; 326 return 0;
327
328 case MODE_QUERY:
329 if (argc == 0)
330 {
331 mu_error (_("not enough arguments"));
332 return 1;
333 }
334
335 if (query_config_file)
336 {
337 mu_load_site_rcfile = 0;
338 mu_load_user_rcfile = 0;
339 mu_load_rcfile = query_config_file;
340 }
341
342 if (mu_libcfg_parse_config (&tree))
343 exit (1);
344 if (!tree)
345 exit (0);
346 rc = mu_stdio_stream_create (&stream, stdout, 0);
347 if (rc)
348 {
349 mu_error ("mu_stdio_stream_create: %s", mu_strerror (rc));
350 exit (1);
351 }
352 if (verbose)
353 fmtflags = MU_CFG_FMT_LOCUS;
354 for ( ; argc > 0; argc--, argv++)
355 {
356 char *path = *argv;
357 mu_cfg_node_t *node;
358
359 if (mu_cfg_find_node (tree->head, path, &node) == 0)
360 {
361 mu_cfg_format_node (stream, node, fmtflags);
362 }
363 }
364 exit (0);
301 } 365 }
302 366
303 argp_help (&argp, stdout, ARGP_HELP_USAGE, program_invocation_short_name); 367 argp_help (&argp, stdout, ARGP_HELP_USAGE, program_invocation_short_name);
......
...@@ -527,7 +527,7 @@ frm_abort (mu_mailbox_t *mbox) ...@@ -527,7 +527,7 @@ frm_abort (mu_mailbox_t *mbox)
527 if ((status = mu_mailbox_close (*mbox)) != 0) 527 if ((status = mu_mailbox_close (*mbox)) != 0)
528 { 528 {
529 mu_url_t url; 529 mu_url_t url;
530 530 mu_mailbox_get_url (*mbox, &url);
531 mu_error (_("could not close mailbox `%s': %s"), 531 mu_error (_("could not close mailbox `%s': %s"),
532 mu_url_to_string (url), mu_strerror (status)); 532 mu_url_to_string (url), mu_strerror (status));
533 exit (3); 533 exit (3);
...@@ -580,7 +580,8 @@ frm_scan (char *mailbox_name, frm_select_t fun, size_t *total) ...@@ -580,7 +580,8 @@ frm_scan (char *mailbox_name, frm_select_t fun, size_t *total)
580 { 580 {
581 mu_error (_("could not open mailbox `%s': %s"), 581 mu_error (_("could not open mailbox `%s': %s"),
582 mu_url_to_string (url), mu_strerror (status)); 582 mu_url_to_string (url), mu_strerror (status));
583 frm_abort (&mbox); 583 mu_mailbox_destroy (&mbox);
584 exit (3);
584 } 585 }
585 else 586 else
586 { 587 {
......
1 # -*- tcl -*- 1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite. 2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, 2007 Free Software Foundation 3 # Copyright (C) 2002, 2007, 2009 Free Software Foundation
4 # 4 #
5 # This program is free software; you can redistribute it and/or modify 5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by 6 # it under the terms of the GNU General Public License as published by
...@@ -51,7 +51,7 @@ mu_exec -retcode 1 -message "frm -qS" -arg -qS \ ...@@ -51,7 +51,7 @@ mu_exec -retcode 1 -message "frm -qS" -arg -qS \
51 mu_exec -retcode 1 -arg -q -message "frm -q" \ 51 mu_exec -retcode 1 -arg -q -message "frm -q" \
52 "There are messages in that folder." 52 "There are messages in that folder."
53 53
54 mu_exec -retcode 1 -arg "--mail-folder=$MU_SPOOL_DIR" -arg +mbox -message "frm +mbox" \ 54 mu_exec -retcode 1 -arg "--set mailbox.folder=$MU_SPOOL_DIR" -arg +mbox -message "frm +mbox" \
55 "Sergey Poznyakoff\tMBOX" 55 "Sergey Poznyakoff\tMBOX"
56 56
57 mu_exec -arg -q -arg %nonexistent -retcode 2 -message "frm -q %nonexistent" \ 57 mu_exec -arg -q -arg %nonexistent -retcode 2 -message "frm -q %nonexistent" \
......
...@@ -57,9 +57,6 @@ int ident_encrypt_only; ...@@ -57,9 +57,6 @@ int ident_encrypt_only;
57 const char *program_version = "imap4d (" PACKAGE_STRING ")"; 57 const char *program_version = "imap4d (" PACKAGE_STRING ")";
58 static char doc[] = N_("GNU imap4d -- the IMAP4D daemon."); 58 static char doc[] = N_("GNU imap4d -- the IMAP4D daemon.");
59 59
60 #define OPT_LOGIN_DISABLED 256
61 #define OPT_TLS_REQUIRED 257
62 #define OPT_CREATE_HOME_DIR 258
63 #define OPT_PREAUTH 259 60 #define OPT_PREAUTH 259
64 #define OPT_FOREGROUND 260 61 #define OPT_FOREGROUND 260
65 62
...@@ -69,21 +66,9 @@ static struct argp_option options[] = { ...@@ -69,21 +66,9 @@ static struct argp_option options[] = {
69 { "daemon", 'd', N_("NUMBER"), OPTION_ARG_OPTIONAL, 66 { "daemon", 'd', N_("NUMBER"), OPTION_ARG_OPTIONAL,
70 N_("runs in daemon mode with a maximum of NUMBER children"), 0 }, 67 N_("runs in daemon mode with a maximum of NUMBER children"), 0 },
71 68
72 {"other-namespace", 'O', N_("PATHLIST"), OPTION_HIDDEN,
73 N_("set the `other' namespace"), 0},
74 {"shared-namespace", 'S', N_("PATHLIST"), OPTION_HIDDEN,
75 N_("set the `shared' namespace"), 0},
76 {"login-disabled", OPT_LOGIN_DISABLED, NULL, OPTION_HIDDEN,
77 N_("disable LOGIN command")},
78 {"create-home-dir", OPT_CREATE_HOME_DIR, N_("MODE"),
79 OPTION_ARG_OPTIONAL|OPTION_HIDDEN,
80 N_("create home directory, if it does not exist")},
81 {"preauth", OPT_PREAUTH, NULL, 0, 69 {"preauth", OPT_PREAUTH, NULL, 0,
82 N_("start in preauth mode") }, 70 N_("start in preauth mode") },
83 #ifdef WITH_TLS 71
84 {"tls-required", OPT_TLS_REQUIRED, NULL, OPTION_HIDDEN,
85 N_("always require STARTTLS before entering authentication phase")},
86 #endif
87 {NULL, 0, NULL, 0, NULL, 0} 72 {NULL, 0, NULL, 0, NULL, 0}
88 }; 73 };
89 74
...@@ -134,30 +119,6 @@ imap4d_parse_opt (int key, char *arg, struct argp_state *state) ...@@ -134,30 +119,6 @@ imap4d_parse_opt (int key, char *arg, struct argp_state *state)
134 mu_argp_node_list_new (&lst, "foreground", "yes"); 119 mu_argp_node_list_new (&lst, "foreground", "yes");
135 break; 120 break;
136 121
137 case 'O':
138 mu_argp_node_list_new (&lst, "other-namespace", arg);
139 break;
140
141 case 'S':
142 mu_argp_node_list_new (&lst, "shared-namespace", arg);
143 break;
144
145 case OPT_LOGIN_DISABLED:
146 mu_argp_node_list_new (&lst, "login-disabled", "yes");
147 break;
148
149 case OPT_CREATE_HOME_DIR:
150 mu_argp_node_list_new (&lst, "create-home-dir", "yes");
151 if (arg)
152 mu_argp_node_list_new (&lst, "home-dir-mode", arg);
153 break;
154
155 #ifdef WITH_TLS
156 case OPT_TLS_REQUIRED:
157 mu_argp_node_list_new (&lst, "tls-required", "yes");
158 break;
159 #endif
160
161 case OPT_PREAUTH: 122 case OPT_PREAUTH:
162 preauth_mode = preauth_stdio; 123 preauth_mode = preauth_stdio;
163 break; 124 break;
......
1 /* cfg.h -- general-purpose configuration file parser 1 /* cfg.h -- general-purpose configuration file parser
2 Copyright (C) 2007, 2008 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
3 3
4 GNU Mailutils is free software; you can redistribute it and/or 4 GNU Mailutils is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as 5 modify it under the terms of the GNU General Public License as
...@@ -58,8 +58,7 @@ struct mu_config_value ...@@ -58,8 +58,7 @@ struct mu_config_value
58 enum mu_cfg_node_type 58 enum mu_cfg_node_type
59 { 59 {
60 mu_cfg_node_undefined, 60 mu_cfg_node_undefined,
61 mu_cfg_statement, 61 mu_cfg_node_statement,
62 mu_cfg_node_tag=mu_cfg_statement, /* FIXME: remove */
63 mu_cfg_node_param 62 mu_cfg_node_param
64 }; 63 };
65 64
...@@ -81,19 +80,24 @@ struct mu_cfg_node ...@@ -81,19 +80,24 @@ struct mu_cfg_node
81 80
82 struct mu_cfg_tree 81 struct mu_cfg_tree
83 { 82 {
84 mu_cfg_node_t *node; 83 mu_cfg_node_t *head, *tail;
85 mu_debug_t debug; 84 mu_debug_t debug;
86 mu_opool_t pool; 85 mu_opool_t pool;
87 }; 86 };
88 87
89 int mu_cfg_parse (mu_cfg_tree_t **ptree); 88 int mu_cfg_parse (mu_cfg_tree_t **ptree);
89 int mu_cfg_tree_union (mu_cfg_tree_t **pa, mu_cfg_tree_t **pb);
90 int mu_cfg_tree_postprocess (mu_cfg_tree_t *tree, int flags);
90 91
91 extern mu_cfg_locus_t mu_cfg_locus; 92 extern mu_cfg_locus_t mu_cfg_locus;
92 93
93 mu_opool_t mu_cfg_lexer_pool (void); 94 mu_opool_t mu_cfg_lexer_pool (void);
94 95
95 void mu_cfg_perror (const mu_cfg_locus_t *, const char *, ...) 96 void mu_cfg_vperror (mu_debug_t, const mu_cfg_locus_t *,
96 MU_PRINTFLIKE(2,3); 97 const char *fmt, va_list ap);
98 void mu_cfg_perror (mu_debug_t debug, const mu_cfg_locus_t *,
99 const char *, ...) MU_PRINTFLIKE(3,4);
100 void mu_cfg_parse_error (const char *, ...) MU_PRINTFLIKE(1,2);
97 void mu_cfg_format_error (mu_debug_t debug, size_t, const char *fmt, ...) 101 void mu_cfg_format_error (mu_debug_t debug, size_t, const char *fmt, ...)
98 MU_PRINTFLIKE(3,4); 102 MU_PRINTFLIKE(3,4);
99 103
...@@ -205,6 +209,9 @@ struct mu_cfg_cidr ...@@ -205,6 +209,9 @@ struct mu_cfg_cidr
205 unsigned long mask; 209 unsigned long mask;
206 }; 210 };
207 211
212 #define MU_CFG_PATH_DELIM '.'
213 #define MU_CFG_PATH_DELIM_STR "."
214
208 int mu_config_create_container (struct mu_cfg_cont **pcont, 215 int mu_config_create_container (struct mu_cfg_cont **pcont,
209 enum mu_cfg_cont_type type); 216 enum mu_cfg_cont_type type);
210 int mu_config_clone_container (struct mu_cfg_cont *cont); 217 int mu_config_clone_container (struct mu_cfg_cont *cont);
...@@ -240,19 +247,32 @@ mu_debug_t mu_cfg_get_debug (void); ...@@ -240,19 +247,32 @@ mu_debug_t mu_cfg_get_debug (void);
240 #define MU_PARSE_CONFIG_GLOBAL 0x1 247 #define MU_PARSE_CONFIG_GLOBAL 0x1
241 #define MU_PARSE_CONFIG_VERBOSE 0x2 248 #define MU_PARSE_CONFIG_VERBOSE 0x2
242 #define MU_PARSE_CONFIG_DUMP 0x4 249 #define MU_PARSE_CONFIG_DUMP 0x4
250 #define MU_PARSE_CONFIG_PLAIN 0x8
251
252 #ifdef MU_CFG_COMPATIBILITY
253 # define MU_CFG_DEPRECATED
254 #else
255 # define MU_CFG_DEPRECATED __attribute__ ((deprecated))
256 #endif
243 257
244 int mu_parse_config (const char *file, const char *progname, 258 int mu_parse_config (const char *file, const char *progname,
245 struct mu_cfg_param *progparam, int flags, 259 struct mu_cfg_param *progparam, int flags,
246 void *target_ptr); 260 void *target_ptr) MU_CFG_DEPRECATED;
247 261
248 int mu_cfg_parse_boolean (const char *str, int *res); 262 int mu_cfg_parse_boolean (const char *str, int *res);
249 263
250 extern int mu_cfg_parser_verbose; 264 extern int mu_cfg_parser_verbose;
251 extern size_t mu_cfg_error_count; 265 extern size_t mu_cfg_error_count;
252 266
267 #define MU_CFG_FMT_LOCUS 0x01
268
253 void mu_cfg_format_docstring (mu_stream_t stream, const char *docstring, 269 void mu_cfg_format_docstring (mu_stream_t stream, const char *docstring,
254 int level); 270 int level);
255 void mu_cfg_format_parse_tree (mu_stream_t stream, struct mu_cfg_tree *tree); 271 void mu_cfg_format_parse_tree (mu_stream_t stream, struct mu_cfg_tree *tree,
272 int flags);
273 void mu_cfg_format_node (mu_stream_t stream, const mu_cfg_node_t *node,
274 int flags);
275
256 void mu_cfg_format_container (mu_stream_t stream, struct mu_cfg_cont *cont); 276 void mu_cfg_format_container (mu_stream_t stream, struct mu_cfg_cont *cont);
257 void mu_format_config_tree (mu_stream_t stream, const char *progname, 277 void mu_format_config_tree (mu_stream_t stream, const char *progname,
258 struct mu_cfg_param *progparam, int flags); 278 struct mu_cfg_param *progparam, int flags);
...@@ -265,14 +285,16 @@ int mu_cfg_string_value_cb (mu_debug_t debug, mu_config_value_t *val, ...@@ -265,14 +285,16 @@ int mu_cfg_string_value_cb (mu_debug_t debug, mu_config_value_t *val,
265 int (*fun) (mu_debug_t, const char *, void *), 285 int (*fun) (mu_debug_t, const char *, void *),
266 void *data); 286 void *data);
267 287
288 int mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file,
289 int flags);
290
291
268 int mu_get_config (const char *file, const char *progname, 292 int mu_get_config (const char *file, const char *progname,
269 struct mu_cfg_param *progparam, int flags, 293 struct mu_cfg_param *progparam, int flags,
270 void *target_ptr); 294 void *target_ptr) MU_CFG_DEPRECATED;
271
272 295
273 int mu_cfg_tree_create (struct mu_cfg_tree **ptree); 296 int mu_cfg_tree_create (struct mu_cfg_tree **ptree);
274 void mu_cfg_tree_set_debug (struct mu_cfg_tree *tree, mu_debug_t debug); 297 void mu_cfg_tree_set_debug (struct mu_cfg_tree *tree, mu_debug_t debug);
275 void mu_cfg_tree_free (struct mu_cfg_tree *tree, void *mem);
276 mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree, 298 mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree,
277 enum mu_cfg_node_type type, 299 enum mu_cfg_node_type type,
278 const mu_cfg_locus_t *loc, 300 const mu_cfg_locus_t *loc,
...@@ -281,6 +303,10 @@ mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree, ...@@ -281,6 +303,10 @@ mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree,
281 mu_cfg_node_t *node); 303 mu_cfg_node_t *node);
282 void mu_cfg_tree_add_node (mu_cfg_tree_t *tree, mu_cfg_node_t *node); 304 void mu_cfg_tree_add_node (mu_cfg_tree_t *tree, mu_cfg_node_t *node);
283 305
306 int mu_cfg_find_node (mu_cfg_node_t *tree, const char *path,
307 mu_cfg_node_t **pnode);
308 int mu_cfg_create_subtree (const char *path, mu_cfg_node_t **pnode);
309
284 #ifdef __cplusplus 310 #ifdef __cplusplus
285 } 311 }
286 #endif 312 #endif
......
...@@ -50,7 +50,9 @@ extern int mu_register_cfg_capa (const char *name, ...@@ -50,7 +50,9 @@ extern int mu_register_cfg_capa (const char *name,
50 50
51 extern void mu_libcfg_init (char **cnames); 51 extern void mu_libcfg_init (char **cnames);
52 extern int mu_parse_config_files (struct mu_cfg_param *param, 52 extern int mu_parse_config_files (struct mu_cfg_param *param,
53 void *target_ptr); 53 void *target_ptr) MU_CFG_DEPRECATED;
54 int mu_libcfg_parse_config (mu_cfg_tree_t **ptree);
55
54 extern void mu_acl_cfg_init (void); 56 extern void mu_acl_cfg_init (void);
55 57
56 #define __mu_common_cat2__(a,b) a ## b 58 #define __mu_common_cat2__(a,b) a ## b
......
...@@ -99,6 +99,7 @@ extern int mu_aget_user_email_domain (char **pdomain); ...@@ -99,6 +99,7 @@ extern int mu_aget_user_email_domain (char **pdomain);
99 */ 99 */
100 extern char *mu_get_user_email (const char *name); 100 extern char *mu_get_user_email (const char *name);
101 101
102 extern char *mu_make_file_name (const char *dir, const char *file);
102 extern char *mu_normalize_path (char *path); 103 extern char *mu_normalize_path (char *path);
103 extern int mu_tempfile (const char *tmpdir, char **namep); 104 extern int mu_tempfile (const char *tmpdir, char **namep);
104 extern char *mu_tempname (const char *tmpdir); 105 extern char *mu_tempname (const char *tmpdir);
...@@ -108,10 +109,6 @@ extern char * mu_getcwd (void); ...@@ -108,10 +109,6 @@ extern char * mu_getcwd (void);
108 109
109 extern int mu_spawnvp(const char *prog, char *av[], int *stat); 110 extern int mu_spawnvp(const char *prog, char *av[], int *stat);
110 111
111 typedef void *(*mu_retrieve_fp) (void *);
112 extern void mu_register_retriever (mu_list_t *pflist, mu_retrieve_fp fun);
113 extern void * mu_retrieve (mu_list_t flist, void *data);
114
115 extern int mu_unroll_symlink (char *out, size_t outsz, const char *in); 112 extern int mu_unroll_symlink (char *out, size_t outsz, const char *in);
116 113
117 extern char * mu_expand_path_pattern (const char *pattern, const char *username); 114 extern char * mu_expand_path_pattern (const char *pattern, const char *username);
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2008 Free Software Foundation, Inc. 2 Copyright (C) 2008, 2009 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -32,6 +32,10 @@ int mu_opool_create (mu_opool_t *pret, int memerr); ...@@ -32,6 +32,10 @@ int mu_opool_create (mu_opool_t *pret, int memerr);
32 int mu_opool_set_bucket_size (mu_opool_t opool, size_t size); 32 int mu_opool_set_bucket_size (mu_opool_t opool, size_t size);
33 int mu_opool_get_bucket_size (mu_opool_t opool, size_t *psize); 33 int mu_opool_get_bucket_size (mu_opool_t opool, size_t *psize);
34 34
35 /* Merge all data from *SRC into *DST. If the latter is NULL, create
36 it. On success, free *SRC and initialize it with NULL. */
37 int mu_opool_union (mu_opool_t *dst, mu_opool_t *src);
38
35 /* Clear all data from the pool, so next mu_opool_append* call will 39 /* Clear all data from the pool, so next mu_opool_append* call will
36 begin a new object. */ 40 begin a new object. */
37 void mu_opool_clear (mu_opool_t opool); 41 void mu_opool_clear (mu_opool_t opool);
......
...@@ -32,14 +32,9 @@ libmu_argp_a_SOURCES =\ ...@@ -32,14 +32,9 @@ libmu_argp_a_SOURCES =\
32 cmdline.h\ 32 cmdline.h\
33 common.c\ 33 common.c\
34 compat.c\ 34 compat.c\
35 gsasl.c\
36 mu_argp.h\ 35 mu_argp.h\
37 mu_argp.c\ 36 mu_argp.c\
38 muinit.c\ 37 muinit.c\
39 pam.c\
40 radius.c\
41 sieve.c\ 38 sieve.c\
42 sql.c\ 39 tls.c
43 tls.c\
44 virtdomain.c
45 40
......
...@@ -28,11 +28,7 @@ ...@@ -28,11 +28,7 @@
28 /* ************************************************************************* */ 28 /* ************************************************************************* */
29 29
30 enum { 30 enum {
31 OPT_AUTHORIZATION=256, 31 OPT_DEBUG_AUTH=256
32 OPT_AUTHENTICATION,
33 OPT_CLEAR_AUTHORIZATION,
34 OPT_CLEAR_AUTHENTICATION,
35 OPT_DEBUG_AUTH
36 }; 32 };
37 33
38 static error_t mu_auth_argp_parser (int key, char *arg, 34 static error_t mu_auth_argp_parser (int key, char *arg,
...@@ -40,14 +36,6 @@ static error_t mu_auth_argp_parser (int key, char *arg, ...@@ -40,14 +36,6 @@ static error_t mu_auth_argp_parser (int key, char *arg,
40 36
41 /* Options used by programs that use extended authentication mechanisms. */ 37 /* Options used by programs that use extended authentication mechanisms. */
42 static struct argp_option mu_auth_argp_option[] = { 38 static struct argp_option mu_auth_argp_option[] = {
43 { "authentication", OPT_AUTHENTICATION, N_("MODLIST"), OPTION_HIDDEN,
44 N_("set the list of modules to be used for authentication"), 0 },
45 { "authorization", OPT_AUTHORIZATION, N_("MODLIST"), OPTION_HIDDEN,
46 N_("set list of modules to be used for authorization"), 0 },
47 { "clear-authorization", OPT_CLEAR_AUTHORIZATION, NULL, OPTION_HIDDEN,
48 N_("clear the list of authorization modules"), 0 },
49 { "clear-authentication", OPT_CLEAR_AUTHENTICATION, NULL, OPTION_HIDDEN,
50 N_("clear the list of authentication modules"), 0 },
51 { "debug-auth", OPT_DEBUG_AUTH, NULL, 0, 39 { "debug-auth", OPT_DEBUG_AUTH, NULL, 0,
52 N_("debug authentication functions") }, 40 N_("debug authentication functions") },
53 { NULL, 0, NULL, 0, NULL, 0 } 41 { NULL, 0, NULL, 0, NULL, 0 }
...@@ -92,22 +80,6 @@ mu_auth_argp_parser (int key, char *arg, struct argp_state *state) ...@@ -92,22 +80,6 @@ mu_auth_argp_parser (int key, char *arg, struct argp_state *state)
92 mu_argp_node_list_finish (&lst, "auth", NULL); 80 mu_argp_node_list_finish (&lst, "auth", NULL);
93 break; 81 break;
94 82
95 case OPT_AUTHORIZATION:
96 mu_argp_node_list_new (&lst, "authorization", arg);
97 break;
98
99 case OPT_AUTHENTICATION:
100 mu_argp_node_list_new (&lst, "authentication", arg);
101 break;
102
103 case OPT_CLEAR_AUTHENTICATION:
104 mu_argp_node_list_new (&lst, "authentication", "clear");
105 break;
106
107 case OPT_CLEAR_AUTHORIZATION:
108 mu_argp_node_list_new (&lst, "authorization", "clear");
109 break;
110
111 case OPT_DEBUG_AUTH: 83 case OPT_DEBUG_AUTH:
112 auth_set_debug (); 84 auth_set_debug ();
113 break; 85 break;
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007, 2008 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -26,17 +26,9 @@ static struct mu_cmdline_capa *all_cmdline_capa[] = { ...@@ -26,17 +26,9 @@ static struct mu_cmdline_capa *all_cmdline_capa[] = {
26 &mu_common_cmdline, 26 &mu_common_cmdline,
27 &mu_logging_cmdline, 27 &mu_logging_cmdline,
28 &mu_license_cmdline, 28 &mu_license_cmdline,
29 &mu_mailbox_cmdline,
30 &mu_locking_cmdline,
31 &mu_address_cmdline,
32 &mu_mailer_cmdline, 29 &mu_mailer_cmdline,
33 &mu_debug_cmdline, 30 &mu_debug_cmdline,
34 &mu_pam_cmdline,
35 &mu_gsasl_cmdline,
36 &mu_tls_cmdline, 31 &mu_tls_cmdline,
37 &mu_radius_cmdline,
38 &mu_sql_cmdline,
39 &mu_virtdomain_cmdline,
40 &mu_auth_cmdline, 32 &mu_auth_cmdline,
41 &mu_sieve_cmdline, 33 &mu_sieve_cmdline,
42 NULL 34 NULL
...@@ -104,7 +96,7 @@ mu_argp_node_list_finish (struct mu_argp_node_list *lst, char *tag, ...@@ -104,7 +96,7 @@ mu_argp_node_list_finish (struct mu_argp_node_list *lst, char *tag,
104 return; 96 return;
105 if (tag) 97 if (tag)
106 node = mu_cfg_tree_create_node (mu_argp_tree, 98 node = mu_cfg_tree_create_node (mu_argp_tree,
107 mu_cfg_node_tag, 99 mu_cfg_node_statement,
108 NULL, 100 NULL,
109 tag, label, 101 tag, label,
110 lst->head); 102 lst->head);
...@@ -113,3 +105,4 @@ mu_argp_node_list_finish (struct mu_argp_node_list *lst, char *tag, ...@@ -113,3 +105,4 @@ mu_argp_node_list_finish (struct mu_argp_node_list *lst, char *tag,
113 mu_cfg_tree_add_node (mu_argp_tree, node); 105 mu_cfg_tree_add_node (mu_argp_tree, node);
114 mu_argp_node_list_init (lst); 106 mu_argp_node_list_init (lst);
115 } 107 }
108
......
...@@ -38,18 +38,11 @@ enum { ...@@ -38,18 +38,11 @@ enum {
38 OPT_RCFILE_LINT, 38 OPT_RCFILE_LINT,
39 OPT_RCFILE_VERBOSE, 39 OPT_RCFILE_VERBOSE,
40 OPT_LOG_FACILITY, 40 OPT_LOG_FACILITY,
41 OPT_LOCK_FLAGS,
42 OPT_LOCK_RETRY_COUNT,
43 OPT_LOCK_RETRY_TIMEOUT,
44 OPT_LOCK_EXPIRE_TIMEOUT,
45 OPT_LOCK_EXTERNAL_PROGRAM,
46 OPT_LICENSE, 41 OPT_LICENSE,
47 OPT_MAILBOX_PATTERN,
48 OPT_MAILBOX_TYPE,
49 OPT_MAIL_FOLDER,
50 OPT_DEBUG_LEVEL, 42 OPT_DEBUG_LEVEL,
51 OPT_LINE_INFO, 43 OPT_LINE_INFO,
52 OPT_HELP_CONFIG 44 OPT_HELP_CONFIG,
45 OPT_SET
53 }; 46 };
54 47
55 static struct argp_option mu_common_argp_options[] = 48 static struct argp_option mu_common_argp_options[] =
...@@ -74,9 +67,21 @@ static struct argp_option mu_common_argp_options[] = ...@@ -74,9 +67,21 @@ static struct argp_option mu_common_argp_options[] =
74 { "config-lint", OPT_RCFILE_LINT, NULL, 0, 67 { "config-lint", OPT_RCFILE_LINT, NULL, 0,
75 N_("check configuration file syntax and exit"), 0 }, 68 N_("check configuration file syntax and exit"), 0 },
76 { "rcfile-lint", 0, NULL, OPTION_ALIAS, NULL }, 69 { "rcfile-lint", 0, NULL, OPTION_ALIAS, NULL },
70 { "set", OPT_SET, N_("PARAM=VALUE"), 0,
71 N_("set configuration parameter"), 0 },
77 { NULL, 0, NULL, 0, NULL, 0 } 72 { NULL, 0, NULL, 0, NULL, 0 }
78 }; 73 };
79 74
75 static void
76 set_config_param (const char *path, struct argp_state *state)
77 {
78 mu_cfg_node_t *node;
79 int rc = mu_cfg_create_subtree (path, &node);
80 if (rc)
81 argp_error (state, "cannot create node: %s", mu_strerror (rc));
82 mu_cfg_tree_add_node (mu_argp_tree, node);
83 }
84
80 static error_t 85 static error_t
81 mu_common_argp_parser (int key, char *arg, struct argp_state *state) 86 mu_common_argp_parser (int key, char *arg, struct argp_state *state)
82 { 87 {
...@@ -111,6 +116,10 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state) ...@@ -111,6 +116,10 @@ mu_common_argp_parser (int key, char *arg, struct argp_state *state)
111 mu_help_config_mode = 1; 116 mu_help_config_mode = 1;
112 break; 117 break;
113 118
119 case OPT_SET:
120 set_config_param (arg, state);
121 break;
122
114 default: 123 default:
115 return ARGP_ERR_UNKNOWN; 124 return ARGP_ERR_UNKNOWN;
116 } 125 }
...@@ -231,215 +240,6 @@ struct mu_cmdline_capa mu_license_cmdline = { ...@@ -231,215 +240,6 @@ struct mu_cmdline_capa mu_license_cmdline = {
231 240
232 241
233 /* ************************************************************************* */ 242 /* ************************************************************************* */
234 /* Mailbox */
235 /* ************************************************************************* */
236
237 /* Options used by programs that access mailboxes. */
238 static struct argp_option mu_mailbox_argp_option[] = {
239 { "mail-spool", 'm', N_("URL"), OPTION_HIDDEN,
240 N_("use specified URL as a mailspool directory"), 0 },
241 { "mailbox-pattern", OPT_MAILBOX_PATTERN, N_("pat"), OPTION_HIDDEN,
242 "", 0 },
243 { "mailbox-type", OPT_MAILBOX_TYPE, N_("PROTO"), OPTION_HIDDEN,
244 N_("default mailbox type to use"), 0 },
245 { "mail-folder", OPT_MAIL_FOLDER, N_("DIR"), OPTION_HIDDEN,
246 N_("default user mail folder"), 0 },
247 { NULL }
248 };
249
250 static error_t
251 mu_mailbox_argp_parser (int key, char *arg, struct argp_state *state)
252 {
253 static struct mu_argp_node_list lst;
254
255 switch (key)
256 {
257 /* mailbox */
258 case 'm':
259 mu_argp_node_list_new (&lst, "mail-spool", arg);
260 break;
261
262 case OPT_MAILBOX_PATTERN:
263 mu_argp_node_list_new (&lst, "mailbox-pattern", arg);
264 break;
265
266 case OPT_MAILBOX_TYPE:
267 mu_argp_node_list_new (&lst, "mailbox-type", arg);
268 break;
269
270 case OPT_MAIL_FOLDER:
271 mu_argp_node_list_new (&lst, "folder", arg);
272 break;
273
274 case ARGP_KEY_INIT:
275 mu_argp_node_list_init (&lst);
276 break;
277
278 case ARGP_KEY_FINI:
279 mu_argp_node_list_finish (&lst, "mailbox", NULL);
280 break;
281
282 default:
283 return ARGP_ERR_UNKNOWN;
284 }
285 return 0;
286 }
287
288 struct argp mu_mailbox_argp = {
289 mu_mailbox_argp_option,
290 mu_mailbox_argp_parser,
291 };
292
293 struct argp_child mu_mailbox_argp_child = {
294 &mu_mailbox_argp,
295 0,
296 NULL,
297 0
298 };
299
300 struct mu_cmdline_capa mu_mailbox_cmdline = {
301 "mailbox", &mu_mailbox_argp_child
302 };
303
304
305 /* ************************************************************************* */
306 /* Locking */
307 /* ************************************************************************* */
308
309 /* Options used by programs that access mailboxes. */
310 static struct argp_option mu_locking_argp_option[] = {
311 {"lock-flags", OPT_LOCK_FLAGS, N_("FLAGS"), OPTION_HIDDEN,
312 N_("default locker flags (E=external, R=retry, T=time, P=pid)"), 0},
313 {"lock-retry-timeout", OPT_LOCK_RETRY_TIMEOUT, N_("SECONDS"), OPTION_HIDDEN,
314 N_("set timeout for acquiring the lockfile") },
315 {"lock-retry-count", OPT_LOCK_RETRY_COUNT, N_("NUMBER"), OPTION_HIDDEN,
316 N_("set the maximum number of times to retry acquiring the lockfile") },
317 {"lock-expire-timeout", OPT_LOCK_EXPIRE_TIMEOUT, N_("SECONDS"),
318 OPTION_HIDDEN,
319 N_("number of seconds after which the lock expires"), },
320 {"external-locker", OPT_LOCK_EXTERNAL_PROGRAM, N_("PATH"), OPTION_HIDDEN,
321 N_("set full path to the external locker program") },
322 { NULL, 0, NULL, 0, NULL, 0 }
323 };
324
325 static error_t
326 mu_locking_argp_parser (int key, char *arg, struct argp_state *state)
327 {
328 static struct mu_argp_node_list lst;
329
330 switch (key)
331 {
332 case OPT_LOCK_FLAGS:
333 mu_argp_node_list_new (&lst, "flags", arg);
334 break;
335
336 case OPT_LOCK_RETRY_COUNT:
337 mu_argp_node_list_new (&lst, "retry-count", arg);
338 break;
339
340 case OPT_LOCK_RETRY_TIMEOUT:
341 mu_argp_node_list_new (&lst, "retry-timeout", arg);
342 break;
343
344 case OPT_LOCK_EXPIRE_TIMEOUT:
345 mu_argp_node_list_new (&lst, "expire-timeout", arg);
346 break;
347
348 case OPT_LOCK_EXTERNAL_PROGRAM:
349 mu_argp_node_list_new (&lst, "external-locker", arg);
350 break;
351
352 case ARGP_KEY_INIT:
353 mu_argp_node_list_init (&lst);
354 break;
355
356 case ARGP_KEY_FINI:
357 mu_argp_node_list_finish (&lst, "locking", NULL);
358 break;
359
360 default:
361 return ARGP_ERR_UNKNOWN;
362 }
363 return 0;
364 }
365
366 struct argp mu_locking_argp = {
367 mu_locking_argp_option,
368 mu_locking_argp_parser,
369 };
370
371 struct argp_child mu_locking_argp_child = {
372 &mu_locking_argp,
373 0,
374 NULL,
375 0
376 };
377
378 struct mu_cmdline_capa mu_locking_cmdline = {
379 "locking", &mu_locking_argp_child
380 };
381
382
383 /* ************************************************************************* */
384 /* Address */
385 /* ************************************************************************* */
386
387 /* Options used by programs that do address mapping. */
388 static struct argp_option mu_address_argp_option[] = {
389 {"email-addr", 'E', N_("EMAIL"), OPTION_HIDDEN,
390 N_("set current user's email address (default is loginname@defaultdomain)"), 0},
391 {"email-domain", 'D', N_("DOMAIN"), OPTION_HIDDEN,
392 N_("set domain for unqualified user names (default is this host)"), 0},
393 { NULL, 0, NULL, 0, NULL, 0 }
394 };
395
396 static error_t
397 mu_address_argp_parser (int key, char *arg, struct argp_state *state)
398 {
399 static struct mu_argp_node_list lst;
400
401 switch (key)
402 {
403 case 'E':
404 mu_argp_node_list_new (&lst, "email-addr", arg);
405 break;
406
407 case 'D':
408 mu_argp_node_list_new (&lst, "email-domain", arg);
409 break;
410
411 case ARGP_KEY_INIT:
412 mu_argp_node_list_init (&lst);
413 break;
414
415 case ARGP_KEY_FINI:
416 mu_argp_node_list_finish (&lst, "address", NULL);
417 break;
418
419 default:
420 return ARGP_ERR_UNKNOWN;
421 }
422 return 0;
423 }
424
425 struct argp mu_address_argp = {
426 mu_address_argp_option,
427 mu_address_argp_parser,
428 };
429
430 struct argp_child mu_address_argp_child = {
431 &mu_address_argp,
432 0,
433 NULL,
434 0
435 };
436
437 struct mu_cmdline_capa mu_address_cmdline = {
438 "address", &mu_address_argp_child
439 };
440
441
442 /* ************************************************************************* */
443 /* Mailer */ 243 /* Mailer */
444 /* ************************************************************************* */ 244 /* ************************************************************************* */
445 245
...@@ -511,7 +311,7 @@ mu_debug_argp_parser (int key, char *arg, struct argp_state *state) ...@@ -511,7 +311,7 @@ mu_debug_argp_parser (int key, char *arg, struct argp_state *state)
511 { 311 {
512 case OPT_DEBUG_LEVEL: 312 case OPT_DEBUG_LEVEL:
513 mu_global_debug_from_string (arg, "command line"); 313 mu_global_debug_from_string (arg, "command line");
514 //mu_argp_node_list_new (&lst, "level", arg); 314 /*mu_argp_node_list_new (&lst, "level", arg);*/
515 break; 315 break;
516 316
517 case OPT_LINE_INFO: 317 case OPT_LINE_INFO:
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007, 2009 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22 #include "cmdline.h"
23 #include <mailutils/gsasl.h>
24
25 #define OPT_CRAM_PASSWD 256
26
27 static struct argp_option _gsasl_argp_options[] = {
28 {"cram-passwd", OPT_CRAM_PASSWD, N_("FILE"), OPTION_HIDDEN,
29 N_("specify password file for CRAM-MD5 authentication"), 0},
30 { NULL, 0, NULL, 0, NULL, 0 }
31 };
32
33 static error_t
34 _gsasl_argp_parser (int key, char *arg, struct argp_state *state)
35 {
36 static struct mu_argp_node_list lst;
37
38 switch (key)
39 {
40 case OPT_CRAM_PASSWD:
41 mu_argp_node_list_new (&lst, "cram-passwd", arg);
42 break;
43
44 case ARGP_KEY_INIT:
45 mu_argp_node_list_init (&lst);
46 break;
47
48 case ARGP_KEY_FINI:
49 mu_argp_node_list_finish (&lst, "gsasl", NULL);
50 break;
51
52 default:
53 return ARGP_ERR_UNKNOWN;
54 }
55 return 0;
56 }
57
58 static struct argp _gsasl_argp = {
59 _gsasl_argp_options,
60 _gsasl_argp_parser
61 };
62
63 struct argp_child mu_gsasl_argp_child = {
64 &_gsasl_argp,
65 0,
66 NULL,
67 0
68 };
69
70 struct mu_cmdline_capa mu_gsasl_cmdline = {
71 "gsasl", &mu_gsasl_argp_child
72 };
73
74
...@@ -66,7 +66,7 @@ mu_app_init (struct argp *myargp, const char **capa, ...@@ -66,7 +66,7 @@ mu_app_init (struct argp *myargp, const char **capa,
66 struct argp *argp; 66 struct argp *argp;
67 struct argp argpnull = { 0 }; 67 struct argp argpnull = { 0 };
68 char **excapa; 68 char **excapa;
69 int cfgflags = 0; 69 struct mu_cfg_tree *parse_tree = NULL;
70 70
71 mu_set_program_name (argv[0]); 71 mu_set_program_name (argv[0]);
72 mu_libargp_init (); 72 mu_libargp_init ();
...@@ -119,15 +119,21 @@ mu_app_init (struct argp *myargp, const char **capa, ...@@ -119,15 +119,21 @@ mu_app_init (struct argp *myargp, const char **capa,
119 mu_stream_destroy (&stream, NULL); 119 mu_stream_destroy (&stream, NULL);
120 exit (0); 120 exit (0);
121 } 121 }
122 else 122
123 mu_parse_config_files (cfg_param, data); 123 rc = mu_libcfg_parse_config (&parse_tree);
124 if (rc == 0)
125 {
126 int cfgflags = MU_PARSE_CONFIG_PLAIN;
124 127
125 if (mu_cfg_parser_verbose) 128 if (mu_cfg_parser_verbose)
126 cfgflags |= MU_PARSE_CONFIG_VERBOSE; 129 cfgflags |= MU_PARSE_CONFIG_VERBOSE;
127 if (mu_cfg_parser_verbose > 1) 130 if (mu_cfg_parser_verbose > 1)
128 cfgflags |= MU_PARSE_CONFIG_DUMP; 131 cfgflags |= MU_PARSE_CONFIG_DUMP;
129 rc = mu_cfg_tree_reduce (mu_argp_tree, mu_program_name, cfg_param, 132 mu_cfg_tree_postprocess (mu_argp_tree, cfgflags);
133 mu_cfg_tree_union (&parse_tree, &mu_argp_tree);
134 rc = mu_cfg_tree_reduce (parse_tree, mu_program_name, cfg_param,
130 cfgflags, data); 135 cfgflags, data);
136 }
131 137
132 if (mu_rcfile_lint) 138 if (mu_rcfile_lint)
133 { 139 {
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007, 2009 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #include "cmdline.h"
24 #include <mailutils/pam.h>
25
26 #define OPT_PAM_SERVICE 256
27
28 static error_t
29 mu_pam_argp_parser (int key, char *arg, struct argp_state *state)
30 {
31 static struct mu_argp_node_list lst;
32
33 switch (key)
34 {
35 case OPT_PAM_SERVICE:
36 mu_argp_node_list_new (&lst, "service", arg);
37 break;
38
39 case ARGP_KEY_INIT:
40 mu_argp_node_list_init (&lst);
41 break;
42
43 case ARGP_KEY_FINI:
44 mu_argp_node_list_finish (&lst, "pam", NULL);
45 break;
46
47 default:
48 return ARGP_ERR_UNKNOWN;
49 }
50 return 0;
51 }
52
53 static struct argp_option mu_pam_argp_option[] = {
54 { "pam-service", OPT_PAM_SERVICE, N_("STRING"), OPTION_HIDDEN,
55 N_("use STRING as PAM service name"), 0},
56 { NULL, 0, NULL, 0, NULL, 0 }
57 };
58
59 static struct argp mu_pam_argp = {
60 mu_pam_argp_option,
61 mu_pam_argp_parser,
62 };
63
64 struct argp_child mu_pam_argp_child = {
65 &mu_pam_argp,
66 0,
67 NULL,
68 0
69 };
70
71 struct mu_cmdline_capa mu_pam_cmdline = {
72 "pam", &mu_pam_argp_child
73 };
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007, 2009 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #include "cmdline.h"
24 #include <mailutils/radius.h>
25
26 enum {
27 OPT_AUTH_REQUEST = 256,
28 OPT_GETPWNAM_REQUEST,
29 OPT_GETPWUID_REQUEST,
30 OPT_RADIUS_DIR
31 };
32
33 static struct argp_option mu_radius_argp_option[] = {
34 { "radius-auth-request", OPT_AUTH_REQUEST, N_("REQUEST"), OPTION_HIDDEN,
35 N_("radius request to authenticate the user"), 0 },
36 { "radius-getpwnam-request", OPT_GETPWNAM_REQUEST, N_("REQUEST"), OPTION_HIDDEN,
37 N_("radius request to retrieve a passwd entry based on username"), 0 },
38 { "radius-getpwuid-request", OPT_GETPWUID_REQUEST, N_("REQUEST"), OPTION_HIDDEN,
39 N_("radius request to retrieve a passwd entry based on UID"), 0 },
40 { "radius-directory", OPT_RADIUS_DIR, N_("DIR"), OPTION_HIDDEN,
41 N_("set name of the radius configuration directory"), 0 },
42 { NULL }
43 };
44
45 static error_t
46 mu_radius_argp_parser (int key, char *arg, struct argp_state *state)
47 {
48 static struct mu_argp_node_list lst;
49
50 switch (key)
51 {
52 case OPT_AUTH_REQUEST:
53 mu_argp_node_list_new (&lst, "auth-request", arg);
54 break;
55
56 case OPT_GETPWNAM_REQUEST:
57 mu_argp_node_list_new (&lst, "getwnam-request", arg);
58 break;
59
60 case OPT_GETPWUID_REQUEST:
61 mu_argp_node_list_new (&lst, "getwuid-request", arg);
62 break;
63
64 case OPT_RADIUS_DIR:
65 mu_argp_node_list_new (&lst, "directory", arg);
66 break;
67
68 case ARGP_KEY_INIT:
69 mu_argp_node_list_init (&lst);
70 break;
71
72 case ARGP_KEY_FINI:
73 mu_argp_node_list_finish (&lst, "radius", NULL);
74 break;
75
76 default:
77 return ARGP_ERR_UNKNOWN;
78 }
79 return 0;
80 }
81
82 static struct argp mu_radius_argp = {
83 mu_radius_argp_option,
84 mu_radius_argp_parser,
85 };
86
87 struct argp_child mu_radius_argp_child = {
88 &mu_radius_argp,
89 0,
90 NULL,
91 0
92 };
93
94 struct mu_cmdline_capa mu_radius_cmdline = {
95 "radius", &mu_radius_argp_child
96 };
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007, 2009 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #include "cmdline.h"
24
25 enum {
26 OPT_SQL_INTERFACE = 256,
27 OPT_SQL_GETPWNAM,
28 OPT_SQL_GETPWUID,
29 OPT_SQL_GETPASS,
30 OPT_SQL_HOST,
31 OPT_SQL_USER,
32 OPT_SQL_PASSWD,
33 OPT_SQL_DB,
34 OPT_SQL_PORT,
35 OPT_SQL_MU_PASSWORD_TYPE,
36 OPT_SQL_FIELD_MAP,
37 };
38
39 static struct argp_option mu_sql_argp_option[] = {
40 {"sql-interface", OPT_SQL_INTERFACE, N_("NAME"), OPTION_HIDDEN,
41 N_("type of SQL interface to use"), },
42 {"sql-getpwnam", OPT_SQL_GETPWNAM, N_("QUERY"), OPTION_HIDDEN,
43 N_("SQL query to retrieve a passwd entry based on username"), 0},
44 {"sql-getpwuid", OPT_SQL_GETPWUID, N_("QUERY"), OPTION_HIDDEN,
45 N_("SQL query to retrieve a passwd entry based on UID"), 0},
46 {"sql-getpass", OPT_SQL_GETPASS, N_("QUERY"), OPTION_HIDDEN,
47 N_("SQL query to retrieve a password from the database"), 0},
48 {"sql-host", OPT_SQL_HOST, N_("HOSTNAME"), OPTION_HIDDEN,
49 N_("name or IP of MySQL server to connect to"), 0},
50 {"sql-user", OPT_SQL_USER, N_("NAME"), OPTION_HIDDEN,
51 N_("SQL user name"), 0},
52 {"sql-passwd", OPT_SQL_PASSWD, N_("STRING"), OPTION_HIDDEN,
53 N_("SQL connection password"), 0},
54 {"sql-db", OPT_SQL_DB, N_("STRING"), OPTION_HIDDEN,
55 N_("name of the database to connect to"), 0},
56 {"sql-port", OPT_SQL_PORT, N_("NUMBER"), OPTION_HIDDEN,
57 N_("port to use"), 0},
58 {"sql-password-type", OPT_SQL_MU_PASSWORD_TYPE, N_("STRING"), OPTION_HIDDEN,
59 N_("type of password returned by --sql-getpass query. STRING is one of: plain, hash, scrambled"), 0},
60 {"sql-field-map", OPT_SQL_FIELD_MAP, N_("MAP"), OPTION_HIDDEN,
61 N_("declare a name translation map for SQL fields in results of sql-getpwnam and "
62 "sql-getpwuid queries"), 0},
63 { NULL, 0, NULL, 0, NULL, 0 }
64 };
65
66 static error_t
67 mu_sql_argp_parser (int key, char *arg, struct argp_state *state)
68 {
69 static struct mu_argp_node_list lst;
70
71 switch (key)
72 {
73 case OPT_SQL_INTERFACE:
74 mu_argp_node_list_new (&lst, "interface", arg);
75 break;
76
77 case OPT_SQL_GETPWNAM:
78 mu_argp_node_list_new (&lst, "getpwnam", arg);
79 break;
80
81 case OPT_SQL_GETPWUID:
82 mu_argp_node_list_new (&lst, "getpwuid", arg);
83 break;
84
85 case OPT_SQL_GETPASS:
86 mu_argp_node_list_new (&lst, "getpass", arg);
87 break;
88
89 case OPT_SQL_HOST:
90 mu_argp_node_list_new (&lst, "host", arg);
91 break;
92
93 case OPT_SQL_USER:
94 mu_argp_node_list_new (&lst, "user", arg);
95 break;
96
97 case OPT_SQL_PASSWD:
98 mu_argp_node_list_new (&lst, "passwd", arg);
99 break;
100
101 case OPT_SQL_DB:
102 mu_argp_node_list_new (&lst, "db", arg);
103 break;
104
105 case OPT_SQL_PORT:
106 mu_argp_node_list_new (&lst, "port", arg);
107 break;
108
109 case OPT_SQL_MU_PASSWORD_TYPE:
110 mu_argp_node_list_new (&lst, "password-type", arg);
111 break;
112
113 case OPT_SQL_FIELD_MAP:
114 mu_argp_node_list_new (&lst, "field-map", arg);
115 break;
116
117 case ARGP_KEY_INIT:
118 mu_argp_node_list_init (&lst);
119 break;
120
121 case ARGP_KEY_FINI:
122 mu_argp_node_list_finish (&lst, "sql", NULL);
123 break;
124
125 default:
126 return ARGP_ERR_UNKNOWN;
127 }
128 return 0;
129 }
130
131 static struct argp mu_sql_argp = {
132 mu_sql_argp_option,
133 mu_sql_argp_parser,
134 };
135
136 struct argp_child mu_sql_argp_child = {
137 &mu_sql_argp,
138 0,
139 NULL,
140 0
141 };
142
143 struct mu_cmdline_capa mu_sql_cmdline = {
144 "sql", &mu_sql_argp_child
145 };
...@@ -24,18 +24,9 @@ ...@@ -24,18 +24,9 @@
24 24
25 enum { 25 enum {
26 OPT_TLS = 256, 26 OPT_TLS = 256,
27 OPT_SSL_CERT,
28 OPT_SSL_KEY,
29 OPT_SSL_CAFILE
30 }; 27 };
31 28
32 static struct argp_option _tls_argp_options[] = { 29 static struct argp_option _tls_argp_options[] = {
33 {"ssl-cert", OPT_SSL_CERT, N_("FILE"), OPTION_HIDDEN,
34 N_("specify SSL certificate file"), 0},
35 {"ssl-key", OPT_SSL_KEY, N_("FILE"), OPTION_HIDDEN,
36 N_("specify SSL certificate key"), },
37 {"ssl-cafile", OPT_SSL_CAFILE, N_("FILE"), OPTION_HIDDEN,
38 N_("specify trusted CAs file"), 0},
39 {"tls", OPT_TLS, N_("BOOL"), OPTION_ARG_OPTIONAL, 30 {"tls", OPT_TLS, N_("BOOL"), OPTION_ARG_OPTIONAL,
40 N_("enable TLS support") }, 31 N_("enable TLS support") },
41 {NULL, 0, NULL, 0, NULL, 0} 32 {NULL, 0, NULL, 0, NULL, 0}
...@@ -52,18 +43,6 @@ _tls_argp_parser (int key, char *arg, struct argp_state *state) ...@@ -52,18 +43,6 @@ _tls_argp_parser (int key, char *arg, struct argp_state *state)
52 mu_argp_node_list_new (&lst, "enable", arg ? arg : "yes"); 43 mu_argp_node_list_new (&lst, "enable", arg ? arg : "yes");
53 break; 44 break;
54 45
55 case OPT_SSL_CERT:
56 mu_argp_node_list_new (&lst, "ssl-cert", arg);
57 break;
58
59 case OPT_SSL_KEY:
60 mu_argp_node_list_new (&lst, "ssl-key", arg);
61 break;
62
63 case OPT_SSL_CAFILE:
64 mu_argp_node_list_new (&lst, "ssl-cafile", arg);
65 break;
66
67 case ARGP_KEY_INIT: 46 case ARGP_KEY_INIT:
68 mu_argp_node_list_init (&lst); 47 mu_argp_node_list_init (&lst);
69 break; 48 break;
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007, 2009 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #include "cmdline.h"
24
25 #define OPT_PWDDIR 256
26
27 static error_t
28 mu_virt_argp_parser (int key, char *arg, struct argp_state *state)
29 {
30 static struct mu_argp_node_list lst;
31
32 switch (key)
33 {
34 case OPT_PWDDIR:
35 mu_argp_node_list_new (&lst, "passwd-dir", arg);
36 break;
37
38 case ARGP_KEY_INIT:
39 mu_argp_node_list_init (&lst);
40 break;
41
42 case ARGP_KEY_FINI:
43 mu_argp_node_list_finish (&lst, "virtdomain", NULL);
44 break;
45
46 default:
47 return ARGP_ERR_UNKNOWN;
48 }
49 return 0;
50 }
51
52 static struct argp_option mu_virt_argp_option[] = {
53 { "virtual-passwd-dir", OPT_PWDDIR, N_("DIR"), OPTION_HIDDEN,
54 N_("search for virtual passwd file in DIR"), 0},
55 { NULL, 0, NULL, 0, NULL, 0 }
56 };
57
58 static struct argp mu_virt_argp = {
59 mu_virt_argp_option,
60 mu_virt_argp_parser,
61 };
62
63 struct argp_child mu_virt_argp_child = {
64 &mu_virt_argp,
65 0,
66 NULL,
67 0
68 };
69
70 struct mu_cmdline_capa mu_virtdomain_cmdline = {
71 "virtdomain", &mu_virt_argp_child
72 };
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
18 #ifdef HAVE_CONFIG_H 18 #ifdef HAVE_CONFIG_H
19 # include <config.h> 19 # include <config.h>
20 #endif 20 #endif
21 #define MU_CFG_COMPATIBILITY /* This source uses deprecated cfg interfaces */
21 #include "mailutils/libcfg.h" 22 #include "mailutils/libcfg.h"
22 #include <string.h> 23 #include <string.h>
23 #include <stdlib.h> 24 #include <stdlib.h>
...@@ -84,6 +85,83 @@ mu_libcfg_init (char **cnames) ...@@ -84,6 +85,83 @@ mu_libcfg_init (char **cnames)
84 } 85 }
85 86
86 int 87 int
88 mu_libcfg_parse_config (mu_cfg_tree_t **ptree)
89 {
90 int flags = 0;
91 int rc = 0;
92 mu_cfg_tree_t *tree = NULL, *tmp;
93
94 if (mu_cfg_parser_verbose)
95 flags |= MU_PARSE_CONFIG_VERBOSE;
96 if (mu_cfg_parser_verbose > 1)
97 flags |= MU_PARSE_CONFIG_DUMP;
98
99 if (mu_load_site_rcfile)
100 {
101 rc = mu_cfg_parse_file (&tmp, MU_CONFIG_FILE, flags);
102
103 if (rc == ENOMEM)
104 {
105 mu_error ("%s", mu_strerror (rc));
106 return rc;
107 }
108 else if (rc == 0)
109 {
110 mu_cfg_tree_postprocess (tmp, flags | MU_PARSE_CONFIG_GLOBAL);
111 mu_cfg_tree_union (&tree, &tmp);
112 }
113 }
114
115 if (mu_load_user_rcfile && mu_program_name)
116 {
117 size_t size = 3 + strlen (mu_program_name) + 1;
118 char *file_name = malloc (size);
119 if (file_name)
120 {
121 strcpy (file_name, "~/.");
122 strcat (file_name, mu_program_name);
123
124 rc = mu_cfg_parse_file (&tmp, file_name, flags);
125 if (rc == ENOMEM)
126 {
127 mu_error ("%s", mu_strerror (rc));
128 mu_cfg_destroy_tree (&tree);
129 return rc;
130 }
131 else if (rc == 0)
132 {
133 mu_cfg_tree_postprocess (tmp, flags);
134 mu_cfg_tree_union (&tree, &tmp);
135 }
136 free (file_name);
137 }
138 }
139
140 if (mu_load_rcfile)
141 {
142 rc = mu_cfg_parse_file (&tmp, mu_load_rcfile, flags);
143 if (rc)
144 {
145 mu_error (_("errors parsing file %s: %s"), mu_load_rcfile,
146 mu_strerror (rc));
147 mu_cfg_destroy_tree (&tree);
148 return rc;
149 }
150 else
151 {
152 mu_cfg_tree_postprocess (tmp, flags);
153 mu_cfg_tree_union (&tree, &tmp);
154 }
155 }
156
157 *ptree = tree;
158 return rc;
159 }
160
161
162
163 /* FIXME: Deprecated */
164 int
87 mu_parse_config_files (struct mu_cfg_param *param, void *target) 165 mu_parse_config_files (struct mu_cfg_param *param, void *target)
88 { 166 {
89 int flags = 0; 167 int flags = 0;
......
1 # -*- tcl -*- 1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite. 2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, 2007 Free Software Foundation 3 # Copyright (C) 2002, 2007, 2009 Free Software Foundation
4 # 4 #
5 # This program is free software; you can redistribute it and/or modify 5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by 6 # it under the terms of the GNU General Public License as published by
...@@ -64,7 +64,7 @@ proc default_mail_start {args} { ...@@ -64,7 +64,7 @@ proc default_mail_start {args} {
64 64
65 if [info exists host_board] { 65 if [info exists host_board] {
66 if [board_info $host_board exists top_srcdir] { 66 if [board_info $host_board exists top_srcdir] {
67 append sw " --mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool" 67 append sw " --set mailbox.mail-spool=[board_info $host_board top_srcdir]/mail/testsuite/spool"
68 } 68 }
69 } 69 }
70 70
......
...@@ -98,6 +98,7 @@ libmailutils_la_SOURCES = \ ...@@ -98,6 +98,7 @@ libmailutils_la_SOURCES = \
98 memory_stream.c\ 98 memory_stream.c\
99 message_stream.c\ 99 message_stream.c\
100 mime.c\ 100 mime.c\
101 mkfilename.c\
101 monitor.c\ 102 monitor.c\
102 msrv.c\ 103 msrv.c\
103 mu_auth.c\ 104 mu_auth.c\
......
1 /* cfg_driver.c -- Main driver for Mailutils configuration files 1 /* cfg_driver.c -- Main driver for Mailutils configuration files
2 Copyright (C) 2007, 2008 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
3 3
4 GNU Mailutils is free software; you can redistribute it and/or 4 GNU Mailutils is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as 5 modify it under the terms of the GNU General Public License as
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
27 #include <ctype.h> 27 #include <ctype.h>
28 #include <mailutils/argcv.h> 28 #include <mailutils/argcv.h>
29 #include <mailutils/nls.h> 29 #include <mailutils/nls.h>
30 #define MU_CFG_COMPATIBILITY /* This source uses deprecated cfg interfaces */
30 #include <mailutils/cfg.h> 31 #include <mailutils/cfg.h>
31 #include <mailutils/errno.h> 32 #include <mailutils/errno.h>
32 #include <mailutils/error.h> 33 #include <mailutils/error.h>
...@@ -453,23 +454,6 @@ prog_parser (enum mu_cfg_section_stage stage, ...@@ -453,23 +454,6 @@ prog_parser (enum mu_cfg_section_stage stage,
453 return 0; 454 return 0;
454 } 455 }
455 456
456 static char *
457 make_file_name (const char *dir, const char *file)
458 {
459 char *tmp;
460 size_t len = strlen (dir) + 1 + strlen (file);
461 tmp = malloc (len + 1);
462 if (!tmp)
463 {
464 mu_error ("%s", mu_strerror (errno));
465 exit (1);
466 }
467 strcpy (tmp, dir);
468 strcat (tmp, "/");
469 strcat (tmp, file);
470 return tmp;
471 }
472
473 struct include_data 457 struct include_data
474 { 458 {
475 const char *progname; 459 const char *progname;
...@@ -492,13 +476,20 @@ _cb_include (mu_debug_t debug, void *data, mu_config_value_t *val) ...@@ -492,13 +476,20 @@ _cb_include (mu_debug_t debug, void *data, mu_config_value_t *val)
492 476
493 dirname = val->v.string; 477 dirname = val->v.string;
494 if (dirname[0] != '/') 478 if (dirname[0] != '/')
495 dirname = tmp = make_file_name (SYSCONFDIR, dirname); 479 {
480 dirname = tmp = mu_make_file_name (SYSCONFDIR, dirname);
481 if (!dirname)
482 {
483 mu_error ("%s", mu_strerror (errno));
484 return 1;
485 }
486 }
496 487
497 if (stat (dirname, &sb) == 0) 488 if (stat (dirname, &sb) == 0)
498 { 489 {
499 if (S_ISDIR (sb.st_mode)) 490 if (S_ISDIR (sb.st_mode))
500 { 491 {
501 char *file = make_file_name (dirname, idp->progname); 492 char *file = mu_make_file_name (dirname, idp->progname);
502 ret = mu_get_config (file, idp->progname, idp->progparam, 493 ret = mu_get_config (file, idp->progname, idp->progparam,
503 idp->flags & ~MU_PARSE_CONFIG_GLOBAL, 494 idp->flags & ~MU_PARSE_CONFIG_GLOBAL,
504 idp->target); 495 idp->target);
...@@ -528,20 +519,25 @@ struct mu_cfg_cont * ...@@ -528,20 +519,25 @@ struct mu_cfg_cont *
528 mu_build_container (const char *progname, struct include_data *idp) 519 mu_build_container (const char *progname, struct include_data *idp)
529 { 520 {
530 struct mu_cfg_cont *cont = root_container; 521 struct mu_cfg_cont *cont = root_container;
522
523 mu_config_clone_container (cont);
524
525 if (idp->flags & MU_PARSE_CONFIG_PLAIN)
526 {
531 struct mu_cfg_param mu_include_param[] = { 527 struct mu_cfg_param mu_include_param[] = {
532 { "include", mu_cfg_callback, NULL, 0, _cb_include, 528 { "include", mu_cfg_callback, NULL, 0, _cb_include,
533 N_("Include contents of the given file. If a directory is given, " 529 N_("Include contents of the given file. If a directory is given, "
534 "include contents of the file <file>/<program>, where <program> is " 530 "include contents of the file <file>/<program>, where "
535 "the name of the program. This latter form is allowed only in " 531 "<program> is the name of the program. This latter form is "
536 "the site-wide configuration file."), 532 "allowed only in the site-wide configuration file."),
537 N_("file-or-directory") }, 533 N_("file-or-directory") },
538 { NULL } 534 { NULL }
539 }; 535 };
540 536
541 mu_include_param[0].data = idp; 537 mu_include_param[0].data = idp;
542 mu_config_clone_container (cont);
543 _mu_config_register_section (&cont, NULL, NULL, NULL, 538 _mu_config_register_section (&cont, NULL, NULL, NULL,
544 (void*) progname, mu_include_param, NULL); 539 (void*) progname, mu_include_param, NULL);
540
545 if (idp->flags & MU_PARSE_CONFIG_GLOBAL) 541 if (idp->flags & MU_PARSE_CONFIG_GLOBAL)
546 { 542 {
547 mu_iterator_t iter; 543 mu_iterator_t iter;
...@@ -573,6 +569,11 @@ mu_build_container (const char *progname, struct include_data *idp) ...@@ -573,6 +569,11 @@ mu_build_container (const char *progname, struct include_data *idp)
573 else if (idp->progparam) 569 else if (idp->progparam)
574 _mu_config_register_section (&cont, NULL, NULL, NULL, NULL, 570 _mu_config_register_section (&cont, NULL, NULL, NULL, NULL,
575 idp->progparam, NULL); 571 idp->progparam, NULL);
572 }
573 else if (idp->progparam)
574 _mu_config_register_section (&cont, NULL, NULL, NULL, NULL,
575 idp->progparam, NULL);
576
576 return cont; 577 return cont;
577 } 578 }
578 579
...@@ -583,13 +584,15 @@ mu_cfg_tree_reduce (mu_cfg_tree_t *parse_tree, const char *progname, ...@@ -583,13 +584,15 @@ mu_cfg_tree_reduce (mu_cfg_tree_t *parse_tree, const char *progname,
583 { 584 {
584 int rc = 0; 585 int rc = 0;
585 586
587 if (!parse_tree)
588 return 0;
586 if (flags & MU_PARSE_CONFIG_DUMP) 589 if (flags & MU_PARSE_CONFIG_DUMP)
587 { 590 {
588 mu_stream_t stream; 591 mu_stream_t stream;
589 mu_stdio_stream_create (&stream, stderr, 592 mu_stdio_stream_create (&stream, stderr,
590 MU_STREAM_NO_CHECK|MU_STREAM_NO_CLOSE); 593 MU_STREAM_NO_CHECK|MU_STREAM_NO_CLOSE);
591 mu_stream_open (stream); 594 mu_stream_open (stream);
592 mu_cfg_format_parse_tree (stream, parse_tree); 595 mu_cfg_format_parse_tree (stream, parse_tree, MU_CFG_FMT_LOCUS);
593 mu_stream_destroy (&stream, NULL); 596 mu_stream_destroy (&stream, NULL);
594 } 597 }
595 598
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
29 29
30 struct tree_print 30 struct tree_print
31 { 31 {
32 int flags;
32 unsigned level; 33 unsigned level;
33 mu_stream_t stream; 34 mu_stream_t stream;
34 char *buf; 35 char *buf;
...@@ -131,7 +132,7 @@ format_node (const mu_cfg_node_t *node, void *data) ...@@ -131,7 +132,7 @@ format_node (const mu_cfg_node_t *node, void *data)
131 { 132 {
132 struct tree_print *tp = data; 133 struct tree_print *tp = data;
133 134
134 if (node->locus.file) 135 if ((tp->flags & MU_CFG_FMT_LOCUS) && node->locus.file)
135 mu_stream_sequential_printf (tp->stream, "# %lu \"%s\"\n", 136 mu_stream_sequential_printf (tp->stream, "# %lu \"%s\"\n",
136 (unsigned long) node->locus.line, 137 (unsigned long) node->locus.line,
137 node->locus.file); 138 node->locus.file);
...@@ -143,7 +144,7 @@ format_node (const mu_cfg_node_t *node, void *data) ...@@ -143,7 +144,7 @@ format_node (const mu_cfg_node_t *node, void *data)
143 _("ERROR: undefined statement")); 144 _("ERROR: undefined statement"));
144 break; 145 break;
145 146
146 case mu_cfg_node_tag: 147 case mu_cfg_node_statement:
147 { 148 {
148 mu_stream_sequential_write (tp->stream, node->tag, 149 mu_stream_sequential_write (tp->stream, node->tag,
149 strlen (node->tag)); 150 strlen (node->tag));
...@@ -183,17 +184,36 @@ format_node_end (const mu_cfg_node_t *node, void *data) ...@@ -183,17 +184,36 @@ format_node_end (const mu_cfg_node_t *node, void *data)
183 } 184 }
184 185
185 void 186 void
186 mu_cfg_format_parse_tree (mu_stream_t stream, mu_cfg_tree_t *tree) 187 mu_cfg_format_parse_tree (mu_stream_t stream, mu_cfg_tree_t *tree, int flags)
187 { 188 {
188 struct tree_print t; 189 struct tree_print t;
190 t.flags = flags;
189 t.level = 0; 191 t.level = 0;
190 t.stream = stream; 192 t.stream = stream;
191 t.buf = NULL; 193 t.buf = NULL;
192 t.bufsize = 0; 194 t.bufsize = 0;
193 mu_cfg_preorder (tree->node, format_node, format_node_end, &t); 195 mu_cfg_preorder (tree->head, format_node, format_node_end, &t);
194 free (t.buf); 196 free (t.buf);
195 } 197 }
196 198
199 void
200 mu_cfg_format_node (mu_stream_t stream, const mu_cfg_node_t *node, int flags)
201 {
202 struct tree_print t;
203 t.flags = flags;
204 t.level = 0;
205 t.stream = stream;
206 t.buf = NULL;
207 t.bufsize = 0;
208 format_node (node, &t);
209 if (node->type == mu_cfg_node_statement)
210 {
211 mu_cfg_preorder (node->node, format_node, format_node_end, &t);
212 format_node_end (node, &t);
213 }
214 }
215
216
197 217
198 const char * 218 const char *
199 mu_cfg_data_type_string (enum mu_cfg_param_data_type type) 219 mu_cfg_data_type_string (enum mu_cfg_param_data_type type)
......
...@@ -150,11 +150,9 @@ P [1-9][0-9]* ...@@ -150,11 +150,9 @@ P [1-9][0-9]*
150 \n { mu_cfg_locus.line++; } 150 \n { mu_cfg_locus.line++; }
151 [,;{}()] return yytext[0]; 151 [,;{}()] return yytext[0];
152 . { if (mu_isprint (yytext[0])) 152 . { if (mu_isprint (yytext[0]))
153 mu_cfg_perror (&mu_cfg_locus, 153 mu_cfg_parse_error (_("stray character %c"), yytext[0]);
154 _("stray character %c"), yytext[0]);
155 else 154 else
156 mu_cfg_perror (&mu_cfg_locus, 155 mu_cfg_parse_error (_("stray character \\%03o"),
157 _("stray character \\%03o"),
158 (unsigned char) yytext[0]); 156 (unsigned char) yytext[0]);
159 } 157 }
160 %% 158 %%
...@@ -172,7 +170,7 @@ unescape_to_line (int c) ...@@ -172,7 +170,7 @@ unescape_to_line (int c)
172 { 170 {
173 char t = mu_argcv_unquote_char (c); 171 char t = mu_argcv_unquote_char (c);
174 if (t == c && t != '\\' && t != '\"') 172 if (t == c && t != '\\' && t != '\"')
175 mu_cfg_perror (&mu_cfg_locus, _("unknown escape sequence '\\%c'"), c); 173 mu_cfg_parse_error (_("unknown escape sequence '\\%c'"), c);
176 mu_opool_append_char (pool, t); 174 mu_opool_append_char (pool, t);
177 } 175 }
178 } 176 }
...@@ -317,13 +315,11 @@ multiline_finish () ...@@ -317,13 +315,11 @@ multiline_finish ()
317 315
318 316
319 int 317 int
320 mu_get_config (const char *file, const char *progname, 318 mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file, int flags)
321 struct mu_cfg_param *progparam, int flags, void *target_ptr)
322 { 319 {
323 struct stat st; 320 struct stat st;
324 FILE *fp; 321 FILE *fp;
325 int rc; 322 int rc;
326 mu_cfg_tree_t *parse_tree;
327 323
328 if (stat (file, &st)) 324 if (stat (file, &st))
329 { 325 {
...@@ -348,20 +344,30 @@ mu_get_config (const char *file, const char *progname, ...@@ -348,20 +344,30 @@ mu_get_config (const char *file, const char *progname,
348 mu_cfg_locus.file = (char*) file; 344 mu_cfg_locus.file = (char*) file;
349 mu_cfg_locus.line = 1; 345 mu_cfg_locus.line = 1;
350 yyrestart (fp); 346 yyrestart (fp);
351 rc = mu_cfg_parse (&parse_tree); 347 rc = mu_cfg_parse (return_tree);
352 fclose (fp); 348 fclose (fp);
349 if (flags & MU_PARSE_CONFIG_VERBOSE)
350 mu_diag_output (MU_DIAG_INFO, _("finished parsing file `%s'"), file);
351 return rc == 0 ? 0 : MU_ERR_FAILURE;
352 }
353
354 /* FIXME: Deprecated interface */
355 int
356 mu_get_config (const char *file, const char *progname,
357 struct mu_cfg_param *progparam, int flags, void *target_ptr)
358 {
359 mu_cfg_tree_t *parse_tree;
360 int rc = mu_cfg_parse_file (&parse_tree, file, flags);
353 if (rc == 0) 361 if (rc == 0)
354 rc = mu_cfg_tree_reduce (parse_tree, progname, progparam, flags, 362 rc = mu_cfg_tree_reduce (parse_tree, progname, progparam, flags,
355 target_ptr); 363 target_ptr);
356 364
357 mu_cfg_destroy_tree (&parse_tree); 365 mu_cfg_destroy_tree (&parse_tree);
358 366
359 if (flags & MU_PARSE_CONFIG_VERBOSE)
360 mu_diag_output (MU_DIAG_INFO, _("finished parsing file `%s'"), file);
361
362 return rc == 0 ? 0 : MU_ERR_FAILURE; 367 return rc == 0 ? 0 : MU_ERR_FAILURE;
363 } 368 }
364 369
370
365 mu_opool_t 371 mu_opool_t
366 mu_cfg_lexer_pool () 372 mu_cfg_lexer_pool ()
367 { 373 {
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2009 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library. If not,
16 see <http://www.gnu.org/licenses/>. */
17
18 #if HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <mailutils/alloc.h>
25 #include <mailutils/mutil.h>
26
27 char *
28 mu_make_file_name (const char *dir, const char *file)
29 {
30 char *tmp;
31 size_t dirlen = strlen (dir);
32 size_t len;
33
34 while (dirlen > 0 && dir[dirlen-1] == '/')
35 dirlen--;
36
37 len = dirlen + 1 + strlen (file);
38 tmp = mu_alloc (len + 1);
39 if (tmp)
40 {
41 memcpy (tmp, dir, dirlen);
42 tmp[dirlen++] = '/';
43 strcpy (tmp + dirlen, file);
44 }
45 return tmp;
46 }
...@@ -291,37 +291,6 @@ mu_cpystr (char *dst, const char *src, size_t size) ...@@ -291,37 +291,6 @@ mu_cpystr (char *dst, const char *src, size_t size)
291 return len; 291 return len;
292 } 292 }
293 293
294 /* General retrieve stack support: */
295
296 void
297 mu_register_retriever (mu_list_t *pflist, mu_retrieve_fp fun)
298 {
299 if (!*pflist && mu_list_create (pflist))
300 return;
301 mu_list_append (*pflist, fun);
302 }
303
304 void *
305 mu_retrieve (mu_list_t flist, void *data)
306 {
307 void *p = NULL;
308 mu_iterator_t itr;
309
310 if (mu_list_get_iterator (flist, &itr) == 0)
311 {
312 mu_retrieve_fp fun;
313 for (mu_iterator_first (itr); !p && !mu_iterator_is_done (itr);
314 mu_iterator_next (itr))
315 {
316 mu_iterator_current (itr, (void **)&fun);
317 p = (*fun) (data);
318 }
319
320 mu_iterator_destroy (&itr);
321 }
322 return p;
323 }
324
325 int 294 int
326 mu_get_host_name (char **host) 295 mu_get_host_name (char **host)
327 { 296 {
......
1 /* String-list functions for GNU Mailutils. 1 /* String-list functions for GNU Mailutils.
2 Copyright (C) 2007, 2008 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
3 3
4 Based on slist module from GNU Radius. Written by Sergey Poznyakoff. 4 Based on slist module from GNU Radius. Written by Sergey Poznyakoff.
5 5
...@@ -255,6 +255,49 @@ mu_opool_finish (mu_opool_t opool, size_t *psize) ...@@ -255,6 +255,49 @@ mu_opool_finish (mu_opool_t opool, size_t *psize)
255 return opool->free->buf; 255 return opool->free->buf;
256 } 256 }
257 257
258 int
259 mu_opool_union (mu_opool_t *pdst, mu_opool_t *psrc)
260 {
261 mu_opool_t src, dst;
262
263 if (!psrc)
264 return EINVAL;
265 if (!*psrc)
266 return 0;
267 src = *psrc;
268
269 if (!pdst)
270 return EINVAL;
271 if (!*pdst)
272 {
273 *pdst = src;
274 *psrc = NULL;
275 return 0;
276 }
277 else
278 dst = *pdst;
279
280 if (dst->tail)
281 dst->tail->next = src->head;
282 else
283 dst->head = src->head;
284 dst->tail = src->tail;
285
286 if (src->free)
287 {
288 struct mu_opool_bucket *p;
289
290 for (p = src->free; p->next; p = p->next)
291 ;
292 p->next = dst->free;
293 dst->free = src->free;
294 }
295
296 free (src);
297 *psrc = NULL;
298 return 0;
299 }
300
258 301
259 /* Iterator support */ 302 /* Iterator support */
260 struct opool_iterator 303 struct opool_iterator
......
1 # -*- tcl -*- 1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite. 2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, 2007 Free Software Foundation 3 # Copyright (C) 2002, 2007, 2009 Free Software Foundation
4 # 4 #
5 # This program is free software; you can redistribute it and/or modify 5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by 6 # it under the terms of the GNU General Public License as published by
...@@ -31,7 +31,7 @@ proc mailbox_run {args} { ...@@ -31,7 +31,7 @@ proc mailbox_run {args} {
31 if {"$a" == "-mail-spool"} { 31 if {"$a" == "-mail-spool"} {
32 if [info exists host_board] { 32 if [info exists host_board] {
33 if [board_info $host_board exists top_srcdir] { 33 if [board_info $host_board exists top_srcdir] {
34 append sw "--mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool" 34 append sw "--set mailbox.mail-spool=[board_info $host_board top_srcdir]/mail/testsuite/spool"
35 } 35 }
36 } 36 }
37 if {![info exists init_spool]} { 37 if {![info exists init_spool]} {
......
1 # -*- tcl -*- 1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite. 2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, 2007 Free Software Foundation 3 # Copyright (C) 2002, 2007, 2009 Free Software Foundation
4 # 4 #
5 # This program is free software; you can redistribute it and/or modify 5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by 6 # it under the terms of the GNU General Public License as published by
...@@ -31,7 +31,7 @@ mu_exec -message "messages" \ ...@@ -31,7 +31,7 @@ mu_exec -message "messages" \
31 mu_exec -message "messages -q" -arg -q "5" 31 mu_exec -message "messages -q" -arg -q "5"
32 32
33 mu_exec -message "messages +teaparty.mbox" \ 33 mu_exec -message "messages +teaparty.mbox" \
34 -arg "--mail-folder=$MU_SPOOL_DIR" -arg +teaparty.mbox \ 34 -arg "--set mailbox.folder=$MU_SPOOL_DIR" -arg +teaparty.mbox \
35 "Number of messages in $MU_SPOOL_DIR/teaparty.mbox: 95" 35 "Number of messages in $MU_SPOOL_DIR/teaparty.mbox: 95"
36 36
37 #end of test.exp 37 #end of test.exp
......
...@@ -43,14 +43,9 @@ libmu_argp/auth.c ...@@ -43,14 +43,9 @@ libmu_argp/auth.c
43 libmu_argp/cmdline.c 43 libmu_argp/cmdline.c
44 libmu_argp/common.c 44 libmu_argp/common.c
45 libmu_argp/compat.c 45 libmu_argp/compat.c
46 libmu_argp/gsasl.c
47 libmu_argp/mu_argp.c 46 libmu_argp/mu_argp.c
48 libmu_argp/pam.c
49 libmu_argp/radius.c
50 libmu_argp/sieve.c 47 libmu_argp/sieve.c
51 libmu_argp/sql.c
52 libmu_argp/tls.c 48 libmu_argp/tls.c
53 libmu_argp/virtdomain.c
54 49
55 libmu_auth/ldap.c 50 libmu_auth/ldap.c
56 libmu_auth/radius.c 51 libmu_auth/radius.c
......
...@@ -56,14 +56,7 @@ static error_t pop3d_parse_opt (int key, char *arg, struct argp_state *astate); ...@@ -56,14 +56,7 @@ static error_t pop3d_parse_opt (int key, char *arg, struct argp_state *astate);
56 const char *program_version = "pop3d (" PACKAGE_STRING ")"; 56 const char *program_version = "pop3d (" PACKAGE_STRING ")";
57 static char doc[] = N_("GNU pop3d -- the POP3 daemon."); 57 static char doc[] = N_("GNU pop3d -- the POP3 daemon.");
58 58
59 #define OPT_LOGIN_DELAY 257 59 #define OPT_FOREGROUND 256
60 #define OPT_STAT_FILE 258
61 #define OPT_EXPIRE 259
62 #define OPT_EXPIRE_ON_EXIT 260
63 #define OPT_TLS_REQUIRED 261
64 #define OPT_BULLETIN_SOURCE 262
65 #define OPT_BULLETIN_DB 263
66 #define OPT_FOREGROUND 264
67 60
68 static struct argp_option options[] = { 61 static struct argp_option options[] = {
69 #define GRP 0 62 #define GRP 0
...@@ -73,38 +66,6 @@ static struct argp_option options[] = { ...@@ -73,38 +66,6 @@ static struct argp_option options[] = {
73 N_("runs in daemon mode with a maximum of NUMBER children"), GRP+1 }, 66 N_("runs in daemon mode with a maximum of NUMBER children"), GRP+1 },
74 #undef GRP 67 #undef GRP
75 68
76 #define GRP 5
77 {"undelete", 'u', NULL, OPTION_HIDDEN,
78 N_("undelete all messages on startup"), GRP+1},
79 {"expire", OPT_EXPIRE, N_("DAYS"), OPTION_HIDDEN,
80 N_("expire read messages after the given number of days"), GRP+1},
81 {"delete-expired", OPT_EXPIRE_ON_EXIT, NULL, OPTION_HIDDEN,
82 N_("delete expired messages upon closing the mailbox"), GRP+1},
83 #ifdef WITH_TLS
84 {"tls-required", OPT_TLS_REQUIRED, NULL, OPTION_HIDDEN,
85 N_("always require STLS before entering authentication phase")},
86 #endif
87 #undef GRP
88
89 #define GRP 10
90 #ifdef ENABLE_LOGIN_DELAY
91 {"login-delay", OPT_LOGIN_DELAY, N_("SECONDS"), OPTION_HIDDEN,
92 N_("allowed delay between two successive logins"), GRP+1},
93 {"stat-file", OPT_STAT_FILE, N_("FILENAME"), OPTION_HIDDEN,
94 N_("name of login statistics file"), GRP+1},
95 #endif
96
97 #undef GRP
98
99 #define GRP 20
100 { "bulletin-source", OPT_BULLETIN_SOURCE, N_("MBOX"), OPTION_HIDDEN,
101 N_("set source mailbox to get bulletins from"), GRP+1 },
102 #ifdef USE_DBM
103 { "bulletin-db", OPT_BULLETIN_DB, N_("FILE"), OPTION_HIDDEN,
104 N_("set the bulletin database file name"), GRP+1 },
105 #endif
106 #undef GRP
107
108 {NULL, 0, NULL, 0, NULL, 0} 69 {NULL, 0, NULL, 0, NULL, 0}
109 }; 70 };
110 71
...@@ -203,44 +164,6 @@ pop3d_parse_opt (int key, char *arg, struct argp_state *astate) ...@@ -203,44 +164,6 @@ pop3d_parse_opt (int key, char *arg, struct argp_state *astate)
203 mu_argp_node_list_new (&lst, "foreground", "yes"); 164 mu_argp_node_list_new (&lst, "foreground", "yes");
204 break; 165 break;
205 166
206 case 'u':
207 mu_argp_node_list_new (&lst, "undelete", "yes");
208 break;
209
210 #ifdef ENABLE_LOGIN_DELAY
211 case OPT_LOGIN_DELAY:
212 mu_argp_node_list_new (&lst, "login-delay", arg);
213 break;
214
215 case OPT_STAT_FILE:
216 mu_argp_node_list_new (&lst, "stat-file", arg);
217 break;
218 #endif
219
220 case OPT_EXPIRE:
221 mu_argp_node_list_new (&lst, "expire", arg);
222 break;
223
224 case OPT_EXPIRE_ON_EXIT:
225 mu_argp_node_list_new (&lst, "delete-expired", "yes");
226 break;
227
228 #ifdef WITH_TLS
229 case OPT_TLS_REQUIRED:
230 mu_argp_node_list_new (&lst, "tls-required", "yes");
231 break;
232 #endif
233
234 case OPT_BULLETIN_SOURCE:
235 mu_argp_node_list_new (&lst, "bulletin-source", arg);
236 break;
237
238 #ifdef USE_DBM
239 case OPT_BULLETIN_DB:
240 mu_argp_node_list_new (&lst, "bulletin-db", arg);
241 break;
242 #endif
243
244 case ARGP_KEY_INIT: 167 case ARGP_KEY_INIT:
245 mu_argp_node_list_init (&lst); 168 mu_argp_node_list_init (&lst);
246 break; 169 break;
......
1 # -*- tcl -*- 1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite. 2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, 2007 Free Software Foundation 3 # Copyright (C) 2002, 2007, 2009 Free Software Foundation
4 # 4 #
5 # This program is free software; you can redistribute it and/or modify 5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by 6 # it under the terms of the GNU General Public License as published by
...@@ -37,7 +37,7 @@ sieve_test discard.sv -pattern\ ...@@ -37,7 +37,7 @@ sieve_test discard.sv -pattern\
37 "DISCARD on msg uid 2: marking as deleted"\ 37 "DISCARD on msg uid 2: marking as deleted"\
38 "DISCARD on msg uid 3: marking as deleted" 38 "DISCARD on msg uid 3: marking as deleted"
39 39
40 sieve_test --mail-folder='$MU_SPOOL_DIR' fileinto.sv -pattern\ 40 sieve_test --set "mailbox.folder='$MU_SPOOL_DIR'" fileinto.sv -pattern\
41 "FILEINTO on msg uid 1: delivering into +file"\ 41 "FILEINTO on msg uid 1: delivering into +file"\
42 "FILEINTO on msg uid 2: delivering into +file"\ 42 "FILEINTO on msg uid 2: delivering into +file"\
43 "FILEINTO on msg uid 3: delivering into +file" 43 "FILEINTO on msg uid 3: delivering into +file"
......
1 # -*- tcl -*- 1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite. 2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, 2005, 2007, 2008 Free Software Foundation 3 # Copyright (C) 2002, 2005, 2007, 2008, 2009 Free Software Foundation
4 # 4 #
5 # This program is free software; you can redistribute it and/or modify 5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by 6 # it under the terms of the GNU General Public License as published by
...@@ -152,7 +152,7 @@ proc mu_init {args} { ...@@ -152,7 +152,7 @@ proc mu_init {args} {
152 if {[llength $args] == 1 && [lindex $args 0] == "-noflags"} { 152 if {[llength $args] == 1 && [lindex $args 0] == "-noflags"} {
153 set MU_TOOL_FLAGS "--no-site-rcfile --no-user-rcfile" 153 set MU_TOOL_FLAGS "--no-site-rcfile --no-user-rcfile"
154 } else { 154 } else {
155 set MU_TOOL_FLAGS "--mail-spool $MU_SPOOL_DIR --no-site-rcfile --no-user-rcfile" 155 set MU_TOOL_FLAGS "--set mailbox.mail-spool=$MU_SPOOL_DIR --no-site-rcfile --no-user-rcfile"
156 for {set i 0} {$i < [llength $args]} {incr i} { 156 for {set i 0} {$i < [llength $args]} {incr i} {
157 append MU_TOOL_FLAGS " [lindex $args $i]" 157 append MU_TOOL_FLAGS " [lindex $args $i]"
158 } 158 }
...@@ -181,7 +181,7 @@ proc mu_start {args} { ...@@ -181,7 +181,7 @@ proc mu_start {args} {
181 181
182 if [info exists host_board] { 182 if [info exists host_board] {
183 if [board_info $host_board exists top_srcdir] { 183 if [board_info $host_board exists top_srcdir] {
184 append sw " --mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool" 184 append sw " --set mailbox.mail-spool=[board_info $host_board top_srcdir]/mail/testsuite/spool"
185 } 185 }
186 } 186 }
187 187
...@@ -263,7 +263,7 @@ proc mu_exec {args} { ...@@ -263,7 +263,7 @@ proc mu_exec {args} {
263 263
264 if [info exists host_board] { 264 if [info exists host_board] {
265 if [board_info $host_board exists top_srcdir] { 265 if [board_info $host_board exists top_srcdir] {
266 append sw " --mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool" 266 append sw " --set mailbox.mail-spool=[board_info $host_board top_srcdir]/mail/testsuite/spool"
267 } 267 }
268 } 268 }
269 269
......