diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-04-11 13:04:34 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-04-11 13:04:34 +0000 |
commit | 15ddbce71e6c1f4f9fc3d76adaca0f962d08c576 (patch) | |
tree | e94169737be6af76b457dd90b9c238c94fb38490 | |
parent | 1b19aae56027ac73cc165acdc51e24693c455dc0 (diff) | |
download | mailfromd-15ddbce71e6c1f4f9fc3d76adaca0f962d08c576.tar.gz mailfromd-15ddbce71e6c1f4f9fc3d76adaca0f962d08c576.tar.bz2 |
Provide a special exception type for unresolved sendmail macros.
git-svn-id: file:///svnroot/mailfromd/trunk@1348 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | doc/mailfromd.texi | 109 | ||||
-rw-r--r-- | src/engine.c | 12 | ||||
-rw-r--r-- | src/mailfromd.h | 1 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/prog.c | 17 |
7 files changed, 68 insertions, 81 deletions
@@ -1,3 +1,9 @@ +2007-04-11 Sergey Poznyakoff <gray@gnu.org.ua> + + * src/engine.c, src/mailfromd.h, src/prog.c, src/main.c, + TODO, doc/mailfromd.texi: Provide a special exception type for + unresolved sendmail macros. + 2007-04-04 Sergey Poznyakoff <gray@gnu.org.ua> * doc/mailfromd.texi, NEWS: Document SPF functions @@ -2,8 +2,6 @@ Mailfromd TODO list. * Language: -** Provide a special exception type for unresolved sendmail macros. - ** Implement \U, \L, \E and other GNU extensions to the replacement strings. * Various items by Jan (ref <Pine.LNX.4.58.0610112345080.2162@cedric.unob.cz>) diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index f5512206..a4c264f5 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -7026,6 +7026,16 @@ following table summarizes all the exception types implemented by @command{mailfromd} version @value{VERSION}: @table @code +@cindex dbfailure, exception type +@item dbfailure + General database failure. For example, the database cannot be +opened. This exception can be signaled by any function that queries +any DBM database. + +@cindex divzero, exception type +@item divzero + Division by zero. + @cindex failure, exception type @item failure A general failure has occurred. In particular, this exception is @@ -7033,50 +7043,16 @@ signaled by DNS lookup functions when any permanent failure occurs. This exception can be signaled by any DNS-related function (@code{hasmx}, @code{poll}, etc.) or operation (@code{mx matches}). -@cindex temp_failure, exception type -@item temp_failure - A temporary failure has occurred. This can be signaled by -DNS-related functions or operations. - -@cindex ston_conv, exception type -@item 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: - -@smallexample -@group - set x "10a" - if %x / 2 - @dots{} -@end group -@end smallexample - -@noindent -The @code{if} condition will signal @code{ston_conv}, since @samp{10a} -cannot be converted to a number. - -@cindex divzero, exception type -@item divzero - Division by zero. - -@cindex regcomp, exception type -@item 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 invcidr, exception type +@item invcidr + Invalid CIDR notation. This is signaled by @code{match_cidr} function +when its second argument is not a valid CIDR. @cindex invip, exception type @item invip Invalid IP address. This is signaled by @code{match_cidr} function when its first argument is not a valid IP address. -@cindex invcidr, exception type -@item invcidr - Invalid CIDR notation. This is signaled by @code{match_cidr} function -when its second argument is not a valid CIDR. - @cindex invtime, exception type @item invtime Invalid time interval specification. It is signaled by @@ -7089,27 +7065,56 @@ when its second argument is not a valid CIDR. functions}, for the description of functions that can signal this exception. -@cindex dbfailure, exception type -@item dbfailure - General database failure. For example, the database cannot be -opened. This exception can be signaled by any function that queries -any DBM database. +@cindex macroundef, exception type +@item macroundef + A Sendmail macro is undefined. -@cindex url, exception type -@item url - The supplied @acronym{URL} is invalid. @xref{Interfaces to -Third-Party Programs}. +@cindex noresolve, exception type +@item noresolve + The argument of a DNS-related function cannot be resolved to host +name or IP address. Currently only @code{ismx} (@pxref{ismx}) raises +this exception. @cindex range, exception type @item range The supplied argument is outside the allowed range. This is signalled, for example, by @code{substring} function (@pxref{substring}). -@cindex noresolve, exception type -@item noresolve - The argument of a DNS-related function cannot be resolved to host -name or IP address. Currently only @code{ismx} (@pxref{ismx}) raises -this exception. +@cindex regcomp, exception type +@item 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 + 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: + +@smallexample +@group + set x "10a" + if %x / 2 + @dots{} +@end group +@end smallexample + +@noindent +The @code{if} condition will signal @code{ston_conv}, since @samp{10a} +cannot be converted to a number. + +@cindex temp_failure, exception type +@item temp_failure + A temporary failure has occurred. This can be signaled by +DNS-related functions or operations. + +@cindex url, exception type +@item url + The supplied @acronym{URL} is invalid. @xref{Interfaces to +Third-Party Programs}. + @end table diff --git a/src/engine.c b/src/engine.c index d93f695c..a506789b 100644 --- a/src/engine.c +++ b/src/engine.c @@ -883,18 +883,8 @@ xeval(eval_environ_t env, enum smtp_state tag) int rc; rc = eval_environment(env, entry_point[tag]); - if (rc) { - struct locus locus; - const char *symbol = environment_get_null_symbol(env, - &locus); - + if (rc) mu_error("Execution of the configuration program was not finished"); - if (symbol) - mu_error("%s:%lu: Symbol `%s' is not defined", - locus.file, - (unsigned long) locus.line, - symbol); - } return rc; } diff --git a/src/mailfromd.h b/src/mailfromd.h index 28264f9d..62023f7a 100644 --- a/src/mailfromd.h +++ b/src/mailfromd.h @@ -66,6 +66,7 @@ typedef enum mf_status_code { mf_url, mf_noresolve, mf_ioerr, + mf_macroundef, mf_status_count } mf_status; @@ -1044,9 +1044,9 @@ static struct argp_option options[] = { N_("Show used Sendmail macros"), GRP+1 }, { "xref", OPTION_DUMP_XREF, NULL, 0, N_("Produce a cross-reference listing"), GRP+1 }, + { "dump-xref", 0, NULL, OPTION_ALIAS, NULL, GRP+1 }, { "gacopyz-debug", OPTION_DEBUG_GACOPYZ, NULL, 0, N_("Milter protocol trace"), GRP+1 }, - { "dump-xref", 0, NULL, OPTION_ALIAS, NULL, GRP+1 }, { "stderr", 's', NULL, 0, N_("Log to stderr"), GRP+1 }, { "syslog", OPTION_SYSLOG, NULL, 0, @@ -272,7 +272,6 @@ struct eval_environ { void **bi_priv_array; /* Exit information */ - char *null_symbol; /* Non resolved symbol that caused the abort */ sfsistat status; /* Program exit status */ jmp_buf x_jmp; /* Return point for runtime errors */ jmp_buf catch_jmp; /* Return point for throws */ @@ -712,13 +711,8 @@ instr_symbol(eval_environ_t env) if (PROG_TRACE_ENGINE) prog_trace(env, "SYMBOL %s", symbol); - if (!s) { - if (PROG_TRACE_ENGINE) - prog_trace(env, "%s is not defined", symbol); - env->null_symbol = symbol; - longjmp(env->x_jmp, 1); - } else if (env->null_symbol && strcmp(env->null_symbol, symbol) == 0) - env->null_symbol = NULL; + if (!s) + env_throw(env, mf_macroundef, "Macro not defined: %s", symbol); if (PROG_TRACE_ENGINE) prog_trace(env, "%s dereferenced to %s", symbol, s); @@ -1789,13 +1783,6 @@ environment_get_status(eval_environ_t env) return env->status; } -const char * -environment_get_null_symbol(eval_environ_t env, struct locus *locus) -{ - *locus = env->locus; - return env->null_symbol; -} - SMFICTX * env_get_context(eval_environ_t env) { |