diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-01-08 16:03:56 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-01-08 16:03:56 +0000 |
commit | 2a0f3d602652fb7a805a5868d1b1ec438e46c48e (patch) | |
tree | 430b95714120bf0d69af654765b4d831eaed75c0 | |
parent | b07d08d37a097fd10e89adbd60feaeb276aeb6d1 (diff) | |
download | mailfromd-2a0f3d602652fb7a805a5868d1b1ec438e46c48e.tar.gz mailfromd-2a0f3d602652fb7a805a5868d1b1ec438e46c48e.tar.bz2 |
* src/gram.y, src/main.c: Remove deprecated features.
* doc/mailfromd.texi, NEWS: Update.
* gacopyz/gacopyz.c: Support URLs.
git-svn-id: file:///svnroot/mailfromd/branches/gmach@1545 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | NEWS | 12 | ||||
-rw-r--r-- | doc/mailfromd.texi | 52 | ||||
-rw-r--r-- | gacopyz/gacopyz.c | 65 | ||||
-rw-r--r-- | src/gram.y | 23 | ||||
-rw-r--r-- | src/main.c | 91 |
6 files changed, 117 insertions, 130 deletions
@@ -1,5 +1,9 @@ 2008-01-08 Sergey Poznyakoff <gray@gnu.org.ua> + * src/gram.y, src/main.c: Remove deprecated features. + * doc/mailfromd.texi, NEWS: Update. + * gacopyz/gacopyz.c: Support URLs. + * lib/libmf.h (mf_init_nls): New proto. * lib/nls.c: New file. * lib/Makefile: Add nls.c. @@ -13,6 +13,11 @@ Version 4.2.91 (SVN) Smap is a general-purpose remote map for MeTA1. +* Milter `ports' can be specified using URL notation, e.g.: + + inet://127.0.0.1:1234 instead of inet:1234@127.0.0.1 + unix:///var/run/socket instead of unix:/var/run/socket + * write built-in The `write' built-in function takes an optional third argument, @@ -38,6 +43,13 @@ implementation will not be compiled. * Fix compilation on Sun. +* Removed depecated features: + + 1. #pragma option ehlo; + 2. #pragma option mailfrom; + 3. The --config-file command line option; + 4. Using built-in exception codes in catch statements. + Version 4.2, 2007-10-23 diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index 6db9fd78..0bc0bf5a 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -1007,6 +1007,26 @@ enable asynchronous syslog feature. To set default syslog implemetation, use @code{DEFAULT_SYSLOG_ASYNC} configuration variable (@pxref{syslog-async}). +The following deprecated features are removed: + +@enumerate +@item @code{#pragma option ehlo} statement. + +It became deprecated in version 4.0. @xref{pragma-option-ehlo}. + +@item @code{#pragma option mailfrom} statement. + +It became deprecated in version 4.0. @xref{pragma-option-ehlo}. + +@item The @option{--config-file} command line option. + +It became deprecated in version 3.1. @xref{30x-31x}. + +@item Built-in exception codes in catch statements. + +They are deprecated since version 4.0. @xref{31x-400}. +@end enumerate + @node 410-420 @section Upgrading from 4.1 to 4.2 @cindex Upgrading from 4.1 to 4.2 @@ -1077,6 +1097,7 @@ Warning: Using built-in exception codes is deprecated Warning: Please include <status.mfh> @end smallexample +@anchor{pragma-option-ehlo} Another important difference is that pragmatic options @samp{ehlo} and @samp{mailfromd} are now deprecated, as well as their command line equivalents @option{--ehlo} and @option{--domain}. These options @@ -3717,6 +3738,12 @@ considered deprecated. @opindex load @opindex load-dir + + -- The following options are removed: + +@opindex domain +@opindex ehlo +@opindex mailfrom ------------------------------------------------------------------------ @end ignore @@ -6589,7 +6616,7 @@ do fi if %level > 20 set flags %flags | MF_SIEVE_DEBUG_PROT - fi + fi if not sieve("/etc/mail/filter.siv", %flags) discard @@ -10265,18 +10292,6 @@ Run in test mode. @xref{Testing Filter Scripts}. Default @var{state} is When used with @option{--compact} or @option{--expire} option, applies the action to all available databases. @xref{compact cronjob}. -@opsummary{domain} -@item -D @var{string} -@itemx --domain=@var{string} -Set default @acronym{SMTP} domain. Overrides @samp{#pragma option ehlo} -(@pxref{pragma ehlo}). This option is -deprecated@footnote{@xref{31x-400}, for a detailed description of -why it is deprecated.}: use @option{-v ehlo_domain=@var{string}} instead. - -@opsummary{ehlo} -@itemx --ehlo=@var{string} -Same as @option{--domain}. - @opsummary{expire-interval} @item -e @var{interval} @itemx --expire-interval=@var{interval} @@ -10345,15 +10360,6 @@ lock-retry-timeout} (@pxref{pragma lock-retry-timeout}. Set the @acronym{URL} of the mailer to use. @xref{Mail Sending Functions}. -@opsummary{mailfrom} -@item --mailfrom=@var{email} -Set postmaster email address. Overrides @samp{#pragma option ehlo}, -which you are advised to use instead (@pxref{pragma ehlo}). The -default is null return address (@samp{""}). This option is -deprecated@footnote{@xref{31x-400}, for a detailed -description of why it is deprecated.}: use @option{-v -mailfrom_address=@var{string}} instead. - @opsummary{mtasim} @item --mtasim This option is reserved for use by @command{mtasim} (@pxref{mtasim}). @@ -10449,8 +10455,6 @@ must be declared in your startup script. @xref{overriding initial values}, for a detailed discussion of this option. @ignore --- Not used any more, but supported for backward compatibility -@opindex config-file -- Reserved for future use @opindex compile @end ignore diff --git a/gacopyz/gacopyz.c b/gacopyz/gacopyz.c index 24f694e8..58e96edc 100644 --- a/gacopyz/gacopyz.c +++ b/gacopyz/gacopyz.c @@ -73,42 +73,69 @@ gacopyz_free(gacopyz_conn_t conn) } } +static int +copy_part(const char *cstr, const char *p, char **pbuf) +{ + size_t len = p - cstr; + char *buf = malloc(len + 1); + if (!buf) { + free(buf); + return MI_FAILURE; + } + memcpy(buf, cstr, len); + buf[len] = 0; + *pbuf = buf; + return 0; +} + + +static int +parse_url(const char *proto, const char *cstr, char **pport, char **ppath) +{ + const char *p = strchr (cstr, ':'); + + if (!p) + *pport = NULL; + else if (copy_part(cstr, p, ppath)) + return MI_FAILURE; + else + cstr = p + 1; + *pport = strdup(cstr); + return *pport == NULL ? MI_FAILURE : 0; +} + int -gacopyz_parse_connection(const char *cstr, +gacopyz_parse_connection(const char *cstr, char **pproto, char **pport, char **ppath) { const char *p; - size_t len; p = strchr(cstr, ':'); if (!p) *pproto = NULL; else { - len = p - cstr; - *pproto = malloc(len + 1); - if (!*pproto) + char *proto; + if (copy_part(cstr, p, &proto)) return MI_FAILURE; - memcpy(*pproto, cstr, len); - (*pproto)[len] = 0; - cstr = p + 1; + if (cstr[0] == '/' && cstr[1] == '/') { + int rc = parse_url(proto, cstr + 2, pport, ppath); + if (rc) + free(proto); + else + *pproto = proto; + return rc; + } + *pproto = proto; } p = strchr(cstr, '@'); if (!p) *pport = NULL; - else { - len = p - cstr; - *pport = malloc(len + 1); - if (!*pport) { - free(*pproto); - return MI_FAILURE; - } - memcpy(*pport, cstr, len); - (*pport)[len] = 0; - + else if (copy_part(cstr, p, pport)) + return MI_FAILURE; + else cstr = p + 1; - } *ppath = strdup(cstr); if (!*ppath) { @@ -1219,9 +1219,8 @@ jumpstmt : BREAK opt_ident parse_error(_("`next' used outside `loop'")); YYERROR; } else { - /*DEPRECATION*/ - parse_warning(_("`next' is used outside `loop'; did you mean `pass'?")); - $$ = alloc_node(node_type_noop, &$1); + parse_error(_("`next' is used outside `loop'; did you mean `pass'?")); + YYERROR; } } else { $$ = alloc_node(node_type_next, &$1); @@ -1906,23 +1905,13 @@ branch : WHEN { allow_unquoted_strings = 1; } valist ':' { allow_unquoted_strings = 0; } stmtlist { struct valist *p; - static int warned_once = 0; + for (p = $3.head; p; p = p->next) { if (p->value.type == dtype_string) { - mf_status status; - if (string_to_stat(p->value.v.literal->text, - &status)) { - parse_error(_("Unknown exception code: %s"), - p->value.v.literal->text); - YYERROR; - } else if (!warned_once) { - /*DEPRECATION*/ - parse_warning("Using built-in exception codes is deprecated."); - parse_warning("Please include <status.mfh>"); - warned_once = 1; - } + parse_error("Invalid data type, expected number."); + /* Try to continue */ p->value.type = dtype_number; - p->value.v.number = status; + p->value.v.number = 0; } } @@ -35,6 +35,7 @@ #include <netdb.h> #include <mailutils/mailutils.h> +#include <mailutils/server.h> #include <mailutils/libargp.h> #include "mailfromd.h" @@ -475,76 +476,35 @@ mf_option_source_ip(mu_debug_t err, char *arg, unsigned long *pval) static int option_string(char *opt, void **pval, char *newval); static int -option_ehlo(char *opt, void **pval, char *newval) +option_deprecated(const char *opt, const char *new, const char *val) { if (get_locus()->file) - parse_warning( - "`#pragma option ehlo' is deprecated, consider using " - "`set ehlo_domain \"%s\"' instead", - (char*) newval); + parse_error( + "`#pragma option %s' is not supported; use " + "`set %s \"%s\"' instead", + opt, new, val); else - parse_warning( - "option --ehlo is deprecated, consider using " - "`-v ehlo_domain=\"%s\"' instead", - (char*) newval); - return option_string(opt, pval, newval); + parse_error( + "option --%s is not supported, use " + "`-v %s=\"%s\"' instead", + opt, new, val); + return 0; } -static void -set_ehlo(void *value) +static int +option_ehlo(char *opt, void **pval, char *newval) { - defer_initialize_variable("ehlo_domain", value); + return option_deprecated(opt, "ehlo_domain", newval); } static int option_mailfrom(char *opt, void **pval, char *newval) { - int rc; - mu_address_t addr; - - /* FIXME-MU: compensate for mailutils deficiency */ - if (newval[0] == 0) - newval = DEFAULT_FROM_ADDRESS; - if (get_locus()->file) - parse_warning( - "`#pragma option mailfrom' is deprecated, consider using " - "`set mailfrom_address \"%s\"' instead", - (char*) newval); - else - parse_warning( - "option --mailfrom is deprecated, consider using " - "`-v mailfrom_address=\"%s\"' instead", - (char*) newval); - - rc = mu_address_create(&addr, newval); - if (rc) { - mu_error(_("Cannot create address `%s': %s"), - newval, mu_strerror(rc)); - return 1; - } - mu_address_destroy(&addr); - return option_string(opt, pval, newval); + if (newval[0] == 0) + newval = "<>"; + return option_deprecated(opt, "mailfrom_address", newval); } -static void -set_mailfrom(void *value) -{ - int rc; - mu_address_t addr; - - /* FIXME-MU: compensate for mailutils deficiency */ - if (*(char*)value == 0) - value = DEFAULT_FROM_ADDRESS; - - rc = mu_address_create(&addr, value); - if (rc) { - mu_error(_("Cannot create address `%s': %s"), - (char*)value, mu_strerror(rc)); - return; - } - mu_address_destroy(&addr); - defer_initialize_variable("mailfrom_address", value); -} /* Other options */ @@ -812,7 +772,7 @@ struct option_cache { void (*set)(void *value); int cumulative; } option_cache[] = { - { "ehlo", NULL, option_ehlo, set_ehlo }, + { "ehlo", NULL, option_ehlo, NULL }, { "debug", NULL, option_debug, set_debug }, { "source-info", NULL, option_boolean, set_source_info }, { "stack-trace", NULL, option_boolean, set_stack_trace }, @@ -825,7 +785,7 @@ struct option_cache { { "group", NULL, option_group, set_group }, { "milter-timeout", NULL, option_time, set_milter_timeout }, { "pidfile", NULL, option_pidfile, set_pidfile }, - { "mailfrom", NULL, option_mailfrom, set_mailfrom }, + { "mailfrom", NULL, option_mailfrom, NULL }, { "timeout", NULL, option_time, set_io_timeout }, { "io-timeout", NULL, option_time, set_io_timeout }, { "connect-timeout", NULL, option_time, set_connect_timeout }, @@ -883,7 +843,6 @@ static char args_doc[] = "[var=value...][SCRIPT]"; enum mailfromd_option { OPTION_ALL = 256, OPTION_COMPACT, - OPTION_CONFIG_FILE, OPTION_DAEMON, OPTION_DELETE, OPTION_DOMAIN_FILE, @@ -987,8 +946,6 @@ static struct argp_option options[] = { N_("General options"), GRP }, { "state-directory", OPTION_STATE_DIRECTORY, N_("DIR"), 0, N_("Set new program state directory"), GRP+1 }, - { "config-file", OPTION_CONFIG_FILE, N_("FILE"), OPTION_HIDDEN, - N_("Read configuration from FILE"), GRP+1 }, { "include", 'I', N_("DIR"), 0, N_("Add the directory DIR to the list of directories to be " "searched for header files"), GRP+1 }, @@ -1150,12 +1107,6 @@ parse_opt (int key, char *arg, struct argp_state *state) all_option = 1; break; - case OPTION_CONFIG_FILE: - /*DEPRECATION*/ - mu_error("Warning: --config-file is obsolete; give the filter script name as an argument"); - script_file = arg; - break; - case OPTION_IGNORE_FAILED_READS: ignore_failed_reads_option = 1; break; @@ -1886,10 +1837,10 @@ portspec_fixup() if (gacopyz_parse_connection(portspec, &proto, &port, &path) != MI_SUCCESS) - return; /* No need to complain: it is left to gacopyz connect + return; /* No need to complain: it is left to gacopyz connect routines */ - if ((!proto + if ((!proto || strcmp(proto, "unix") == 0 || strcmp(proto, "local") == 0) && !port && path[0] != '/') { |