2006-11-10 Sergey Poznyakoff * NEWS: Update. * doc/Makefile.am (mailfromd_TEXINFOS): Add values.texi.o * doc/values.texi: New file * doc/mailfromd.texi: Include values.texi. Document SMTP timeouts. * src/engine.c (smtp_stream_wait,smtp_wait,smtp_recvline) (check_on_host,listens_on): Implement new timeout control scheme. (smtp_recv_tm): New function * src/mailfrom.h (io_attempts,connect_attempts): Remove (io_timeout,connect_timeout): Change the type to time_t (response_timeout): New declaration * src/main.c (io_attempts,connect_attempts): Remove (io_timeout,connect_timeout): Change the type to time_t (response_timeout): New variable (option_cache): Deprecate options connect-retry and io-retry (process_options): Additionally check if p->set is not NULL. 2006-11-09 Sergey Poznyakoff Do not explicitely lock the databases, it is the responsibility of the underlying DB library. In case of GDBM, honor lock timeout/attempts by retrying gdbm_open while errno is EAGAIN. Berkeley DB does not need locking at all. * src/mu_dbm.c (mu_dbm_open): Take 5th argument (mu_dbm_lock,mu_dbm_unlock): Removed * src/mu_dbm.h (struct mu_db_file.locker): Removed * src/bi_db.m4: Update invocations of mu_dbm_open, remove calls to mu_dbm_lock/mu_dbm_unlock. * src/cache.c: Likewise * src/db.c: Likewise * src/rate.c: Likewise * src/mailfrom.h (lock_retry_count_option) (lock_retry_timeout_option): New declarations * src/main.c (lock_retry_count_option) (lock_retry_timeout_option): New variables (set_lock_retry_count,set_lock_retry_timeout): Set variables instead of calling mu_locker_set_* functions (option_email): Forgotten to commit yesterday * NEWS, configure.ac: Version 3.0.2 2006-11-08 Sergey Poznyakoff * configure.ac, NEW: Version 3.0.1 * src/engine.c (check_on_host): Fix multiple mail from address handling. * src/gram.y (pragma_option): Skip extra whitespace between the word `option' and the argument. (src/main.c): Fix address validation (cond : RATE error): Remove FIXME-xref. * etc/rc.in (mailfromd_stop): Fix arithmetical expression syntax * gacopyz/gacopyz.c (parse_state_arg): Bugfix: do not reuse the parser buffer. (gacopyz_run): Call gacopyz_cleanup_children at the start of the loop, to ensure the children are collected ASAP. * src/mailfrom.h (struct function): Remove misleading comment * src/mu_dbm.c (mu_dbm_open) [WITH_GDBM]: Use GDBM_NOLOCK, as we do the locking ourselves 2006-11-06 Sergey Poznyakoff Release 3.0 * doc/mailfromd.texi: Update * etc/rc.in: Update 2006-11-05 Sergey Poznyakoff * NEWS, configure.ac: Set the version number to 3.0 (dropping libmilter support calls for raising the major number). * TODO: Update * src/Makefile.am: Install mailfromd in sbin * etc/Makefile.am (.in.mailfromd): Likewise * gacopyz/gacopyz.c (gacopyz_handle_connection): Reset SIGTERM and SIGHUP in child. * gacopyz/proc.c (gacopyz_cleanup_conn): Ignore SIGTERM while stopping children. * doc/gacopyz.texi: New file * doc/Makefile.am (mailfromd_TEXINFOS): Add gacopyz.texi (EXTRA_DIST): Add extract.awk (extract): New rule * doc/macros.texi (function-begin, function-end): Remove macros (example-output): New macro * doc/mailfromd.texi: Finish changes for 3.0 2006-11-04 Sergey Poznyakoff * NEWS: Update * TODO: Update * doc/Makefile.am (check-pragmas): Minor change * doc/macros.texi (function-begin,function-end): New macros * doc/mailfromd.texi: Add missing documentation * etc/rc.in: New option `macros'. * gacopyz/gacopyz.c (ctx_read,ctx_write): Return immediately on timeout and eof. 2006-11-03 Sergey Poznyakoff * etc/rc.in: New command 'configtest' (proposed by Jan) * gacopyz/gacopyz.c (gacopyz_run): Update invocation of gacopyz_cleanup_children. * gacopyz/gacopyz.h (gacopyz_cleanup_children): Change signature * gacopyz/proc.c: Do not keep the list of children. gacopyz_cleanup_children now does the housekeeping job. * src/engine.c (check_portspec): Minor fix: no use to make sp static. (mailfromd_daemon): Stop on SIGTERM, SIGQUIT, SIGHUP and SIGINT. Finally! * src/engine.c (smfilter): Set child start handler * NEWS: Update * configure.ac: Warn if libmilter is requested * doc/mailfromd.texi: Remove any references to libmilter * src/mailfrom.h: Fix conditionals for definition of res_n* wrappers. * configure.ac: Autodetect the presence of res_n* functions Define HAVE_PTHREAD if we need to use libpthread * gacopyz/gacopyz.c (macro_assoc_free): Initialize macro_assoc_t fields to NULL * src/bi_poll.m4: Fix trace output (AS part) * src/dns.c: Replace pthread-specific calls with macro wrappers * src/gram.y (on pollstmt do branches): Fix passing of arguments to the built-in poller * src/mailfrom.h: Define wrappers for phread and res_n* functions, if necessary * libmilter: Removed. Everything moved to /gacopyz * gacopyz: New directory. See libmilter for the previous history * Makefile.am (SUBDIRS): Replace libmilter with gacopyz * NEWS: Update * configure.ac: Raise version number to 2.0.4 Default to using libgacopyz. If the user really calls for trouble, allow him to use libmilter (possibly forked), instead. * src/Makefile.am (INCLUDES): Add MILTER_INCLUDES * src/engine.c: Remove include mfapi.h (priv_get): Special provision for test mode * src/mailfrom.h: Include mfapi.h without leading directory. -I should take care of it. (MAILFROMD_DAEMON,MAILFROMD_TEST,MAILFROMD_DELETE,MAILFROMD_LIST) (MAILFROMD_EXPIRE,MAILFROMD_COMPACT) (MAILFROMD_SHOW_DEFAULTS): Moved from main.c (mode): New global * src/main.c: Do not include mfapi (MAILFROMD_DAEMON,MAILFROMD_TEST,MAILFROMD_DELETE,MAILFROMD_LIST) (MAILFROMD_EXPIRE,MAILFROMD_COMPACT) (MAILFROMD_SHOW_DEFAULTS): Move defines to mailfrom.h * src/ml.c: Include mfapi.h without leading directory. -I should take care of it. [GACOPYZ_VERSION_MAJOR]: Provide wrapper for gacopyz_setreply * gacopyz/smfi.c (smfi_main): Remove debugging hook * libmilter/dummy.c: Update * libmilter/milter.c, libmilter/milter.h, libmilter/smfi.c: Finished libmilter implementation. * testsuite/mail.null: Skip -f option and its argument. * libmilter/context.c, libmilter/milter.h, libmilter/smfi.c: (g_milter_setmlreply_v, smfi_setmlreply): Improved implementation. (g_milter_setmlreply_va): New function 2006-11-02 Sergey Poznyakoff * libmilter/context.c, libmilter/milter.c, libmilter/milter.h libmilter/milter_priv.h, libmilter/smfi.c: Implement sending reply strings to sendmail. * src/gram.y: Fix type casting of arguments. * libmilter/milter.c, libmilter/milter.h, libmilter/milter_priv.h: Finish context loop implementation. * libmilter/dummy.c: Add to the repository * libmilter/milter.c (trans_ok, get_command): Change signature (send_reply): Remove translation of the command. (union state_arg): Change contents. (state_ret_type): New data type (state_handler_fn): Change type and signature. (state_disp): New field `name'. (shan_abort,shan_macro,shan_optneg): Implemented (find_disp): New function (parse_state_arg): New function (g_milter_context_loop): Initial loop implementation. (g_milter_getsymval): New function * libmilter/milter.h (SMFI_V1_ACTS,SMFI_V2_ACTS): New defines (smfi_getsymval): Define to g_milter_getsymval (g_milter_getsymval): New prototype * libmilter/milter_priv.h (macro_assoc_t): New data type (struct smfi_str.macros): Change type to macro_assoc_t * libmilter/trans.awk: Define state_name array 2006-11-01 Sergey Poznyakoff * configure.ac (BUILD_DUMMY): New var * libmilter/Makefile.am: Build dummy - a test program for libmilter * libmilter/log.c (g_smfi_logdump): New function * libmilter/milter.c: Lots of fixes. Start implementing the read and eval loop. * libmilter/milter.h (smfi_register): Fix prototype (g_smfi_logdump): New function * libmilter/milter_priv.h (enum macro_index) (milter_sockaddr_t,mi_uint32_t): New data type (struct smfi_str.macros): Change type * libmilter/smfi.c (smfi_register): Fix declaration (smfi_main): Temporarly force foreground mode * libmilter/trans.awk (END): Emit st_none * Makefile.am (SUBDIRS): Add libmilter * configure.ac: Add testing framework for libmilter Raise version number to 2.0.3 * libmilter/Makefile.am: Conditionally build libmilter.a * libmilter/: Initial commit * context.c: Initial commit * log.c: Initial commit * milter.c: Initial commit * milter.h: Initial commit * milter_priv.h: Initial commit * proc.c: Initial commit * smfi.c: Initial commit * trans.awk: Initial commit * trans.tab: Initial commit * libmilter/.cvsignore: Initial commit * src/prog.c (instr_ston): Fix runtime error diagnostic message 2006-10-30 Sergey Poznyakoff * src/engine.c (check_on_host): Iterate over addresses from `mailfrom' until either the list is exhausted or the remote server replies 2xx. Generalization of Jan's idea. * src/main.c (set_mailfrom): Check if value is a valid mail address (or a list thereof) * testsuite/etc/poll-1.rc: New file * testsuite/etc/Makefile.am (RCFILES): Add poll-1.rc * testsuite/mailfromd/poll.exp: Test multiple from addresses. * NEWS: Update * doc/Makefile.am (check-exceptions): New goal (all-check-docs): Depend on check-exceptions * doc/mailfromd.texi: Document multiple from addresses. * src/gram.y (pragma_option): Return the rest of the line as the option argument for `pragma option mailfromd' * NEWS, TODO: Update * src/bi_poll.m4 (_pollmx): Update invocation of check_mx_records * src/engine.c (check_mx_records): Return actual number of MXs in the location given by the last argument. All callers updated (method_standard): Do the last-resort poll (i.e. querying the domain part of the sender email, treated as an MX) only if the domain has no MX records. * src/mailfrom.h (check_mx_records): Update declaration 2006-10-29 Sergey Poznyakoff * src/bi_dns.m4 (ismx): New built-in function Implement connect-timeout and connect-retry options proposed by Jan: * src/engine.c (smtp_stream_wait, smpt_wait) (check_on_host, listens_on): Use connect_wait/connect_timeout for the initial connection and io_wait/io_timeout for the I/O operations. * src/mailfrom.h (connect_timeout, connect_attempts): New variables. * src/main.c: Likewise. * src/prog.c (struct eval_environ): Fix setheader prototype. * TODO, NEWS: Update 2006-10-28 Sergey Poznyakoff * NEWS, configure.ac: Version 2.0.2 * src/bi_sa.m4 (clamav): New built-in function * src/snarf.m4: Minor comment fixes * src/snarf.m4 (env_get_stream): New macro. Make sure env_get_stream is used only within capturing function definitions. * doc/Makefile.am (check-pragmas, check-options) (check-builtins): Use new check-docs.sh invocation syntax * doc/check-docs.sh: Allow to take any number of "source" arguments. * doc/mailfromd.texi: Remove ignored deftypefn of numrcpt 2006-10-27 Sergey Poznyakoff * NEWS: Update * src/bi_db.m4 (MF_INIT): Install greylist_seconds_left variable * src/engine.c (ctx_setheader,priv_store_header_command): Change type of the second argument to struct old_header_node. * src/gram.y: Rules for header modification changed to allow an expression as the second argument. (register_macro,print_used_macros): New functions (dbg_setheader): Change type of the second argument to struct old_header_node. (print_node,code_node): Change handling of node_type_header * src/mailfrom.h (struct old_header_node): Renamed from header_node (struct header_node): New structure. (print_config_macros): New function (create_environment): Change type of the 4th argument (priv_store_header_command): Remove declaration (compare_string): New declaration * src/main.c: New option --dump-macros * src/prog.c (instr_header): The value for the header is obtained as the 1st argument. (struct optab): Change instr_header description (create_environment) Change type of the 4th argument * configure.ac: Check for SIGRETTYPE * src/Makefile.am (M4_FILES): Add bi_sa.m4 * src/bi_db.m4, src/bi_dns.m4, src/bi_string.m4: Remove unneded quoting * src/engine.c (mlfi_envfrom,mlfi_header,mlfi_eoh) (mlfi_body, mlfi_eom): Capture support (mlfi_eom): Bugfix: mlfi_eval called with wrong state tag * src/gram.y: Check if builtin invocations are allowed in the current state. (status_tab): Add mf_url * src/lex.l (parse_include): Remove unused variable * src/mailfrom.h (mf_status): New status mf_url (struct builtin): New fields rettype, statemask, capture. (va_builtin_install_ex): New function (env_get_stream,env_capture_start,env_capture_write, env_capture_write_args): New functions * src/prog.c: Include stdarg.h (struct eval_environ): New member `stream' (env_get_stream,env_capture_start,env_capture_write) (env_capture_write_args): New functions (destroy_environment): Destroy the capture stream (builtin_setup): Call sa_init_builtin. * src/prog.h (sa_init_builtin): New function * src/snarf.m4: Change quoting symbols to [<,>] (MF_STATE, MF_CAPTURE): New defines (MF_DEFUN): use va_builtin_install_ex * src/symtab.c (va_builtin_install_ex): New function * src/bi_sa.m4: New file. Spam-Assassin interface. * src/Makefile.am (mailfromd_SOURCES): Add engine.c * src/bi_string.m4 (substring): Fix swapping of start and end offsets. * src/mailfrom.h: Add external declarations, necessary for engine.c * src/main.c: Move all milter-related stuff to engine.c * src/engine.c: New file * src/prog.h (other_init_builtin): New extern * src/rate.c (rate_print_item): Remove unused variables 2006-10-23 Sergey Poznyakoff * src/prog.c: Minor indentation changes * src/snarf.m4: Add comments 2006-10-22 Sergey Poznyakoff * src/lex.l: Use familiar \N notation for back references. Expand \0ooo and \xhh notations in double-quoted strings. 2006-10-21 Sergey Poznyakoff * src/lex.l: Allow variable and macro interpretation and backreference substitution in "" strings. * src/gram.y: Implement regexp back-references * src/lex.l: Likewise * src/mailfrom.h: Likewise * src/prog.c: Likewise 2006-10-20 Sergey Poznyakoff Implement new framework for builtin functions, which allows for easy addition of new functions and provides basic sanity checks. * TODO: Update * NEWS: Update * src/.cvsignore: Update * src/bi_db.m4: New file * src/bi_dns.m4: New file * src/bi_other.m4: New file * src/bi_poll.m4: New file * src/bi_string.m4: New file * src/snarf.m4: New file * src/prog.h: New file * src/Makefile.am: Add rules for generating builtin implementation files from m4 sources * src/gram.y (status_tab): New status mf_range * src/mailfrom.h: New status mf_range * src/main.c (check_on_host): Return mf_temp_failure if stream_open fails. * src/prog.c: Include prog.h Remove implementations of builtin functions. They all go into the corresponding m4 files. (advance_pc,adjust_stack): Functions, instead of macros (env_var_ref,env_dict_getsym,env_dict_install,env_get_locus): New functions. 2006-10-18 Sergey Poznyakoff * src/prog.c (set_last_poll_result): Allow NULL arguments * configure.ac: Check for mu_get_auth (MU >= 1.0.1) * src/prog.c (bi_hostname, bi_resolve): Cache negative results (valid_user_p): Use mu_get_auth if available and throw appropriate exceptions if the user validity cannot be confirmed. 2006-10-13 Sergey Poznyakoff * TODO: Update * doc/mailfromd.texi: Apply some fixes, proposed by Jan 2006-10-11 Sergey Poznyakoff * src/main.c (method_standard, method_strict): Initialize last_poll_sent, last_poll_recv to empty strings if cache was used. 2006-10-09 Sergey Poznyakoff * src/lex.l: Allow interpretation of variables and macros within here-documents. Special form to remove all leading whitespace from the here- document lines. * src/ml.c (ml_split): Fix counting of lines in the reply. The last line was not taken into account unless it ended with a newline. * NEWS: Update. * doc/mailfromd.texi: Document here-documents. 2006-10-07 Sergey Poznyakoff * doc/mailfromd.texi: Provide example of cached_data usage. * configure.ac: Fix Berkeley DB autodetection * src/Makefile.am (INCLUDES): Add MU_COMMON_INCLUDES * src/mu_dbm.c [WITH_BDB] (mu_dbm_open): Use DB_VERSION_MAJOR to select the version-dependent code. 2006-10-06 Sergey Poznyakoff * NEWS: Update * TODO: Update * doc/mailfromd.texi: Document cache_used variable * src/mailfrom.h (set_cache_used): New function * src/main.c (method_strict, method_standard): Set cache_used to 1 or 0 depending on whether the cached data were used or not. * src/prog.c (set_cache_used): New function * configure.ac: Add explicit support for Berkeley DB 4. Raise version number to 2.0.1 * src/mailfrom.h (set_last_poll_result): New function. (env_get_context): New function. (check_on_host,check_mx_records,method_strict) (method_standard): Change first argument type to eval_environ_t * src/main.c (smtp_send): Clear reply before proceeding (smtp_last_sent,smtp_last_received): Return literal "nothing" if nothing was sent/received. (check_mx_records,method_strict) (method_standard): Change first argument type to eval_environ_t (check_on_host): Change first argument type to eval_environ_t. Return last polled host, sent command and received reply in variables last_poll_host, last_poll_send and last_poll_recv. * src/mu_dbm.c [WITH_BDB] (mu_dbm_open): Support Berkeley DB 4 * src/prog.c (env_get_context, env_get_context): New function (greylist_expire_item): New function (greylist_format_struct): Add expire field. (greylist_format_struct): Declare last_poll_host, last_poll_send, last_poll_recv * src/rate.c (rate_expire_item): Compute the interval relative to the current time. * doc/mailfromd.texi: Document new variables * NEWS: Update 2006-09-15 Sergey Poznyakoff -= Release 2.0 =- * configure.ac: Raise version number to 2.0 * NEWS: Likewise * doc/mailfromd.texi: Finished * src/main.c (filter_cleanup): Free md->helostr (mlfi_helo): Allocate md->helostr. * src/main.c (main): Enclose PACKAGE_BUGREPORT in angle brackets 2006-09-14 Sergey Poznyakoff * doc/mailfromd.texi: Update * src/gram.y: Warn about unquoted strings * src/main.c: Do not enclose dbm-related variables in #ifdef USE_DBM. * configure.ac: Define program_name * doc/mailfromd.texi: Update * src/gram.y: Fix coredump if "rate" is not defined * src/prog.c: Include sys/types.h * doc/mailfromd.texi: Update * etc/mailfromd.rc: Update * src/lex.l: Fix counting of the input lines * src/main.c: New option -l (--lint) * NEWS: Update 2006-09-13 Sergey Poznyakoff * doc/mailfromd.texi: Update * doc/strftime.texi: New file * doc/mastermenu.el: New file * doc/Makefile.am (mailfromd_TEXINFOS): Add strftime.texi (check-builtins): Update rule (check-refs,check-fixmes): New rules (all-check-docs): New rule (check-docs): Rewrite via all-check-docs * README-alpha: Update (fprintftime gnulib module is required). * src/Makefile.am (INCLUDES): Add lib (for fprintftime.h) * src/cache.c (cache_print_item): Use format_time_str * src/db.c (format_time_str): New function * src/gram.y (convert_rate): allow a separator ("per" or a punctuation) between the message count and the interval spec. * src/mailfrom.h (format_time_str): New function (time_format_string): New global * src/main.c (time_format_string): New global New option --time-format (db_format_enumerator): Protect by #ifdef USE_DBM. Print negative expiration for cache. * src/prog.c (greylist_print_item): Use format_time_str. * src/rate.c (rate_print_item): Use format_time_str. 2006-09-12 Sergey Poznyakoff * doc/mailfromd.texi: Update * src/prog.c (env_catch): Reset the exception handler. 2006-09-10 Sergey Poznyakoff * TODO: Update * configure.ac: Set doc hints depending on the version (alpha vs. stable). * doc/Makefile.am (check-pragmas): Modify (check-docs): Add check-builtins to the lst of prerequisites. (check-builtins): New rule (RENDITION): Remove variable assignment * doc/macros.texi (xprindex): Not used now * doc/mailfromd.texi: Update * src/gram.y: Set the precedence of MATCHES and FNMATCHES to that of EQ (print_bin_op): Add missing opcodes (print_node): Fix printing of NEG argument * src/main.c (options): Fix wrongly placed N_()s. 2006-09-09 Sergey Poznyakoff * README-alpha: Add texinfo to the prerequisites * doc/macros.texi: New file * doc/Makefile.am (mailfromd_TEXINFOS): Add macros.texi (check-pragmas,check-options): New rules (EXTRA_DIST): Add check-docs.sh * doc/mailfromd.texi: Update * src/main.c: Use ifdef USE_DBM where appropriate * src/prog.c (valid_user_p): Do not suppose argument is an email address. 2006-09-07 Sergey Poznyakoff * NEWS: Update * doc/mailfromd.texi: Almost finished Tutorial chapter * src/prog.c (bi_domainpart, bi_localpart): New function (dbmap): Signal dbfailure exception if the database cannot be opened. Do not suppose the argument is an email address. 2006-09-05 Sergey Poznyakoff * NEWS: Update * doc/mailfromd.texi: Update * src/prog.c (bi_toupper, bi_tolower): New built-ins. (bi_stdpoll, bi_strictpoll, bi__pollhost, bi__pollmx): Signal runtime error on unhandled exceptions. * Makefile.am: Update * NEWS: Update * src/db.c (db_compact): Print debugging info at the beginning * src/lex.l (parse_error): Do not output locus is locus.file is not set. * src/main.c: New option --all (stderr_error_printer): Use program_invocation_short_name (main): Set stderr_error_printer early, before parsing command line. * README-alpha: New file * Makefile.am (SUBDIRS): Add lib * NEWS: Update * configure.ac: Switch to using gnulib * src/Makefile.am: Likewise * src/main.c: New options --lock-retry-count and --lock-retry-timeout * src/obstack.c, src/obstack.h, src/snprintf.c, src/snprintf.h, src/strtok_r.c: Remove files. 2006-09-03 Sergey Poznyakoff * NEWS: Update * doc/mailfromd.texi: Update * src/lex.l: Implement #include directive (pop_source): Do not free locus.file. It has already been referenced by now. * src/main.c (log_status): Avoid logging SMFIS_CONTINUE actions. 2006-09-02 Sergey Poznyakoff * NEWS, configure.ac: Raise version number to 1.9.93. * THANKS: Updated Jan's record * src/cache.c: Print status code and time stamps in human-readable form. * src/gram.y (ECHO): Rename to KW_ECHO to avoid clashes with the lex macro name. * src/lex.l: Likewise * src/mailfrom.h (debug macros): Print source location only if source_info_option is set (source_info_option): New extern (builtin_post_setup,print_code,yylex,yyerror,onblock,string_to_stat) (mailfromd_msgid,mailfromd_timestr,logmsg): (xeval,check_on_host,check_mx_records,get_rate): Add missing declarations * src/main.c (source_info_option): New option (struct message_data.msgid): New member (priv_get): Init msgid (mailfromd_msgid,mailfromd_timestr): New functions (trace, transcript): Use mailfromd_msgid() (check_on_host): Print exit code on debug level 1 * src/mu_dbm.c: Include mailutils/error.h * src/mu_dbm.h (mu_dbm_unlock): Return void * src/prog.c: Minor changes * testsuite/etc/poll.rc: New file * NEWS: Update * etc/mailfromd.rc: Use RFC-compliant reply codes. * testsuite/etc/arg.pat: Likewise. * testsuite/etc/arg.rc: Likewise. * testsuite/etc/cidr.rc: Likewise. * testsuite/etc/cond.rc: Likewise. * testsuite/etc/numrcpt.pat: Likewise. * testsuite/etc/numrcpt.rc: Likewise. * testsuite/etc/reject.pat: Likewise. * testsuite/etc/reject.rc: Likewise. * testsuite/etc/relayed.rc: Likewise. * testsuite/etc/tempfail.pat: Likewise. * testsuite/etc/tempfail.rc: Likewise. * testsuite/mailfromd/cidr.exp: Likewise. * testsuite/mailfromd/cond.exp: Likewise. * testsuite/mailfromd/relayed.exp: Likewise. * src/gram.y (on_cond): Use the values of %ehlo_domain and %mailfrom_address variables as default values for ehlo domain and sender address. * src/mailfrom.h (smtp_domain): New extern (get_smtp_domain): Remove function * src/main.c (get_smtp_domain): Remove function (main): Call builtin_post_setup after configuration * src/prog.c (builtin_post_setup): New function (builtin_setup): Install ehlo_domain and mailfrom_address vars (bi_strictpoll): Fix parameter order (bi__pollhost, bi__pollmx): New functions (bi_match_cidr): Fix coredump * testsuite/etc/catch01.rc: New file * testsuite/etc/hasmx.rc: New file * testsuite/etc/Makefile.am: Add catch01.rc and hasmx.rc * testsuite/etc/catch.rc: Rewrite * testsuite/mailfromd/catch.exp: Rewrite * testsuite/mailfromd/hasmx.exp: New file * testsuite/mailfromd/poll.exp: New file * testsuite/mailfromd/DISTFILES: Add hasmx.exp and poll.exp * src/codegen.awk: Remove * src/onwrap_std.cin: Remove * src/onwrap_std.rc: Remove * src/onwrap_strict.cin: Remove * src/onwrap_strict.rc: Remove * Makefile.am, src/Makefile.am: Remove bootstrap. Not needed any more. * src/gram.y: Allow to specify catches for all exceptions (catch *). Allow to use any function as a selector to `on' statement. Get rid of poll_node. * src/mailfrom.h (struct poll_node): Remove (struct poll_data): New data type (struct catch_node): Replace mf_status *values with unsigned exmask (enum node_type): Remove poll_node (std_on_wrapper_func,strict_on_wrapper_func): Remove * src/prog.c (instr_catch, dump_catch): Update for the new catch calling convention. Remove includes of onwrap_std.c and onwrap_strict.c. * src/.cvsignore: Update * Makefile.am, src/Makefile.am (bootstrap): New goal * src/Makefile.am: Add rules for generation of onwrap_std.c and onwrap_strict.c * src/codegen.awk: New file * src/onwrap_std.cin: New file * src/onwrap_std.rc: New file * src/onwrap_strict.cin: New file * src/onwrap_strict.rc: New file * src/gram.y: Change catch semantics: a catch handler always causes exit from the function or prog it was called from. The scope of a catch handler installed in a function ends with the end of that function. Rewrite ON statement using CATCH + wrappers over stdpoll or strictpoll functions. * src/lex.l: The sequences poll, host, for, as and from are valid keywords only if used in ONBLOCK state. (onblock): New function * src/mailfrom.h (mf_status): Add new status codes (it'd be better to call them exception codes, perhaps). (EXMASK): New macro (prog_trace_option): New global (struct poll_action): Removed (struct poll_node): Change type of `actions' to struct case_stmt (struct function.exmask): New member (std_on_wrapper_func, strict_on_wrapper_func): New globals (instr_callout): Removed (instr_retcatch, instr_saveex, instr_restex): New instructions (env_catch): Return an error code * src/main.c: New option --trace-prog * src/prog.c (prog_trace): New function. Used in all instructions and builtins instead of debugN(100...). (instr_callout): Removed (instr_retcatch, instr_saveex, instr_restex): New instructions (env_catch): Return an error code (bi_stdpoll, bi_strictpoll): New builtins * src/.cvsignore: Update * testsuite/etc/catch.rc: Update catch syntax 2006-08-30 Sergey Poznyakoff * NEWS: Update * etc/mailfromd.rc: Rewrite using 2.x syntax * src/gram.y: Simplify case syntax: do not require do .. done around statement lists * src/prog.c (instr_ntos): Remove unused variable * testsuite/etc/switch.rc: Rewrite using new syntax * NEWS: Update * src/gram.y: Use NUMERIC_BUFSIZE_BOUND to declare buffers for numeric conversion * src/prog.c: Likewise * src/lex.l: New notation &word (for future use) * src/mailfrom.h (NUMERIC_BUFSIZE_BOUND): New macro * src/main.c: Set log_to_stderr=1 for some working modes (e.g. --test, --compact, --expire) (mailfromd_show_defaults): Remove NDBM/DBM leftovers * testsuite/etc/switch.rc: Minor fix * NEWS: Document switch statement, database pragma and the new greylist syntax * TODO: Update * src/cache.c: Use cache_format * src/rate.c: Use rate_format * src/gram.y: Implement switch statement * src/lex.l: Likewise * src/mailfrom.h (DEFAULT_GREYLIST_DATABASE): New define (positive_expire_interval,rates_expire_interval): Remove globals (struct value,struct valist,struct case_stmt) (struct switch_stmt): New data types (node_type_switch): New node type (struct node.v.switch_stmt): New member (instr_xlat,instr_xlats,instr_jreg): New instructions (code_peek,code_reserve): New functions (struct db_format.expire_interval): New member (db_format_install): Return struct db_format * * src/main.c (positive_expire_interval,rates_expire_interval): Remove globals. Use corresponding db_format fields instead. All references updated. (db_format_setup): Protect by #ifdef USE_DBM (mailfromd_show_defaults): Use symbol_enumerate to dump available database information. * src/prog.c (instr_xlat,instr_xlats,instr_jreg): New instructions (code_peek,code_reserve): New functions * src/symtab.c (db_format_install): Return struct db_format * * testsuite/etc/Makefile.am (RCFILES): Add switch.rc * testsuite/etc/greylist.in: Rewrite to use new greylist syntax * testsuite/mailfromd/DISTFILES: Add switch.exp * testsuite/etc/switch.rc: New testcase * testsuite/mailfromd/switch.exp: New testcase 2006-08-23 Sergey Poznyakoff * src/main.c (stderr_error_printer): New function (main): Set stderr_error_printer as the default error printer if log_to_stderr is true. Bail out if extra arguments are given in daemon mode. * NEWS: Update * src/dns.c (getmx): Do not recurse to parent domains * src/gram.y: Remove rate statement, use the built-in function instead. (pragma_option): Several pragmas take time interval specification as their argument. (time_multiplier): Analize the part of the first argument up to the first space characrer. Allow for abbreviated time units. (parse_time_interval): New function (convert_rate): Rewrite unsing parse_time_interval * src/lex.l: Allow to use multi-letter sendmail variables without surrounding cury braces. * src/mailfrom.h (node_type_rate): Remove type (instr_rate): Remove function * src/main.c: Options ending in "timeout" and "expire-interval" take time interval specification as their argument. * src/prog.c (instr_rate): Remove (bi_interval,bi_rate): New functions * src/rate.c (rate_print_item): Improved output 2006-08-22 Sergey Poznyakoff * src/main.c: Switch to user privileges before compacting the database * NEWS: Update * src/gram.y: The legacy syntax (statement list without any prog declaration) is no longer supported SET statements are allowed between declarations, they declare global variables and assign initial values to them. * src/lex.l (parse_error_locus): Locus pointer is const * src/mailfrom.h (parse_error_locus,function_install): Locus pointer is const (declare_numeric_variable,declare_string_variable): New function * src/prog.c (declare_numeric_variable) (declare_string_variable): New function (env_decl_vars): New function (create_environment): Call env_decl_vars * src/symtab.c (variable_install): Do not overwrite existing variables. (function_install): Locus pointer is const * testsuite/etc/Makefile.am: Add var.rc * testsuite/etc/var.rc: New file * testsuite/etc/accept.rc: Rewrite using the new syntax * testsuite/etc/ml.rc: Likewise * testsuite/etc/reject.rc: Likewise * testsuite/etc/tempfail.rc: Likewise * testsuite/etc/ack.rc: Update the comment * testsuite/mailfromd/DISTFILES: Add var.exp * testsuite/mailfromd/var.exp: New testcase * src/gram.y (FUNC declaration): Assign the entry point early to properly handle recursive functions (variable): Throw error if the variable is not defined * src/prog.c (instr_add,instr_sub,instr_mul,instr_div): Adjust stack (instr_result): Fix the debug diagnostics (instr_builtin): Advance pc before calling the handler, so it can use env_catch (instr_variable,instr_asgn,instr_svalidate,instr_arg) (instr_return,instr_adjust,instr_popreg,instr_pushreg): Provide appropriate debug diagnostics (bi_hasmx): Call freemx only if getmx returned success. Call env_catch otherwise * testsuite/etc/Makefile.am: New files ack.rc and catch.rc * testsuite/etc/ack.rc: New file * testsuite/etc/catch.rc: New file * testsuite/mailfromd/DISTFILES: New files ack.exp and catch.exp * testsuite/mailfromd/ack.exp: New file * testsuite/mailfromd/catch.exp: New file * src/gram.y: Implement user-defined functions * src/lex.l: Likewise * src/mailfrom.h: Likewise * src/prog.c: Likewise * src/symtab.c: Likewise * TODO: Update 2006-08-21 Sergey Poznyakoff * src/gram.y (echo): New statement. Begin implementing user-defined functions * src/lex.l: Likewise * src/mailfrom.h (node_type_echo): New node type (symbol_enumerator_t): New data type (symbol_enumerate): New function) (instr_echo): New instruction (env_make_frame,env_leave_frame,function_install): New functions * src/main.c (mlfi_helo, mlfi_envfrom, mlfi_envrcpt, mlfi_header) (mlfi_eoh, mlfi_body, mlfi_eom): Create normal stack frame before calling the handler. (main): Use print_code to handle --dump-code option * src/prog.c (struct eval_environ): New member `base' (pop): Return popped value (instr_ston): Fix format spec (instr_echo): New instruction (env_make_frame, env_leave_frame): New functions (env_catch): Create normal stack frame for the catch handler. Pass it the exception code as its argument. (print_code): New function. * src/symtab.c (SYM_.*): Move defines to mailfrom.h (symbol_enumerate): new function (function_install): New function * src/gram.y: Implement catch statement * src/lex.l: Likewise * src/mailfrom.h (mf_status_count): New value (struct catch_node): New data type (node_type_catch): New node type (instr_catch): New function * src/prog.c (struct eval_environ): New member `catch' (instr_catch): New function (env_catch): New function (dump_locus,dump_push_immediate,dump_symbol,dump_branch,dump_return) (dump_header,dump_builtin,dump_variable,mx_match): Change signature. All callers updated (instr_catch,dump_catch): New function (env_init): Initialize catch array 2006-08-20 Sergey Poznyakoff * src/gram.y: Implement MX MATCHES and MX FNMATCHES. Change handling of compiled regular expressions. (%union): New member matchtype (MXMATCHES,MXFNMATCHES): New tokens (optimize,optimize_node): New function (codegen): Call optimize * src/lex.l (MXMATCHES,MXFNMATCHES): New tokens * src/mailfrom.h (bin_regex,struct regex_node): Remove (struct bin_node): New member qualifier (node_type_push,node_type_regcomp): New node types (struct node.v.re): Removed (instr_fnmatch_mx,instr_regex_mx): New functions * src/prog.c (instr_fnmatch_mx,instr_regex_mx): New functions (instr_regex,instr_regcomp): Rewritten * NEWS: Update * src/gram.y: Add arithmetical operations. Fix the implicit type conversion rules. (test_program): Removed (mailfromd_test): New function * src/mailfrom.h (bin_add,bin_sub,bin_mul,bin_div): New binary opcodes (unary_minus): New unary opcode (instr_add,instr_sub,instr_mul,instr_div,instr_neg): New functions (env_init,env_push_string,env_push_number,env_set_variable): New declarations. (test_program): Removed (mailfromd_test): New declaration * src/main.c: The --test option takes an optional argument specifying which state handler to test. Only one handler can be tested per invocation. Command line interface allows to define all types of variables (sendmail, mailfromd and positional arguments). * src/prog.c (instr_add,instr_sub,instr_mul,instr_div) (instr_neg,env_set_variable): New functions. * testsuite/mailfromd/cidr.exp: Update for new --test semantics * testsuite/mailfromd/cond.exp: Likewise * testsuite/mailfromd/relayed.exp: Likewise 2006-08-19 Sergey Poznyakoff * NEWS: Update * configure.ac: Update to 1.9.92 * src/dns.c (freemx): New function * src/gram.y: Use verbose error diagnostics. (NUMBER): New token * src/lex.l: Return CODE only for strings consisting of three digits. Other number of digits form NUMBER token. Allow to split strings among multiple lines using \ as the last character on the line * src/mailfrom.h: Rearrange and add comments * src/main.c (check_mx_records): Use freemx * src/mu_dbm.c: Update copyright year * src/prog.c (bi_hasmx): use freemx * src/rate.c: Update copyright year 2006-08-18 Sergey Poznyakoff * src/gram.y: Bugfixes * testsuite/etc/Makefile.am: Add arg.rc, arg.pat * testsuite/etc/arg.rc: New file * testsuite/etc/arg.pat: New file * testsuite/mailfromd/DISTFILES: Add arg.exp * testsuite/mailfromd/arg.exp: New file * src/cache.c (format_status): Remove function. Use mf_status_str instead. * src/gram.y: Handle positional arguments (state_tag,state_args): New variables (action: ACT_CONTINUE, ACT_DISCARD): Initialize $$->v.ret to all zeros. (parse_config): Fix return value (mf_status_str): extern (test_program): Call env_init (builtin_variable_install): Change return value * src/lex.l: $N notation (positional parameter) Fix IDENTIFIER rule to accept single-character identifiers * src/mailfrom.h (node_type_arg): New node type (define_numeric_var): Removed (get_rcpt_count,clear_rcpt_count,incr_rcpt_count): New functions (mf_status_str): New declaration (builtin_variable_install): Change return value * src/main.c (struct message_data): Remove numrcpt (mlfi_helo,mlfi_envfrom,mlfi_envrcpt,mlfi_header,mlfi_eoh) (mlfi_body,mlfi_eom): Init env and pass positional parameters. (mlfi_envrcpt): Update rcpt_count variable using incr_rcpt_count (mlfi_eom): Clear %rcpt_count * src/prog.c (env_init,env_push_string,env_push_number): New functions. (get_rcpt_count,clear_rcpt_count,incr_rcpt_count): New functions (define_numeric_var): Remove function (bi_numrcpt): Directly update %rcpt_count cell. (bi_greylist): Directly update %greylist_seconds_left cell (builtin_setup): Initialize offsets of the internal variables * src/symtab.c: Indentation fix * TODO: Update * src/cache.c, src/rate.c: Include trailing nul to the key size. * src/db.c (db_list_item,db_delete): Include trailing nul to the key size (db_expire): Do not return error on failed reads if ignore_failed_reads_option is set. (db_compact): Add trailing zero to the keys missing it. * src/dns.c: Debug level 100 is reserved for instruction traces * src/mailfrom.h (DEFAULT_RATE_DATABASE): Include suffix (ignore_failed_reads_option): New variable * src/main.c (ignore_failed_reads_option): New variable Do not use debug level 100, it is reserved for instruction traces. (--ignore-failed-reads): New option * configure.ac: Remove NDBM and DBM support. * src/cache.c: Lock the database before writing to it. * src/prog.c: Likewise * src/rate.c: Likewise * src/db.c (db_compact): Implement locking. Improve error checking. * src/mailfrom.h (DEFAULT_DATABASE): File name with suffix. * src/main.c (db_format_setup): Initialize locking parameters. * src/mu_dbm.c: Remove NDBM and DBM support. Implement locking functions. * src/mu_dbm.h: Likewise Handle multiple DB formats by keeping a symbol table, describing main primitives for each of them. When a database management action is required (by using --list, --delete, --expire or --compact), the DB format can be given via --format option. The database file name can be given using --file option. * src/cache.c: Rewritten using new DB format handling primitives. * src/prog.c: Likewise * src/rate.c: Likewise * src/db.c (all functions): Change data types to int. Improve error checking (db_compact): New function (Note: no locking so far!) * src/symtab.c (SYM_DB_FORMAT): New symbol state (struct symtab.v): New member db (db_format_install,db_format_lookup): New functions * src/mailfrom.h (struct db_format): New data type (db_format_install,db_format_lookup): New functions * src/main.c (options --expire,--list,--delete): Do not take argument. --format and/or --file should be used instead (--format, --file): New options * src/mu_dbm.c (mu_dbm_file_name): New function (mu_dbm_stat): Rewrite using mu_dbm_file_name. * src/mu_dbm.h (mu_dbm_file_name): New function Remove obsolete __P() declaration wrappers. 2006-08-17 Sergey Poznyakoff * src/Makefile.am (mailfromd_SOURCES): Add ml.c * src/ml.c: New file. * src/db.c: Rewrite db_expire to avoid skipping some keys using broken backends (namely, GDBM) * src/gram.y: Bugfixes * src/lex.l: Implement multy-line strings. * src/mailfrom.h (sendmail_mlreply): New function. * src/main.c (ctx_setreply): Implement multy-line responses. * src/prog.c (bi_greylist): Define greylist_seconds_left in both branches of the conditional. * testsuite/etc/Makefile.am: Add ml.rc, ml.pat * testsuite/etc/ml.rc: New file. * testsuite/etc/ml.pat: New file. * testsuite/mailfromd/DISTFILES: Add ml.exp * testsuite/mailfromd/ml.exp: New testcase 2006-08-16 Sergey Poznyakoff * src/gram.y: Add comparison operators (<,<=,>,>=) * src/lex.l: Likewise. * src/mailfrom.h: Likewise. (define_numeric_var): New function * src/prog.c: Add comparison operators (<,<=,>,>=) (struct eval_environ): Remove mailpool. Use heap to keep string values. Remove numrcpt. The number of recipients is kept in the variable %rcpt_count (pushs): New function (instr_arg): New function (for future use) (env_set_numrcpt,env_alloc,free_meme): Removed (define_numeric_var): New function * src/main.c (mlfi_envrcpt): Define %rcpt_count * testsuite/etc/Makefile.am (RCFILES,PATFILES): Add numrcpt test * testsuite/etc/numrcpt.pat: New file. * testsuite/etc/numrcpt.rc: New file. * testsuite/mailfromd/numrcpt.exp: New file * NEWS: Update * doc/mailfromd.texi: Start rewriting * src/gram.y: Implement concatenation of expressions and internal variables. * src/lex.l: Implement internal variables (%name notation) * src/mailfrom.h (stack_size, variable_count): New variables. (struct return_node.message): Change type to NODE (struct concat_node, asgn_node): New data types (node_type_concat,node_type_asgn,node_type_variable): New node types. (struct node.v): add new structures. (instr_concat,instr_variable,instr_asgn,instr_svalidate): New instructions. (struct function): New member `name' (struct varuable): New structure (variable_install,variable_lookup,builtin_variable_install): New functions. * src/prog.c (stack_size): new variable (struct eval_environ): Remove stacksize. New members: toh, var (struct environ_state): Remove (push): Do not realloc stack. Take into account heap top when computing stack space left. (heap_reserve): New function (instr_return): Remove third immediate argument (message). Take it from the stack instead (dump_return): Likewise (instr_concat,instr_variable,instr_asgn,instr_svalidate): New instructions. (struct optab): Add new instructions (eval_environment): Initialize tos and toh (create_environment): stack_size gives the total size of the stack+heap. Allocate memory for the variable array. (bi_greylist): Do not prolong greylisting period if the function is called within a greylisting interval. Variable greylist_seconds_left keeps the number of seconds left to the end of the greylisting period. (builtin_setup): Install greylist_seconds_left variable. * src/symtab.c (SYM_VARIABLE): New entry state. (struct symtab.name): Move to the union. All references updated. (variable_install,variable_lookup): New functions. 2006-08-14 Sergey Poznyakoff * src/gram.y (MARK_LOCUS): Optimize insertion of instr_locus codes. * TODO: New file. 2006-08-13 Sergey Poznyakoff * src/prog.c (instr_header): Allocate header_node. 2006-08-12 Sergey Poznyakoff * src/main.c: Call umask in child process. Set default umask to 0117. * testsuite/.cvsignore: Update * testsuite/etc/.cvsignore: Update * testsuite/etc/cond.rc: Update * configure.ac: Remove stray AC_DEFINE * src/lex.l (line_finish): Extra debug * src/main.c (mailfromd_show_defaults): Print version instead of the method. * src/prog.c (eval_environment): Initialize status to SMFIS_CONTINUE. * testsuite/Makefile.am (SUBDIRS): Remove . * testsuite/etc/Makefile.am (RCFILES): Add cidr.rc, cond.rc, greylist.in, relayed.list, relayed.rc (PATFILES): Add greylist.pat (CLEANFILES, noinst_DATA): Add greylist.rc (.in.rc): New implicit rule * testsuite/etc/cidr.rc: New file * testsuite/etc/cond.rc: New file * testsuite/etc/greylist.in: New file * testsuite/etc/greylist.pat: New file * testsuite/etc/relayed.list: New file * testsuite/etc/relayed.rc: New file * testsuite/lib/mailfromd.exp (start_daemon): Prefix config name with MAILFROMD_ETC_DIR only if it does not already begin with / (mailfromd_init): Initialize MAILFROMD_STATE_DIR instead of doing it in (default_mailfromd_start) (default_mailfromd_version, mailfromd_version) (mailfromd_check_capability,mailfromd_exec): New functions (mailfromd_pat): New keyword :RCDIR * testsuite/mailfromd/DISTFILES: Add new files * testsuite/mailfromd/cidr.exp: New file * testsuite/mailfromd/cond.exp: New file * testsuite/mailfromd/greylist.exp: New file * testsuite/mailfromd/relayed.exp: New file * Makefile.am (SUBDIRS): Add testsuite * configure.ac (AC_CONFIG_FILES): Add testsuite/* Makefiles * .cvsignore: Update * src/main.c (option_pidfile): Assign *pval (mailfromd_daemon): Bail out if daemon fails * testsuite: New directory * testsuite/Makefile.am: Initial import * testsuite/.cvsignore: Likewise * testsuite/mail.null: Likewise * testsuite/etc: New directory * testsuite/etc/Makefile.am: Initial import * testsuite/etc/.cvsignore: Likewise * testsuite/etc/accept.pat: Likewise * testsuite/etc/accept.rc: Likewise * testsuite/etc/reject.pat: Likewise * testsuite/etc/reject.rc: Likewise * testsuite/etc/sendmail.cin: Likewise * testsuite/etc/sendmail.m4: Likewise * testsuite/etc/tempfail.pat: Likewise * testsuite/etc/tempfail.rc: Likewise * testsuite/lib: New directory * testsuite/lib/DISTFILES: Initial import * testsuite/lib/mailfromd.exp: Likewise * testsuite/mailfromd: New directory * testsuite/mailfromd/DISTFILES: Initial import * testsuite/mailfromd/actions.exp: Likewise 2006-08-11 Sergey Poznyakoff * src/gram.y: Warn if accept is used with arguments. Check codes and xcodes for reject and tmpfail actions. * src/main.c: New option --log-tag (-L) sets syslog tag. * src/prog.c: New test greylist. 2006-08-10 Sergey Poznyakoff * THANKS: Add Jan Rafaj * NEWS, configure.ac: Raise version number to 1.9.91 * doc/mailfromd.texi: Update * src/db.c (db_expire): Rewritten the loop after the proposal of Jan Rafaj. * src/dns.c (_getmx,cnameloop): Use res_n* functions to assure thread safety. * src/gram.y: Major change in confguration language. By default all code will be executed in envfrom SMTP state. The parts of code enclosed in 'PROG DO ... DONE' will be executed when the requested is handled. Deferred evaluation is considered a failed experiment and is removed. ITER statement is removed as well, since it is no longer needed. * src/lex.l (iter): Remove keyword (prog): New keyword * src/mailfrom.h (enum smtp_state): smtp_state_first marks first executable SMTP state, smtp_state_count gives the number of available states. (struct iter_node,node_type_iter,instr_iter,instr_pushenv) (instr_suspend): Removed. (entry_point): New global data (environment_get_null_symbol): Return locus in the location pointed to by the second argument. (codegen): Remove declaration (dump_code): Accepts two arguments. * src/main.c (check_on_host): Be more liberal. Return mf_temp_failure if any transport error occurs Send QUIT after exiting the loop, so that we close the transaction correctly even if we get a negative reply. (xeval,mlfi_eval): New functions. (mlfi_helo,mlfi_envfrom,mlfi_envrcpt,mlfi_header,mlfi_eoh) (mlfi_eom,mlfi_body): Use mlfi_eval to evaluate the response. (smfilter,milter_enable_state): Set all handlers on request, when a specified PROG is available to avoid useless milter calls. (main): Rewritten handling of --dump-code * src/prog.c (struct eval_environ) Remove statepool and smtp_state. (environ_save_state,environ_restore_state,environ_state_free): Remove. (instr_symbol): Fix debug diagnostic corresponding to previous cases of deferred evaluation. (instr_pushenv,instr_iter,dump_iter,instr_suspend): Remove (dump_code): Take two arguments. (eval_environment): Check second argument type (prog_counter_t). (environment_get_null_symbol): Return location where the undefined symbol occurs in the memory location pointed to by the second variable. (bi_numrcpt): Remove non-local jump 2006-08-08 Sergey Poznyakoff * doc/mailfromd.texi: Update * src/gram.y (code_node): Optimize code generation for `ON POLL' statements, avoiding multiple generation of action code for `or' branches. * src/main.c: Exit immediately if any of the --dump options was given. 2006-08-06 Sergey Poznyakoff * src/main.c (mlfi_helo): Do not clear md->helostr after processing. We don't rely on sendmail setting $s any more. * src/prog.c (instr_symbol): Improve debugging messages (bi_match_cidr): New builtin. 2006-08-01 Sergey Poznyakoff * configure.ac (AC_ARG_WITH([berkeley-db])): Fix the help string * README, doc/mailfromd.texi, doc/rendition.texi: Update * src/gram.y (%union): const struct builtin (iter): Call milter_enable_state * src/mailfrom.h (struct builtin_node) const struct builtin (code_instr,code_immediate): Take const argument (milter_enable_state): New function * src/main.c (mlfi_header,mlfi_header,mlfi_eoh): Initial implementation. (milter_enable_state): New function (set_milter_header,set_milter_body): Removed Removed "API control" options (--milter-body and --milter-header). * src/prog.c (code_instr,code_immediate): Take const argument (bi_resolve): Fix inet_ntoa usage (dbmap_lookup_p): Change first argument 2006-07-31 Sergey Poznyakoff * src/gram.y: Use get_smtp_domain() instead of smtp_domain * src/mailfrom.h (smtp_domain): Removed declaration; (get_smtp_domain): New function * src/main.c (get_smtp_domain): New function (main): Remove initialization of smtp_domain. * src/prog.c (dbmap_lookup_p): Protect the text by ifdef USE_DBM (builtin_setup): Do not install bi_dbmap if DBM is not used. * NEWS: Update * src/mailfrom.h (string_to_state,state_to_string): New functions (instr_iter,instr_pushenv,instr_suspend): New functions (struct iter_node): New data type * src/gram.y: Support ITER construct (string_to_state,state_to_string): New functions * src/lex.l: Support ITER construct * src/prog.c: Support ITER construct (struct eval_environ): New member statepool (struct environ_state): New member next (environ_save_state): Create the state in the internal environment memory pool (destroy_environment): Free states from the pool (instr_pushenv,instr_iter,dump_iter,instr_suspend): New functions * src/main.c (mlfi_envrcpt): Remove implicit looping in envrcpt state. (struct message_data): Remove envstate. All references updated 2006-07-30 Sergey Poznyakoff * src/gram.y: Use direct boolean arithmetics: 1 means true, 0 means false. * src/prog.c: Likewise (bi_resolve,bi_hasmx): New builtins * etc/sendmail-8.13.7.diff: Added to the repository * configure.ac: Update version number to 1.9.90 * NEWS: Update for 1.9.90 * src/main.c (struct option_cache): New option cumulative (sync with 1.x) Mark relay as cumulative (set_option): Ignore override for cumulative options * src/prog.c (instr_rate): Bugfix * configure.ac: Change DB options to those used by MU configure. * src/main.c: New option --group (pragrma group) (switch_to_privs): Retain groups specified with --group options (mailfromd_show_defaults): Show DB version in use. (main): Call MU_AUTH_REGISTER_ALL_MODULES * src/mu_dbm.c (mu_dbm_open): Fix for DB 3.x * src/mu_dbm.h: Likewise * src/prog.c (environ_state_free): State can be NULL (bi_dbmap): Fix order of arguments * configure.ac (MAILUTILS_LIBS): Link with MU Auth * src/gram.y: Allow numeric constants in the program * src/mailfrom.h (enum node_type): New type node_type_number (enum smtp_state, environ_state_t): new data type (eval_environment): Takes 2nd argument: smtp_state. All callers updated. (environ_save_state,environ_restore_state,environ_state_free): New functions. (emalloc): New prototype * src/main.c (struct message_data): New member envstate (priv_get,filter_cleanup): Handle envstate (mlfi_helo,mlfi_envfrom): Update call to eval_environment (mlfi_envrcpt): Save environment state on the first call, restore it on subsequent ones. Keep track of the number of recipients. (mlfi_header): Call eval_environment (mlfi_eom): Call eval_environment. Return tempfail if the configuration program did not finish. (capa): Use "auth" capability * src/prog.c (struct eval_environ): New fields numrcpt, smtp_state (struct environ_state): New data type (environ_save_state,environ_restore_state,environ_state_free): New functions. (instr_ston,instr_ntos): Bugfix: do not advance pc (instr_symbol): Do not set env->status before longjump (env_set_numrcpt): New function (eval_environment): Take 2nd argument: the smtp state (bi_numrcpt,bi_validuser,bi_dbmap): New builtins (builtin_setup): Register new builtins 2006-07-29 Sergey Poznyakoff * src/symtab.c: New file * src/Makefile.am (mailfromd_SOURCES): Add symtab.c * src/gram.y: Introduce builtin functions. Remove rules for HOSTNAME and RELAYED: they are builtins now. * src/lex.l: Likewise * src/prog.c: Likewise * src/mailfrom.h: Add missing prototypes. Make debug macros safe to use within if blocks (struct builtin, struct function): New data types * src/main.c (check_mx_records): Add default case (listens_on): New function (for compatibility with 1.x branch) (mlfi_eom): Clear numrcpt (main): Call builtin_setup. Check return value of codegen * src/rate.c (get_rate): Remove unused variable 2006-07-26 Sergey Poznyakoff * configure.ac: Implement --with-forks option from 1.x branch. * src/Makefile.am (LDADD): Use MILTER variable instead of hardcoding -lmilter * src/main.c (struct message_data): New members env, helostr and numrcpt (priv_get): Initialize new message_data members (ctx_getsym): Special handling for $s - sendmail does not set it when calling xxfi_helo (filter_cleanup): Use priv_get instead of MLFIPRIV Destroy the environment (mlfi_helo): Use priv_get instead of MLFIPRIV Set md->helostr (mlfi_envfrom): Use priv_get instead of MLFIPRIV Use md->env instead of creating new environment (mlfi_envrcpt): Increase numrcpt (mlfi_eom): Use priv_get instead of MLFIPRIV * src/prog.c (get_immediate): Compensate for changes in eval_environment (eval_environment): Fix reenterability: increase env->pc only when the instruction returns successfully. 2006-06-14 Sergey Poznyakoff * src/Makefile.am: Remove MU_COMPAT. We need the latest mailutils (pre 1.0) * src/gram.y: Adopt new MU namespace (code_node): Fix generation of 'and' and 'or' code * src/lex.l: Adopt new MU namespace * src/mailfrom.h (instr_and,instr_or): Remove Adopt new MU namespace * src/main.c: Adopt new MU namespace New option --source * src/prog.c: Adopt new MU namespace (instr_and,instr_or): Remove * doc/mailfromd.texi: Update 2006-01-17 Sergey Poznyakoff (Sync with v_1_0) * src/main.c (check_portspec): Fix eventual coredump and add more checks. 2006-01-10 Sergey Poznyakoff * src/gram.y (code_node): Use BNZ for branching. [poll]: bugfix * src/main.c (config_dump): Renamed to config_dump_tree. (code_dump): Renamed to config_dump_code. New opions --dump-tree (eq. --debug=d), --dump-grammar-trace (eq. --debug=y), --dump-lex-trace (eq. --debug=l), --dump-code (eq. --debug=c). * src/prog.c (adjust_stack): Fix typo (reverted sign) (get_immediate): pc is already advanced by 1 by the time the function is called. (instr_bz, instr_bnz, instr_jmp): Fix 2nd. argument to advance_pc (instr_callout): Fix typo: adjust_stack instead of advance_pc. 2006-01-10 Sergey Poznyakoff Started major rewrite. The final aim is to make the internal program reentrant and to make it stop when it is trying to reference a non-existend sendmail variable. Then, the milter handler should return SMFIS_CONTINUE to pass control over to the next handler. That, in turn, should restart program execution in the hope that Sendmail has provided the variable on this stage. If it does not the process continues. * src/Makefile.am (mailfromd_SOURCES): Add prog.c * src/prog.c: New file * src/gram.y (codegen): Add code generation functions. (name_comp,name_destroy,dict_init,dict_install,dict_destroy) (dict_getsym): Move to prog.c (eval_poll,eval_hostname,eval_rate,eval_node) (eval_node_list,run_program): Remove runtime evaluation functions (ctx_getsym,ctx_setreply,ctx_setheader): Moved to main.c (test_program): Rewritten using new functions * src/lex.l: Return EQ and NE as keywords. (parse_error_locus): New function. * src/mailfrom.h (regex_flags): Extern declaration (eval_environ_t,instr_t,prog_counter_t): New types. (instr_xchg,instr_ston,instr_ntos,instr_locus,instr_push_immediate) (instr_symbol,instr_bz,instr_bnz,instr_jmp,instr_callout,instr_dup) (instr_cmp,instr_pop,instr_and,instr_or,instr_regex,instr_regcomp) (instr_fnmatch,instr_not,instr_next,instr_return,instr_header) (instr_resolve,instr_relayed_domain,instr_rate,instr_eqn,instr_eqs) (instr_nen,instr_nen,create_environment,destroy_environment) (eval_environment,environment_get_status,codegen) (parse_error_locus): New functions * src/main.c (code_dump): New variable (--debug=c option) (ctx_getsym,ctx_setreply,ctx_setheader): Moved from gram.y (mlfi_envfrom): Rewritten using new functions (decode_debug): Handle [cC] (main): Generate code and, if required, print it on stdout 2006-01-06 Sergey Poznyakoff -= Release 1.3 =- 2006-01-06 Sergey Poznyakoff * src/lex.l: Remove leftover argc_unquote_char 2006-01-05 Sergey Poznyakoff * configure.ac: Raise version number to 1.3 * NEWS: Updated * README: Mention BROKEN_PTHREAD_SLEEP Sendmail variable * doc/mailfromd.texi: Likewise * src/main.c (check_portspec): New function. 2005-11-24 Sergey Poznyakoff * src/Makefile.am (AM_CPPFLAGS): Define MU_COMPAT, needed for latest mailutils. 2005-09-20 Sergey Poznyakoff * src/dns.c (resolve_ipstr): New implementation, taking into account cnames. * src/main.c (resolve_ipstr): Removed in favor of the new implementation. 2005-08-17 Sergey Poznyakoff * THANKS: New file * Makefile.am (AUTOMAKE_OPTIONS): New variable * configure.ac: Raised version number to 1.2 * NEWS: Likewise. * doc/gendocs_template: Updated * doc/mailfromd.texi: Updated * src/cache.c (cache_delete): Rewritten using db_delete * src/db.c (db_delete): New function * src/mailfrom.h: Likewise * src/main.c: Option --delete takes an optional argument, as --list and --expire * src/rate.c (rate_delete): New function * src/lex.l (line_add_unescape): Use argcv_unquote_char * src/cache.c: Use separate expiration times for negative and positive entries. * src/mailfrom.h: Likewise. * src/main.c: Likewise. * src/dns.c (getmx): Return immediately in mf_temp_failure. 2005-08-09 Sergey Poznyakoff * src/main.c: New option --syslog (cancels --stderr). (parse_opt) Make sure the errors are reported on stderr wherever it is connected to a tty (unless in daemon mode or otherwise directed by --syslog option). 2005-08-08 Sergey Poznyakoff * src/gram.y (stmtlist): Bugfix (NEXT): New token * src/lex.l (NEXT): New token * src/mailfrom.h (node_type_continue): Renamed to node_type_next * src/gram.y (ACT_CONTINUE): Continue execution of the program * src/mailfrom.h (node_type_continue): New node type * configure.ac (DEFAULT_EXPIRE_RATES_INTERVAL): New variable * src/db.c: New file * src/Makefile.am (mailfromd_SOURCES): Add db.c (AM_CPPFLAGS): Define DEFAULT_EXPIRE_RATES_INTERVAL * src/mailfrom.h (db_item_printer_t,db_expire_t): New types (rate_expire_db,db_list_item,db_list,db_expire): New functions * src/cache.c (cache_list_item,cache_list_db,cache_expire_db): Rewritten using functions from db.c * src/main.c (MAILFROMD_EXPIRE_RATEDB): New mode (parse_opt): Removed --list-rates option. Both --list and --expire now take an optional argument, specifying which database to operate upon. (set_rates_expire): New function. Handles rates-expire-interval pragma. * src/rate.c (get_rate): Optimized expiration logic. (rate_list_item,rate_list_db): Rewritten using functions from db.c (rate_expire_db): New function 2005-08-07 Sergey Poznyakoff * configure.ac: Complain if a DB support is required but not found. * src/rate.c: New file * src/Makefile.am: Add rate.c * src/gram.y: Add support for rate statement * src/lex.l: Likewise. * src/main.c: Likewise. * src/mailfrom.h: Rename getmx_status to mf_status * src/cache.c: Likewise. * src/dns.c: Likewise. * doc/mailfromd.texi: Documented rate statement * etc/mailfromd.rc: Likewise 2005-07-31 Sergey Poznyakoff * src/main.c (check_on_host): Destroy IO data only if these have been initialized. * src/dns.c (_getmx): Fix eventual buffer overflow. 2005-07-28 Sergey Poznyakoff * src/gram.y: Do not include gram.h (eval_hostname): Return with unmodified val if resolve_ipstr fails. * configure.ac: Raised version number to 1.1 Check for argcv_unescape_char vs. argcv_unquote_char (CVS mailutils declares the latter). * src/Makefile.am: Bugfix: place LIBOBJS into LDADD * src/dns.c: Include resolv.h after netinet/in.h 2005-06-30 Sergey Poznyakoff * doc/mailfromd.texi: Fixed usage of @email{} and @url{}. 2005-06-17 Sergey Poznyakoff * src/cache.c (cache_expire_db): Check for res==NULL. * src/main.c (method_strict): Give precedence to temporary failure, if it occurs in any poll. (method_standard): Check the client host unless mx check gives success. Give precedence to temporary failure, if it occurs in any poll. 2005-06-16 Sergey Poznyakoff * src/main.c (smtp_send2,smtp_send3): Send fully formed command, along with final CRLF, in one go. (method_standard): Check MXs first, and only if they fail, check the client host. * src/gram.y (eval_poll): Fix wording of trace message 2005-06-12 Sergey Poznyakoff * configure.ac: Raised version number to 1.0. * Makefile.am (distuninstallcheck_listfiles): New variable. The install-data-local rule in etc/Makefile.am breaks distuninstall checks, hence the need to fix it. * doc/mailfromd.texi: Finished 2005-06-12 Sergey Poznyakoff * configure.ac: Warn if DBM support is not configured * doc/mailfromd.texi: Updated to match recent changes. * etc/Makefile.am: Install mailfromd.rc * src/gram.y: Allow two additional arguments to poll: as and from. * src/lex.l: Handle new keywords: not, as, from. * src/mailfrom.h (smtp_domain,postmaster_email): External declarations. * src/main.c (check_on_host,check_mx_records) (method_strict,method_standard): Accept two additional arguments. 2005-06-10 Sergey Poznyakoff * Makefile.am (SUBDIRS): Add etc * configure.ac: New subst variable MAILFROMSTATEDIR * etc: New directory * etc/Makefile.am: New file * etc/mailfromd.rc: New file * etc/rc.in: New file * etc/.cvsignore: New file * src/Makefile.am (MAILFROMSTATEDIR): Remove definition * src/dns.c: Add missing includes. (free_mx_buffer): Removed * src/gram.y: Add configurable regcomp flags. (parse_pragma): New function * src/lex.l: Parse pragma directives * src/mailfrom.h: Add new declarations * src/main.c: Changed option handling 2005-06-09 Sergey Poznyakoff * src/gram.y: Implement new keyword 'relayed' * src/lex.l: Likewise * src/mailfrom.h: Likewise * src/main.c (relayed_domain_p): Verify full hostname as well (method_strict,method_standard): Return success on empty email. * configure.ac: Raised version number to 0.9.9 * src/Makefile.am (EXTRA_DIST): Added gram.h * src/gram.y: Improved tracing and debugging output. * src/lex.l: Return locus along with the keyword * src/mailfrom.h (debug4,debug5,debug6): New macros (struct locus): new data type (struct poll_action, struct node): Include locus (get_locus, trace): New functions * src/main.c (do_trace): New variable (option --trace) (vlogmsg,logmsg,transcript): Fixed signature (const char *fmt). (trace): New function. (parse_opt): Handle --trace option. 2005-06-09 Sergey Poznyakoff * src/mailfrom.h: New debug macros. (node_type_hostname): New node type * src/cache.c: Use new debug macros * src/dns.c: Likewise * src/gram.y: Likewise * src/lex.l: New keyword HOSTNAME. * src/main.c: Implement header operations 2005-06-08 Sergey Poznyakoff * configure.ac: Check for yacc and lex * src/gram.y: New file. Configuration file grammar and run-time support. * src/lex.l: New file. Configuration file lexical analyzer. * src/Makefile.am (mailfromd_SOURCES): Add gram.y lex.l (AM_CPPFLAGS): Define SYSCONFDIR (AM_YFLAGS,AM_LFLAGS): New vars * src/dns.c: mailutils/mailutils.h are now included from mailfrom.h * src/mailfrom.h: Add new includes (DEFAULT_CONFIG_FILE): New define Add parse tree-related data types (parse_error,yyparse,source,parse_config): New declarations * src/main.c: Major rewrite: removed predefined and configurable actions, get *the program* to be executed from the configuration file. * src/.cvsignore: Updated 2005-06-08 Sergey Poznyakoff * src/main.c (smtp_stream_wait): Take an additional argument: number of attempts. Loop until the stream is ready or the number of attempts is exhausted. All callers updated. 2005-06-07 Sergey Poznyakoff * src/main.c (method_fp,method_standard,method_strict): Changed return type. All callers updated. (check_on_host): Issue EHLO if remote party refuses HELO. 2005-06-06 Sergey Poznyakoff * src/main.c (method_standard): Check the host first, only if it does not answer, check MXs. 2005-06-06 Sergey Poznyakoff * NEWS: Updated * README: Updated * src/main.c (action_failure_default): Changed to return:reject (SMTP_MAJOR): New macro (check_on_host): Use SMTP_MAJOR * doc/.cvsignore: Updated 2005-06-05 Sergey Poznyakoff * doc/mailfromd.texi: More documentation * src/Makefile.am (install-data-local): Create MAILFROMSTATEDIR * src/cache.c (cache_expire_db): New function * src/mailfrom.h: Likewise * src/main.c (add_header): Removed. Use per-message private data to keep it. All referers updated. (--delete): New mode (--expire): New mode * doc/Makefile.am: Bugfixes * doc/mailfromd.texi: Created documentation framework * src/cache.c (cache_get): Do not update timestamps on each retrieval. * src/main.c (capa): Add license capability. * configure.ac (DEFAULT_SOCKET): Change default * src/Makefile.am (AM_CPPFLAGS): Define MAILFROMSTATEDIR instead of LOCALSTATEDIR (LDADD): Get rid of static linkage with libresolv * src/mailfrom.h (DEFAULT_PIDFILE,DEFAULT_DATABASE): Use MAILFROMSTATEDIR instead of LOCALSTATEDIR. * src/dns.c (_getmx): Rewritten using BIND-4-style interface. See comment to this function for the reasons of this regress. * src/main.c (check_mx_records): Bugfix. Provide default return value in case no MX records are found. (mailfromd_show_defaults): Show MAILFROMSTATEDIR 2005-06-04 Sergey Poznyakoff * Makefile.am (SUBDIRS): Add doc * configure.ac (AC_CONFIG_FILES): Add doc/Makefile * src/main.c (postmaster_email): New variable (check_on_host): Use postmaster_email instead of hardcoding <> address. (options): New option --postmaster-email; Fixed several bugs. (parse_opt): Handle --postmaster-email option. Minor fixes. * doc: New directory * doc/Makefile.am, doc/fdl.texi, doc/gendocs_template, doc/mailfromd.texi, doc/rendition.texi, doc/.cvsignore: New files. * Makefile.am: Updated for deep directory structure * configure.ac: Updated for deep directory structure. Detect DBM/NDBM/GDBM, define variables for caching. Raised version number to 0.2 * src: New directory * dns.c, daemon.c, obstack.c, obstack.h, snprintf.c, snprintf.h, mailfrom.h: Moved to ... * src/dns.c, src/daemon.c, obstack.c, src/obstack.h, src/snprintf.c, src/snprintf.h, src/mailfrom.h: here * src/Makefile.am: New file * main.c: Moved to src/ * src/main.c: Moved from ../. Added result caching and new operating modes. * src/mu_dbm.c, src/mu_dbm.h, src/strtok_r.c: New files. Exported from mailutils * src/cache.c: New file. Caching support. * .cvsignore: New file * src/.cvsignore: New file * dns.c (getmx): Do not skip hostname when checking. Handle both IP address and FQDN as input. * main.c: Implemented two methods: standard (the default) and strict (the one that was implemented initially). 2005-06-04 Sergey Poznyakoff * main.c: Rewritten action system. Documented the code. 2005-06-03 Sergey Poznyakoff * main.c (parse_opt): Ordered switch cases. (main): Switch to user's privileges only if started as root. 2005-06-03 Sergey Poznyakoff * Initial release. Local Variables: mode: change-log version-control: never End: