diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-03-09 16:20:50 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-03-09 16:20:50 +0000 |
commit | 67f891b804218ca7b42318fadeedfeec9243a0d6 (patch) | |
tree | 8b6b14e31236a91108865b85241b02f069a30b0e | |
parent | 14cc2f2806c7b66992ca4a41d6f8da6020931194 (diff) | |
download | mailfromd-67f891b804218ca7b42318fadeedfeec9243a0d6.tar.gz mailfromd-67f891b804218ca7b42318fadeedfeec9243a0d6.tar.bz2 |
Prefix all exception codes with `e_'.
* src/mfstat.awk: Look for mf_exception_code/mf_exception_count.
* src/lex.l (variable_or_const): Add type cast.
* src/mailfromd.h (enum mf_status_code): Retain only first four proper
status codes.
(enum mf_exception_code): New type.
(mf_status_to_exception): New macro
(mf_exception_str,string_to_exception): New functions
(mf_status_str): Rewrite as macro.
(string_to_stat): Remove.
* src/mf-status.mfi: Prefix codes with e_
* src/status.mfi: Prefix exception codes with e_. Retain
succes, not_found, failure, and temp_failure for backward
compatibility.
Retain old exception names if m4 symbol COMPAT_4_3 is defined.
* src/gram.y, src/snarf.m4, src/bi_poll.m4, src/bi_string.m4,
src/drivers.c, src/bi_dns.m4, src/bi_system.m4, src/bi_spf.m4,
src/prog.c, src/bi_ipaddr.m4, src/bi_sa.m4, src/bi_io.m4,
src/bi_sieve.m4, src/bi_vars.m4, src/bi_other.m4, src/bi_mail.m4,
src/bi_gettext.m4, src/bi_db.m4, : Use new exception names.
* configure.ac (MF_VERSION_PATCH): Set to 90
* doc/mailfromd.texi: Document changes.
git-svn-id: file:///svnroot/mailfromd/branches/release_4_3_patches@1628 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | doc/mailfromd.texi | 128 | ||||
-rw-r--r-- | src/bi_db.m4 | 22 | ||||
-rw-r--r-- | src/bi_dns.m4 | 22 | ||||
-rw-r--r-- | src/bi_gettext.m4 | 4 | ||||
-rw-r--r-- | src/bi_io.m4 | 16 | ||||
-rw-r--r-- | src/bi_ipaddr.m4 | 6 | ||||
-rw-r--r-- | src/bi_mail.m4 | 14 | ||||
-rw-r--r-- | src/bi_other.m4 | 14 | ||||
-rw-r--r-- | src/bi_poll.m4 | 18 | ||||
-rw-r--r-- | src/bi_sa.m4 | 52 | ||||
-rw-r--r-- | src/bi_sieve.m4 | 13 | ||||
-rw-r--r-- | src/bi_spf.m4 | 2 | ||||
-rw-r--r-- | src/bi_string.m4 | 8 | ||||
-rw-r--r-- | src/bi_system.m4 | 2 | ||||
-rw-r--r-- | src/bi_vars.m4 | 2 | ||||
-rw-r--r-- | src/drivers.c | 6 | ||||
-rw-r--r-- | src/gram.y | 12 | ||||
-rw-r--r-- | src/lex.l | 2 | ||||
-rw-r--r-- | src/mailfromd.h | 54 | ||||
-rw-r--r-- | src/mf-status.mfi | 12 | ||||
-rw-r--r-- | src/mfstat.awk | 8 | ||||
-rw-r--r-- | src/prog.c | 28 | ||||
-rw-r--r-- | src/snarf.m4 | 2 | ||||
-rw-r--r-- | src/status.mfi | 8 |
26 files changed, 267 insertions, 214 deletions
@@ -1,5 +1,29 @@ 2008-03-09 Sergey Poznyakoff <gray@gnu.org.ua> + Prefix all exception codes with `e_'. + + * src/mfstat.awk: Look for mf_exception_code/mf_exception_count. + * src/lex.l (variable_or_const): Add type cast. + * src/mailfromd.h (enum mf_status_code): Retain only first four proper + status codes. + (enum mf_exception_code): New type. + (mf_status_to_exception): New macro + (mf_exception_str,string_to_exception): New functions + (mf_status_str): Rewrite as macro. + (string_to_stat): Remove. + * src/mf-status.mfi: Prefix codes with e_ + * src/status.mfi: Prefix exception codes with e_. Retain + succes, not_found, failure, and temp_failure for backward + compatibility. + Retain old exception names if m4 symbol COMPAT_4_3 is defined. + * src/gram.y, src/snarf.m4, src/bi_poll.m4, src/bi_string.m4, + src/drivers.c, src/bi_dns.m4, src/bi_system.m4, src/bi_spf.m4, + src/prog.c, src/bi_ipaddr.m4, src/bi_sa.m4, src/bi_io.m4, + src/bi_sieve.m4, src/bi_vars.m4, src/bi_other.m4, src/bi_mail.m4, + src/bi_gettext.m4, src/bi_db.m4, : Use new exception names. + * configure.ac (MF_VERSION_PATCH): Set to 90 + * doc/mailfromd.texi: Document changes. + Name clashes between constants and variables went unnoticed by the compiler. Bug reported by Thomas Lynch. Fix this and rename exception codes to minimize chances of such diff --git a/configure.ac b/configure.ac index 6b55d68d..c76eae46 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) m4_define([MF_VERSION_MAJOR], 4) m4_define([MF_VERSION_MINOR], 3) -m4_define([MF_VERSION_PATCH], 1) +m4_define([MF_VERSION_PATCH], 90) AC_INIT([mailfromd], MF_VERSION_MAJOR.MF_VERSION_MINOR[]m4_ifdef([MF_VERSION_PATCH],.MF_VERSION_PATCH), [bug-mailfromd@gnu.org.ua]) diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index e4b456d1..27ff4c46 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -133,6 +133,7 @@ Sender Address Verification. Building the Package +* 43x-440:: Upgrading from 4.3.x to 4.4 * 420-43x:: Upgrading from 4.2 to 4.3.x * 410-420:: Upgrading from 4.1 to 4.2 * 400-410:: Upgrading from 4.0 to 4.1 @@ -987,6 +988,7 @@ the corresponding section below. @end enumerate @menu +* 43x-440:: Upgrading from 4.3.x to 4.4 * 420-43x:: Upgrading from 4.2 to 4.3.x * 410-420:: Upgrading from 4.1 to 4.2 * 400-410:: Upgrading from 4.0 to 4.1 @@ -996,6 +998,11 @@ the corresponding section below. * 1x-2x:: Upgrading from 1.x to 2.x @end menu +@node 43x-440 +@section Upgrading from 4.3.x to 4.4 +@cindex Upgrading from 4.3.x to 4.4 +@UNREVISED{} + @node 420-43x @section Upgrading from 4.2 to 4.3.x @cindex Upgrading from 4.2 to 4.3.x @@ -3167,7 +3174,7 @@ done @end smallexample Another common case are undefined Sendmail macros. In this case the -@code{macroundef} exception is generated: +@code{e_macroundef} exception is generated: @smallexample RUNTIME ERROR near foo.c:34: Macro not defined: @{client_adr@} @@ -5386,7 +5393,7 @@ starting at @var{start}. If @var{length} is omitted, the rest of @var{str} is used. If @var{length} is greater than the actual length of the string, the -@code{range} exception is signalled. +@code{e_range} exception is signalled. @smallexample substr("mailfrom", 4) @result{} "from" @@ -5520,7 +5527,7 @@ supplied arguments match their corresponding conversion specifiers. By default, the arguments are used in the order given, where each @samp{*} and each conversion specifier asks for the next argument. If insufficiently many arguments are given, @code{sprintf} raises -@samp{range} exception. One can also specify explicitly which +@samp{e_range} exception. One can also specify explicitly which argument is taken, at each place where an argument is required, by writing @samp{%@var{m}$}, instead of @samp{%} and @samp{*@var{m}$} instead of @samp{*}, where the decimal integer @var{m} denotes the @@ -5657,7 +5664,7 @@ arguments: @end table If the function is unable to encode the string, it raises the -exception @code{failure}. +exception @code{e_failure}. For example: @@ -5674,7 +5681,7 @@ message_header_encode(%string, "ISO-8859-1") (string @var{text}, [string @var{charset}]) @var{text} must be a header value encoded in accordance with @acronym{RFC} 2047. The function returns the decoded string. If the decoding fails, -it raises @code{failure} exception. The optional argument +it raises @code{e_failure} exception. The optional argument @var{charset} specifies the character set to use (default -- @samp{UTF-8}). @@ -5734,7 +5741,7 @@ using @var{domain} as @code{EHLO} domain and @var{mailfrom} as In contrast to @code{strictpoll} function, this function does not use cache database and does not fall back to polling @acronym{MX} servers if the main poll tempfails. The function can throw one of the following -exceptions: @code{failure}, @code{temp_failure}. +exceptions: @code{e_failure}, @code{e_temp_failure}. @end deftypefn @deftypefn {Built-in Function} number _pollmx @ @@ -5746,7 +5753,7 @@ FROM} address. Returns 0 or 1 depending on the result of the test. In contrast to @code{stdpoll} function, @code{_pollmx} does not use cache database and does not fall back to polling the @var{ip} if the poll fails. The function can throw one of the following -exceptions: @code{failure}, @code{temp_failure}. +exceptions: @code{e_failure}, @code{e_temp_failure}. @end deftypefn @deftypefn {Built-in Function} number stdpoll @ @@ -5755,7 +5762,7 @@ exceptions: @code{failure}, @code{temp_failure}. Performs standard poll for @var{email}, using @var{domain} as @code{EHLO} domain and @var{mailfrom} as @code{MAIL FROM} address. Returns 0 or 1 depending on the result of the test. Can raise one of -the following exceptions: @code{failure}, @code{temp_failure}. +the following exceptions: @code{e_failure}, @code{e_temp_failure}. In @code{on} statement context, it is synonymous to @code{poll} without explicit @var{host}. @FIXME{more details and references} @@ -5873,7 +5880,7 @@ inet_ntoa(len_to_netmask(24)) @result{} 255.255.255.0 inet_ntoa(len_to_netmask(7)) @result{} 254.0.0.0 @end smallexample -If @var{n} is greater than 32 the function raises @code{range} +If @var{n} is greater than 32 the function raises @code{e_range} exception. @end deftypefn @@ -6031,7 +6038,7 @@ returns the fully qualified domain name of the host represented by Sendmail variable @samp{client_addr}. If there is no @samp{PTR} record for @var{ip}, @code{primitive_hostname} -raises the exception @code{not_found}. +raises the exception @code{e_not_found}. If @acronym{DNS} query fails, the function raises @code{failure} or @code{temp_failure}, depending on the character of the failure. @@ -6066,7 +6073,7 @@ is a host name or @acronym{IP} address. records for the @var{domain}. If @var{domain} has no @samp{MX} records, @code{primitive_ismx} raises -exception @code{not_found}. +exception @code{e_not_found}. If @acronym{DNS} query fails, the function raises @code{failure} or @code{temp_failure}, depending on the character of the failure. @@ -6090,7 +6097,7 @@ function returns @code{false}. Reverse of @code{primitive_hostname}. The @code{primitive_resolve} function returns the @acronym{IP} address for the host name specified by @var{host} argument. If @var{host} has no A records, the function raises the -exception @code{not_found}. +exception @code{e_not_found}. If @acronym{DNS} lookup fails, the function raises @code{failure} or @code{temp_failure}, depending on the character of the failure. @@ -6312,14 +6319,14 @@ rest of database functions (see above). (@pxref{Database Formats}). If it is valid, the function returns the expiration interval for that format. @FIXME{How to obtain negative expiration??} Otherwise, @code{db_expire_interval} raises the -@code{not_found} exception. +@code{e_not_found} exception. @end deftypefn @deftypefn {Built-in Function} string db_name (string @var{fmtid}) The @var{fmt} argument is a database format identifier (@pxref{Database Formats}). The function returns the file name for that format. If @var{fmtid} does not match any known format, -@code{db_name} raises the @code{not_found} exception. +@code{db_name} raises the @code{e_not_found} exception. @end deftypefn @cindex getting cache status @@ -6327,7 +6334,7 @@ for that format. If @var{fmtid} does not match any known format, @deftypefn {Built-in Function} number db_get_active (string @var{fmtid}) Returns the flag indicating whether the cache database @var{fmtid} is currently enabled. If @var{fmtid} does not match any known format, -@code{db_name} raises the @code{not_found} exception. +@code{db_name} raises the @code{e_not_found} exception. @end deftypefn @cindex disabling cache @@ -6401,7 +6408,7 @@ the program's standard output. of an existing file and @code{open} will attempt to open this file for reading. - The @code{open} function will signal exception @code{failure} if it + The @code{open} function will signal exception @code{e_failure} if it is unable to open the resource or get the required access to it. @end deftypefn @@ -6410,7 +6417,7 @@ is unable to open the resource or get the required access to it. previous call to @code{open}. The function @code{close} closes the resource and deallocates any memory associated with it. - @code{close} will signal @code{range} exception if @var{rd} lies + @code{close} will signal @code{e_range} exception if @var{rd} lies outside of allowed range of resource descriptors. @FIXME{More info on it} @end deftypefn @@ -6425,8 +6432,8 @@ termination of the filtering program. Writes the string @var{str} to the resource descriptor @var{rd}. If the @var{size} argument is given, writes this number of bytes. - The function will signal @code{range} exception if @var{rd} lies -outside of allowed range of resource descriptors, and @code{ioerr} + The function will signal @code{e_range} exception if @var{rd} lies +outside of allowed range of resource descriptors, and @code{e_io} exception if an @acronym{I/O} error occurs. @end deftypefn @@ -6436,7 +6443,7 @@ descriptor @var{rd}. The terminating newline character will be removed from the return value. The function will signal @code{range} exception if @var{rd} lies -outside of allowed range of resource descriptors, and @code{ioerr} +outside of allowed range of resource descriptors, and @code{e_io} exception if an @acronym{I/O} error occurs. @end deftypefn @@ -6691,8 +6698,8 @@ message. @end table The @code{sa} function can signal the following exceptions: -@code{failure} if the connection fails, @code{url} if the supplied -@acronym{URL} is invalid and @code{range} if the supplied port number +@code{e_failure} if the connection fails, @code{e_url} if the supplied +@acronym{URL} is invalid and @code{e_range} if the supplied port number is out of the range 1--65535. The simplest way to use the function is: @@ -6749,8 +6756,8 @@ done @code{clamav_virus_name} global variable. The @code{clamav} function can signal the following exceptions: -@code{failure} if connection failed, @code{url} if the supplied -@acronym{URL} is invalid and @code{range} if the supplied port number +@code{e_failure} if connection failed, @code{e_url} if the supplied +@acronym{URL} is invalid and @code{e_range} if the supplied port number is out of the range 1--65535. An example usage: @@ -6781,7 +6788,7 @@ of greylisting period in the internal variable @code{greylist_seconds_left}. @xref{Greylisting}, for a detailed explanation. - The function @code{greylist} can signal @code{dbfailure} exception. + The function @code{greylist} can signal @code{e_dbfailure} exception. @end deftypefn @deftypefn {Built-in Function} boolean listens (string @var{host}, [number @var{port}]) @@ -8298,7 +8305,7 @@ returns true only if any of the @samp{MX}s for (domain or email) @var{x} match the globbing pattern @var{y}. Both @code{mx matches} and @code{mx fnmatches} can signal the -following exceptions: @code{temp_failure}, @code{failure}. +following exceptions: @code{e_temp_failure}, @code{e_failure}. The value of any parenthesized subexpression occurring within the right-hand side argument to @code{matches} or @code{mx matches} can be @@ -9047,69 +9054,71 @@ following table summarizes all the exception types implemented by @command{mailfromd} version @value{VERSION}: @table @code -@cindex dbfailure, exception type -@item dbfailure +@cindex e_dbfailure, exception type +@item e_dbfailure General database failure. For example, the database cannot be opened. This exception can be signaled by any function that queries any @acronym{DBM} database. -@cindex divzero, exception type -@item divzero +@cindex e_divzero, exception type +@item e_divzero Division by zero. +@cindex e_failure, exception type @cindex failure, exception type -@item failure +@item e_failure +@itemx failure A general failure has occurred. In particular, this exception is signaled by @acronym{DNS} lookup functions when any permanent failure occurs. This exception can be signaled by any @acronym{DNS}-related function (@code{hasmx}, @code{poll}, etc.) or operation (@code{mx matches}). -@cindex invcidr, exception type -@item invcidr +@cindex e_invcidr, exception type +@item e_invcidr Invalid @acronym{CIDR} notation. This is signaled by @code{match_cidr} function when its second argument is not a valid @acronym{CIDR}. -@cindex invip, exception type -@item invip +@cindex e_invip, exception type +@item e_invip Invalid @acronym{IP} address. This is signaled by @code{match_cidr} function when its first argument is not a valid @acronym{IP} address. -@cindex invtime, exception type -@item invtime +@cindex e_invtime, exception type +@item e_invtime Invalid time interval specification. It is signaled by @code{interval} function if its argument is not a valid time interval (@pxref{time interval specification}). -@cindex ioerr, exception type -@item ioerr +@cindex e_io, exception type +@item e_io An error occurred during the input-output operation. @xref{I/O functions}, for a description of functions that can signal this exception. -@cindex macroundef, exception type -@item macroundef +@cindex e_macroundef, exception type +@item e_macroundef A Sendmail macro is undefined. -@cindex noresolve, exception type -@item noresolve +@cindex e_noresolve, exception type +@item e_noresolve The argument of a @acronym{DNS}-related function cannot be resolved to host name or @acronym{IP} address. Currently only @code{ismx} (@pxref{ismx}) raises this exception. -@cindex range, exception type -@item range +@cindex e_range, exception type +@item e_range The supplied argument is outside the allowed range. This is signalled, for example, by @code{substring} function (@pxref{substring}). -@cindex regcomp, exception type -@item regcomp +@cindex e_regcomp, exception type +@item e_regcomp Regular expression cannot be compiled. This can happen when a regular expression (a right-hand argument of a @code{matches} operator) is built at the runtime and the produced string is an invalid regex. -@cindex ston_conv, exception type -@item ston_conv +@cindex e_ston_conv, exception type +@item e_ston_conv String-to-number conversion failed. This can be signaled when a string is used in numeric context which cannot be converted to the numeric data type. For example: @@ -9126,13 +9135,15 @@ data type. For example: The @code{if} condition will signal @code{ston_conv}, since @samp{10a} cannot be converted to a number. +@cindex e_temp_failure, exception type @cindex temp_failure, exception type -@item temp_failure +@item e_temp_failure +@itemx temp_failure A temporary failure has occurred. This can be signaled by @acronym{DNS}-related functions or operations. -@cindex url, exception type -@item url +@cindex e_url, exception type +@item e_url The supplied @acronym{URL} is invalid. @xref{Interfaces to Third-Party Programs}. @@ -9140,14 +9151,17 @@ Third-Party Programs}. @end table @cindex success, exception type +@cindex e_success, exception type @cindex not_found, exception type +@cindex e_not_found, exception type In addition to these, two symbols are defined that are not exception types in the strict sense of the world, but are provided to make writing filter scripts more convenient. These are @code{success}, meaning successful return from a function, and @code{not_found}, meaning that the required entity (e.g. domain name or email address) was not found. @xref{figure-poll-wrapper}, for an illustration on -how these can be used. +how these can be used. For consistency with other exception codes, +these can be spelled as @code{e_success} and @code{e_not_found}. @cindex exceptions, default handling @cindex default exception handling @@ -9179,8 +9193,8 @@ where @var{exception-list} is the list of exception types, separated by the word @code{or}. A special form @samp{*}, which stands for all exceptions, is allowed as well. The @var{handler-body} is the list of statements comprising the handler body. For example, the code below -installs a handler for exceptions 2 (@samp{failure}) and 3 -(@samp{temp_failure}): +installs a handler for exceptions 2 (@samp{e_failure}) and 3 +(@samp{e_temp_failure}): @smallexample @group @@ -9204,7 +9218,7 @@ above code snippet will look like: @group #include <status.mfh> -catch failure or temp_failure +catch e_failure or e_temp_failure do @dots{} done @@ -9255,7 +9269,7 @@ In the latter case, a log message is also issued: prog envfrom do - catch failure or temp_failure + catch e_failure or e_temp_failure do echo "Caught exception $1: $2" continue diff --git a/src/bi_db.m4 b/src/bi_db.m4 index f366008f..024337e7 100644 --- a/src/bi_db.m4 +++ b/src/bi_db.m4 @@ -29,7 +29,7 @@ dbmap_lookup(eval_environ_t env, char *dbname, const char *keystr, if (!defval) defval = ""; if (mu_dbm_open(dbname, &db, MU_STREAM_READ, 0, NULL)) - MF_THROW(mf_dbfailure, + MF_THROW(mfe_dbfailure, _("mu_dbm_open(%s) failed: %s"), dbname, mu_dbm_strerror()); @@ -91,7 +91,7 @@ MF_DEFUN(dbput, VOID, STRING dbname, STRING keystr, STRING value, DBM_DATUM contents; if (mu_dbm_open(dbname, &db, MU_STREAM_RDWR, 0640, NULL)) - MF_THROW(mf_dbfailure, + MF_THROW(mfe_dbfailure, _("mu_dbm_open(%s) failed: %s"), dbname, mu_dbm_strerror()); @@ -108,7 +108,7 @@ MF_DEFUN(dbput, VOID, STRING dbname, STRING keystr, STRING value, rc = mu_dbm_insert(&db, key, contents, 1); mu_dbm_close(&db); MF_ASSERT(rc == 0, - mf_dbfailure, + mfe_dbfailure, _("Failed to insert data to %s: %s %s: %s"), dbname, keystr, @@ -123,7 +123,7 @@ MF_DEFUN(dbdel, VOID, STRING dbname, STRING keystr, OPTIONAL, NUMBER null) DBM_DATUM key; int rc; if (mu_dbm_open(dbname, &db, MU_STREAM_RDWR, 0640, NULL)) - MF_THROW(mf_dbfailure, + MF_THROW(mfe_dbfailure, _("mu_dbm_open(%s) failed: %s"), dbname, mu_dbm_strerror()); @@ -135,7 +135,7 @@ MF_DEFUN(dbdel, VOID, STRING dbname, STRING keystr, OPTIONAL, NUMBER null) rc = mu_dbm_delete(&db, key); mu_dbm_close(&db); MF_ASSERT(rc == 0, - mf_dbfailure, + mfe_dbfailure, _("Failed to delete data `%s' from `%s': %s"), keystr, dbname, @@ -192,7 +192,7 @@ MF_DEFUN(greylist, NUMBER, STRING email, NUMBER interval) rc = mu_dbm_open(greylist_format->dbname, &db, MU_STREAM_RDWR, 0600, &readonly); - MF_ASSERT(rc == 0, mf_dbfailure, _("mu_dbm_open(%s) failed: %s"), + MF_ASSERT(rc == 0, mfe_dbfailure, _("mu_dbm_open(%s) failed: %s"), greylist_format->dbname, mu_dbm_strerror()); memset(&key, 0, sizeof key); @@ -205,7 +205,7 @@ MF_DEFUN(greylist, NUMBER, STRING email, NUMBER interval) time_t timestamp, diff; MF_ASSERT(MU_DATUM_SIZE(contents) == sizeof timestamp, - mf_dbfailure, + mfe_dbfailure, _("Greylist database %s has wrong data size"), greylist_format->dbname); @@ -279,7 +279,7 @@ MF_DEFUN(db_name, STRING, STRING fmtid) { struct db_format *fmt = db_format_lookup(fmtid); MF_ASSERT(fmt != NULL, - mf_not_found, + mfe_not_found, _("No such db format: %s"), fmtid); MF_RETURN_STRING(fmt->dbname); } @@ -289,7 +289,7 @@ MF_DEFUN(db_get_active, NUMBER, STRING fmtid) { struct db_format *fmt = db_format_lookup(fmtid); MF_ASSERT(fmt != NULL, - mf_not_found, + mfe_not_found, _("No such db format: %s"), fmtid); MF_RETURN(fmt->enabled); } @@ -299,7 +299,7 @@ MF_DEFUN(db_set_active, VOID, STRING fmtid, NUMBER active) { struct db_format *fmt = db_format_lookup(fmtid); MF_ASSERT(fmt != NULL, - mf_not_found, + mfe_not_found, _("No such db format: %s"), fmtid); fmt->enabled = active; } @@ -309,7 +309,7 @@ MF_DEFUN(db_expire_interval, NUMBER, STRING fmtid) { struct db_format *fmt = db_format_lookup(fmtid); MF_ASSERT(fmt != NULL, - mf_not_found, + mfe_not_found, _("No such db format: %s"), fmtid); MF_RETURN(fmt->expire_interval); } diff --git a/src/bi_dns.m4 b/src/bi_dns.m4 index 7e92c964..ad09ee1b 100644 --- a/src/bi_dns.m4 +++ b/src/bi_dns.m4 @@ -1,5 +1,5 @@ /* This file is part of mailfromd. -*- c -*- - Copyright (C) 2006, 2007 Sergey Poznyakoff + Copyright (C) 2006, 2007, 2008 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ MF_DEFUN(primitive_hostname, STRING, STRING string) stat = resolve_ipstr(string, &hbuf); MF_ASSERT(stat == mf_success, - stat, + mf_status_to_exception(stat), _("Cannot resolve IP %s"), string); @@ -43,12 +43,12 @@ MF_DEFUN(primitive_resolve, STRING, STRING string, OPTIONAL, STRING domain) if (MF_OPTVAL(domain,"")[0]) { stat = resolve_ipstr_domain(string, domain, &ipstr); MF_ASSERT(stat == mf_success, - stat, + mf_status_to_exception(stat), _("Cannot resolve %s.%s"), string, domain); } else { stat = resolve_hostname(string, &ipstr); MF_ASSERT(stat == mf_success, - stat, + mf_status_to_exception(stat), _("Cannot resolve %s"), string); } pushs(env, ipstr); @@ -117,7 +117,7 @@ MF_DEFUN(dns_getname, STRING, STRING ipstr) char *names[64]; MF_ASSERT(inet_aton(ipstr, &addr), - mf_invip, + mfe_invip, _("Invalid IP: %s"), ipstr); dnstat = ptr_lookup(addr, names, NELEMS(names), &ttl, NULL, 0); @@ -160,7 +160,7 @@ MF_DEFUN(primitive_hasmx, NUMBER, STRING string) mxstat = getmx(string, mxbuf); MF_ASSERT(mxstat == mf_success || mxstat == mf_not_found, - mxstat, + mf_status_to_exception(mxstat), _("Cannot get MX records for %s"), string); @@ -182,7 +182,7 @@ MF_DEFUN(getmx, STRING, STRING domain, OPTIONAL, NUMBER resolve) else mxstat = getmx(domain, mxbuf); MF_ASSERT(mxstat == mf_success || mxstat == mf_not_found, - mxstat, + mf_status_to_exception(mxstat), _("Cannot get MX records for %s"), domain); if (mxstat == mf_not_found) MF_RETURN_STRING(""); @@ -220,9 +220,9 @@ resolve_host(const char *string, unsigned long *ip) rc = inet_aton(ipstr, &addr); free(ipstr); if (rc == 0) { - mu_error(_("INTERNAL ERROR at %s:%lu: resolve_hostname returned " + mu_error(_("INTERNAL ERROR at %s:%d: resolve_hostname returned " "invalid IP address: %s"), - __FILE__, __FILE__, ipstr); + __FILE__, __LINE__, ipstr); return 1; } *ip = addr.s_addr; @@ -237,13 +237,13 @@ MF_DEFUN(primitive_ismx, NUMBER, STRING domain, STRING ipstr) int rc = 0; int i; - MF_ASSERT(resolve_host(ipstr, &ip) == 0, mf_noresolve, + MF_ASSERT(resolve_host(ipstr, &ip) == 0, mfe_noresolve, _("Cannot resolve host name %s"), ipstr); mxstat = getmx(domain, mxbuf); MF_ASSERT(mxstat == mf_success, - mxstat, + mf_status_to_exception(mxstat), _("Cannot get MXs for %s"), domain); for (i = 0; i < MAXMXCOUNT && mxbuf[i]; i++) { diff --git a/src/bi_gettext.m4 b/src/bi_gettext.m4 index aeb008cb..f97b2387 100644 --- a/src/bi_gettext.m4 +++ b/src/bi_gettext.m4 @@ -1,5 +1,5 @@ /* This file is part of mailfromd. -*- c -*- - Copyright (C) 2007 Sergey Poznyakoff + Copyright (C) 2007, 2008 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ MF_DEFUN(bindtextdomain, STRING, STRING domain, STRING dirname) { char *s = bindtextdomain(domain[0] ? domain : NULL, dirname); MF_ASSERT(s != NULL, - mf_failure, + mfe_failure, "bindtextdomain failed: %s", mu_strerror(errno)); MF_RETURN_STRING(s); } diff --git a/src/bi_io.m4 b/src/bi_io.m4 index 17303a92..40810a08 100644 --- a/src/bi_io.m4 +++ b/src/bi_io.m4 @@ -1,5 +1,5 @@ /* This file is part of mailfromd. -*- c -*- - Copyright (C) 2006, 2007 Sergey Poznyakoff + Copyright (C) 2006, 2007, 2008 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -226,7 +226,7 @@ MF_DEFUN(open, NUMBER, STRING name) break; } MF_ASSERT(i < NSTREAMS, - mf_failure, + mfe_failure, _("No more files available")); debug1(10, "opening stream %s", name); @@ -256,7 +256,7 @@ MF_DEFUN(open, NUMBER, STRING name) rc = opf(&iotab[i], name, flags); MF_ASSERT(rc == 0, - mf_failure, + mfe_failure, _("Cannot open stream %s: %s"), name, mu_strerror(rc)); debug2(10, "open(%s) = %d", name, i); @@ -269,7 +269,7 @@ MF_DEFUN(close, VOID, NUMBER fd) struct io_stream *iotab = MF_GET_DATA; MF_ASSERT(fd >= 0 && fd < NSTREAMS, - mf_range, + mfe_range, _("Invalid file descriptor")); close_stream(&iotab[fd]); } @@ -282,11 +282,11 @@ MF_DEFUN(write, VOID, NUMBER fd, STRING str, OPTIONAL, NUMBER n) debug2(10, "writing %s to %d", str, fd); MF_ASSERT(fd >= 0 && fd < NSTREAMS && OFD(iotab[fd]), - mf_range, + mfe_range, _("Invalid file descriptor")); rc = write(OFD(iotab[fd]), str, MF_OPTVAL(n, strlen (str))); MF_ASSERT(n == rc, - mf_ioerr, + mfe_io, _("Write error on %s: %s"), iotab[fd].name, mu_strerror(errno)); } @@ -298,11 +298,11 @@ MF_DEFUN(getline, STRING, NUMBER fd) int rc; MF_ASSERT(fd >= 0 && fd < NSTREAMS && IFD(iotab[fd]), - mf_range, + mfe_range, _("Invalid file descriptor")); rc = read_stream_line(&iotab[fd]); MF_ASSERT(rc == 0, - mf_ioerr, + mfe_io, _("Read error on %s: %s"), iotab[fd].name, mu_strerror(errno)); MF_RETURN_STRING(iotab[fd].buf); diff --git a/src/bi_ipaddr.m4 b/src/bi_ipaddr.m4 index 44b5b104..8a34a254 100644 --- a/src/bi_ipaddr.m4 +++ b/src/bi_ipaddr.m4 @@ -1,5 +1,5 @@ /* This file is part of mailfromd. -*- c -*- - Copyright (C) 2007 Sergey Poznyakoff + Copyright (C) 2007, 2008 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ MF_DEFUN(inet_aton, NUMBER, STRING s) struct in_addr addr; MF_ASSERT(inet_aton(s, &addr), - mf_invip, + mfe_invip, _("Invalid IP address (%s)"), s); MF_RETURN(ntohl(addr.s_addr)); @@ -72,7 +72,7 @@ MF_DEFUN(len_to_netmask, NUMBER, NUMBER x) unsigned long n = (unsigned long) x; unsigned long netmask; - MF_ASSERT(n <= 32, mf_range, + MF_ASSERT(n <= 32, mfe_range, _("Invalid netmask: %lu"), n); n = 32 - n; if (n == 32) diff --git a/src/bi_mail.m4 b/src/bi_mail.m4 index 8b106d8e..01fc37b5 100644 --- a/src/bi_mail.m4 +++ b/src/bi_mail.m4 @@ -1,5 +1,5 @@ /* This file is part of mailfromd. -*- c -*- - Copyright (C) 2006, 2007 Sergey Poznyakoff + Copyright (C) 2006, 2007, 2008 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ _send(eval_environ_t env, status = mu_mailer_create(&mailer, mailer_url); if (status) { destroy(ptr); - MF_THROW(mf_failure, |