summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFiles
2021-06-10Fix memory leaks (mboxrd and mail)Sergey Poznyakoff5
* libproto/mbox/mboxrd.c (mboxrd_rescan_unlocked): Free buf. (mboxrd_detect): Destroy str when no longer needed. * mail/copy.c (mail_copy0): Free allocated memory. Create file in cwd if util_outfolder_name return NULL. * mail/exit.c (mail_exit): Destroy mbox. * mail/util.c (util_range_msg): Use msgset_free instead of plain free.
2021-06-10Provide several ways of creating the outgoing file name.Sergey Poznyakoff7
Several mail commands store message in a file named by its recipient (or sender) in the "folder" directory (these commands are: Copy, Save, Mail, followup, Followup). As per POSIX, the local part of the email address serves as the file name. There may be cases, however, when using the entire email would be preferable. This commit introduces new mail variable "outfilename" that controls how the file name is generated. Its default value is "local", which means use the email local part. Other possible values are: "email", to save messages in a file named by entire email, and "domain", to save them in a file named by domain part of the email. * NEWS: Document changes. * doc/texinfo/programs/mail.texi: Document changes. * mail/mail.c (default_setup): Set outfilename=local. * mail/mail.h (mailvar_name_outfilename): New define. (outfilename_mode): New extern. (util_outfilename): New proto. * mail/mailvar.c: New variable: "outfilename". * mail/send.c (mail_compose_send): Use util_outfilename to form outgoing file name. * mail/util.c (outfilename_mode): New global. (util_outfilename): New function. (util_message_sender): Use util_outfilename.
2021-06-09mail: implement the fullnames variableSergey Poznyakoff6
* NEWS: Document changes. * doc/texinfo/programs/mail.texi: Likewise. * mail/mail.c (default_setup): Set fullnames. * mail/mail.h (mailvar_name_fullnames): New define. * mail/mailvar.c (fullnames): New variable. * mail/reply.c (compose_remove_personal): New function. (respond_msg,respond_all): Call compose_remove_personal if fullnames is not set.
2021-06-09Add tests for mail send/reply/followup commandsSergey Poznyakoff11
* mail/mail.c (main): Fix exit status in send mode. * mail/tests/Makefile.am: Add new tests. * mail/tests/testsuite.at: Likewise. * mail/tests/atlocal.in (MAILER): New variable. * mail/tests/Followup.at: New file. * mail/tests/Reply.at: New file. * mail/tests/followup.at: New file. * mail/tests/reply.at: New file. * mail/tests/send.at: New file. * mail/tests/sendbyname.at: New file. * mail/tests/sendrec.at: New file.
2021-06-09mail: fix semantics of mail sending and saving commandsSergey Poznyakoff17
* NEWS: Document changes. * doc/texinfo/programs/mail.texi: Document changes. * mail/Makefile.am (mail_SOURCES): Remove followup.c * mail/followup.c: Remove. * mail/mail.c: Fix the -F option. Rewrite send mode by calling mail_send directly. * mail/mail.h (mailvar_name_byname): Remove. (mail_send0): Rename to mail_compose_send. All uses changed. (util_message_sender): New function. * mail/mailvar.c (mailvar_tab): Remove the "byname" variable. "outfolder": Accept string and boolean values. (print_descr): Handle hard newlines. (mailvar_get): Use mailvar_type_whatever to test whether a variable is set, regardless of its type. * mail/reply.c: Rewrite to match POSIX standard. This affects the following commands: "reply", "Reply", "followup", "Followup". * mail/send.c (compose_header_set): Use util_merge_addresses when operating on address headers. (send_message): In mailx compatibility mode, assume the sendmail:// scheme. (mail_send0): Rename to mail_compose_send. Add Date header before saving the message, to make sure mu_mailbox_append_message won't bail out. * mail/table.c: New command: "Mail". * mail/testsuite/mail/send.exp: Fix expected output. * mail/testsuite/mail/write.exp: Likewise. * mail/util.c (util_message_sender): New function. (util_get_sender): Rewrite using util_message_sender. (util_outfolder_name,util_save_outgoing): Rewrite from scratch, Ensure mailx compatibility, * mail/write.c (mail_write): Don't use outfolder. * testsuite/mockmail.c: Support -i and -v options. * testsuite/mockmail.at: Unset MAIL_DUMP when testing.
2021-06-08BugfixSergey Poznyakoff1
* libproto/mbox/mboxrd.c (mailbox_append_message): Don't overwrite the error code.
2021-06-07mail: Add a Date: header before sending the messageSergey Poznyakoff1
* mail/send.c (message_add_date): New function. (mail_send0): Call message_add_date before sending the message.
2021-06-06mail: revamp parsing of adresses in send modeSergey Poznyakoff5
In particular, this fixes parsing of addresses with comma in the local part. * include/mailutils/address.h (MU_ADDRESS_HINT_INITIALIZER): New define. * libmailutils/address/addrstream.c (mu_stream_format_address): Format local user names without surrounding angle quotes. * mail/mail.h (util_header_expand): Rename to util_header_expand_aliases. All uses changed. (util_address_expand_aliases): New function. * mail/send.c (compose_header_set): Expand aliases if inplacealiases is set. Avoid useless recursion. * mail/util.c (send_message): Create addresses via mu_address_create_hint to avoid appending local domain to the unqualified user names. (mail_send0): Likewise. (util_address_expand_aliases): New function. (util_header_expand): Rename to util_header_expand_aliases. Use util_address_expand_aliases and regular address parsing functions instead of wordsplit. Unwrap header values.
2021-05-25Test IMAP folder scanning.Sergey Poznyakoff12
* imap4d/imap4d.c (prefix_section_parser): Use namespace_encode_delim. * imap4d/imap4d.h (namespace_decode_delim) (namespace_encode_delim): New protos. * imap4d/list.c (list_ref): Convert delimiters in the wcard to /. * imap4d/namespace.c (namespace_decode_delim) (namespace_encode_delim): New functions. * imap4d/tests/testclient.c: New auxiliary program. * imap4d/tests/.gitignore: Add testclient. * imap4d/tests/Makefile.am: Add new tests * imap4d/tests/atlocal.in: Include libproto/imap/tests in the PATH. * imap4d/tests/clt_list.at: New file. * imap4d/tests/list.at: Test delimiter translation. * imap4d/tests/testsuite.at: Add new tests. * libproto/imap/tests/imapfolder.c: Sort the resulting lists. Use quoting on output.
2021-05-25imap4d LIST: discern between implementation-defined and required behavior.Sergey Poznyakoff3
* imap4d/list.c (match_pfx): Return true if ref is "pfx/", where / stands for a namespace delimiter. * imap4d/namespace.c (prefix_translate_name): namespace prefix is required to end with a delimiter. * imap4d/tests/list.at: Make sure all reference arguments that refer to directories end in a hierarchy delimiter.
2021-05-23fix memory leak in folder scannerSergey Poznyakoff2
* libmailutils/mailbox/folder.c (mu_folder_enumerate): Set the destroy_item function on the created list. * libmailutils/mailbox/fsfolder.c (list_helper): Free the resp structure when it is no longer needed.
2021-05-23Fix the previous commit: take into account "" mailbox names.Sergey Poznyakoff2
* libproto/imap/folder.c (_mu_imap_folder_separator): Use empty mailbox name to get the hierarchy delimiter. * libproto/imap/genlist.c: Take into account eventual hierarchy delimiter queries.
2021-05-22folder scan returns mailbox names without the leading directory prefix.Sergey Poznyakoff18
For example, suppose folder /foo/bar contains mailboxes a, b, and c. Then scanning the mu_folder_t object for '/foo' will return 'bar/a', 'bar/b', and 'bar/c'. Scanning the mu_folder_t for '/foo/bar' will return 'a', 'b', and 'c', and so on. * libmailutils/string/mkfilename.c (mu_make_file_name_suf): Reasonable handling of corner cases. Document its behavior. * libmailutils/mailbox/fsfolder.c (struct folder_scan_data): New member: prefix_len (list_helper): Return the portion of the file name after the base directory prefix. (_fsfolder_list): Initialize sdata.prefix_len. * libmailutils/tests/fsfolder.c: Remove prefix handling code. * libmailutils/tests/fsfolder00.at: Change expectations. * libmailutils/tests/fsfolder02.at: Likewise. * libmailutils/tests/fsfolder03.at: Likewise. * libmailutils/tests/fsfolder04.at: Likewise. * include/mailutils/sys/imap.h (struct _mu_imap): New members: separator and prefix_len. * libproto/imap/folder.c (_mu_imap_folder_separator): New function. (_mu_imap_folder_pathname): New function. (_mu_imap_folder_list): Prefix the original refname with the base directory of the folder. (_mu_imap_folder_lsub,_mu_imap_folder_subscribe) (_mu_imap_folder_unsubscribe,_mu_imap_folder_delete) (_mu_imap_folder_rename): Adjust input mailbox names. * libproto/imap/genlist.c (list_untagged_handler): Return the portion of the file name after the base directory prefix. * libproto/imap/tests/imapfolder.c: Minor change. Update for changed folder behavior * imap4d/list.c (struct refinfo): Replace dirlen with delim - a character to be inserted between the original reference and mailbox name. (list_fun): Insert delimiter, if required. (list_ref): Set refinfo.delim, unless the reference prefix already ends with a delimiter or is the same as the namespace prefix. Mail 'folders' command: add support for remote folders. * mail/folders.c: Handle remote folders correctly. * mail/mail.h (util_get_folder): New proto. * mail/mailline.c (struct filegen): Remove path_len. (new_folder): Rename to util_get_folder and move to util.c (filegen_init): Initialize prefix_len from the argument. * mail/util.c (util_get_folder): New function.
2021-05-21Bugfix in mu_list_clearSergey Poznyakoff1
The bug affected imap client code, in particular. * libmailutils/list/clear.c (mu_list_clear): Reset list item count.
2021-05-01Revise the mailbox locking functions.Sergey Poznyakoff22
The locker is created by the following call: mu_locker_create_ext(&locker, filename, &hints); The last arguments points to a structure mu_locker_hints_t, which defines the settings for the locker. NULL value implies default. Settings of an existing locker can be modified using the following call: mu_locker_modify(locker, &hints); Current settings can be examined using mu_locker_get_hints. The functions mu_locker_destroy, mu_locker_lock_mode, mu_locker_lock, mu_locker_touchlock, mu_locker_unlock, and mu_locker_remove_lock remained unchanged. Rest of functions is deprecated, but retained for a couple of releases for the sake of backward compatibility. Constants (locker types, flags, etc) are also revisited. This commit also fixes a bug in mu_spawnvp function, which was discovered when testing external lockers. * include/mailutils/locker.h: Major rewrite. (MU_LOCKER_DEFAULT_EXPIRE_TIME) (MU_LOCKER_DEFAULT_RETRY_COUNT) (MU_LOCKER_DEFAULT_RETRY_SLEEP) (MU_LOCKER_DEFAULT_EXT_LOCKER): New defines. (mu_locker_hints_t): New data type. (MU_LOCKER_FLAG_RETRY) (MU_LOCKER_FLAG_EXPIRE_TIME) (MU_LOCKER_FLAG_CHECK_PID) (MU_LOCKER_FLAG_TYPE,MU_LOCKER_FLAGS_ALL): New defines. (mu_locker_create_ext, mu_locker_modify) (mu_locker_get_hints): New functions. (mu_locker_create,mu_locker_set_default_flags) (mu_locker_set_default_retry_timeout) (mu_locker_set_default_retry_count) (mu_locker_set_default_expire_timeout) (mu_locker_set_default_external_program) (mu_locker_set_flags,mu_locker_mod_flags) (mu_locker_set_expire_time,mu_locker_set_retries) (mu_locker_set_retry_sleep,mu_locker_set_external) (mu_locker_get_flags,mu_locker_get_expire_time) (mu_locker_get_retries,mu_locker_get_retry_sleep): Mark as deprecated. * libmailutils/base/locker.c: Rewrite. * libmailutils/cli/stdcapa.c: New locking statements: type and retry-sleep. retry-timeout is deprecated. * libmailutils/tests/lck.c: Use new locker functions. * libmailutils/tests/lock.at: Test the external locker. * libmailutils/base/spawnvp.c (mu_spawnvp): Restore the default SIGCHLD handler while waiting for the process to terminate. * dotlock/dotlock.c: Use new locker functions. * lib/manlock.c: Likewise. * libmailutils/base/amd.c: Likewise. * libmu_dbm/berkeley.c: Likewise. * libmu_sieve/extensions/vacation.c: Likewise. * libproto/dotmail/dotmail.c: Likewise. * libproto/mbox/mboxrd.c: Likewise. * mail/copy.c: Likewise. * mda/lmtpd/lmtpd.c: Modify mu_locker_defaults instead of using deprecated functions. * mda/mda/mda.c: Likewise. * mda/putmail/putmail.c: Likewise. * NEWS: Document changes. * configure.ac: Version 3.12.90. * doc/texinfo/Makefile.am: Add programs/dotlock.texi * doc/texinfo/programs.texi: Rewrite the locking section. New section: dotlock. * doc/texinfo/programs/dotlock.texi: New file.
2021-04-29mail: accept attachments from FIFOsSergey Poznyakoff1
* mail/send.c: Use mu_file_stream_create for FIFOs.
2021-04-29mh: fix extra doc formattingSergey Poznyakoff1
* mh/mh_getopt.c (mh_extra_help_hook): Use number of leading whitespace as left margin for output.
2021-04-29libopt: don't show hidden options in the --usage output.Sergey Poznyakoff1
* libmailutils/opt/help.c (option_summary): Skip options with MU_OPTION_HIDDEN bit set. (mu_option_describe_options): Reset margin to 0 so that eventual extra_doc is formatted correctly.
2021-04-29Further improvements of the locker interface.Sergey Poznyakoff8
This fixes a bug that prevented previous versions of mailutils to retry aquiring the lock. Locking configuration (the "locking" section) is improved. * dotlock/dotlock.c: New options: --retry (-r), --delay (-t), --pid-check (-p). Use the "locking" capability. * libmailutils/base/locker.c: Remove the uses of assert(). (mu_locker_lock_mode): Fix the retry loop. (lock_dotlock): Use mu_asprintf to create temporary lock name. Return EAGAIN on temporary error conditions. (lock_kernel): Fix typo (EACCES). * libmailutils/cli/stdcapa.c (cb_locker_flags): Locker flags are deprecated. (cb_locker_retry_timeout,cb_locker_retry_count): Clear the MU_LOCKER_RETRY flag, if supplied a zero value. (cb_locker_external): Clear the MU_LOCKER_EXTERNAL flag (revert to the dotlock locker type) if the value is a false boolean value. * libmailutils/tests/Makefile.am: Add new test. * libmailutils/tests/testsuite.at: Include new test, * libmailutils/tests/lck.c: New test program. * libmailutils/tests/lock.at: New test.
2021-04-27Fix misattributed locker flags.Sergey Poznyakoff1
* libmailutils/cli/stdcapa.c (cb_locker_expire_timeout) (cb_locker_external): Pass proper first argument to mu_locker_set_default_flags.
2021-04-18Bugfix in the configuration file lexer.Sergey Poznyakoff1
String values like the following caused failure: "foo \ bar \ baz \ qux" The second and third physical lines would not be recognized by the scanner. The bug was due to a long-standing copy-paste error.
2021-04-18SQL auth: supply backend-specific parameters via the "param" statement.Sergey Poznyakoff5
For MySQL, backend-specific parameter is a list of keuword=value pairs delimited by semicolons. Valid keywords are: defaults_file - read configuration from the supplied file; group - if default_file is supplied, read configuration from this named group (default - "client"); ca - name of the certificate authority file; * include/mailutils/sql.h (mu_sql_module_config)<param>: New member. (mu_sql_connection)<param>: New member. (mu_sql_connection_init): Take additional argument (param). All uses changed. * libmu_auth/sql.c: New keyword: "param". * sql/mysql.c (mu_mysql_connect): Parse backend-specific parameters: defaults_file, group, and ca. * sql/sql.c (mu_sql_connection_init): Take additional argument. Initialize the connection param member.
2021-04-18mbox,dotmail: fix the _message_unseen methodSergey Poznyakoff2
* libproto/dotmail/dotmail.c (dotmail_message_unseen): Set return value to 0 and return success if there are no unseen messages. * libproto/mbox/mboxrd.c (mboxrd_message_unseen): Likewise.
2021-04-15Bugfix in mimeview testsuiteSergey Poznyakoff1
* mimeview/tests/bf.c (write_byte): Fix type of the character buffer.
2021-04-15Minor fixSergey Poznyakoff1
* include/mailutils/sys/streamtrans.h: Add missing #endif
2021-02-13Version 3.12release-3.12Sergey Poznyakoff2
2021-02-13Skip imap4d tests if home directory does not existSergey Poznyakoff1
* imap4d/tests/testsuite.at (IMAP4D_RUN): Skip test if home directory does not exist.
2021-02-10inc: when updating the unseen sequence, translate message numbers to uidsSergey Poznyakoff1
* mh/inc.c (main): Ensure translation from ordinal to sequence numbers (uid).
2021-02-09dotmail: synchronize with the recent changes to mboxSergey Poznyakoff4
* libproto/dotmail/dotmail.c: Synchronize with the recent changes to mbox. * libproto/dotmail/tests/rospool.at: New test. * libproto/dotmail/tests/Makefile.am: Add new test. * libproto/dotmail/tests/testsuite.at: Add new test.
2021-02-09mbox: use fstat etc. instead of stat etc.Sergey Poznyakoff2
* libproto/mbox/mboxrd.c (mboxrd_stat,mboxrd_set_priv): New functions. (mboxrd_get_atime): Use mboxrd_stat instead of stat(2). Fix the return value. (mboxrd_flush_unlocked): Use mboxrd_stat to stat the mailbox and mboxrd_set_priv to set mode and ownership. * libproto/mbox/tests/rospool.at: Remove extra newline (typo).
2021-02-09mbox: fix expunging in a read-only directorySergey Poznyakoff4
This fixes debian bug 980042. Re: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980042#16 * libproto/mbox/mboxrd.c (mboxrd_flush_unlocked): If temporary file cannot be created in the directory of the mailbox because of EACCES, create it elsewhere and copy back to the mailbox when ready. Also, make sure that the mode and ownership of the mailbox are preserved, no matter what temporary file was used. * libproto/mbox/tests/rospool.at: New test. * libproto/mbox/tests/Makefile.am: Add new test. * libproto/mbox/tests/testsuite.at: Add new test.
2021-01-12Fix libmu_scm testsuiteSergey Poznyakoff5
This is a follow-up to a3bd653315. * libmu_scm/tests/testsuite.at (MU_GUILE_OUTPUT_FILTER): New macro. (MU_GUILE_CHECK): If MU_GUILE_OUTPUT_FILTER is not empty, filter the stdout through it. * libmu_scm/tests/mailbox-append-message.at: Filter out line and byte counts. * libmu_scm/tests/mailbox-expunge.at: Fix line and byte counts. * libmu_scm/tests/mailbox-get-message.at: Likewise. * libmu_scm/tests/mailbox-iterate.at: Likewise.
2021-01-12Remove left-over mailutils.rc supportSergey Poznyakoff1
* libmailutils/cli/cli.c (MU_LEGACY_CONFIG_FILE): Remove. (mu_cli_ext): No handling for the pre-3.0 configuration file.
2021-01-11Fix building mda utilities with mailbox quotas offSergey Poznyakoff1
2021-01-11Fix architecture-dependent test failuresSergey Poznyakoff5
* configure.ac (MU_COND_MAILBOX_QUOTA): Fix test condition. * libproto/dotmail/tests/atlocal.in (x_imapbase_normalize): New function. * libproto/mbox/tests/atlocal.in: Likewise. * libproto/dotmail/tests/delete.at: Filter output through x_imapbase_normalize to avoid triggering false negative due to padding differences. * libproto/mbox/tests/delete.at: Likewise.
2021-01-11Force character signedness in strout testSergey Poznyakoff1
2021-01-11SMTP mailer: fix selection of the default portSergey Poznyakoff1
* libproto/mailer/smtp.c (smtp_open): Use MU_SMTPS_PORT only if MAILER_TLS_ALWAYS is required.
2021-01-11strout test: don't wait for the input forever.Sergey Poznyakoff1
* libmailutils/tests/strout.c: Run no longer than 30 seconds. Standardize exit codes.
2021-01-05Minor changesSergey Poznyakoff9
2021-01-05Version 3.11.1release-3.11.1Sergey Poznyakoff2
2021-01-05Fix version outputSergey Poznyakoff3
* include/mailutils/cli.h (mu_copyright_year): New extern. (mu_version_print): New proto. * libmailutils/cli/cli.c (mu_copyright_year): New variable. Should be updated once a year. (mu_version_print): New function. (mu_version_hook): Use mu_version_print. * mail/mail.c (mail_warranty): Use mu_version_print.
2021-01-05Update copyright yearsSergey Poznyakoff1728
2020-12-30Fix coredump on NULL input to mu_url_create_hintSergey Poznyakoff2
In particular, this caused inc to coredump when called without explicit -file option. * libmailutils/url/create.c (mu_url_create_hint): Return EINVAL if str is NULL. * mh/tests/inc.at: Add new test.
2020-12-30Use well-known mboxrd format name everywhereSergey Poznyakoff7
2020-12-23Version 3.11release-3.11Sergey Poznyakoff2
2020-12-21MH: provide a mh_profile setting to control assignment of sequence numbersSergey Poznyakoff10
The "Volatile-uidnext" setting controls how sequence numbers are allocated. By default they increase monotonically. If Volatile-uidnext is set to "true", each new incorporated message is assigned the sequence number equal to that of the last message increased by one. When the last message in the mailbox is deleted, the value of UIDNEXT is recalculated and UIDVALIDITY is increased. This follows the behavior of traditional MH implementations. * doc/texinfo/mu-mh.texi: Document chnges. * include/mailutils/sys/amd.h (MU_AMD_VOLATILE_UIDNEXT): New constant. * libmailutils/base/amd.c (amd_expunge): Reset uidvalidity and uidnext if MU_AMD_VOLATILE_UIDNEXT capability is set and the last message was removed. * libproto/mh/mh.c (_mailbox_mh_init): New mh_profile setting "Volatile-uidnext". If set to true, it instructs mailutils to mimic the traditional MH behavior when assigning sequence number to the new message. * testsuite/mbop.c (main): Use MBOP_PRE_OPEN_HOOK (if defined) as the name of the function to call before opening the mailbox. * libproto/mh/tests/mbop.c (mbop_pre_open_hook): New function. If the MH environment variable is set, take its value as the name of the mh_profile and read settings from it. * libproto/mh/tests/Makefile.am: Add uidvol.at * libproto/mh/tests/atlocal.in: Unset MH. * libproto/mh/tests/testsuite.at: Include uidvol.at * libproto/mh/tests/uidvol.at: New file.
2020-12-04amd: reset the UIDNEXT after resetting the uidvaliditySergey Poznyakoff2
This happens automatically for plaintext mailboxes, but needs to be done explicitly for directory-based ones. * libmailutils/base/amd.c (amd_set_uidvalidity): Reset the UIDNEXT * testsuite/mbop.c: New command: uidvalidity_reset
2020-12-04Explicitly reset uidvalidity after folder -pickSergey Poznyakoff1
(See also 6e0fb32ec8)
2020-11-30Version 3.10.91Sergey Poznyakoff2
2020-11-30New functions for closing all fds and daemonizingSergey Poznyakoff16
* configure.ac: Select a suitable interface for closing all file descriptors greater than or equal to a chosen one. * include/mailutils/daemon.h (mu_daemon): New proto. * include/mailutils/util.h (mu_close_fds): New proto. * lib/daemon.c: Removed. * lib/Makefile.am: Remove daemon.c * libmailutils/base/Makefile.am: Add closefds.c * libmailutils/base/closefds.c: New file. * libmailutils/base/daemon.c: Rename to libmailutils/base/pidfile.c * libmailutils/base/daemon.c: New file. * libmailutils/diag/bt.c: Use mu_close_fds. * libmailutils/server/acl.c: Likewise. * mh/mh_whatnow.c: Likewise. * libmailutils/stream/prog_stream.c: Likewise. * libmailutils/server/msrv.c: Use mu_daemon. * mh/send.c: Likewise. * mda/lib/util.c (mda_close_fds): Remove.

Return to:

Send suggestions and report system problems to the System administrator.