aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFiles
2022-10-10BugfixesSergey Poznyakoff1
* doc/mailfromd.texi: Minor changes. * mfmod/template.mfl (libname,libh): Mark internal variables as static. * src/builtin/mfmod.bi (dlcall): Initialize varargs.
2022-10-06Improve dlcall interfaceSergey Poznyakoff2
* doc/mailfromd.texi: Document changes. * src/builtin/mfmod.bi (dlcall): Last symbol in the type string can be '+' or '*', indicating optional arguments. * src/prog.c (env_final_gc): Fix memory leak. * tests/mfmod_echo.c (sum): New function. * tests/mfmod03.at: New test. * tests/Makefile.am: Add new test. * tests/testsuite.at: Include new test.
2022-10-04BugfixesSergey Poznyakoff2
* elisp/mfl-mode.el (mfl-keywords): Add dclex. * src/builtin/io.bi (open_program_stream_ioe): Run the command via $SHELL -c. * src/prog.c (run_startup): Fix size calculation.
2022-10-03Fix typos in diagnostic messagesSergey Poznyakoff1
2022-09-30mfmod: export functions for checking argument counts and typesSergey Poznyakoff3
* Makefile.am [MFMOD_COND] (mfmod): Include conditionally. * doc/mailfromd.texi: Document new functions and macros. * mfmod/Makefile.am (pkginclude_HEADERS): Install mfmod.h * src/mfmod.h: move to mfmod/mfmod.h (mfmod_data_type_str,mfmod_error) (mfmod_error_argtype): New protos. (ASSERT_ARGCOUNT,ASSERT_ARGTYPE): New macros. * mfmod/template.c: Use new macros. Improve docs. * src/Makefile.am [MFMOD_COND] (mailfromd_LDFLAGS): Use -export-dynamic * src/builtin/mfmod.bi (mfmod_data_type_str,mfmod_error) (mfmod_error_argtype): New functions. * tests/mfmod_echo.c: Use new macros. * tests/mfmod02.at: New test. * tests/Makefile.am: Add new test. * tests/testsuite.at: Likewise. * mfmod/template.mfl: Use new syntax (prog startup).
2022-09-30Minor fix in lex scannerSergey Poznyakoff2
* src/lex.l: Check for eventual errors during numeric conversions. * src/Makefile.am: Remove reference to unused variable.
2022-09-28New syntax for special handlersSergey Poznyakoff2
Special handlers are defined using the "prog" keyword, as the rest of handlers. This fixes, in particular, a name clash between the 'shutdown' handler and eponymous function. This commit also restores handling of identifiers after 'require' and initial 'from' keywords, which was inadvertently lost long ago (commit bd6d33fe0). Perhaps it wasn't needed so much, but for the time being let it be. * NEWS: Document changes. * doc/mailfromd.texi: Likewise. * doc/upgrade.texi: Likewise. * etc/Makefile.am: Fix the lint rule. * mflib/callout.mf4: Use new syntax for "begin". * src/gram.y: Support new syntax for special handler definitions/ Remove tokens: T_BEGIN, T_STARTUP, T_SHUTDOWN, T_END. Correctly report state handler duplications. * src/lex.l: Swich to XIDENT state after 'prog', 'require' and initial 'from'. Remove unneeded tokens. Use strtol instead of strtoul to parse numeric constants. * tests/progdup.at: New test. * tests/progobs.at: New test. * tests/progord.at: New test. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Run new tests.
2022-09-26Fix running startup handlers in daemon mode.Sergey Poznyakoff1
* lib/libmf.h (mf_epriv_setup): Remove proto. (mf_server_startup_hook): New extern. * lib/server.c (mf_server_startup_hook): New global. (mf_server_start): Call mf_server_startup_hook after switching to user privileges and eventually daemonizing. * lib/userprivs.c (mf_epriv_setup): Remove unused function. * src/main.c: In daemon mode, make sure run_startup is run as mf_server_startup_hook.
2022-09-25New special handlers: startup and shutdownSergey Poznyakoff9
* NEWS: Document changes * doc/mailfromd.texi: Document changes * elisp/mfl-mode.el: Support for the "startup" and "shutdown" keyword. * mfmod/template.mfl: Load the library in the startup handler. * src/builtin/mfmod.bi: Use static variable for keeping modinfo of the loaded modules. This allows for using dlopen in startup handlers. * src/gram.y: Support for startup and shutdown handlers. (print_syntax_tree): Print special handlers as well. (state_parms): Update. (string_to_state,state_to_string): Rewrite. * src/lex.l (startup): New keyword. * src/mailfromd.h (smtp_state_startup) (smtp_state_shutdown): New states. (smtp_state_first): Redefine. All uses changed. (smtp_state_last): New state marker. States between smtp_state_first and smtp_state_last (both inclusive) are proper SMTP states, as distinguished from "special" states (startup, shutdown, begin, end). (struct function) <refstart>: New field. Start of the entry point reference chain. (struct progdecl) <tree>: Change type to stmtlist. Keep both head and tail of the list to facilitate merging special handlers. * src/main.c (main): Run startup handlers. * src/prog.c (run_startup): New function. (print_code): Print special handlers as well. * src/prog.h (run_startup): New proto. * src/drivers.c (code_type_call): If func->entry is NULL, the function has not been compiled yet. Keep a list of entry point references in func->refstart. (code_type_funcdecl): Resolve function entrypoint references. (code_type_progdecl): Don't check for redefinition here, it is done in the progspecial production now. * src/engine.c (first_used_state): Initialize to smtp_state_none. * lib/srvman.c (server_run): Cleanup mailutils onexit list in child.
2022-09-22Minor fixSergey Poznyakoff1
* src/engine.c: Include prog.h (for declaration of adjust_stack)
2022-09-21Unify prog and func code generation. Fix stack trace generation.Sergey Poznyakoff4
* doc/mailfromd.texi: Document $3 in catch handlers. * src/drivers.c (code_type_try): Mark the locus of the "catch" statement. * src/engine.c (xeval): Create a proper frame before evaluating the starting point. (mlfi_connect, mlfi_helo, mlfi_envfrom) (mlfi_envrcpt, mlfi_data, mlfi_header) (mlfi_eoh, mlfi_body, mlfi_eom): Remove calls to toe env_make_frame/env_leave_frame. Use adjust_stack to clean-up the stack space. * src/gram.y (parmcount_catch): Change returned argument count. (parmtype_catch): Handle third argument. (codegen): Remove the finalize parameter. The code for each handler follows normal layout for functions. (mailfromd_test,mailfromd_run): Add missing calls to env_init. Remove calls to env_make_frame/env_leave_frame. (create_node_arg): Return NULL node on error. * src/prog.c (stack_trace_entry): Rewrite. (instr_throw): Don't adjust pc before calling env_throw_0. (instr_retcatch): Clean up three arguments. (env_throw_0): Pass original pc (where the exception occurred) as third argument to handler. * tests/strace.at: New test. * tests/Makefile.am: Add new test. * tests/testsuite.at: Likewise.
2022-09-20Preserve initial pc when running begin handler in the "run" mode.Sergey Poznyakoff2
This fixes bug introduced in 18ca63bd5a. * src/gram.y (mailfromd_run): Run smtp_state_begin in its own frame. * src/prog.c (env_make_frame): Push pc without incrementing it. (instr_return): Don't adjust pc after env_leave_frame.
2022-09-20Change default MFL source suffix to .mfl; introduce separate module pathSergey Poznyakoff13
* NEWS: Document changes. * doc/mailfromd.texi: Document changes. * mfmod/Makefile.am: Rename template.mf to template.mfl * mfmod/mfmodnew.c: Likewise. * mfmod/mfmod.m4: Define MFMODDIR to the installation directory for MFL interface module files. * mfmod/template.ac: Remove AC_CONFIG_COMMANDS * mfmod/template.am: Use .mfl suffix for the interface module. * mfmod/template.mf: Rename to mfmod/template.mfl Change include and module path ordering * src/pp.c (include_path, module_path): Move version-specific directory to the last place in the path. Revise the preprocessor configuration. * src/lex.l: Use preprocessor.enabled. * src/mailfromd.h (ext_pp): Remove extern. (preprocessor): New struct and extern. (preprocessor_cfg_init,string_preprocessor) (preprocessor_finalize): New protos. (alloc_ext_pp): Remove. * src/main.c (ext_pp): Remove glabal. (opt_clear_ext_pp): Rename to opt_disable_preprocessor & rewrite, (opt_preprocessor): New callback. (opt_define,opt_undefine): Take into account preprocessor.pass_defines setting. (--preprocess option): Argument is optional. The use without argument is intended to override the preprocessor.enabled setting. New configuration statements: "module-path" and "preprocessor". (string_preprocessor): Remove the static qualifier. * src/pp.c (preprocessor): New global. (preprocessor_cfg_init): New function. (alloc_ext_pp): Remove (preprocessor_finalize): New function. (stderr_redirector): Run preprocessor via sh -c Introduce separate module search path * Makefile.am (distuninstallcheck_listfiles): Ignore mailfromd.mfl (complements 0fca940acc). * mflib/Makefile.am (moddir): New directory. (mod_DATA): Add $(MFL_FILES). (EXTRA_DIST): Add $(mod_DATA) (MFL_LINT_0): Use -M option instead of -I. * src/Makefile.am (AM_CPPFLAGS): Define DEFAULT_MODDIR and DEFAULT_VERSION_MODDIR instead of DEFAULT_INCLUDE_DIR and DEFAULT_VERSION_INCLUDE_DIR. * src/mailfromd.h (pathbuf): New struct. (PATHBUF_INITIALIZER): New macro. (pathbuf_add): New proto. (include_path,module_path): New externs. (print_include_path,add_include_dir): Remove. * src/main.c (opt_include_dir): Remove. (opt_path_add): New function. (mailfromd_options): New option: --module (-M) (cb_include_path): Removed. (cb_pathbuf_add): New function. (string_values): Change definition of "include path". Add "module path". * src/pp.c (pathbuf_add): New function. (include_path, module_path): New variables. (try_file): Take pointer to struct pathbuf as third argument. All uses updated. (require_module): Look for the module in module search path first. If not found, try include path and issue a warning. (add_include_dir,print_include_path): Remove. * tests/atlocal.in (MFOPTS): Use -M instead of -I. * tests/testsuite.at (MAILFROMD_OPTIONS): Likewise. Fix the output of mailfromd --show-defaults * src/mailfromd.h (print_include_path): New proto. * src/main.c (string_value): New field: data.s_print, a callback for printing the data directly to the output stream. (string_values): New entries: "script file search path" and "include path". (print_string_values): Use s_print for STRING_FUNCTION type. (mailfromd_show_defaults): Disable wordwrap stream for mailutils versions prior to 3.16 * src/pp.c (print_include_path): New function.
2022-09-15Fix scanning of multiline replies in calloutSergey Poznyakoff1
* src/callout.c (smtp_io_data): New fields: last_sent and last_recv (smtp_io_state_restore): Clear the last_* fields. (smtp_io_free): Free the new fields. (smtp_send): Clear the last_* fields. (smtp_recvline): Coalesce memory region before returning. Fix starting address and size calculation for the case when the reply was obtained in several iterations. (first_line_of): Return allocated copy of the string, (smtp_last_sent,smtp_last_received): Cache allocated copy.
2022-09-15Fix eventual access to freed memory region in gethostbynameSergey Poznyakoff1
2022-09-13Change TLS priorities default value; document TLS configurationSergey Poznyakoff2
* doc/mailfromd.texi: Document the tls configuration section * src/srvcfg.c (tls_conf.priorities): Change default.
2022-09-13Restart callout connection if STARTTLS fails.Sergey Poznyakoff1
* src/callout.c (smtp_io_reopen): New function. (callout_io): Abort current connection if STARTTLS fails. If in tls_always mode, attempt to restart it afterwards.
2022-09-13Configurable TLS for calloutSergey Poznyakoff3
* src/callout.c (callout_io): Pass tls_conf to mu_starttls. * src/srvcfg.c (tls_conf): New global. (srv_cfg_param): New configuration statement "tls". (mf_srvcfg_init): Call mu_tls_cfg_init() * src/srvcfg.h (tls_conf): New extern.
2022-09-12Support for STARTTLS in callout.Sergey Poznyakoff7
* NEWS: Document changes. * doc/calloutd.texi: Likewise. * doc/functions.texi: Likewise. * configure.ac: Check if libmailutils supports GnuTLS. * mflib/callout.mf4 (callout_setvars): Pass STARTTLS * src/builtin/callout.bi (callout_starttls): New function. * src/builtin/debug.bi (callout_transcript): Move to callout.bi. * src/callout.c (smtp_io_state): Remove the "start" field. (smtp_io_data): Remove "esmtp_capa". Add "tls" and "capa"; (smtp_io_setup_callout): Take additional argument specifying how and when to use STARTTLS command. (smtp_recvline): Append the line to the string being constructed. Return it and its length in memory locations supplied by the arguments. All callers updated. (callout_io): Collect ESMTP capabilities. Support STARTTLS. * src/callout.h (smtp_starttls_t): New typedef. (smtp_use_tls): New external variable. (smtp_str_to_starttls,smtp_starttls_to_str): New functions. * src/savsrv.c (addq,cmd_set): Support for the STARTTLS variable. * src/srvcfg.c (smtp_use_tls): New global. (srv_cfg_param): New statement: smtp-starttls
2022-09-11RSET during callout shouldn't affect the result of the check.Sergey Poznyakoff1
* src/callout.c (smtp_io_state): New struct. (smtp_io_data): Pack send/recv related fields into smtp_io_data. All uses changed. (reset): Preserve original state no matter what the reply of RSET.
2022-09-07Fix discrepancy between normal operation and "run" mode.Sergey Poznyakoff3
In run mode, main was called with the return pc value 0 in the calling frame. This means that stopping the program relied on two unsigned wraparounds: first when decrementing the return pc in instr_return, and second when incrementing it again in the eval_environment loop. As a side effect, this made runtime_stack_trace go astray and coredump when used in run mode. This commit reserves the slot at pc 1 as return point for "main" in run mode and thus fixes the discrepancy. NB: Another way to fix it would be to rewrite the loop in eval_environment. But that doesn't seem to be worth the candles. * src/gram.y (parse_program): Remove call to code_immediate - out of place here. (compile_tree): Reserve two pc slots: 0 as emergency return point and 1 as return point for the "main" function. (mailfromd_run): Call env_make_frame instead of env_make_frame0. * src/mailfromd.h (env_make_frame0): Remove prototype. * src/prog.c (env_make_frame0): Remove function.
2022-09-07Fix coredump when printing tree for ARGVSergey Poznyakoff1
* src/drivers.c (print_type_argv): Check if node is not NULL before attempting to descend into it.
2022-09-06Improve the docsSergey Poznyakoff1
2022-09-06Improve the mfmod interfaceSergey Poznyakoff3
* mflib/.gitignore: Ignore exceptions.h * mflib/Makefile.am (status.ex): Removed. (exceptions.h): Installable target. * mflib/mfex.awk: Produce a valid include file. * mflib/status.mf (e_inval): New exception code. * mfmod/mfmodnew.c: Check if the proposed module name is valid. * src/builtin/mfmod.bi: Support for mfmod_message dtat type. (dlcall): The library function is allowed to return arbitrary mailfromd exception number. retval->string can in this case be used to supply the descriptive string. (dlresult_message): New function. * src/mailfromd.h: Include mflib/exceptions.h * src/mfmod.h (mfmod_message): New data type. (mfmod_param): New union field: message
2022-09-04Version 8.14.91: New utility for creating mfmodsSergey Poznyakoff2
2022-09-01Honor begin and end sections when called with --run as well.Sergey Poznyakoff1
* src/gram.y (mailfromd_run): Run begin and end sections.
2022-09-01Document mfmod.hSergey Poznyakoff1
2022-08-31BugfixSergey Poznyakoff1
* src/drivers.c (code_type_builtin): Restore argument count correction accidentally lost in previous commits.
2022-08-31Fix stack adjustment when return from a function is ignoredSergey Poznyakoff3
* src/drivers.c (code_type_builtin): Adjust stack if node->value_ignored is set. (code_type_call): Don't call pushreg if node->value_ignored is set. * src/gram.y: Set value_ignored to 1 if return value from a function was ignored. (alloc_node): Set value_ignored to 0. * src/mailfromd.h (node): New field: value_ignored. * tests/ignoreret.at: New test. * tests/numck.c: New option -c (set comment starter). * tests/testsuite.at: Include new test.
2022-08-31Fix passing argument list with $@(N) at the end.Sergey Poznyakoff1
The corner case covered by this commit is when the argument list is passed to a function with at least one mandatory argument, and that argument is given as a result of another function call. * src/drivers.c (code_args_shifted): New function. (code_type_builtin, code_type_call): Use it. * tests/shiftadj.at: New test. * tests/Makefile.am: Include new test. * tests/testsuite.at: Likewise.
2022-08-31Minor optimizationSergey Poznyakoff1
* src/drivers.c (code_type_builtin, code_type_call): node_type_argv can appear only at the head of the reversed argument list.
2022-08-31Fix stack adjustment after function calls.Sergey Poznyakoff3
* src/drivers.c (code_type_call): Pass formal parameter count as inline argument to adjustx. * src/opcodes (ADJUSTX): Expect one argument. * src/prog.c (instr_adjustx): Take formal parameter count as inline argument. Use it if the actual number of arguments is less than that. * tests/Makefile.am (TESTSUITE_AT): Add stkadj.at (noinst_PROGRAMS): Build numck. * tests/numck.c: New program. * tests/testsuite.at: Include stkadj.at * tests/trycatch05.at: Use numck. * tests/trycatch06.at: Likewise. * tests/trycatch07.at: Likewise. * tests/trycatch08.at: Likewise. * tests/trycatch09.at: Likewise. * tests/trycatch10.at: Likewise. * tests/trycatch11.at: Likewise. * tests/trycatch12.at: Likewise. * tests/trycatch13.at: Likewise. * tests/trycatch14.at: Likewise. * tests/trycatch15.at: Likewise. * tests/trycatch16.at: Likewise.
2022-08-31Fix stack adjustment after a call to a variadic functionSergey Poznyakoff3
* src/drivers.c (code_type_call): Code adjustx instruction after variadic function or function with optional arguments. * src/opcodes (ADJUSTX): New instruction. * src/prog.c (instr_adjustx): New function.
2022-08-30Fix improper wordsplit usageSergey Poznyakoff2
* src/builtin/mfmod.bi: MU_WRDSF_DELIM alone can't be used, it also needs WRDSF_NOCMD|WRDSF_NOVAR (unless command anv variable handlers are provided). * src/builtin/geoip2.bi: Likewise.
2022-08-30Look up mfmod files in a predefined set of directoriesSergey Poznyakoff4
* src/builtin/Makefile.am (AM_CPPFLAGS): Define MFMODDIR * src/builtin/mfmod.bi (mfmod_path): New variable. (mfmod-path): New configuration statement. (dlopen): Look up the library in mfmod_path. * src/mailfromd.h (mfmod_path): New extern. * src/main.c (string_values): New entry: "mfmod path". (mailfromd_show_defaults): Don't use wordwrap stream if piping or redirecting the output.
2022-08-30Implement shifted $@Sergey Poznyakoff5
* NEWS: Document changes. * doc/mailfromd.texi: Document changes. * src/drivers.c (code_type_builtin, code_type_call) (code_type_argv): Generate code for shifts. * src/gram.y: new construct: $@(N) - shift N arguments and pass remaining to the argument list. * src/mailfromd.h (argv_node): New member: node. * src/opcodes: Restore DUP. * src/prog.c (instr_dup): New instruction. (instr_dupn): Count is signed. Throw a runtime error if it is negative. * tests/vapass.at: New tests.
2022-08-30BugfixSergey Poznyakoff2
* src/drivers.c (code_type_builtin): Adjust passed number of parameters.
2022-08-29Implement the $@ operatorSergey Poznyakoff6
* NEWS: Document $@ * doc/mailfromd.texi: Document $@ * src/drivers.c: New data type: argv ($@) (code_type_call): Take into account eventual $@. * src/gram.y: Support for $@ * src/lex.l: New token: $@ * src/mailfromd.h (struct argv_node): New data type. (struct node): Add struct argv_node member. * src/opcodes (DUP): Remove unused opcode. (DUPN): New opcode. * src/prog.c (instr_dup): Remove, (instr_dupn): New instruction. * tests/Makefile.am: Add new test. * tests/testsuite.at: Include new test. * tests/vapass.at: New test. * tests/atlocal.in: Fix typo.
2022-08-28Support for dynamically loaded modulesSergey Poznyakoff6
* NEWS: Update. * configure.ac: Check for dlopen. New option: --enable-mfmod. * global.def (MAX_MFMODS): New constant. * src/Makefile.am (mailfromd_LDADD): Add libraries needed for dlopen. (pkginclude_HEADERS): Add mfmod.h * src/builtin/.gitignore: Update. * src/builtin/Makefile.am: Add mfmod.bi * src/builtin/mfmod.bi: New file. * src/main.c (mailfromd_show_defaults): Reflect mfmod status. * src/mfmod.h: New file. * tests/mfmod01.at: New file. * tests/mfmod_echo.c: New file. * tests/testsuite.at: Include new test. * tests/Makefile.am: Build mfmod_echo.la Add new test. * tests/atlocal.in (MFMOD_SUPPORT): New variable.
2022-08-23BugfixSergey Poznyakoff1
* src/builtin/dns.bi (dns_reply_entry_ok): New function. Replace all uses of dns_reply_entry_unused with calls to dns_reply_entry_ok.
2022-08-17BugfixSergey Poznyakoff1
* src/dkim.c (dkim_result_trans): Add translation for DKIM_EXPL_BAD_KEY_TYPE.
2022-08-14Remove deprecated configuration statements: lock-retry-count and ↵Sergey Poznyakoff3
lock-retry-timeout Use the "locking" configuration statement instead: <https://mailutils.org/manual/html_node/locking-statement.html>
2022-08-14Remove obsolete features: legacy GeoIP and DSPAMSergey Poznyakoff6
2022-08-11New DKIM explanation code: DKIM_EXPL_BAD_KEY_TYPESergey Poznyakoff2
* NEWS: Document changes. * doc/functions.texi: Document changes. * mflib/status.mf: Implement new explanation code. * src/dkim.c: Likewise. * src/dkim.h: Likewise.
2022-08-10Support for CNAME chains (RFC 1034, section 3.6.2)Sergey Poznyakoff2
* NEWS: Document changes. * doc/mailfromd.texi: Likewise. * lib/dns.c (dnsbase_finish): Reset state to NULL. (dnsbase_real_init): Install dnsbase_finish to be called on exit. (dns_max_cname_chain): New global. (dns_query): New function. (all functions: Use dns_query instead of adns_synchronous. (dnsbase_init): Install the "resolver" canned section. * lib/libmf.h (dns_max_cname_chain): New extern. * src/calloutd.c: Add the "resolver" configuration section. * src/main.c: Likewise. * tests/resolv.c: New option -c sets dns_max_cname_chain. * tests/resolv_cnamechain.at: New test. * tests/Makefile.am: Add new test. * tests/testsuite.at: Add new test.
2022-08-09Support for rsa-sha1 in DKIMSergey Poznyakoff3
* NEWS: Document changes. * src/builtin/dkim.bi (dkim_sign): New optional argument: algo. (dkim_signing_algorithm): New global variable. (dkim_verify): Initialize dkim_signing_algorithm. * src/dkim.c (dkim_ctx): New struct (dkim_ctx_init,dkim_ctx_digest) (dkim_ctx_update,dkim_ctx_sign,dkim_ctx_verify): New static functions to manage dkim_ctx. All functions: use dkim_ctx instead of the algorithm-specific context. (dkim_algo): New function. (mfd_dkim_verify): Take third argument: return storage for the algorithm name. * src/dkim.h (dkim_algorithm): New enum. (DKIM_ALGO_DEFAULT): New define. (DKIM_ALGORITHM): Remove. (dkim_algo_str): New extern. (dkim_algo): New proto. (dkim_signature) <algo>: New field. (mfd_dkim_verify): Change signature.
2022-08-04Fix inconsistency in checking stream validitySergey Poznyakoff1
* src/builtin/io.bi (io_stream_is_avail): New static function. (io_find_avail, io_get_open_stream): Use io_stream_is_avail. (tempfile): Initialize ios->name. * tests/tempfile.at: New test file. * tests/Makefile.am: Add new test. * tests/testsuite.at: Include new test.
2022-08-03Fixes in the spawn built-inSergey Poznyakoff1
2022-08-02Major rewrite of the I/O code.Sergey Poznyakoff10
* src/prog.h (cleanup_when): New enum. (env_cleanup_list_append,env_function_cleanup_del) (env_function_cleanup_flush): Change signature. * src/prog.c (environ_cleanup_closure) <when>: New field. (eval_environ) <environ_cleanup_list>: Remove. (_cleanup_compare): Compare both when and data. (env_cleanup_list_append): Take additional 'when' argument. (env_function_cleanup_del): Likewise. (env_function_cleanup_flush): Rewrite. (env_throw_0): Call env_function_cleanup_flush with when=CLEANUP_THROW. * src/builtin/snarf.m4 (MF_DCL_CLEANUP): Takes two to three arguments. (MF_CLR_CLEANUP): Takes two arguments. (MF_CLEANUP): Removed. * src/builtin/io.bi: Major rewrite. (struct io_stream): fd[2] replaced with fd. New field strout points to the output stream for program streams. Revise error handling. Make sure current stream gets properly cleaned up if an attempt to open it fails with an exception. (get_output): New MFL function, Returns the descriptor of the output stream, if there's any, or -1 otherwise. * src/builtin/burst.bi: Use new versions of CLEANUP macros. * src/builtin/dspam.bi: Likewise. * src/builtin/filter.bi: Likewise. * src/builtin/msg.bi: Likewise. * src/builtin/sa.bi: Likewise. * src/builtin/sieve.bi: Likewise.
2022-08-02Bugfix in primitive_has* functionsSergey Poznyakoff1
* src/builtin/dns.bi (primitive_hasmx) (primitive_hasns): Free the reply only if it has been actually allocated.

Return to:

Send suggestions and report system problems to the System administrator.