summaryrefslogtreecommitdiff
path: root/libmailutils
AgeCommit message (Collapse)AuthorFiles
2024-01-06Update copyright yearsSergey Poznyakoff571
2023-06-09Add missing includesSergey Poznyakoff1
2023-05-09Fix global timeout and transcript statements in pop3d and imap4d.Sergey Poznyakoff1
* include/mailutils/server.h (mu_m_server_config_default_fp): New data type. (mu_m_server_set_config_default): New prototype. * libmailutils/server/msrv.c (_mu_m_server): New field: config_default. (mu_m_server_set_config_default): New function. (mu_m_server_listen): If config_default is initialized, call it to initialize the pconf structure. * imap4d/imap4d.c (imap4d_connection): Don't reset idle_timeout and imap4d_transcript. (imap4d_config_default): New function. (main): Initialize the server's config_default function. * pop3d/apop.c (apop_ok): New function. * pop3d/pop3d.c (pop3d_mainloop): Don't include timestamp in the banner greeting if APOP database is not available. (pop3d_config_default): New function. (main): Initialize the server's config_default function. * pop3d/pop3d.h (apop_ok): New prototype.
2023-05-07Improve file safety checking routineSergey Poznyakoff1
* libmailutils/base/filesafety.c (mu_file_safety_check): Accept symbolic links. Fix memory leak.
2023-05-04pop3d, imap4d: if not set explicitly, derive tls mode from the port used.Sergey Poznyakoff2
* NEWS: Version 3.16.90 * configure.ac: Likewise. * imap4d/imap4d.c (main): Use PORT_IMAP4 constant. * imap4d/imap4d.h (PORT_IMAP4,PORT_IMAP4S): New defines. * imap4d/starttls.c (starttls_server_check): Derive the tls mode from the port used or from the global tls mode. * include/mailutils/sockaddr.h (mu_sockaddr_get_port): New proto. * libmailutils/sockaddr/Makefile.am: Add port.c * libmailutils/sockaddr/port.c: New file. * mu/libexec/shell.c (readline): Minor change. * pop3d/cmd.c (stls_server_check): Derive the tls mode from the port used or from the global tls mode. * pop3d/pop3d.c (main): Use PORT_POP3 constant. * pop3d/pop3d.h (PORT_POP3, PORT_POP3S): New defines.
2023-05-01Remove leftover uses of gethostby* functions.Sergey Poznyakoff2
* configure.ac: Remove check for gethostbyname * include/mailutils/util.h: Fix comment. * imap4d/util.c: Use getaddrinfo. * libmailutils/base/hostname.c: Likewise. * libmailutils/sockaddr/fromnode.c: Likewise. * libmu_auth/virtual.c: Use getnameinfo.
2023-04-30Switch to newer autotoolsSergey Poznyakoff2
* configure.ac: Require autoconf 2.71, automake 1.16.2 Don't use obsolete macros. Drop support for Berkeley DB 2. * gint: Upgrade. * gnulib: Upgrade. * am/db2.m4: Remove. Support for bdb2 withdrawn. * libmu_dbm/berkeley.c: Drop support for bdb2. * am/config_paths.m4: Don't use obsolete autoconf macros. * am/debug.m4: Likewise. * am/enable.m4: Likewise. * am/gsasl.m4: Likewise. * am/gssapi.m4: Likewise. * am/ipv6.m4: Likewise. * am/tls.m4: Likewise. * mail/mail.h (mailvar_value): Rename bool to boolean to avoid eventual conflicts. All uses changed. * comsat/comsat.c: Remove the uses of RETSIGTYPE. * examples/echosrv.c: Likewise. * imap4d/bye.c: Likewise. * imap4d/imap4d.c: Likewise. * imap4d/imap4d.h: Likewise. * imap4d/signal.c: Likewise. * lib/muaux.h: Likewise. * lib/signal.c: Likewise. * libmailutils/mailer/progmailer.c: Likewise. * libmailutils/server/msrv.c: Likewise. * libmu_sieve/extensions/spamd.c: Likewise. * mh/mhn.c: Likewise. * mh/prompter-tty.c: Likewise. * mh/sortm.c: Likewise. * pop3d/pop3d.h: Likewise. * pop3d/signal.c: Likewise.
2023-01-22Update copyright yearsSergey Poznyakoff559
2022-12-27Various fixesSergey Poznyakoff8
* NEWS: Document changes. * configure.ac: Version 3.15.90 * libmailutils/stdstream/strerr.c (mu_stdstream_strerr_setup): Don't destroy mu_strerr unconditionally, use mu_stream_unref. * frm/common.c (format_field_align): Initialize local variable. * lib/mailcap.c (mime_context_get_temp_file): Issue diagnostics on error. (expand_string): Return -1 if the temp file creation fails. (create_filter,run_test,run_mailcap): Improve error checking. * libmailutils/base/fgetpwent.c (mu_fgetpwent_r): Fix use of uninitialized variables. * libmailutils/mailbox/msgqlines.c (mu_message_quick_lines): Likewise. * libmailutils/mime/mimeitr.c (itrdup): Initialize the allocated value with zeroes. * libmailutils/stream/prog_stream.c (start_program_filter): Improve error checking. * libmailutils/tests/t-streamshift.c: Use typecasts when printing mu_off_t values. * libmailutils/url/set-service.c (mu_url_set_service): Initialize port. * libproto/imap/fetch.c (_fill_response): Fix possible use of uninitialized variable. * libproto/maildir/maildir.c (maildir_message_name_parse): Initialize endval. * libproto/mailer/prog.c (url_to_argv): Translate wordsplit error code to the mailutils one. * libproto/mbox/message.c (env_to_stream): Make sure ref->date is null-terminated. * libproto/pop/pop3_response.c (mu_pop3_get_response): Don't check for non-null receiver before calling mu_cpystr: it copes with the case by itself. * libproto/pop/pop3_top.c (mu_pop3_top): Always initialize status. * mail/escape.c (escape_help): Likewise. * mail/util.c (util_do_command): Remove unnecessaty conditional. Upon successful return from mu_vasnprintf cmd is guaranteed to have a non- null value. * mda/lib/script.c (mda_filter_message): Bail out if changing to the user dir fails. * mh/mhn.c (com_send): Fix allowed user responses. * mu/libexec/smtp.c (next_name_from_file): Fix the use of uninitialized variables.
2022-09-16Fix handling of overflowing lines in wordwrap streamsSergey Poznyakoff2
* libmailutils/stream/wordwrap.c (mu_wordwrap_stream): New field: overflow. (line_not_empty): New auxiliary function. (_wordwrap_flush_line,_wordwrap_write) (_wordwrap_flush): Handle line overflow. * libmailutils/tests/wordwrap03.at: More tests.
2022-07-18BugfixSergey Poznyakoff1
* libmailutils/base/mutil.c (mutil_parse_field_map): Fix an attempt to free a memory area that hasn't been allocated. Not so critical: the bug would be hit only if mu_assoc_install failed (which means out of memory condition).
2022-05-08Modify .gitignoreSergey Poznyakoff1
2022-05-08rdcache_size: return MU_ERR_INFO_UNAVAILABLE if unable to get transport ↵Sergey Poznyakoff3
stream size This addresses the problem mentioned in the previous commit. * libmailutils/stream/rdcache_stream.c (rdcache_size): Return MU_ERR_INFO_UNAVAILABLE if mu_stream_size returns EAGAIN, EINTR, ENOSYS, or EINPROGRESS. * libmailutils/stream/stream.c (mu_stream_seterr): Handle MU_ERR_INFO_UNAVAILABLE same way as ENOSYS et al. * libmailutils/stream/streamcpy.c (mu_stream_copy_wcb): Same handling for: EAGAIN, EINTR, ENOSYS, EINPROGRESS, and MU_ERR_INFO_UNAVAILABLE. * mh/msgchk.c (checkmail): Likewise.
2022-05-08rdcache: fix stream size computationSergey Poznyakoff4
Until now, read cache stream incorrectly updated its size when it should not. This happened when the stream had cached some data, then had been rewound and a read operation performed on it. * libmailutils/stream/rdcache_stream.c (mu_rdcache_stream_max_memory_size): Remove unused global. (rdcache_read): Fix stream size computation. (rdcache_size): Return cached size only if EOF was hit on transport stream, otherwise return its size. This means that depending on whether the stream was already cached or not, the call to mu_stream_size on rdcache stream may return ENOSYS or success. * libmailutils/tests/t-rdcache.c: New test program. * libmailutils/tests/Makefile.am: Build t-rdcache. * libmailutils/tests/testsuite.at: Run t-rdcache.
2022-02-18Fix GSASL stream initialization in imap4dSergey Poznyakoff1
* imap4d/auth_gsasl.c (auth_gsasl): Initialize stream[1], unless set after return from ioctl. * libmailutils/stream/fltstream.c (filter_ctl): If both streams are supplied for MU_IOCTL_OP_SET, combine them into an iostream prior to setting the transport pointer.
2022-02-18Minor change in msrv signal handlingSergey Poznyakoff1
* libmailutils/server/msrv.c (set_signal): Catch errors. (_mu_m_server.sigtab): Increase size by one. Slot 0 is not used. (mu_m_server_begin,mu_m_server_restore_signals): Enumerate signals starting from 1.
2022-02-09mbox format: preserve trailing newlines in bodySergey Poznyakoff1
* libmailutils/stream/streamcpy.c (mu_stream_copy_nl): Append an extra \n only unless the last character in stream is a newline. Always append an empty line at the end. * libproto/mbox/message.c (mboxrd_message_copy_with_uid): use regular mu_stream_copy, instead of mu_stream_copy_nl. * mda/tests/input.msg: Remove empty line at the end. * mda/lmtpd/tests/lmtpd.at: Ensure expout ends with an empty line. * mda/mda/tests/forward.at: Likewise. * mda/mda/tests/mda.at: Likewise. * mda/putmail/tests/putmail.at: Likewise.
2022-02-08Bugfix in _fromrd_encoderSergey Poznyakoff1
See 451ca485. Patch by Kurt Hackenberg.
2022-02-08Fix mu_stream_read with NULL as 4th argument.Sergey Poznyakoff2
If called with NULL as its fourth argument (size_t *pread), the function should return error if unable to read the requested number of bytes. * libmailutils/stream/stream.c (mu_stream_read): If pread is NULL and less than the requested number of bytes has been read, return MU_ERR_READ. * libmailutils/tests/t-streamshift.c (stream_verify): Fix size calculation.
2022-01-28Improve performance of the Sieve fileinto actionSergey Poznyakoff1
* include/mailutils/assoc.h (MU_ASSOC_LRU): New flag. (mu_assoc_pop, mu_assoc_shift): Change signature: second argument is char **. * libmailutils/base/assoc.c (mu_assoc_install_ref2): Maintain LRU ordering, if so requested. mu_assoc_pop, mu_assoc_shift): Change type of the second argument to char **. Unless it is NULL, store there a copy of the key. * libmu_sieve/sieve-priv.h (mu_sieve_machine): New member: mailboxes. * libmu_sieve/actions.c (sieve_action_fileinto): Maintain a table of output mailboxes. Keep each mailbox open for as long as possible. If running out of open files, close the least recently used mailbox and retry. * libmu_sieve/sieve-gram.y (mu_sieve_machine_destroy): Destroy the mailbox table.
2022-01-28Improve efficiency of operations on flat mailboxes in append modeSergey Poznyakoff2
Until now both mboxrd and dotmail preferred mmap over unistd-based I/O. This improved performance when reading and updating mailboxes, but deteriorated it when operating in append mode. To improve performance in append mode, a new function (mu_mailbox_stream_create) is introduced, which selects the underlying stream for the mailbox file based on the requested open mode and the currentstatus of the file itself. Both mboxrd and dotmail use this function to initialize mailbox stream. * include/mailutils/stream.h (mu_mailbox_stream_create): New proto. * libmailutils/stream/Makefile.am (libstream_la_SOURCES): Add mailbox_stream.c * libmailutils/stream/mailbox_stream.c: New file. * libproto/dotmail/dotmail.c (dotmail_mailbox_init_stream): Use mu_mailbox_stream_create. * libproto/mbox/mboxrd.c (mboxrd_mailbox_init_stream): Likewise.
2022-01-24Bugfix in mboxrd decoderSergey Poznyakoff1
* libmailutils/filter/fromrd.c (_fromrd_decoder): Don't switch state if '\n' is received while in S_BOL state.
2022-01-21Bugfix in quoted-printable decoderSergey Poznyakoff1
Bug reported by Kurt Hackenberg, see: https://lists.gnu.org/archive/html/bug-mailutils/2022-01/msg00001.html * libmailutils/filter/qpflt.c (_qp_decoder): Fix calculation of the number of consumed input characters.
2022-01-17Fix EOF check with flex >= 2.6.1Sergey Poznyakoff1
2022-01-02Update copyright yearSergey Poznyakoff557
2021-12-07amd: Rewrite message scannerSergey Poznyakoff1
* include/mailutils/sys/amd.h (_amd_message) <header_size>: New member. (MU_AMD_DASHDELIM): New flag. * libmailutils/base/amd.c (_amd_message_save): Optionally save dash delimiter line (useful for MH). (_amd_message_save): Initialize header_size. (amd_scan_message): Rewrite as a state mashine. Support MH-style dash-line delimiters between header and body. (amd_message_stream_open): Close stream on failure. (amd_header_fill): Use header_size instead of body_start. * libproto/mh/mh.c (_mailbox_mh_init): Set MU_AMD_DASHDELIM capability.
2021-12-05amd: use Return-Path and Received headers to save envelope informationSergey Poznyakoff1
* libmailutils/base/amd.c (_amd_tempstream): New function. (_amd_tempfile, _amd_delim): Removed. (_amd_message_save): Rewrite using mailutils stream functions. Use mu_stream_stat_buffer to count octets and lines. Use Return-Path and Received headers to save envelope information. * libproto/maildir/tests/append.at: Update expected headers. * libproto/mh/tests/append.at: Likewise. * mh/tests/pick.at (pick-component, pick-component-or): Use mbox2dir -e to create the mailstore. Use --Return-Path option for tests. * testsuite/mbox2dir.c: New option -e. Rewrite message copying routines.
2021-12-05Improve message append APISergey Poznyakoff5
The new API allows for specifying envelope and attributes (status) for the message being appended. * include/mailutils/attribute.h (MU_STATUS_BUF_SIZE): Order flags lexicographically. * include/mailutils/imap.h (mu_imap_append_stream_size) (mu_imap_append_stream) (mu_imap_append_message): Take envelope and attribute as arguments, instead of struct tm, mu_timezone, and flags. * include/mailutils/mailbox.h (mu_mailbox_append_message_ext): New proto. * include/mailutils/sys/amd.h (_amd_data): Change prototype of msg_finish_delivery: take additional mu_attribute_t argument. * include/mailutils/sys/mailbox.h (_mu_mailbox): Change prototype of _append_message: take mu_envelope_t and mu_attribute_t as additional arguments. * libmailutils/base/amd.c (_amd_message_save): Take mu_envelope_t argument. (amd_append_message): Take mu_envelope_t and mu_attribute_t arguments. Use them to alter message envelope and status. * libmailutils/mailbox/attribute.c (mu_attribute_unset_flags): Check return from mu_attribute_get_flags. (flagtrans): Order alphabetically. * libmailutils/mailbox/mailbox.c (mu_mailbox_append_message_ext): New function. (mu_mailbox_append_message): Rewrite as an alternative entry point to mu_mailbox_append_message_ext. * libmailutils/mailbox/msgenv.c (message_envelope_date): Give MU_HEADER_ENV_DATE higher priority than MU_HEADER_RECEIVED. (message_envelope_sender): Give X-Envelope-Sender higher priority than Return-Path. * libmailutils/stream/message_stream.c (mu_message_from_stream_with_envelope): Initialize attribute from MU_HEADER_STATUS. * testsuite/mbop.c (mbop_append): Options -attr, -sender, and -date can be used to alter message attributes and envelope. * libproto/dotmail/dotmail.c (mailbox_append_message) (dotmail_append_message): Take mu_envelope_t and mu_attribute_t arguments. Use them to alter message envelope and status. * libproto/dotmail/tests/append.at: Test modifying envelope and attributes during append. * libproto/dotmail/tests/testsuite.at: Force TZ=0. * libproto/imap/appmsg.c (mu_imap_append_message): Take mu_envelope_t and mu_attribute_t as arguments. * libproto/imap/appstr.c (mu_imap_append_stream): Likewise. * libproto/imap/appstrsiz.c (mu_imap_append_stream_size): Likewise. Use mu_attribute_t to set message flags and mu_envelope_t to set its delivery date. Note, that sender is not yet affected. * libproto/imap/mailbox.c (_imap_mbx_append_message): Take mu_envelope_t and mu_attribute_t as arguments. Use them to alter message envelope and status, via mu_imap_append_message. Altering envelope is done by amd.c * libproto/maildir/maildir.c (maildir_msg_finish_delivery): Take additional mu_attribute_t argument. Use it to alter message flags. Change msg->file_name if needed. * libproto/maildir/tests/append.at: Test modifying envelope and attributes during append. * libproto/mailer/mailbox.c (remote_mbox_append_message): Take mu_envelope_t and mu_attribute_t as arguments. Use mu_envelope_t to set sender address. mu_attribute_t is ignored, as SMTP does not transfer message attributes. * libproto/mbox/mboxrd.c (mailbox_append_message) (mboxrd_append_message): Take mu_envelope_t and mu_attribute_t as arguments. Use them to alter message envelope and status. * libproto/mbox/tests/append.at: Test modifying envelope and attributes during append. * libproto/mh/tests/append.at: Test modifying envelope and attributes during append. * mail/copy.c (append_to_mailbox): Preserve message status when appending. * mail/quit.c (mail_mbox_commit): Preserve message status when storing it to MBOX. * mail/tests/hold.at: Test whether message status is preserved. * mu/libexec/imap.c (com_append): Rewrite using the new mu_imap_append_stream call.
2021-11-20Fix typosSergey Poznyakoff25
2021-11-19Fix a corner case in mu_make_file_name_sufSergey Poznyakoff1
If dir is '/' (optionally followed by another '/'), copy it verbatim. * libmailutils/string/mkfilename.c (mu_make_file_name_suf):
2021-11-19Forgotten to add with 22ceaddfb8Sergey Poznyakoff1
2021-11-19Fix memory and fd leak in maildir and amdSergey Poznyakoff1
* libmailutils/base/amd.c (amd_expunge): Close and destroy the associated message stream. * libproto/maildir/maildir.c (maildir_close): Fix erroneously reverted condition.
2021-11-03Free allocated memory on exit.Sergey Poznyakoff3
See also 91d35ab2ee. * include/mailutils/cfg.h (mu_cfg_section): New members: ident_storage and label_storage. * libmailutils/cfg/driver.c (mu_config_destroy_container): Free the storage allocated for ident and label. Do this onlyw if the decreased refcount hits zero. (mu_config_container_register_section): Assign allocated strings to ident_storage and label_storage. (mu_config_root_register_section): Register an onexit routine for freeing the allocated memory. * libmailutils/cli/capa.c (capa_free): Register an onexit routine for freeing the allocated memory. * libmailutils/opt/progname.c (mu_set_program_name): Likewise.
2021-11-03Minor changeSergey Poznyakoff1
* libmailutils/stdstream/basestr.c (std_log_bootstrap): Mark stream as open.
2021-11-03Free some allocated memory on exit.Sergey Poznyakoff4
This eliminates certain "memory leaks", that have little (if any) practical importance, bu make leak detection tools overly vociferous. * libmailutils/base/monitor.c (static_monitor_dealloc): New function. (mu_monitor_rdlock, mu_monitor_wrlock): Install static_monitor_dealloc as onexit handler. * libmailutils/filter/filter.c (filter_dealloc): New function: deallocate filter_list. (mu_filter_get_list): Install filter_dealloc as onexit handler. * libmailutils/locus/ident.c (nametab_dealloc): New function. (mu_ident_ref): Install nametab_dealloc as onexit handler. * libmailutils/stdstream/basestr.c (std_log_bootstrap): Unref transport after setting it up to log stream. (stdstream_flushall): Call mu_stream_destroy instead of mu_stream_flush.
2021-11-03Move mimetypes support into the librarySergey Poznyakoff8
* configure.ac: Build libmailutils/mimetypes/Makefile * include/mailutils/Makefile.am: New header mimetypes.h * mimeview/mimeview.h: moved from include/mailutils/mimetypes.h * include/mailutils/sys/Makefile.am: Add mimetypes.h * include/mailutils/sys/mimetypes.h: New file. * include/mailutils.h: Include mailutils/mimetypes.h * libmailutils/Makefile.am: Build mimetypes. * libmailutils/mimetypes/.gitignore: New file. * libmailutils/mimetypes/eval.c: New file. * libmailutils/mimetypes/grammar.y: Moved from mimeview/grammar.y * libmailutils/mimetypes/lexer.l: Moved from mimeview/lexer.l. * libmailutils/diag/debcat: Add mimetypes. * mimeview/Makefile.am: Update. * mimeview/tests/testsuite.at: Change debug level. * include/mailutils/stream.h (mu_fd_stream_create): filename is const. * libmailutils/stream/file_stream.c: Likewise.
2021-11-01Require GNU bison and flexSergey Poznyakoff8
* am/bison.m4: Use AC_PATH_PROG. * am/flex.m4: Likewise. * configure.ac: Remove MU_YLWRAP. * include/mailutils/yyloc.h (YYLTYPE): Remove. This needs be defined in each grammar source individually. * mu-aux/Makefile.am: Remove gylwrap. * mu-aux/gylwrap: Remove. * libmailutils/cfg/Makefile.am: Rewrite rules for building grammars and lexers. * libmailutils/datetime/Makefile.am: Likewise. * libmu_sieve/Makefile.am: Likewise. * mail/Makefile.am: Likewise. * mh/Makefile.am: Likewise. * mimeview/Makefile.am: Likewise. * libmailutils/cfg/gylwrap.conf: Remove. * libmailutils/datetime/gylwrap.conf: Remove. * libmu_sieve/gylwrap.conf: Remove. * mh/gylwrap.conf: Remove. * mimeview/gylwrap.conf: Remove. * libmailutils/cfg/lexer.l: Use %option prefix * libmu_sieve/sieve-lex.l: Likewise. * mh/mh_alias_lex.l: Likewise. * mimeview/lexer.l: Likewise. * libmailutils/cfg/parser.y: Use api.prefix and %code requires. * libmailutils/datetime/parsedate.y: Likewise. * mh/mh_alias_gram.y: Likewise. * mh/mh_fmtgram.y: Likewise. * mh/pick-gram.y: Likewise. * libmu_sieve/sieve-gram.y: Likewise. * mimeview/grammar.y: Likewise. * testsuite/lib/mailutils.exp (mu_create_config): Fix source location.
2021-09-30Fix timezone calculation (see https://savannah.gnu.org/bugs/?61239)Sergey Poznyakoff1
* libmailutils/datetime/utcoff.c (mu_utc_offset): Fix the timezone correction.
2021-08-27BugfixSergey Poznyakoff1
* libmailutils/stream/stream.c (mu_stream_timed_getdelim): If buffer points to NULL, assume size = 0.
2021-08-26Test TLS streamsSergey Poznyakoff1
* configure.ac: Configure test directory in libmu_auth * libmu_auth/Makefile.am: Likewise. * libmu_auth/tests/.gitignore: New file. * libmu_auth/tests/Makefile.am: New file. * libmu_auth/tests/atlocal.in: New file. * libmu_auth/tests/genfile.c: New file. * libmu_auth/tests/testsuite.at: New file. * libmu_auth/tests/tls.at: New file. * libmu_auth/tests/tlscpy.c: New file. * pop3d/cmd.c: Fix typo.
2021-08-25New function: mu_starttlsSergey Poznyakoff4
* libmu_auth/tlsfdstr.c (mu_tlsfd_stream_create): Accept conf==NULL. (mu_starttls): New function. * include/mailutils/tls.h (mu_starttls): New proto. * include/mailutils/imapio.h (mu_imapio_get_transport) (mu_imapio_set_transport): New functions. * libmailutils/imapio/transport.c (mu_imapio_get_transport) (mu_imapio_set_transport): New functions. * libmailutils/stream/iostream.c (mu_iostream_create): Accept NULL out stream. * libmailutils/stream/tcp.c: Support MU_IOCTL_FD (_tcp_instance): New member fd_borrowed. (_tcp_close): Don't close fd if fd_borrowed is set. (_tcp_ioctl): Handle MU_IOCTL_FD. * libmailutils/stream/xscript-stream.c (_xscript_ctl): Accept pstr[1] == NULL. * libmu_auth/notls.c (mu_tlsfd_stream_create) (mu_tlsfd_stream2_convert) (mu_starttls): New placeholders. * libproto/imap/folder.c (_mu_imap_folder_open): Use mu_tlsfd_stream_convert. Fix stream leak. * libproto/imap/starttls.c (mu_imap_starttls): Use mu_starttls. * libproto/mailer/smtp.c (smtp_open): Use mu_tlsfd_stream_convert. * libproto/mailer/smtp_starttls.c (mu_smtp_starttls): Use mu_starttls. * libproto/pop/pop3_stls.c (mu_pop3_stls): Likewise. * libproto/pop/mailbox.c (pop_open): Use mu_tlsfd_stream_convert. Fix stream leak. * mu/libexec/imap.c (com_connect): Use mu_tlsfd_stream_convert. Fix stream leak. * mu/libexec/pop.c: Likewise. * mu/libexec/smtp.c: Likewise. * imap4d/io.c (imap4d_init_tls_server): Use mu_starttls. * pop3d/extra.c: Likewise.
2021-08-25New function mu_tlsfd_stream2_convertSergey Poznyakoff1
* libmu_auth/tlsfdstr.c (mu_tlsfd_stream_create): Remove last argument. All uses changed. (mu_tlsfd_stream2_convert): New function. * include/mailutils/tls.h (mu_tlsfd_stream_create): Change signature (flags removed). (mu_tlsfd_stream2_convert): New proto. (mu_tlsfd_stream_convert): New inline function. * libmailutils/diag/errors (MU_ERR_TRANSPORT_GET) (MU_ERR_TRANSPORT_SET): New error codes. * imap4d/io.c (imap4d_init_tls_server): Use mu_tlsfd_stream2_convert. * pop3d/extra.c (pop3d_init_tls_server): Use mu_tlsfd_stream2_convert.
2021-08-24Intermediate streams: propagate _MU_STR_EVENT_CLRFLAG to the underlying ↵Sergey Poznyakoff2
transport * libmailutils/stream/fltstream.c: Propagate mu_stream_clearerr to the transport stream. * libmailutils/stream/iostream.c: Likewise. * libmu_auth/tls.c: Likewise. * libmu_auth/tlsiostr.c: Likewise. * libmu_auth/tlsfdstr.c (_tlsfd_read, _tlsfd_write): Translate GNUTLS_E_TIMEDOUT to MU_ERR_TIMEOUT. * imap4d/bye.c (imap4d_bye_command): Clear stream error on ERR_TIMEOUT. ---
2021-08-23Fix handling of MU_IOCTL_SUBSTREAM in iostreamSergey Poznyakoff1
* libmailutils/stream/iostream.c (_iostream_ctl): Fix handling of MU_IOCTL_SUBSTREAM (get/set) requests. * imap4d/io.c (io_setio): Unreference the source stream. (imap4d_init_tls_server): Fix reference decrement for tlsstream. * pop3d/extra.c (pop3d_setio): Unreference the source stream. (pop3d_init_tls_server): Fix reference decrement for tlsstream.
2021-08-21Implement "timed" versions of the stream read-up-to-delimiter operationsSergey Poznyakoff4
* include/mailutils/stream.h (MU_IOCTL_TIMEOUT): New ioctl code. (mu_stream_timed_readdelim,mu_stream_timed_readline): New protos. (mu_stream_readdelim,mu_stream_readline,mu_stream_getdelim) (mu_stream_getline): Rewrite as inline functions. * include/mailutils/datetime.h (mu_timeval_cmp, mu_timeval_add) (mu_timeval_sub): New inline functions for operations over struct timeval. * include/mailutils/sys/file_stream.h (_mu_file_stream): New member: io_timeout. * libmailutils/diag/errors (MU_ERR_TIMEOUT, MU_ERR_SET_TIMEOUT) (MU_ERR_WRITE, MU_ERR_TLS): New error codes. * libmailutils/stream/file_stream.c (fd_read,fd_write): Take into account I/O timeout. (fd_ioctl): Handle MU_IOCTL_TIMEOUT. * libmailutils/stream/stream.c (mu_stream_timed_readdelim) (mu_stream_timed_readline): New functions. * libmu_auth/tls.c (_tls_open): Special handling for time-out errors. * libmailutils/stream/iostream.c (_iostream_ctl): Pass MU_IOCTL_TIMEOUT to the transport stream.
2021-07-27Prefer User-Agent header over X-MailerSergey Poznyakoff1
* NEWS: Update. * doc/texinfo/programs/mail.texi: Update. * include/mailutils/header.h (MU_HEADER_USER_AGENT): New define. * mail/mail.c (default_setup): Set useragent * mail/mail.h (mailvar_name_useragent): New define. * mail/mailline.c (header_generator): Add MU_HEADER_USER_AGENT. * mail/mailvar.c: Mew variable: "useragent". Retain "xmailer" as an alias. * mail/send.c (mail_compose_send): Add the User-Agent header if the "useragent" variable is set. * libmailutils/tests/hdrcpy.at: Use User-Agent instead of X-Mailer. * mail/tests/send.at: Likewise. * mail/tests/sendbyname.at: Likewise. * mail/tests/sendrec.at: Likewise. * mail/testsuite/mail/Followup.exp: Likewise. * mail/testsuite/mail/Reply.exp: Likewise. * mail/testsuite/mail/reply.exp: Likewise. * mail/testsuite/mail/send.exp: Likewise. * mh/repl.c: Likewise. * mh/send.c: New .mtstailor vareiable "user-agent".
2021-07-19Fix in quoted-printable decoderSergey Poznyakoff1
* libmailutils/filter/qpflt.c (_qp_decoder): Accept soft line breaks (RFC 2045, 6.7, page 19)
2021-07-16Rename the FROMRB filter to FROMRDSergey Poznyakoff6
Old name is retained as an alias.
2021-07-15Fix stream reference bug in mu_filter_stream_createSergey Poznyakoff2
If the mu_filter_xcode_t function failed in mu_filter_init request, mu_filter_stream_create would leave the transport reference counter incremented by one. * libmailutils/stream/fltstream.c (mu_filter_stream_create): On failure, decrement reference counter of transport stream. * libmailutils/tests/fltcnt.c: Test for the above bug as well.
2021-07-15Fix stream reference bug in mu_filter_chain_create family functions.Sergey Poznyakoff6
This change affects the following two functions: mu_filter_chain_create, mu_filter_chain_create_pred. In previous versions, if these functions failed to create the requested filter chain, they decremented reference counter of their transport (input stream) argument. This change restores the proper behavior: - On success, reference counter is incremented by 1. - On error, reference counter doesn't change. * libmailutils/filter/fltchain.c (_add_next_link): Make sure the transport reference counter does not change. * libmailutils/tests/Makefile.am: Add new auxiliary program and test case. * libmailutils/tests/fltcnt.at: New file. * libmailutils/tests/fltcnt.c: New file. * libmailutils/tests/testsuite.at: Include new test.

Return to:

Send suggestions and report system problems to the System administrator.