aboutsummaryrefslogtreecommitdiff
path: root/mfd/prog.c
AgeCommit message (Collapse)AuthorFiles
2009-06-30Bugfix.Sergey Poznyakoff1
* mfd/bi_dns.m4 (dns_getname): Missed call to MF_OBSTACK_BEGIN. * mfd/prog.c (runtime_stack_trace): Prevent coredump on arriving to pc == 0.
2009-05-12Version 5.0.94Sergey Poznyakoff1
* NEWS, configure.ac: Update. * mfd/prog.c (env_free_captured): env->bi_priv_array can be NULL.
2009-05-11Implement functional notation for reply actionsSergey Poznyakoff1
* NEWS, doc/mailfromd.texi: Update. * mfd/drivers.c (print_type_result, mark_type_result) (optimize_type_result, code_type_result): Rewrite. * mfd/gram.y: Rewrite action rules. * mfd/lex.l (CODE,XCODE): Remove. * mfd/opcodes (RESULT): Takes one immediate parameter. (instr_result): Get arguments from stack.
2009-05-11Implement some system information functions.Sergey Poznyakoff1
* mfd/bi_gethostname.m4: New file. * NEWS, doc/mailfromd.texi: Update. * mfd/Makefile.am (M4_FILES): Add bi_gethostname.m4. * mfd/bi_system.m4 (uname): New function. * mfd/prog.c (heap_obstack_cancel, heap_obstack_base): New function. * mfd/prog.h: Likewise. * mfd/snarf.m4 (MF_OBSTACK_BASE, MF_OBSTACK_CANCEL): New defuns. * mtasim/mtasim.c (stop_mailfromd): Reset signal handler before doing kill, so that waitpid works on hosts with BSD signal semantics.
2009-05-09Implement current header access functions.Sergey Poznyakoff1
* mfd/bi_curhdr.m4: New file: implementation of current header functions. * mfd/Makefile.am (M4_FILES): Add bi_curhdr.m4 * mfd/bi_mbox.m4 (mailbox_open): Work over MU lossage. * mfd/bi_msg.m4 (bi_drop_current_message): Remove. (drop_current_message): New function. * mfd/mailfromd.h (env_reposition): New prototype. * mfd/msg.h (bi_drop_current_message): Remove. * mfd/prog.c (struct eval_environ.reposition): New member. (env_reposition): New function. Work over MU lossage. (env_capture_start): Call env_free_captured to release any module private captured data. Reset env->reposition to 0. (env_capture_write): If env->reposition is set, move stream pointer to the end of stream. (struct builtin_priv.free_capture): New member. (builtin_priv_register): Take 3 arguments. (env_free_captured): New function. * mfd/prog.h (builtin_priv_register): Update proto. * mfd/snarf.m4 (MF_DECLARE_DATA): Get at most 3 arguments. * NEWS, doc/mailutils.texi: Document new functions. * tests/etc/hdr.mts: New file (message transfer session). * tests/etc/hdr2.mts: Likewise. * tests/etc/Makefile.am (EXTRA_DIST): Add new files. * tests/hdr-all.at: New testcase. * tests/hdr-cap.at: New testcase. * tests/hdr-count.at: New testcase. * tests/hdr-gete.at: New testcase. * tests/hdr-getn.at: New testcase. * tests/hdr-itr.at: New testcase. * tests/hdr-mul.at: New testcase. * tests/Makefile.am (TESTSUITE_AT): Add new testcase. * tests/atlocal.in (TESTDIR): New variable. * tests/testsuite.at (MTASIM_DEFS): New define. (AT_MTA_TEST): Rename to AT_MTA_TEST_FILTER. All uses updated. (AT_MTA_TEST_SCRIPT,AT_MTA_TEST_FILTER_SCRIPT): New defines. Include new testcases. * tests/arg.at, tests/curmsg.at, tests/numrcpt.at, tests/reject.at, tests/tempfail.at: Updated.
2009-05-07Fix exception handling code (saveex/restex).Sergey Poznyakoff1
* mfd/drivers.c (code_type_funcdecl): Exmask handling and jump fixups are handled within codegen. (code_type_progdecl): Update call to codegen. * mfd/gram.y (codegen): Take an extra argument specifying the exception mask to handle. Unless it is zero, code saveex/restex pair around the main code. This makes sure local allocations do not disturb exception handling code. Also, take care of jump fixup here. (mailfromd_test): Fix bug in numeric argument passing. * mfd/prog.c (instr_saveex): Provide additional debugging diagnostics (temporary). (dump_saveex): Fix retrieving of the exmask (seftover from earlier version). (instr_memstk, instr_xmemstk, instr_deref) (instr_ston, instr_ntos, instr_cmp) (instr_logand, instr_logor, instr_logxor) (instr_add, instr_sub, instr_mul) (instr_div, instr_regex, instr_regcomp) (instr_funcall): Make sure PC and stack adjustments occur after outputting trace info.
2009-04-19Do not use RFC822 filter.Sergey Poznyakoff1
* mfd/bi_sa.m4 (write_822): New function to replace MU's "rfc822" filter, which is a pile of junk (sorry). Improves performance, besides. (spamd_send_stream): Use write_822 instead of the filter. See above. * mfd/engine.c: Fix comment. * mfd/mailfromd.h (mem_search): New proto. * mfd/prog.c (env_capture_write): Use mem_search.
2009-04-18Fix CRLF/LF inconsistencies. Fix bug in SAVEEX/RESTEX.Sergey Poznyakoff1
* mfd/prog.c (instr_restex): Bugfix. Use pop to restore catch addresses. This also fixes the resulting tos value. * mfd/bi_body.m4 (current_message): Use mf_stream_to_message * mfd/bi_sa.m4 (spamd_send_stream): Return int. Recode delimiters to "\r\n". (sa): Check return from spamd_send_stream. Adjust reported stream size. (clamav): Check return from spamd_send_stream. * mfd/bi_sieve.m4 [MAILUTILS_VERSION_NUMBER < 1290]: Remove * mfd/mailfromd.h (env_get_line_count, mf_stream_to_message): New functions. * mfd/prog.c (struct eval_environ.line_count): New member. (env_get_line_count): New function. (env_capture_start): Init eval_environ.line_count (env_capture_write): Recode "\r\n" -> "\r". Update eval_environ.line_count. * mtasim/mtasim.c (send_body): New function. (smtp): Use CRLF as line terminator in message body. * pmult/pmult.c (collect_headers): strip off \r's.
2009-03-12Fix the current_message function and subprocess handling in mtasim.Sergey Poznyakoff1
* mtasim/mtasim.c (stop_mailfromd): Wait for the mailfromd child to terminate and analyze its return status. * mfd/bi_msg.m4 (bi_drop_current_message): New function. * mfd/prog.c (env_capture_start): Call bi_drop_current_message if the capture stream already exists (i.e. when starting processing 2nd or later message in a session). * mfd/msg.h (bi_drop_current_message): New prototype. * gacopyz/server.c (srv_connect): Retry attempts to connect if they fail with ECONNREFUSED. Implement 5-second timeout. * tests/testsuite.at (MAILFROMD_OPTIONS): New define. (AT_MTA_TEST): Pass MAILFROMD_OPTIONS to mtasim invocation. (AT_WITH_MAILFROMD_OPTIONS): New macro. Include curmsg.at. * tests/curmsg.at: New file * tests/etc/Makefile.am (RCFILES): Add size.rc * tests/etc/size.rc: New file git-svn-id: file:///svnroot/mailfromd/trunk@1779 7a8a7f39-df28-0410-adc6-e0d955640f24
2009-03-11Minor fixes.Sergey Poznyakoff1
* mfd/prog.c (env_get_macro, instr_symbol): Minor fixes (env_capture_start): Seek to 0 after truncating the stream. Mailutils should know better and do it automatically. git-svn-id: file:///svnroot/mailfromd/trunk@1778 7a8a7f39-df28-0410-adc6-e0d955640f24
2009-03-10BugfixesSergey Poznyakoff1
* mfd/prog.c (env_capture_start): Do not create the stream if it already exists. Bug reported by Con Tassios. * mfd/bi_sieve.m4 (sieve): Don't free unexistend Sieve machines. * THANKS: Update * NEWS: Update git-svn-id: file:///svnroot/mailfromd/trunk@1777 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-11-28Add const qualifiers to gacopyz_getsymval, gacopyz_replace_body andSergey Poznyakoff1
derived functions. git-svn-id: file:///svnroot/mailfromd/trunk@1765 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-11-09Add built-in functions for accessing Sendmail macros.Sergey Poznyakoff1
* mfd/mailfromd.h (env_get_macro): New proto. * mfd/prog.c (env_get_macro): New function. * mfd/bi_macro.m4: New file. * mfd/Makefile.am (M4_FILES): Add bi_macro.m4. * NEWS: Update. * doc/mailfromd.texi (Macro access): New subsubsection. git-svn-id: file:///svnroot/mailfromd/trunk@1729 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-09-20Improve stack memory management.Sergey Poznyakoff1
* mfd/gram.y (strtosize, get_stack_max, get_stack_incr) (get_stack_size): New functions. (pragma_stacksize): Rewrite. Take maximum stack size as an optional third argument. * mfd/mailfromd.h (stack_max_size): New declaration. (stack_max_size): New function. (expand_dataseg): Signal exception if new memory size would be greater than the stack size limit. * NEWS, doc/mailfromd.texi: Update. git-svn-id: file:///svnroot/mailfromd/trunk@1678 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-09-19Implement two stack growth policies.Sergey Poznyakoff1
* mfd/gram.y (pragma_stacksize): Implement two stack growth policies. * mfd/mailfromd.h (enum stack_expand_policy): New enum. (stack_expand_incr, stack_expand_policy): New global variables. * mfd/prog.c (stack_expand_incr) (stack_expand_policy): New global variables. * NEWS: Update. * doc/mailfromd.texi (stacksize): Document changes to pragma stacksize. * doc/values.texi (STACK-INCR): New value. git-svn-id: file:///svnroot/mailfromd/trunk@1676 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-09-16* mfd/bi_getopt.m4 (getopt): Use | as a short/long optionSergey Poznyakoff1
separator. Make sure optind/optarg are set before returning EOF. * mfd/gram.y (mailfromd_run): Remove superfluous call to env_leave_frame. * mfd/drivers.c (mark_type_argx, mark_type_vaptr): New functions. * mfd/prog.c (env_vaptr): Cast the result. * mfd/main.c (argpflag): Understand abbreviated forms of the --run option. * mfd/bi_db.m4 (dbfirst, dbnext, dbkey, dbvalue): New functions (proof of concept). git-svn-id: file:///svnroot/mailfromd/trunk@1670 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-09-16Implement functions with variable number of arguments and 'run' mode.Sergey Poznyakoff1
* mfd/symtab.c (function_install): Take additional argument. * mfd/lex.l: New tokens `vaptr', `...' and ARGX. * mfd/snarf.m4 (MF_VASTRING): New define. * mfd/gram.y: Handle functions with variable number of arguments, $(expr), and vaptr() expressions. This raises shift/reduce expectation to 29 conflicts. (parmtype_function): Return dtype_string for arguments from vararg list. (FUNC_HIDDEN_ARGS): Return 1 if f->varargs is set. (type_to_string): Handle pointer argument. (function_call): Handle function->varargs. (node_type): Handle node_type_argx, and node_type_vaptr. (cast_arg_list): Handle variable number of arguments. (cast_to): Handle dtype_pointer as dtype_number. * mfd/drivers.c (argx, vaptr): New node types. (code_type_call): Handle variable number of arguments. (code_cast): Handle dtype_pointer as dtype_number. * mfd/mailfromd.h (MAILFROMD_RUN): New define. (struct argx_node): New type. (struct node): Add argx_node. (struct function): New member `varargs'. (function_install): Add varargs. (mailfromd_run): New prototype. * mfd/prog.c (env_vaptr, env_get_reg): New functions. (env_make_frame0): New function. (instr_xmemstk): New instruction handler. * mfd/opcodes (XMEMSTK): New opcode. * mfd/prog.h (env_get_reg, env_vaptr): New protos. * mfd/main.c (options): New option `--run'. (main): Handle `run' mode. * mfd/Makefile.am (M4_FILES): Add bi_getopt.m4. * NEWS: Update. git-svn-id: file:///svnroot/mailfromd/trunk@1669 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-09-08* mfd/prog.c (instr_stkalloc): Expand stack segment if needed.Sergey Poznyakoff1
git-svn-id: file:///svnroot/mailfromd/trunk@1660 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-06-22Minor fixes.Sergey Poznyakoff1
* doc/mailfromd.texi: Fix a typo. * mfd/prog.c: Fix comment. * gacopyz/server.c: Fix erroneous range checking condition. git-svn-id: file:///svnroot/mailfromd/trunk@1656 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-05-15Fixup C variables that point to dataseg after expanding it.Sergey Poznyakoff1
Bug reported by Sergey Afonin. * mfd/snarf.m4 (mf_c_argdcl): Produce only C declarations. (mf_c_arginit): New macro. (__mf_c_argdcl_list,__mf_c_arginit_list): New auxiliary macros. (__mf_c_arglist): Rewrite using the above macros. (mf_c_arglist,MF_VA_ARG): Reflect changes to get_.*_arg functions. * mfd/bi_sprintf.m4: Update invocations of MF_VA_ARG. * mfd/prog.c (struct eval_environ): New members auto_ptr and numautos. (env_register_auto, env_unregister_autos, env_fixup_autos): New functions. (expand_dataseg): Call env_fixup_autos. (get_literal, get_string_arg): Change signature. Call env_register_auto. All callers updated. (get_numeric_arg): Change signature for consistency with other get_ functions. All callers updated. (get_pointer_arg): New function. (eval_environment): Call env_unregister_autos after running each instruction. * mfd/prog.h (get_pointer_arg): New function. (get_string_arg, get_numeric_arg): Change prototypes. * mfd/bi_sieve.m4: Minor stylistic fix. * NEWS: Update. * mfd/drivers.c (code_cast): Handle dtype_pointer git-svn-id: file:///svnroot/mailfromd/trunk@1655 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-04-02Add new MFL datatype `POINTER' and convert `body' handler toSergey Poznyakoff1
take first argument of that type. Provide a function for converting POINTER to STRING. * mfd/Makefile.am (M4_FILES): Add bi_body.m4 * mfd/bi_body.m4: New file. * mfd/engine.c (mlfi_body): Pass bodyp as a generic pointer. * mfd/snarf.m4 (__mf_argtype, __mf_ctype, __mf_c_getarg) (__mf_printf_type): Handle new data type POINTER. * mfd/gram.y (state_parms): Change type of the first parameter to body to dtype_pointer. (cast_to): Handle dtype_pointer. * mfd/mailfromd.h (data_type_t): New type dtype_pointer. (env_push_pointer): New function. * mfd/prog.c (env_push_pointer): New function. * mfd/prog.h (get_pointer_arg): New macro. * NEWS: Update. Bugfixes: * mtasim/mtasim.c (get_input_line): Make sure the return line always terminates with a newline. (smtp): Remove erroneous break. * mfd/symtab.c (variable_replace): Maintain correct value of newvar->owner. * mfd/pp.c (push_source): Prevent coredump on the first call. git-svn-id: file:///svnroot/mailfromd/trunk@1648 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-03-10Port r1632 of branches/release_4_3_patches.Sergey Poznyakoff1
git-svn-id: file:///svnroot/mailfromd/trunk@1634 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-03-01Ported r1619 from branches/release_4_3_patches.Sergey Poznyakoff1
* src/prog.c, src/prog.h (advance_pc): Fix type of the 2nd argument. * configure.ac: Use AC_TRY_LINK to check for libresolve. * THANKS: Update * NEWS: Update git-svn-id: file:///svnroot/mailfromd/trunk@1620 7a8a7f39-df28-0410-adc6-e0d955640f24
2008-02-10Merged HEAD from branches/gmachSergey Poznyakoff1
git-svn-id: file:///svnroot/mailfromd/trunk@1612 7a8a7f39-df28-0410-adc6-e0d955640f24

Return to:

Send suggestions and report system problems to the System administrator.