1. 28 Nov, 2011 3 commits
    • Sergey Poznyakoff authored
    • * imap4d/tests/Makefile.am (TESTSUITE_AT): Add append00.at and
      append01.at
      * imap4d/tests/testsuite.at: Include append tests.
      * imap4d/tests/append00.at: New file.
      * imap4d/tests/append01.at: New file.
      Sergey Poznyakoff authored
    • * configure.ac (IMAP_AUTHOBJS): Remove subst variable.  Use conditional
      instead.
      Configure imap4d/tests for testing.
      Build imap4d/tests/Makefile and imap4d/tests/atlocal.
      * imap4d/Makefile.am (SUBDIRS): Add tests.
      [MU_COND_GSASL]: Define AUTH_GSASL
      [MU_COND_GSSAPI]: Define AUTH_GSSAPI
      (imap4d_SOURCES): Include AUTH_GSASL and AUTH_GSSAPI
      (imap4d_LDADD,imap4d_DEPENDENCIES): Remove reference to IMAP_AUTHOBJS.
      (EXTRA_DIST): Remove.
      
      * imap4d/tests/.gitignore: New file.
      * imap4d/tests/IDEF0955.at: New file
      * imap4d/tests/IDEF0956.at: New file
      * imap4d/tests/Makefile.am
      * imap4d/tests/anystate.at: New file
      * imap4d/tests/atlocal.in
      * imap4d/tests/create01.at: New file
      * imap4d/tests/create02.at: New file
      * imap4d/tests/examine.at: New file
      * imap4d/tests/expunge.at: New file
      * imap4d/tests/id.at: New file
      * imap4d/tests/list.at: New file
      * imap4d/tests/search.at: New file
      * imap4d/tests/select.at: New file
      * imap4d/tests/status.at: New file
      * imap4d/tests/testsuite.at: New file
      
      * imap4d/fetch.c (fetch_io): Improve range checking.  If the requested
      number of bytes is greater than maximum, truncate it.
      * imap4d/imap4d.c: New option --test.
      (test_mode): New global variable.
      (imap4d_session_setup0): Fix improperly allocated automatic variable.
      (main): Call GSASL and GSSAPI initializations only if mu_gsasl_enabled()
      returns true.
      * imap4d/imap4d.h (test_mode): New extern.
      * imap4d/preauth.c: Do not complain about failed getpeername in test mode.
      * imap4d/select.c: Fix human-readable response texts.
      
      * include/mailutils/gsasl.h (mu_gsasl_module_data)<enable>: New member.
      (mu_gsasl_enabled): New proto.
      * libmailutils/mailbox/mailbox.c (mu_mailbox_flush):
      (mu_mailbox_append_message,mu_mailbox_sync)
      (mu_mailbox_expunge): Use MU_STREAM_WRITE instead of MU_STREAM_RDWR.
      * libmu_auth/gsasl.c (mu_gsasl_module_data): Fix initialization.
      (mu_gsasl_enabled): New function.
      * libmu_cfg/gsasl.c (mu_gsasl_param): New parameter "enable".
      Sergey Poznyakoff authored
  2. 27 Nov, 2011 1 commit
    • * imap4d/fetch.c (bodystructure): Do not emit CHARSET pair if there is
      none in the Content-Type header.
      (fetch_get_part_rfc822): Use mu_message_unencapsulate
      * libmailutils/mime/attachment.c (mu_message_unencapsulate): Use
      mu_stream_to_message to create destination message.  This ensures that
      the latter can be handled by other MU functions (e.g. mu_header_*
      family).
      Sergey Poznyakoff authored
  3. 26 Nov, 2011 2 commits
    • According to RFC 3501 HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT part
      specifiers refer to the RFC-2822 header of the message or of an encapsulated
      MESSAGE/RFC822 message.  They return NILs if applied to a MIME part other
      than MESSAGE/RFC822.
      
      * imap4d/fetch.c (fetch_get_part_rfc822): New function.
      (_frt_body): Used only for BODY[]. Consequently, do not try to resolve
      message part, use the message itself instead.
      (_frt_body_n): New function.
      (_frt_mime): New function.
      (_frt_body_text,_frt_header,_frt_header_fields): Use fetch_get_part_rfc822.
      Unref the retrieved message when through.
      (parse_section_text): Use _frt_mime for BODY[<n>.MIME]
      (parse_section): Use _frt_body_n for BODY[<n>].
      * imap4d/testsuite/imap4d/fetch.exp: Remove incorrect tests.
      Sergey Poznyakoff authored
    • The purpose is to avoid using variadic calls in order to let the compiler
      do the necessary argument checking.
      
      * include/mailutils/imap.h (mu_imap_callback_t): Take a pair of size_t
      and void * arguments instead of the single va_list.
      (mu_imap_callback): Likewise.
      * libproto/imap/callback.c: Likewise.
      * libproto/imap/resproc.c: Update callback calls.
      * mu/imap.c: Update callback declarations.
      Sergey Poznyakoff authored
  4. 25 Nov, 2011 3 commits
  5. 24 Nov, 2011 10 commits
    • * include/mailutils/imap.h (mu_imap_noop): New proto.
      * include/mailutils/sys/imap.h (mu_imap_client_state)
      <MU_IMAP_NOOP_RX>: New state.
      * libproto/imap/noop.c: New file.
      * libproto/imap/Makefile.am (libmu_imap_la_SOURCES): Add noop.c
      * mu/imap.c (report_failure): New function.
      (com_login,select_mbox,com_status): Use report_failure for
      error reporting.
      (com_noop): New function.
      (imap_comtab)<noop>: New command.
      Sergey Poznyakoff authored
    • * mu/imap.c: Add missing gettext markers.
      Sergey Poznyakoff authored
    • * include/mailutils/imap.h (mu_imap_response_action_t): Move to
      sys/imap.h
      (mu_imap_foreach_response): Remove.
      * include/mailutils/sys/imap.h (_mu_imap)<untagged_resp>: Remove.
      All sources updated.
      (_mu_imap_response): Change sigature.
      (_mu_imap_untagged_response_clear)
      (_mu_imap_untagged_response_add): Remove.
      (_mu_imap_untagged_response_to_list)
      (_mu_imap_process_untagged_response): New protos.
      * libproto/imap/connect.c: Use _mu_imap_untagged_response_to_list
      and _mu_imap_process_untagged_response.
      * libproto/imap/create.c: Update.
      * libproto/imap/destroy.c: Update.
      * libproto/imap/disconnect.c: Update.
      * libproto/imap/capability.c: Update calls to _mu_imap_response
      * libproto/imap/id.c: Likewise.
      * libproto/imap/login.c: Likewise.
      * libproto/imap/logout.c: Likewise.
      * libproto/imap/select.c: Likewise.
      * libproto/imap/status.c: Likewise.
      * libproto/imap/resplist.c (_mu_imap_untagged_response_clear): Remove.
      (_mu_imap_untagged_response_add): Remove.
      (_mu_imap_untagged_response_to_list): New function.
      * libproto/imap/response.c (_mu_imap_response): Take response-processing
      function and its closure as arguments.
      * libproto/imap/resproc.c (_mu_imap_process_untagged_response): New
      function.
      (mu_imap_foreach_response): Remove.
      
      * mu/imap.c: Install a BYE callback.
      Sergey Poznyakoff authored
    • * include/mailutils/imap.h (MU_IMAP_CB_NO)
      (MU_IMAP_CB_BAD,MU_IMAP_CB_BYE)
      (MU_IMAP_CB_PREAUTH): New callbacks.
      (mu_imap_callback_t): Change signature.
      (mu_imap_callback): Change signature.
      * include/mailutils/sys/imap.h (mu_imap_client_state)
      <MU_IMAP_CLOSING>: New state.
      * libproto/imap/callback.c (mu_imap_callback): Change signature.
      Fix boundary check.
      (mu_imap_register_callback_function): Fix boundary check.
      * libproto/imap/connect.c (mu_imap_connect): Use mu_imap_foreach_response
      to parse response.
      * libproto/imap/response.c (_mu_imap_response): Check number of words
      before dereferencing them.
      * libproto/imap/resproc.c: Handle all server responses.
      * mu/imap.c (com_connect): Set POPAUTH callback.
      Set verbosity flags after I/O structure has been created.
      Sergey Poznyakoff authored
    • * include/mailutils/list.h (mu_list_head, mu_list_tail): New prototypes.
      * libmailutils/list/head.c: New file.
      * libmailutils/list/tail.c: New file.
      * libmailutils/list/Makefile.am (liblist_la_SOURCES): Add new files.
      * libmailutils/tests/listop.c (head,tail): New commands.
      * libmailutils/tests/list.at: Test head and tail.
      Sergey Poznyakoff authored
    • * include/mailutils/sys/imap.h (_mu_imap_seterrstrz): New proto.
      * libmailutils/imapio/replstr.c: Update.
      * libproto/imap/err.c (_mu_imap_seterrstrz): New function.
      * libproto/imap/id.c: Remove superfluous calls to _mu_imap_seterrstr.
      * libproto/imap/login.c: Likewise.
      * libproto/imap/select.c: Likewise.
      * libproto/imap/status.c: Likewise.
      * libproto/imap/response.c: Set human-readable text as errstr.
      * libproto/imap/resproc.c (ok_response): Reflect changes to
      mu_imapio_getline.
      Sergey Poznyakoff authored
    • * libmailutils/imapio/create.c (mu_imapio_create): Treat [ and ] as
      delimiters.
      Use MU_WRDSF_DQUOTE flag instead of MU_WRDSF_QUOTE.
      Use MU_WRDSF_APPEND
      * libmailutils/imapio/getline.c (mu_imapio_getline): Use incremental
      wordsplit mode.  Return human-readable part of status responses as a
      single token.
      Sergey Poznyakoff authored
    • * libmailutils/string/wordsplit.c (scan_word): Return only one delimiter
      if MU_WRDSF_RETURN_DELIMS is on
      * libmailutils/tests/wordsplit.at: Reflect that.
      Sergey Poznyakoff authored
    • * include/mailutils/wordsplit.h (MU_WRDSF_INCREMENTAL): New flag.
      (MU_WRDSE_NOINPUT): New error code.
      * libmailutils/string/wordsplit.c (mu_wordsplit_init0): New function.
      (mu_wordsplit_init): Call mu_wordsplit_init0.
      (expvar): Use MU_WRDSF_WS instead of MU_WRDSF_SQUEEZE_DELIMS in
      call to subordinate mu_wordsplit.
      (skip_delim): If both MU_WRDSF_RETURN_DELIMS and MU_WRDSF_SQUEEZE_DELIMS
      are given, squeeze only the same delimiter characters.
      * libmailutils/tests/wordsplit.at: Add tests for incremental mode.
      * libmailutils/tests/wsp.c: Support incremental mode.
      Sergey Poznyakoff authored
    • * libmu_auth/tls.c: Don't generate DH params at all.
      Sergey Poznyakoff authored
  6. 23 Nov, 2011 1 commit
    • * am/gsasl.m4 (MU_CHECK_GSASL): Enable GSASL by default.  Other minor fixes.
      * am/tls.m4 (MU_CHECK_TLS): Rename to MU_CHECK_GNUTLS.  Check option
      arguments.  Check for gnutls library version.
      * configure.ac: Update.
      * README: Document the change.
      * NEWS: Document the change.
      Sergey Poznyakoff authored
  7. 22 Nov, 2011 2 commits
    • * libmu_dbm/dbm.c (mu_dbm_create_from_url): Parameter list beginning
      with a negative parameter implies default safety criteria.
      Fix semantics of the "default" keyword: it is different from "all".
      * libmu_dbm/mudbm.h (DEFAULT_DBM_SAFETY_FLAGS): Remove.  Not needed now.
      * pop3d/bulletin.c (read_bulletin_db): Remove a leftover call to
      mu_dbm_safety_set_flags.
      Sergey Poznyakoff authored
    • The new format, called "C", allows programmers to create input data
      for use by mu load using conventional means.  It represents both key and
      content as C strings (hence its name), with usual C (literal and octal)
      escapes to represent non-printable characters.
      
      * mu/dbm.c (IOBUF_REREAD,IOBUF_EOF): New constants.
      (iobuf) <state>: New member.
      (input_eof): New macro.
      (input_getline): Use iobuf.state to detect EOF.
      (input_ungetline): Reset state only if it is 0.
      (format_tab): New format "C".
      (write_quoted_string,C_writer,C_read_datum)
      (C_reader): New functions to implement the C dump format.
      * libmailutils/tests/testsuite.at: Minor change.
      Sergey Poznyakoff authored
  8. 21 Nov, 2011 2 commits
    • Sergey Poznyakoff authored
    • * configure.ac (check_dbm_impl): Fix improper usage of expr in BDB=* case.
      * include/mailutils/dbm.h (mu_dbm_create_from_url)
      (mu_dbm_create): Take default safety flags as the last argument.
      * libmailutils/base/filesafety.c (_check_linkwrdir): Check for both
      hard and symbolic links.  Fix the latter check.
      * libmailutils/tests/fsaf.at: Add check for softlink in a writable dir.
      * libmu_dbm/create.c (mu_dbm_create): Take default file safety as the
      last argument.
      * libmu_dbm/dbm.c (mu_dbm_create_from_url): Likewise.
      * maidag/mailquota.c (dbm_retrieve_quota): Update call to mu_dbm_create.
      Impose MU_FILE_SAFETY_ALL by default.
      * mu/dbm.c (open_db_file): Update call to mu_dbm_create.  No checks
      by default.
      * pop3d/apop.c (pop3d_apopuser): Update call to mu_dbm_create.  Use
      apop_database_safety as the default checks.
      * pop3d/bulletin.c (read_bulletin_db,write_bulletin_db): Update calls to
      mu_dbm_create.  Use DEFAULT_GROUP_DB_SAFETY as default.
      * pop3d/logindelay.c (open_stat_db): Update call to mu_dbm_create.
      Use DEFAULT_GROUP_DB_SAFETY as default.
      * pop3d/pop3d.c (apop_database_safety): Initialize to MU_FILE_SAFETY_ALL.
      (apop_database_safety_set): Remove.
      * pop3d/pop3d.h (apop_database_safety_set): Remove.
      * pop3d/popauth.c (open_db_file): Update call to mu_dbm_create.  Use
      safety_flags by default.
      Sergey Poznyakoff authored
  9. 20 Nov, 2011 1 commit
    • * include/mailutils/wordsplit.h (MU_WRDSF_SQUOTE,MU_WRDSF_DQUOTE): New flags.
      (MU_WRDSF_QUOTE): Redefine as an OR of the above two.
      * libmailutils/string/wordsplit.c (scan_word): Treat '\'' and '"'
      separately, depending on the flags.
      * libmailutils/tests/wsp.c: Add squote and dquote options.
      * libmailutils/tests/wordsplit.at: Test separate quoting support.
      Sergey Poznyakoff authored
  10. 19 Nov, 2011 4 commits
    • * include/mailutils/list.h (mu_list_slice_dup,mu_list_slice)
      (mu_list_slice2_dup,mu_list_slice2): New protos.
      * libmailutils/list/slice.c: New file.
      * libmailutils/list/slice2.c: New file.
      * libmailutils/list/Makefile.am: Add slice.c and slice2.c
      * libmailutils/tests/list.at: Add slicing tests.
      * libmailutils/tests/listop.c: New command: "slice"
      Sergey Poznyakoff authored
    • Sergey Poznyakoff authored
    • * include/mailutils/imap.h (mu_imap_response_action_t): New typedef.
      (mu_imap_foreach_response): New proto.
      (MU_IMAP_CB_PERMANENT_FLAGS,MU_IMAP_CB_MESSAGE_COUNT)
      (MU_IMAP_CB_RECENT_COUNT,MU_IMAP_CB_FIRST_UNSEEN)
      (MU_IMAP_CB_UIDNEXT,MU_IMAP_CB_UIDVALIDITY)
      (MU_IMAP_CB_OK,_MU_IMAP_CB_MAX): New constants.
      (mu_imap_callback_t): New typedef.
      (mu_imap_callback,mu_imap_register_callback_function): New protos.
      (MU_IMAP_RESPONSE_ALERT,MU_IMAP_RESPONSE_BADCHARSET)
      (MU_IMAP_RESPONSE_CAPABILITY,MU_IMAP_RESPONSE_PARSE)
      (MU_IMAP_RESPONSE_PERMANENTFLAGS,MU_IMAP_RESPONSE_READ_ONLY)
      (MU_IMAP_RESPONSE_READ_WRITE,MU_IMAP_RESPONSE_TRYCREATE)
      (MU_IMAP_RESPONSE_UIDNEXT,MU_IMAP_RESPONSE_UIDVALIDITY)
      (MU_IMAP_RESPONSE_UNSEEN): New constants.
      (mu_imap_response_codes): New extern.
      * include/mailutils/sys/imap.h (_mu_imap) <callback>: New member.
      (_mu_imap_collect_flags, _mu_imap_list_at): New protos.
      * libproto/imap/resplist.c (_mu_imap_list_at): New function.
      * libproto/imap/callback.c: New file.
      * libproto/imap/resproc.c: New file.
      * libproto/imap/Makefile.am: Add new files.
      * libproto/imap/capability.c: Rewrite using mu_imap_foreach_response.
      * libproto/imap/id.c: Likewise.
      * libproto/imap/select.c: Likewise.
      Sergey Poznyakoff authored
  11. 18 Nov, 2011 7 commits
    • * include/mailutils/imap.h (mu_imap_status): New proto.
      (_mu_imap_status_name_table): New declaration.
      * include/mailutils/sys/imap.h (mu_imap_client_state)
      <MU_IMAP_STATUS_RX>: New state.
      * libproto/imap/status.c: New file.
      * libproto/imap/Makefile.am (libmu_imap_la_SOURCES): Add status.c
      * mu/imap.c: Implement "status"
      Sergey Poznyakoff authored
    • * include/mailutils/imap.h (mu_imap_stat): New structs.
      (MU_IMAP_STAT_DEFINED_FLAGS,MU_IMAP_STAT_PERMANENT_FLAGS)
      (MU_IMAP_STAT_MESSAGE_COUNT,MU_IMAP_STAT_RECENT_COUNT)
      (MU_IMAP_STAT_FIRST_UNSEEN,MU_IMAP_STAT_UIDNEXT)
      (MU_IMAP_STAT_UIDVALIDITY):  New flags.
      (mu_imap_select): New proto.
      * include/mailutils/imapio.h (mu_imap_flag_to_attribute)
      (mu_imap_format_flags): New protos.
      * include/mailutils/sys/imap.h (mu_imap_client_state)
      <MU_IMAP_SELECT_RX>: New state.
      (_mu_imap) <mbox_name,mbox_writable,mbox_stat>: New members.
      * libmailutils/imapio/flags.c: New file.
      * libmailutils/imapio/Makefile.am: Add flags.c
      * libproto/imap/select.c: New file.
      * libproto/imap/Makefile.am: Add select.c
      * libproto/imap/err.c (_mu_imap_seterrstr)
      (_mu_imap_clrerrstr, mu_imap_strerror): Allow for imap==NULL.
      * libproto/imap/id.c (mu_imap_id): Set errstr on MU_ERR_BADREPLY
      * libproto/imap/login.c (mu_imap_login): Likewise.
      * libproto/imap/resplist.c (_mu_imap_list_element_is_string): New function.
      * mu/imap.c: Implement examine and select.
      Sergey Poznyakoff authored
    • * libproto/imap/capability.c (mu_imap_capability): Use mu_list_map to
      create the capability list.
      * libproto/imap/id.c (_id_convert): Likewise for ID pairs.
      Sergey Poznyakoff authored
    • * include/mailutils/list.h (MU_LIST_MAP_OK)
      (MU_LIST_MAP_SKIP,MU_LIST_MAP_STOP): New constants.
      (mu_list_mapper_t): New typedef.
      (mu_list_map): New proto.
      * libmailutils/list/gmap.c: New file.
      * libmailutils/list/map.c: New file.
      * libmailutils/list/Makefile.am: Add gmap.c and map.c
      * libmailutils/tests/listop.c: New command "map".
      * libmailutils/tests/list.at: Test the list mapping.
      Sergey Poznyakoff authored
    • * configure.ac: Build libmailutils/list/Makefile
      * include/mailutils/sys/list.h (DESTROY_ITEM): New define.
      (_mu_list_insert_item): New proto.
      * libmailutils/Makefile.am (SUBDIRS): Add list.
      (libmailutils_la_LIBADD): Add list/liblist.la
      * libmailutils/base/Makefile.am (libbase_la_SOURCES): Remove list sources.
      * libmailutils/base/list.c: Split into smaller files (see below).
      * libmailutils/base/listlist.c: Move to libmailutils/list/listlist.c
      * libmailutils/list/Makefile.am: New file.
      * libmailutils/list/append.c: New file.
      * libmailutils/list/array.c: New file.
      * libmailutils/list/clear.c: New file.
      * libmailutils/list/count.c: New file.
      * libmailutils/list/create.c: New file.
      * libmailutils/list/destroy.c: New file.
      * libmailutils/list/do.c: New file.
      * libmailutils/list/empty.c: New file.
      * libmailutils/list/get.c: New file.
      * libmailutils/list/getcomp.c: New file.
      * libmailutils/list/insert.c: New file.
      * libmailutils/list/intersect.c: New file.
      * libmailutils/list/iterator.c: New file.
      * libmailutils/list/locate.c: New file.
      * libmailutils/list/prepend.c: New file.
      * libmailutils/list/remove.c: New file.
      * libmailutils/list/replace.c: New file.
      * libmailutils/list/setcomp.c: New file.
      * libmailutils/list/setdestr.c: New file.
      Sergey Poznyakoff authored
    • * include/mailutils/imapio.h (mu_imapio_reply_string): New proto.
      * libmailutils/imapio/replstr.c: New file.
      * libmailutils/imapio/Makefile.am: Add replstr.c
      Sergey Poznyakoff authored
  12. 17 Nov, 2011 2 commits
    • * include/mailutils/imapio.h: New file.
      * include/mailutils/sys/imapio.h: New file.
      * libmailutils/imapio/create.c: New file.
      * libmailutils/imapio/getline.c: New file.
      * libmailutils/imapio/literal.c: New file.
      * libmailutils/imapio/printf.c: New file.
      * libmailutils/imapio/qstring.c: New file.
      * libmailutils/imapio/send.c: New file.
      * libmailutils/imapio/trace.c: New file.
      * libmailutils/imapio/words.c: New file.
      * libmailutils/imapio/xscript.c: New file.
      
      * configure.ac: Build libmailutils/imapio/Makefile
      * include/mailutils/Makefile.am (pkginclude_HEADERS): Add imapio.h.
      * include/mailutils/imapio.h: New file.
      * include/mailutils/sys/Makefile.am (sysinclude_HEADERS): Add imapio.h.
      * include/mailutils/sys/imapio.h: New file.
      * include/mailutils/types.hin (mu_imapio_t): New data type.
      * libmailutils/Makefile.am (SUBDIRS): Add imapio.
      
      * libmailutils/tests/Makefile.am: Build imapio
      * libmailutils/tests/imapio.c: New source.
      * libmailutils/tests/wsp.c: Handle escape argument
      Sergey Poznyakoff authored
    • * include/mailutils/wordsplit.h (mu_wordsplit) <ws_escape>: New member.
      (MU_WRDSF_ESCAPE): New flag.
      (mu_wordsplit_general_unquote_copy): New function.
      * libmailutils/string/wordsplit.c: Remove empty nodes after whitespace
      trimming.  If MU_WRDSF_ESCAPE is set, remove only backslashes appearing
      in front of a character in ws_escape.
      * libmailutils/tests/wordsplit.at: Test new features.
      Sergey Poznyakoff authored
  13. 15 Nov, 2011 2 commits
    • * python/libmu_py/Makefile.am (libmu_py_la_SOURCES): Add errno.c
      * python/libmu_py/errno.c: New file.
      * python/libmu_py/libmu_py.c (_mu_py_module_name): New function.
      (_mu_py_attach_module): Use _mu_py_module_name to allocate FQ
      module name instead of taking the risk of using fixed size buffer.
      Don't call Py_InitModule if methods is NULL.
      (mu_py_attach_modules): Call _mu_py_attach_errno.
      * python/libmu_py/libmu_py.h (_mu_py_attach_errno): New proto.
      * python/mailutils/error.py: Re-export everything from c_api.errno.
      Remove hardcoded definitions of error codes.
      Sergey Poznyakoff authored
    • * libmu_cfg/tls.c (SSL_KEY_FILE_CHECKS): Mask out
      MU_FILE_SAFETY_OWNER_MISMATCH bit.
      * mu/shell.c: Handle SIGPIPE and SIGINTR.
      Sergey Poznyakoff authored