Commit 73be707d 73be707da183c2ed8d59e7da781790c8ee759d1d by Sergey Poznyakoff

Bugfixes.

* libmailutils/cfg/parser.y (STRTONUM, STRxTONUM)
(GETSNUM, GETUNUM): Remove unused arguments.
* libmailutils/stream/tcp.c (mu_tcp_stream_create_from_sa): Take
care not to destroy sockaddr arguments in case of failure.
1 parent d1e06eeb
......@@ -1387,7 +1387,7 @@ subsection.
@node General Server Configuration
@subsubsection General Server Configuration
@cindex server configuration, general
@subsubheading Syntax
@* Syntax:
@smallexample
# @r{Set daemon mode.}
mode @samp{inetd|daemon};
......@@ -1403,7 +1403,7 @@ port @var{portspec};
timeout @var{time};
@end smallexample
@subsubheading Description
@* Description:
These statements configure general server-related issues.
@deffn {Configuration} mode @var{string};
......@@ -1476,7 +1476,7 @@ requests during @var{time} seconds, the child process terminates.
@subsubsection Server Statement
@cindex server statement
@kwindex server
@subsubheading Syntax
@* Syntax:
@smallexample
server @var{ipaddr}[:@var{port}] @{
# @r{Run this server as a single process.}
......@@ -1490,7 +1490,7 @@ server @var{ipaddr}[:@var{port}] @{
@}
@end smallexample
@subsubheading Description
@* Description:
The @code{server} block statement configures a single TCP or UDP
server. It takes effect only in daemon mode (@pxref{server mode}).
The argument to this statement specifies the IP address, and,
......@@ -2427,7 +2427,7 @@ The actual escape character may be changed by setting the value of
@end menu
@node Quitting Compose Mode
@subsubheading Quitting Compose Mode
@subsubsection Quitting Compose Mode
@kyindex ~., mail escape
@kyindex ~x, mail escape
......@@ -2450,7 +2450,7 @@ when mail variable @code{ignore} is set. In this case, you can use
@samp{~x} escape to achieve the same effect.
@node Getting Help on Compose Escapes
@subsubheading Getting Help on Compose Escapes: ~?
@subsubsection Getting Help on Compose Escapes: ~?
@kyindex ~?, mail escape
The @samp{~?} escape prints on screen a brief summary of the available
......@@ -2458,7 +2458,7 @@ compose escapes. @emph{Please note}, that @samp{~h} escape prompts
for changing the header values, and does @emph{not} give help.
@node Editing the Message
@subsubheading Editing the Message: ~e and ~v
@subsubsection Editing the Message: ~e and ~v
@kyindex ~e, mail escape
@kyindex ~v, mail escape
......@@ -2474,7 +2474,7 @@ the message with headers included, thus allowing you to change
the headers as well.
@node Modifying the Headers
@subsubheading Modifying the Headers: ~h, ~t, ~c, ~b, ~s
@subsubsection Modifying the Headers: ~h, ~t, ~c, ~b, ~s
To add new addresses to the list of message recipients, use @samp{~t}
command, e.g.:
......@@ -2498,7 +2498,7 @@ you with the values of @code{To}, @code{Cc}, @code{Bcc}, and
commands.
@node Enclosing Another Message
@subsubheading Enclosing Another Message: ~m and ~M
@subsubsection Enclosing Another Message: ~m and ~M
@kyindex ~m, mail escape
@kyindex ~M, mail escape
......@@ -2515,7 +2515,7 @@ In both cases, the contents of @code{indentprefix} mail variable is
prepended to each line enclosed.
@node Adding a File to the Message
@subsubheading Adding a File to the Message: ~r and ~d
@subsubsection Adding a File to the Message: ~r and ~d
To append the contents of file @var{filename} to the message, type
......@@ -2537,7 +2537,7 @@ The @samp{~d} escape is a shorthand for
@end smallexample
@node Printing And Saving the Message
@subsubheading Printing And Saving the Message
@subsubsection Printing And Saving the Message
@kyindex ~p, mail escape
@kyindex ~w, mail escape
......@@ -2547,7 +2547,7 @@ an arbitrary file using @samp{~w} escape. It takes the filename as its
argument.
@node Signing the Message
@subsubheading Signing the Message: ~a and ~A
@subsubsection Signing the Message: ~a and ~A
@kyindex ~a, mail escape
@kyindex ~A, mail escape
......@@ -2560,7 +2560,7 @@ variable @code{Sign}, and use @samp{~A} escape to insert it into
the message.
@node Printing Another Message
@subsubheading Printing Another Message: ~f and ~F
@subsubsection Printing Another Message: ~f and ~F
@kyindex ~f, mail escape
@kyindex ~F, mail escape
......@@ -2573,14 +2573,14 @@ lists to select headers to be displayed, whereas the latter prints
all headers.
@node Inserting Value of a Mail Variable
@subsubheading Inserting Value of a Mail Variable: ~i
@subsubsection Inserting Value of a Mail Variable: ~i
@kyindex ~i, mail escape
The @samp{~i} escape enters the value of the named mail variable into
the body of the message being composed.
@node Executing Other Mail Commands
@subsubheading Executing Other Mail Commands: ~: and ~-
@subsubsection Executing Other Mail Commands: ~: and ~-
@kyindex ~:, mail escape
@kyindex ~-, mail escape
......@@ -2603,7 +2603,7 @@ the only commands that can reasonably be used are: @code{alias},
@code{unalias}, @code{alternate}, @code{set}, and @code{unset}.
@node Executing Shell Commands
@subsubheading Executing Shell Commands: ~! and ~|
@subsubsection Executing Shell Commands: ~! and ~|
@kyindex ~!, mail escape
@kyindex ~|, mail escape
......@@ -2693,7 +2693,7 @@ commands the user enters.
@c **********************************
@node Quitting the Program
@subsubheading Quitting the Program
@subsubsection Quitting the Program
Following commands quit the program:
......@@ -2716,7 +2716,7 @@ upon.
Typing EOF (@samp{C-D}) alone is equivalent to @samp{quit}.
@node Obtaining Online Help
@subsubheading Obtaining Online Help
@subsubsection Obtaining Online Help
@kyindex help, mail command
@kyindex ?, mail command
@kyindex list, mail command
......@@ -2744,7 +2744,7 @@ Display program warranty statement.
@end table
@node Moving Within a Mailbox
@subsubheading Moving Within a Mailbox
@subsubsection Moving Within a Mailbox
@kyindex next, mail command
@kyindex prev, mail command
......@@ -2762,7 +2762,7 @@ Move to the previous message.
@end table
@node Changing mailbox/directory
@subsubheading Changing Mailbox/Directory
@subsubsection Changing Mailbox/Directory
@kyindex chdir, mail command
@kyindex file, mail command
@kyindex folder, mail command
......@@ -2791,7 +2791,7 @@ name followed by the summary information regarding it, e.g.:
@end table
@node Controlling Header Display
@subsubheading Controlling Header Display
@subsubsection Controlling Header Display
@kyindex discard, mail command
@kyindex ignore, mail command
@kyindex retain, mail command
......@@ -2820,7 +2820,7 @@ arguments, this command prints the contents of retained list.
@end table
@node Displaying Information
@subsubheading Displaying Information
@subsubsection Displaying Information
@kyindex =, mail command
@kyindex headers, mail command
@kyindex from, mail command
......@@ -2872,7 +2872,7 @@ Displays current mailbox summary. E.g.:
@end table
@node Displaying Messages
@subsubheading Displaying Messages
@subsubsection Displaying Messages
@kyindex print, mail command
@kyindex type, mail command
@kyindex Print, mail command
......@@ -2945,7 +2945,7 @@ Example:
@end table
@node Marking Messages
@subsubheading Marking Messages
@subsubsection Marking Messages
@kyindex tag, mail command
@kyindex hold, mail command
@kyindex preserve, mail command
......@@ -2971,7 +2971,7 @@ does not override the effect of @code{delete} command.
@end table
@node Disposing of Messages
@subsubheading Disposing of Messages
@subsubsection Disposing of Messages
@kyindex delete, mail command
@kyindex undelete, mail command
@kyindex dt, mail command
......@@ -2995,7 +2995,7 @@ prints the message, immediately following last deleted one.
@end table
@node Saving Messages
@subsubheading Saving Messages
@subsubsection Saving Messages
@kyindex save, mail command
@kyindex Save, mail command
@kyindex write, mail command
......@@ -3060,7 +3060,7 @@ deletion.
@end table
@node Editing Messages
@subsubheading Editing Messages
@subsubsection Editing Messages
@kyindex edit, mail command
@kyindex visual, mail command
......@@ -3081,7 +3081,7 @@ Edits each message in @var{msglist} with the editor, specified in
@end table
@node Aliasing
@subsubheading Aliasing
@subsubsection Aliasing
@kyindex alias, mail command
@kyindex group, mail command
@kyindex unalias, mail command
......@@ -3111,7 +3111,7 @@ alternate names is displayed.
@end table
@node Replying
@subsubheading Replying
@subsubsection Replying
@kyindex mail, mail command
@kyindex reply, mail command
@kyindex Reply, mail command
......@@ -3226,7 +3226,7 @@ Subject: Re: News
@end smallexample
@node Controlling Sender Fields
@subsubheading Controlling Sender Fields
@subsubsection Controlling Sender Fields
@kyindex sender, mail command
@kyindex nosender, mail command
......@@ -3279,7 +3279,7 @@ Sender address is obtained from the envelope
@end smallexample
@node Incorporating New Mail
@subsubheading Incorporating New Mail
@subsubsection Incorporating New Mail
@kyindex incorporate, mail command
The @code{incorporate} (@code{inc}) command incorporates newly arrived
......@@ -3288,7 +3288,7 @@ before returning to @command{mail} command prompt if the variable
@code{autoinc} is set.
@node Shell Escapes
@subsubheading Shell Escapes
@subsubsection Shell Escapes
@kyindex shell, mail command
@kyindex !, mail command
......@@ -4730,7 +4730,7 @@ its standard.
@end menu
@node Invoking Sieve
@subsubheading Invoking @command{sieve}
@subsubsection Invoking @command{sieve}
The @command{sieve} invocation syntax is:
......@@ -4816,7 +4816,7 @@ Log all actions executed. See also @ref{Sieve Configuration, verbose}.
@end table
@node Sieve Configuration
@subsubheading Sieve Configuration
@subsubsection Sieve Configuration
The behavior of @command{sieve} is affected by the following
configuration statements:
......@@ -4905,7 +4905,7 @@ executed.
@end deffn
@node Logging and Debugging
@subsubheading Logging and debugging
@subsubsection Logging and debugging
The default behavior of @command{sieve} is to remain silent about
anything except errors. However, it is sometimes necessary to see
......@@ -4958,7 +4958,7 @@ This option causes @command{sieve} to output its diagnostics to
the given syslog facility.
@node Extending Sieve
@subsubheading Extending @command{sieve}
@subsubsection Extending @command{sieve}
The basic set of sieve actions, tests and comparators may be extended
using loadable extensions. Usual @code{require} mechanism is used for
......
......@@ -381,7 +381,7 @@ Currently implemented directives are @code{include} and @code{searchpath}.
@end menu
@node #include
@subheading Sieve #include directive
@subsection Sieve #include directive
@kwindex #include, sieve
The @code{#include} directive reads in the contents of the given file.
......@@ -401,7 +401,7 @@ If @var{filename} starts with a directory separator character
(@samp{/}) both forms have the same effect.
@node #searchpath
@subheading Sieve #searchpath directive
@subsection Sieve #searchpath directive
@kwindex #searchpath, sieve
The @code{#searchpath} directive adds its argument to the list of
......@@ -939,7 +939,7 @@ header :contains ["X-Caffeine"] [""] @result{} true
@var{header-names}(string-list) @
@var{count}(number)
@noindent
@subsubheading Synopsis
@*Synopsis:
@smallexample
require "test-numaddr";
@dots{}
......@@ -948,7 +948,7 @@ if numaddr @var{args}
@dots{}
@}
@end smallexample
@subsubheading Description
@*Description:
This test is provided as an example of loadable extension tests. You
must use @samp{require "test-numaddr"} statement before actually using
it.
......@@ -973,7 +973,7 @@ If the tagged argument is not given, @samp{:over} is assumed.
[:socket @var{unix-socket}(string)] @
[:user @var{name}(string)] @
[:over | :under @var{limit}(string)]
@subsubheading Synopsis
@*Synopsis:
@smallexample
require "test-spamd";
@dots{}
......@@ -984,7 +984,7 @@ if spamd @var{args}
@}
@end smallexample
@subsubheading Description
@*Description:
This test is an interface to SpamAssassin filter. It connects to the
@command{spamd} daemon using connection parameters specified by tagged
arguments @code{:host} and @code{:port} (if the daemon is listening on
......@@ -1021,7 +1021,7 @@ Comma-separated list of keywords, describing the spam checks that
succeeded for this message.
@end table
@subsubheading Example
@*Example:
@smallexample
request "test-spamd";
......@@ -1036,7 +1036,7 @@ if spamd :host 127.0.0.1 :port 3333
@deftypefn Test {} list [@var{comparator}] [@var{match-type}] @
[ :delim @var{delimiters}(string) ] @
@var{headers}(string-list) @var{keys}(string-list)
@subsubheading Synopsis
@*Synopsis:
@smallexample
require "test-list";
if list @var{args}
......@@ -1044,14 +1044,14 @@ if list @var{args}
@dots{}
@}
@end smallexample
@subsubheading Description
@*Description:
The @code{list} test evaluates to true if any of @var{headers} match any
key from @var{keys}. Each header is regarded as containing a list of
keywords. By default, comma is assumed as list separator. This can be
overridden by specifying the @code{:delim} tag, whose value is a
string consisting of valid list delimiter characters.
@subsubheading Example
@*Example:
This test can be used in conjunction with the @code{spamd} test
described above:
......@@ -1075,7 +1075,7 @@ if spamd :host 127.0.0.1 :port 3333
@deftypefn Test {} timestamp [:before | :after] @
@var{header}(string) @var{date}(string)
@subsubheading Synopsis
@*Synopsis:
@smallexample
require "test-timestamp";
......@@ -1084,7 +1084,7 @@ if timestamp @var{arg}
@dots{}
@}
@end smallexample
@subsubheading Description
@*Description:
The @code{timestamp} test compares the value of a structured date header
field (@var{header}) with the given date (@var{date}).
......@@ -1101,7 +1101,7 @@ If no tagged argument is supplied, @code{:after} is assumed.
Almost any date format is understood. @xref{Date Input Formats}, for
a detailed information on date formats.
@subsubheading Example
@*Example:
The test below succeeds if the date in @samp{X-Expire-Timestamp}
header is more than 5 days older than the current date:
......@@ -1366,12 +1366,12 @@ required prior to use (@pxref{Require Statement}).
@deftypefn Action {} moderator [:keep] [:address @var{address}(string)] @
[:source @var{sieve-file}(string)]
@subsubheading Synopsis
@*Synopsis:
@smallexample
require "moderator"
moderator @var{args};
@end smallexample
@subsubheading Description
@*Description:
@cindex mailman
This action is a moderator robot for Mailman-driven mail archives.
A Mailman moderation request is a MIME message consisting of the
......@@ -1408,7 +1408,7 @@ does not have exactly 3 MIME parts, or if parts 2 and 3 are not of
make sure the message is actually a valid Mailman moderation request
(see the example below).
@subsubheading Example
@*Example:
@smallexample
if allof(header :is "Sender" "mailman-bounces@@gnu.org",
header :is "X-List-Administrivia" "yes")
......@@ -1419,7 +1419,7 @@ if allof(header :is "Sender" "mailman-bounces@@gnu.org",
@end deftypefn
@deftypefn Action {} pipe [:envelope] @var{command}(string)
@subsubheading Synopsis
@*Synopsis:
@smallexample
require "pipe";
if pipe @var{args}
......@@ -1427,7 +1427,7 @@ if pipe @var{args}
@dots{}
@}
@end smallexample
@subsubheading Description
@*Description:
The @code{pipe} action sends executes a command specified by its
argument and sends the entire message to its standard input. The
@var{command} argument supplies the command line.
......@@ -1435,7 +1435,7 @@ argument and sends the entire message to its standard input. The
The envelope of the message is included, if the @code{:envelope} tag
is given.
@subsubheading Example
@*Example:
The example below uses the @command{maidag} utility
(@pxref{maidag}) to forward the message to user @samp{gray} on
the machine @samp{mail.gnu.org}.
......@@ -1454,12 +1454,12 @@ pipe "/usr/sbin/maidag --url smtp://gray@@mail.gnu.org"
[:reply_regex @var{expr}(string)] @
[:reply_prefix @var{prefix}(string)] @
@var{reply-text}(string)
@subsubheading Syntax
@*Syntax:
@smallexample
require "vacation";
vacation @var{args};
@end smallexample
@subsubheading Description
@*Description:
The @code{vacation} action returns a message with @var{reply-text} to
the sender. It is intended to inform the sender that the recipient is
not currently reading his mail.
......
......@@ -780,7 +780,7 @@ pop_section (struct scan_tree_data *dat)
return sec;
}
#define STRTONUM(s, type, base, res, limit, d, loc) \
#define STRTONUM(s, type, base, res, limit, loc) \
{ \
type sum = 0; \
\
......@@ -815,7 +815,7 @@ pop_section (struct scan_tree_data *dat)
res = sum; \
}
#define STRxTONUM(s, type, res, limit, d, loc) \
#define STRxTONUM(s, type, res, limit, loc) \
{ \
int base; \
if (*s == '0') \
......@@ -832,14 +832,14 @@ pop_section (struct scan_tree_data *dat)
base = 8; \
} else \
base = 10; \
STRTONUM (s, type, base, res, limit, d, loc); \
STRTONUM (s, type, base, res, limit, loc); \
}
#define GETUNUM(str, type, res, d, loc) \
#define GETUNUM(str, type, res, loc) \
{ \
type tmpres; \
const char *s = str; \
STRxTONUM (s, type, tmpres, 0, d, loc); \
STRxTONUM (s, type, tmpres, 0, loc); \
if (*s) \
{ \
mu_diag_at_locus (MU_LOG_ERROR, loc, \
......@@ -851,7 +851,7 @@ pop_section (struct scan_tree_data *dat)
res = tmpres; \
}
#define GETSNUM(str, type, res, d, loc) \
#define GETSNUM(str, type, res, loc) \
{ \
unsigned type tmpres; \
const char *s = str; \
......@@ -871,7 +871,7 @@ pop_section (struct scan_tree_data *dat)
limit = TYPE_MAXIMUM (type); \
} \
\
STRxTONUM (s, unsigned type, tmpres, limit, d, loc); \
STRxTONUM (s, unsigned type, tmpres, limit, loc); \
if (*s) \
{ \
mu_diag_at_locus (MU_LOG_ERROR, loc, \
......@@ -955,7 +955,7 @@ parse_cidr (struct scan_tree_data *sdata, const struct mu_locus *locus,
p++;
s = p;
STRxTONUM (s, unsigned long, mask, 0, sdata->tree->debug, locus);
STRxTONUM (s, unsigned long, mask, 0, locus);
if (*s == '.')
{
struct in_addr a;
......@@ -991,7 +991,7 @@ parse_cidr (struct scan_tree_data *sdata, const struct mu_locus *locus,
p = str;
for (i = 0; i < 3; i++)
{
STRxTONUM (p, unsigned short, x, 255, sdata->tree->debug, locus);
STRxTONUM (p, unsigned short, x, 255, locus);
if (*p != '.')
break;
addr.s_addr = (addr.s_addr << 8) + x;
......@@ -1071,36 +1071,31 @@ valcvt (struct scan_tree_data *sdata, const struct mu_locus *locus,
}
case mu_cfg_short:
GETSNUM (val->v.string, short, *(short*)tgt, sdata->tree->debug, locus);
GETUNUM (val->v.string, short, *(short*)tgt, locus);
break;
case mu_cfg_ushort:
GETUNUM (val->v.string, unsigned short, *(unsigned short*)tgt,
sdata->tree->debug, locus);
GETUNUM (val->v.string, unsigned short, *(unsigned short*)tgt, locus);
break;
case mu_cfg_int:
GETSNUM (val->v.string, int, *(int*)tgt, sdata->tree->debug, locus);
GETSNUM (val->v.string, int, *(int*)tgt, locus);
break;
case mu_cfg_uint:
GETUNUM (val->v.string, unsigned int, *(unsigned int*)tgt,
sdata->tree->debug, locus);
GETUNUM (val->v.string, unsigned int, *(unsigned int*)tgt, locus);
break;
case mu_cfg_long:
GETSNUM (val->v.string, long, *(long*)tgt,
sdata->tree->debug, locus);
GETSNUM (val->v.string, long, *(long*)tgt, locus);
break;
case mu_cfg_ulong:
GETUNUM (val->v.string, unsigned long, *(unsigned long*)tgt,
sdata->tree->debug, locus);
GETUNUM (val->v.string, unsigned long, *(unsigned long*)tgt, locus);
break;
case mu_cfg_size:
GETUNUM (val->v.string, size_t, *(size_t*)tgt,
sdata->tree->debug, locus);
GETUNUM (val->v.string, size_t, *(size_t*)tgt, locus);
break;
case mu_cfg_off:
......@@ -1110,8 +1105,7 @@ valcvt (struct scan_tree_data *sdata, const struct mu_locus *locus,
return 1;
case mu_cfg_time:
GETUNUM (val->v.string, time_t, *(time_t*)tgt,
sdata->tree->debug, locus);
GETUNUM (val->v.string, time_t, *(time_t*)tgt, locus);
break;
case mu_cfg_bool:
......
......@@ -292,7 +292,11 @@ mu_tcp_stream_create_from_sa (mu_stream_t *pstream,
if (rc == 0 || rc == EAGAIN || rc == EINPROGRESS)
*pstream = stream;
else
mu_stream_destroy (&stream);
{
/* Make sure sockaddrs are not freed on error */
tcp->remote_addr = tcp->source_addr = NULL;
mu_stream_destroy (&stream);
}
return rc;
}
......