1. 18 Mar, 2017 1 commit
    • The new implementation allows for per-server certificates.
      
      * libmu_auth/Makefile.am: Build tls support depending on the value of
      MU_COND_GNUTLS.
      * libmu_auth/notls.c: New file.
      * libmu_auth/tls.c: Rewrite.
      * libmu_auth/tlsiostr.c: New file.
      * libmu_auth/tlsvar.c: New file.
      * libmu_auth/tlsconf.c: New file.
      
      * include/mailutils/sys/tls-stream.h (_mu_tls_stream): New members:
      session_type, conf, cred.
      (mu_tls_io_stream_create): New proto.
      * include/mailutils/tls.h (mu_tls_module_config): Remove definition.
      (mu_tls_config): New structure.
      (mu_tls_server_stream_create): Remove proto.
      (mu_tls_cert_file_checks)
      (mu_tls_key_file_checksr)
      (mu_tls_ca_file_checks): New globals
      (MU_TLS_CERT_FILE_CHECKS)
      (MU_TLS_KEY_FILE_CHECKS)
      (MU_TLS_CA_FILE_CHECKS): New defines.
      (mu_tls_stream_create): New proto.
      (mu_tls_config_status): New constants.
      (mu_tls_check_config): Remove.
      (mu_tls_config_check): New function.
      
      * include/mailutils/server.h (mu_m_server_preflight_fp): New typedef.
      (mu_m_server_set_preflight): New proto.
      
      * libmailutils/diag/debcat (tls): New category.
      * libmailutils/server/ipsrv.c (mu_ip_server_get_data): New function.
      * libmailutils/server/msrv.c (_mu_m_server) <preflight>: New method.
      (mu_m_server_set_preflight): New function.
      (mu_m_server_destroy): Destroy the srvlist.
      (open_connection): New function.
      (mu_m_server_run): Remove from srvlist only those servers that failed
      to open.  Run preflight check, if registered.
      
      * include/mailutils/cfg.h (mu_cfg_section): New member: data.
      * libmailutils/cfg/driver.c (dup_container): Copy the "data" pointer.
      (mu_cfg_section_add_params): Preserve original pointer and offset when
      necessary.
      * libmailutils/cfg/parser.y (_scan_tree_helper): Use the section data
      pointer (if set) as data target.
      
      * configure.ac (MU_COND_GNUTLS): New conditional.
      * imap4d/commands.c: Remove #ifdef WITH_TLS preprocessor conditional.
      * imap4d/imap4d.c (tls_mode): Remove variable.
      (imap4d_srv_config): Move definition to the header file.
      Remove #ifdef WITH_TLS preprocessor conditionals.
      Rename the tls configuration statement to tls-mode.
      Add new subsection .server.tls;
      Remove the legacy tls-required configuration statement.
      (imap4d_mainloop): Change signature: take a pointer to the
      struct imap4d_srv_config as the 3rd argument,
      Use the cfg->tls_mode member to decide on TLS state.
      (main): Call mu_tls_cfg_init.
      Install server preflight checker.
      * imap4d/imap4d.h: Remove #ifdef WITH_TLS preprocessor conditionals.
      (imap4d_srv_config): Moved from imap4d.c
      New member: tls_conf
      (imap4d_session): New member: tls_conf
      (global_tls_conf): New global.
      (io_setio, imap4d_init_tls_server): Change prototypes.
      * imap4d/io.c (io_setio): Change signature: take a pointer to the
      struct mu_tls_config as the 3rd argument.
      Rewrite TLS support.
      (imap4d_init_tls_server): Take a pointer to the
      struct mu_tls_config.
      * imap4d/starttls.c (tls_available, tls_done): Remove globals.
      (global_tls_conf): New global.
      (imap4d_starttls): Keep TLS state in the session.
      (tls_encryption_on): Likewise.
      (starttls_init): Rewrite as a mserver preflight check function.
      
      * pop3d/capa.c: Remove #ifdef WITH_TLS preprocessor conditional.
      (capa_stls): Rewrite.
      * pop3d/cmd.c (global_tls_conf): New global.
      (stls_preflight): New function.
      (pop3d_error_string): Rewrite using char ** array.
      * pop3d/extra.c (pop3d_setio): Take a pointer to struct mu_tls_config
      as the 3rd argument. Decide on TLS using it.
      (pop3d_init_tls_server): Take a pointer to struct mu_tls_config.
      * pop3d/pop3d.c: Rename the tls configuration statement to tls-mode.
      Add new subsection .server.tls;
      Remove the legacy tls-required configuration statement.
      (pop3d_mainloop) Take a pointer to struct mu_tls_config
      as the 3rd argument. Decide on TLS using it.
      (main): Call mu_tls_cfg_init. Install server preflight check.
      * pop3d/pop3d.h (pop3d_session): New member tls_conf.
      (pop3d_srv_config): New definition.
      (global_tls_conf): New extern.
      * pop3d/stls.c: Rewrite TLS support.
      
      * NEWS: Document new features.
      * configure.ac: Version 3.2.90.
      * doc/texinfo/programs.texi: Update.
      Sergey Poznyakoff authored
  2. 11 Mar, 2017 2 commits
  3. 06 Mar, 2017 1 commit
  4. 18 Feb, 2017 1 commit
  5. 17 Feb, 2017 2 commits
    • * libmailutils/stream/stream.c (mu_stream_destroy): Free
      buffer space.
      (mu_stream_set_buffer,mu_stream_getdelim): Use stdlib allocation
      functions instead of mu wrappers.
      Sergey Poznyakoff authored
    • The approach used so far failed to recognize ambiguous abbreviations
      located in different groups.  It also didn't work when
      MU_PARSEOPT_NO_SORT was requested.  This commit fixes it by keeping
      an additional array of indices to long options.  The array is sorted
      so that its elements produce a lexicographically ascending list of
      long options.
      
      * include/mailutils/opt.h (mu_parseopt): New members po_longcnt,
      po_longidx keep a sorted array of indices to po_optv with long
      options.
      * libmailutils/opt/opt.c (find_long_option): Iterate over po_longidx.
      (parseopt_init): Initialize and sort po_longidx.
      (mu_parseopt_free): Free po_longidx.
      
      * libmailutils/tests/parseopt.c: Add three more potentially
      ambiguous options
      * libmailutils/tests/parseopt26.at: New testcase.
      * libmailutils/tests/parseopt27.at: New testcase.
      * libmailutils/tests/Makefile.am: Add new testcases.
      * libmailutils/tests/testsuite.at: Likewise.
      Sergey Poznyakoff authored
  6. 05 Feb, 2017 1 commit
  7. 30 Jan, 2017 3 commits
    • The new node type mu_sieve_node_end is introduced to explicitly
      mark end of the parse tree.  When generating code, this node
      triggers insertion of _mu_i_sv_instr_source/_mu_i_sv_instr_line
      before the end of code marker.  This, in turn, ensures that a
      correct location is reported for implicit keep, if logging is
      enabled.
      
      * libmu_sieve/sieve-priv.h (mu_sieve_node_end): New node type.
      (mu_sieve_node_list): New type (from struct node_list in sieve.y)
      * libmu_sieve/sieve.y (node_list_add): New function.
      (input production): Add mu_sieve_node_end at the end of the tree.
      Sergey Poznyakoff authored
    • * lib/sieve.c (_sieve_action_log): Log source location
      Sergey Poznyakoff authored
    • * maidag/maidag.c (sieve_debug_flags)
      (sieve_enable_log): Remove.
      * maidag/script.c (apply_script): Check for mu_script_sieve_log.
      Sergey Poznyakoff authored
  8. 26 Jan, 2017 4 commits
  9. 24 Jan, 2017 4 commits
    • * imap4d/list.c (list_fun): Ignore names that contain delimiter
      as part of their name (untranslatable names);
      Don't insert spurious separators.
      (list_ref): Make sure a pathnames are properly separated from
      namespace prefixes.
      (imap4d_list): Fix eventual use of uninitialized pfx.
      * imap4d/namespace.c (prefix_translate_name): Allow for NS_OTHER
      prefixes ending with a delimiter.
      (extract_username): Return NULL if prefix without trailing delimiter
      was used.
      * imap4d/tests/atlocal.in (make_config): Add more namespace prefixes.
      * imap4d/tests/list.at: Add more tests.
      * libmailutils/string/expvar.c (exp_getvar): Return MU_WRDSE_UNDEF if
      the variable is defined, but has NULL value.
      Sergey Poznyakoff authored
    • * imap4d/namespace.c (namespace_get_name): Return NULL if name
      is the same as the returned prefix
      Sergey Poznyakoff authored
    • * imap4d/namespace.c (prefix_translate_name): Remove the url
      parameter. All uses changed.
      (namespace_translate_name): Likewise.
      (i_translate_name): Rename to translate_name. Remove the url
      and ns parameters. All uses changed.
      * imap4d/imap4d.h (namespace_translate_name): Change signature.
      Sergey Poznyakoff authored
    • This avoids problems with escaping pathnames that contain characters
      specific for URLs
      
      * imap4d/select.c (imap4d_select0): Don't use mailbox URL.
      * lib/manlock.c (manlock_open_mailbox_from_record): New function.
      * lib/muaux.h (manlock_open_mailbox_from_record): New proto.
      Sergey Poznyakoff authored
  10. 23 Jan, 2017 2 commits
    • Sergey Poznyakoff authored
    • * imap4d/list.c (refinfo) <refptr>: const pointer.
      (list_fun): Don't insert spurious delimiter between the
      prefix and the value.
      (list_ref): New static function.  Actually list a normalized ref/wcard
      pair.
      (imap4d_list): Correctly handle wildcard part starting with
      namespace prefixes
      * imap4d/namespace.c (prefix_translate_name): If a prefix ends with
      a delimiter, allow its use without trailing delimiter in ref.   E.g.
      
        LIST "~" "%"
      
      for prefix "~/" is quite OK.
      * imap4d/tests/atlocal.in: Fix prefix declaration.
      Sergey Poznyakoff authored
  11. 22 Jan, 2017 4 commits
    • * imap4d/io.c (io_send_qstring): Fix condition
      * imap4d/list.c (list_fun): Use io_send_qstring to print names.
      * imap4d/lsub.c (imap4d_lsub): Likewise.
      Sergey Poznyakoff authored
    • * imap4d/namespace.c (namespace_init): Provide record for default
      "" prefix.
      Sergey Poznyakoff authored
    • Instead of translating names to full mailbox URLs, translate them
      to the filesystem pathname and record (mu_record_t) that should be
      used when creating the mailbox.  Never use mu_mailbox_create_default.
      
      This patch also fixes memory leaks in some functions (the return
      value from namespace_get_url was never freed).
      
      * imap4d/imap4d.h (namespace_get_url): Remove.
      (namespace_get_name): New proto.
      * imap4d/namespace.c (namespace_init): Always intialize the
      pfx->record member.  This requires that the default record be
      initialized.
      (namespace_get_url): Remove.
      (namespace_get_name): New function.
      
      * imap4d/create.c: Use namespace_get_name and
      mu_mailbox_create_from_record to create mailboxes.  Fix folder
      creation.
      * imap4d/append.c: Use namespace_get_name and
      mu_mailbox_create_from_record to create mailboxes.
      * imap4d/copy.c: Likewise.
      * imap4d/delete.c: Likewise.
      * imap4d/quota.c: Likewise.
      * imap4d/rename.c: Likewise.
      * imap4d/status.c: Likewise.
      Sergey Poznyakoff authored
    • * imap4d/list.c (list_fun): List matching directories.
      Sergey Poznyakoff authored
  12. 21 Jan, 2017 1 commit
    • Bugfix · b3d82e99
      * libmu_auth/ldap.c (_construct_attr_array)
      (_mu_entry_to_auth_data): Fix types of iterator return values.
      Sergey Poznyakoff authored
  13. 20 Jan, 2017 2 commits
  14. 19 Jan, 2017 2 commits
    • * libmailutils/string/expvar.c (exp_shell): Fix out-of-buffer
      read when used without arguments.
      (mu_str_expand): Improve error handling.
      * libmailutils/tests/testsuite.at (MU_GENERIC_TEST_CMD): New
      macro.
      Include exp.at
      * libmailutils/tests/vexp.c: New file.
      * libmailutils/tests/Makefile.am: Build vexp. Add exp.at
      * libmailutils/tests/exp.at: New file.
      Sergey Poznyakoff authored
    • The functions are used wherever variables can be expected, most
      notably in configuration statements, such as ldap, namespace (imap4d),
      etc.  Apart from expanding variables it also provides command
      expansion $(command args...)
      
      The commands currently available are:
      
        domainpart ARG       splits its argument on the first occurrence of @
                             and returns the part after it.
        localpart ARG        splits its argument on the first occurrence of @
                             and returns the part before it.
        shell CMD ARG...     runs shell command CMD and returns its output
      
      * include/mailutils/cstr.h (mu_str_expand, mu_str_vexpand): New protos.
      * libmailutils/string/expvar.c: New file.
      * libmailutils/string/Makefile.am: Add expvar.c
      
      * libmailutils/tests/exp.c: New file.
      * libmailutils/tests/Makefile.am: Add exp.c
      
      * imap4d/imap4d.c (namespace_cfg_init): Fix docstring.
      * imap4d/namespace.c (namespace_translate_name): Use mu_str_expand.
      
      * libmailutils/mailbox/mbx_default.c (mu_construct_user_mailbox_url):
      Use mu_str_vexpand.
      * libmu_auth/ldap.c (_mu_ldap_search): Likewise.
      * libmu_auth/radius.c (_expand_query): Likewise.
      * libmu_auth/sql.c (mu_sql_expand_query): Likewise.
      
      * mu/shell.c (mutool_prompt_env): Remove.
      (shell_prompt): Rewrite
      (input_line_interactive): Use mu_str_expand.
      (mutool_shell_prompt_assoc): New function.
      * mu/mu.h (mutool_shell_prompt_assoc): New proto.
      * mu/imap.c (imap_prompt_env): Use mutool_shell_prompt_assoc.
      * mu/pop.c (pop_prompt_env): Likewise.
      * mu/smtp.c (smtp_prompt_env): Likewise.
      Sergey Poznyakoff authored
  15. 18 Jan, 2017 1 commit
  16. 17 Jan, 2017 2 commits
  17. 16 Jan, 2017 4 commits
    • * libmailutils/mime/attachment.c (mu_attachment_copy_from_stream)
      (mu_attachment_copy_from_file): Remove the encoding parameter.  Take
      the encoding to use from the value of the Content-Transfer-Encoding
      header.  Return EINVAL if it is not present.
      * include/mailutils/message.h (mu_attachment_copy_from_stream)
      (mu_attachment_copy_from_file): Change signature.  All uses changed.
      Sergey Poznyakoff authored
    • This also includes small bugfixes in the MIME library code.
      
      The --skip-empty-attachment option now affects the original
      body as well.  If the option is in effect, and the body is empty,
      it will not be included to the composed message.
      
      * libmailutils/mime/mime.c (_mime_body_stream_read): Return EOF
      if there are no parts in the message.
      (mu_mime_get_num_parts): If message is not multipart, report 1 part
      without setting mime->nmtp_parts.  Setting it caused coredump in
      other MIME functions (namely, in mu_mime_add_part.
      * mail/send.c (add_body): New function.  Adds original body to
      the MIME, honoring the --skip-empty-attachment option.
      * doc/texinfo/programs.texi: Update.
      Sergey Poznyakoff authored
    • * imap4d/id.c (eat_args): Log the client identity using the info channel.
      * imap4d/list.c: tiny change
      Sergey Poznyakoff authored
    • * libmailutils/cli/cli.c (mu_cli): Use "no-" prefix to indicate negation
      * mail/mail.c (skip_empty_attachments): New global.
      (mail_options): New option --skip-empty-attachments
      * mail/mail.h (skip_empty_attachments): New extern.
      * mail/send.c (atchinfo) <skip_empty>: New field.
      (send_attach_file): Initialize skip_empty
      (saveatt): Optionally skip empty attachments
      
      * NEWS: Mention the new option.
      * doc/texinfo/programs.texi: Document the new option.
      Sergey Poznyakoff authored
  18. 14 Jan, 2017 3 commits