1. 17 Sep, 2010 5 commits
    • * include/mailutils/smtp.h (mu_smtp_mail_basic)
      (mu_smtp_rcpt_basic, mu_smtp_send_stream)
      (mu_smtp_rset, mu_smtp_quit): New prototypes.
      * include/mailutils/sys/smtp.h (MU_SMTP_RCPT)
      (MU_SMTP_MORE, MU_SMTP_DOT, MU_SMTP_QUIT, MU_SMTP_CLOS): New states.
      (_mu_smtp_xscript_level): New proto.
      * libmailutils/errors (MU_ERR_REPLY): New error code.
      * libproto/mailer/Makefile.am (libmu_mailer_la_SOURCES): Add new sources.
      * libproto/mailer/smtp_data.c: New file.
      * libproto/mailer/smtp_mail.c: New file.
      * libproto/mailer/smtp_quit.c: New file.
      * libproto/mailer/smtp_rcpt.c: New file.
      * libproto/mailer/smtp_rset.c: New file.
      * libproto/mailer/smtp_ehlo.c: Return MU_ERR_REPLY if the server replied
      with a code other than 2xx.
      * libproto/mailer/smtp_open.c: Likewise.
      * testsuite/smtpsend.c: Implement full sending cycle (excepting
      authorization).
      Sergey Poznyakoff authored
    • * sieve/tests/reject.at: Fix dependency on TZ.
      * sieve/tests/relational.at: Ensure that fileintos go
      to the test folder.
      * sieve/tests/mul-addr.at: Remove unneeded require.
      Sergey Poznyakoff authored
    • * include/mailutils/smtp.h: New file.
      * include/mailutils/Makefile.am (pkginclude_HEADERS): Add smtp.h.
      * include/mailutils/list.h (mu_list_clear): New proto.
      * include/mailutils/sys/smtp.h: New file.
      * include/mailutils/sys/Makefile.am (sysinclude_HEADERS): Add smtp.h.
      * libmailutils/errors (MU_ERR_BADREPLY, MU_ERR_SEQ): New error codes.
      * libmailutils/list.c (mu_list_clear): New function.
      * libproto/mailer/Makefile.am (libmu_mailer_la_SOURCES): Add new sources.
      * libproto/mailer/smtp_capa.c: New file.
      * libproto/mailer/smtp_carrier.c: New file.
      * libproto/mailer/smtp_create.c: New file.
      * libproto/mailer/smtp_disconnect.c: New file.
      * libproto/mailer/smtp_domain.c: New file.
      * libproto/mailer/smtp_ehlo.c: New file.
      * libproto/mailer/smtp_io.c: New file.
      * libproto/mailer/smtp_open.c: New file.
      * libproto/mailer/smtp_starttls.c: New file.
      * libproto/mailer/smtp_trace.c: New file.
      * testsuite/smtpsend.c: New file.
      * testsuite/Makefile.am (noinst_PROGRAMS): Add smtpsend.
      Sergey Poznyakoff authored
    • * bootstrap.conf: Build included listings in doc/texinfo.
      * configure.ac: Require gettext 0.18
      * doc/texinfo/Makefile.am: Remove the .c.inc rules.
      * doc/texinfo/maint.mk: New file.
      * lib/Makefile.am (libmuaux_la_SOURCES): Replace with libmuaux_a_SOURCES.
      Sergey Poznyakoff authored
    • Git does not keep empty subdirectories, so we need to recreate /cur and
      /tmp subdirs in maildir mailboxes retrieved from the repo.
      
      * bootstrap.conf: Recreate missing maildir parts.
      * testsuite/testsuite.inc (MUT_MBCOPY): New macro.
      * sieve/tests/ext.at: Use MUT_MBCOPY to copy mailboxes.
      * sieve/tests/redirect.at: Likewise.
      * sieve/tests/reject.at: Likewise.
      * sieve/tests/testsuite.at: Likewise.
      * testsuite/mbdel.at: Likewise.
      * frm/tests/Makefile.am: Testsuite depends on
      $(top_srcdir)/testsuite/testsuite.inc.
      * libmailutils/tests/Makefile.am: Likewise.
      * messages/tests/Makefile.am: Likewise.
      * readmsg/tests/Makefile.am: Likewise.
      * sieve/tests/Makefile.am: Likewise.
      * testsuite/Makefile.am: Likewise.
      Sergey Poznyakoff authored
  2. 16 Sep, 2010 2 commits
    • That's the first commit since the merge six days ago that passes
      distcheck (with python, cxx, imap and nntp disabled, of course).
      
      * testsuite/folder/DISTFILES: Restore. It is needed for some
      of the remaining DejaGNU tests.
      * testsuite/spool/DISTFILES: Likewise.
      * testsuite/testsuite.at: New file.
      * testsuite/atlocal.in: New file.
      * libmailutils/tests/mbdel.at: Move to testsuite/.
      * libmailutils/tests/mbdel.c: Likewise.
      * libmailutils/tests/mime.at: Likewise.
      * libmailutils/tests/mimetest.c: Likewise.
      
      * Makefile.am (SUBDIRS): Place testsuite after libproto.
      * configure.ac (AM_INIT_AUTOMAKE): Remove dist-lzma.
      (AC_CONFIG_FILES): Add testsuite/atlocal.
      * libmailutils/base64.c (_base64_decoder)
      (_base64_encoder): Fix the use of uninitialized variables.
      * libmailutils/tests/.gitignore: Remove mbdel and mimetest.
      * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Remove mbdel and mimetest.
      (LDADD): Leave only MU_LIB_MAILUTILS.
      (TESTSUITE_AT): Remove mbdel.at and mime.at
      * libmailutils/tests/atlocal.in (PATH): Bugfix.
      * libmailutils/tests/testsuite.at: Remove inclusion of mbdel.at and mime.at.
      * po/POTFILES.in: Replace mailbox/ with libmailutils/.
      
      * testsuite/.gitignore: Rewrite.
      * testsuite/Makefile.am: Rewrite.
      * testsuite/mbdel.at: Set +w on all copied mailboxes.
      * testsuite/mimetest.c (main): Open mailbox for reading only.
      
      * sieve/Makefile.am: Add examples/ to the distribution.
      
      * libproto/mbox/mbox.c (mbox_open): Create locker only
      if the mailbox is open for modification.
      All users updated to check for mailbox->locker!=NULL before
      using it.
      Sergey Poznyakoff authored
    • * libmailutils/tests/mbdel.at: New testcase.
      * libmailutils/tests/Makefile.am (TESTSUITE_AT): Add mbdel.at.
      * libmailutils/tests/testsuite.at: Include mbdel.at.
      * libproto/mbox/mbox.c (mbox_remove): Fix return code.
      
      * testsuite/maildir/mbox1: New test mailbox.
      * testsuite/mh/mbox1: New test mailbox.
      * testsuite/etc/DISTFILES: Remove.
      * testsuite/folder/DISTFILES: Remove.
      * testsuite/lib/DISTFILES: Remove.
      * testsuite/Makefile.am: Use EXTRA_DIST to distribute
      subdirs.
      Sergey Poznyakoff authored
  3. 15 Sep, 2010 4 commits
    • * libmailutils/mailbox.c (mu_mailbox_open): Return MU_ERR_OPEN
      if the mailbox has already been opened.
      Sergey Poznyakoff authored
    • * include/mailutils/mailbox.h (mu_mailbox_remove): New function.
      * include/mailutils/stream.h: Add some comments.
      * include/mailutils/sys/amd.h (_amd_data)<remove>: New method.
      (amd_remove_dir): New function.
      * include/mailutils/sys/mailbox.h (_mu_mailbox)<_remove>: New
      method.
      * libmailutils/amd.c (amd_remove_mbox): New function.
      (amd_init_mailbox): Initialize the _remove method.
      (amd_remove_dir): New function.
      * libmailutils/errors (MU_ERR_MBX_REMOVED)
      (MU_ERR_NOT_OPEN, MU_ERR_OPEN): New error codes.
      * libmailutils/mailbox.c: Keep state of the mailbox (open vs. not
      open, removed). Check it before doing anything on it.
      (_MU_MAILBOX_OPEN, _MU_MAILBOX_REMOVED, _MU_MAILBOX_MASK): New
      defines.
      (mu_mailbox_open): Set _MU_MAILBOX_OPEN if the operation succeeds.
      (mu_mailbox_close): Clear _MU_MAILBOX_OPEN if the operation succeeds.
      Refuse to run if the mailbox was not opened.
      (mu_mailbox_remove): New function.
      (all functions): return MU_ERR_MBX_NULL if the mbox argument is
      NULL.
      Check mailbox state on entry and proceed accordingly.
      * libproto/maildir/mbox.c: Implement _remove method.
      (maildir_remove): New function.
      (_mailbox_maildir_init): Initialize amd->_remove.
      * libproto/mbox/mbox.c: Implement _remove method.
      (mbox_remove): New function.
      (_mailbox_mbox_init): Initialize amd->_remove.
      * libproto/mh/mbox.c: Implement _remove method.
      (mh_remove): New function.
      (_mailbox_mh_init): Initialize amd->_remove.
      
      * libmailutils/tests/mbdel.c: New file.
      * libmailutils/tests/.gitignore: Add mbdel.
      * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Likewise.
      (LDADD): List all mailbox formats.
      
      * imap4d/delete.c (imap4d_delete): Use mu_mailbox_remove to
      delete the folder.  Fall back to remove() if it does not appear
      to be a mailbox.
      Sergey Poznyakoff authored
    • * examples/listop.c: Move to libmailutils/tests.
      * examples/Makefile.am (noinst_PROGRAMS): Remove listop.
      * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add listop.
      (TESTSUITE_AT): Add list.at.
      * libmailutils/tests/.gitignore: New file.
      * libmailutils/tests/list.at: New file.
      * libmailutils/tests/testsuite.at: Include list.at.
      
      * libmailutils/list.c (list_itrctl): Fix mu_itrctl_replace.
      Sergey Poznyakoff authored
    • * libmailutils/tests/testsuite.at (MU_TEST_GROUP)
      (MU_TEST_KEYWORDS, MU_TEST_COMMAND): New defines.
      (mu_trimstr, mu_firstline): New macros.
      (MU_GENERIC_TEST): New macro.
      * libmailutils/tests/addr.c: Accept addresses from stdin.
      * libmailutils/tests/address.at (TESTADDR): If the address
      contains single quotes, pass it to the program via stdin.
      Uncomment all such tests.
      * libmailutils/tests/argcv.at (TESTARGS): Rewrite as a wrapper
      over MU_GENERIC_TEST.
      * libmailutils/tests/decode2047.at (TESTDEC2047): Likewise.
      * libmailutils/tests/mailcap.at (MAILCAP): Likewise.
      * libmailutils/tests/url.at (TESTURL): Likewise.
      * libmailutils/tests/mailcap.c: Accept data from stdin.
      Sergey Poznyakoff authored
  4. 14 Sep, 2010 6 commits
    • * libmailutils/Makefile.am (SUBDIRS): Make sure tests are descended
      into only when the libmailutils library is already built.
      Sergey Poznyakoff authored
    • * configure.ac: Remove messages/testsuite
      * messages/Makefile.am (SUBDIRS): Replace testsuite with tests.
      * messages/tests/.gitignore: New file.
      * messages/tests/Makefile.am: New file.
      * messages/tests/atlocal.in: New file.
      * messages/tests/testsuite.at: New file.
      * messages/testsuite: Remove.
      Sergey Poznyakoff authored
    • * configure.ac: Create libmailutils/tests/atlocal and
      libmailutils/tests/Makefile. Remove libmailutils/testsuite.
      * examples/Makefile.am (noinst_PROGRAMS): Remove programs moved
      to libmailutils/tests.
      * examples/argcv.c -> libmailutils/tests/argcv.c
      * libmailutils/testsuite/Decode -> libmailutils/tests/Decode
      * libmailutils/testsuite/Encode -> libmailutils/tests/Encode
      * examples/decode2047.c: Move to libmailutils/tests
      * examples/encode2047.c: Move to libmailutils/tests
      * examples/mailcap.c: Likewise.
      * examples/url-parse.c: Likewise.
      
      * include/mailutils/Makefile.am: Minor changes.
      * libmailutils/Makefile.am (SUBDIRS): Replace testsuite with tests.
      * libmailutils/tests/Makefile.am: New file.
      * libmailutils/tests/addr.c: New file.
      * libmailutils/tests/address.at: New file.
      * libmailutils/tests/argcv.at: New file.
      * libmailutils/tests/atlocal.in: New file.
      * libmailutils/tests/base64d.at: New file.
      * libmailutils/tests/base64e.at: New file.
      * libmailutils/tests/decode2047.at: New file.
      * libmailutils/tests/encode2047.at: New file.
      * libmailutils/tests/fltst.c: New file.
      * libmailutils/tests/mailcap.at: New file.
      * libmailutils/tests/mime.at: New file.
      * libmailutils/tests/testsuite.at: New file.
      * libmailutils/tests/url.at: New file.
      
      * libmailutils/testsuite/: Delete.
      
      * frm/tests/Makefile.am: Prefix package.m4 creation commands with $(AM_V_GEN).
      * readmsg/tests/Makefile.am: Likewise.
      * sieve/tests/Makefile.am: Likewise.
      * frm/tests/testsuite.at: Minor changes.
      * readmsg/tests/testsuite.at: Include testsuite.inc.
      * sieve/tests/testsuite.at: Likewise.
      * sieve/tests/version.at: Comment out inclusion of testsuite.inc.
      * testsuite/testsuite.inc: Add m4_version_prereq.
      Sergey Poznyakoff authored
    • This change has been waiting since 2005-08-16 (aaab8814),
      when libmailbox had been renamed to libmailutils.  Back then MU
      was still under CVS, which didn't like renames.
      Sergey Poznyakoff authored
    • * configure.ac: Add readmsg/tests/
      * readmsg/Makefile.am: New file.
      * readmsg/tests/.gitignore: New file.
      * readmsg/tests/Makefile.am: New file.
      * readmsg/tests/all.at: New file.
      * readmsg/tests/atlocal.in: New file.
      * readmsg/tests/hdr.at: New file.
      * readmsg/tests/nohdr.at: New file.
      * readmsg/tests/testsuite.at: New file.
      * readmsg/tests/twomsg.at: New file.
      * readmsg/tests/weed.at: New file.
      * readmsg/testsuite: Remove.
      * testsuite/testsuite.inc (AT_SKIP_TEST): New macro.
      
      * testsuite/spool/mbox1: Remove trailing whitespace after Received headers.
      * imap4d/testsuite/imap4d/fetch.exp: Reflece changes in mbox1.
      * mail/testsuite/mail/read.exp: Likewise.
      * mail/testsuite/mail/write.exp: Likewise.
      * mailbox/testsuite/Mime: Likewise.
      Sergey Poznyakoff authored
    • * configure.ac: Build frm/testsuite/Makefile.am and atlocal.
      Remove frm/testsuite/Makefile.
      * testsuite/testsuite.inc: New file.
      
      * frm/testsuite: Remove DejaGNU-based testsuite.
      * frm/tests: Autotest-based testsuite.
      * frm/tests/.gitignore
      * frm/tests/Makefile.am
      * frm/tests/atlocal.in
      * frm/tests/testsuite.at
      
      * frm/Makefile.am (SUBDIRS): Replace testsuite with tests.
      
      * sieve/tests/Makefile.am (TESTSUITE): Add an include option.
      * sieve/tests/version.at: Use macro from testsuite.inc.
      Sergey Poznyakoff authored
  5. 13 Sep, 2010 3 commits
    • * sieve/examples/INBOX.orig
      * sieve/examples/Test
      * sieve/examples/test.out
      Sergey Poznyakoff authored
    • * mailbox/cfg_parser.y (mu_cfg_create_subtree): Optional prefix
      character may be used to alter the separator or to suppress
      value splitting.
      Sergey Poznyakoff authored
    • * include/mailutils/sys/stream.h (_MU_STR_EVENT_SET): Rename
      to _MU_STR_EVENT_SET.
      (_MU_STR_EVENT_CLR): Rename to _MU_STR_EVENT_CLRFLAG.
      (_MU_STR_EVENT_FILLBUF, _MU_STR_EVENT_FLUSHBUF): New event codes.
      (_MU_STR_EVMASK): New macro.
      (_mu_stream) <cur>: Replace with pos, indicating current position
      in the buffer.
      (event_cb): Change signature.
      (mu_stream_read_unbuffered): Remove.
      (mu_stream_write_unbuffered): Remove.
      
      * mailbox/iostream.c (mu_iostream_create): Provide the readdelim method
      only if the underlying input transpor stream provides it.
      * mailbox/streamref.c (mu_streamref_create_abridged): Likewise.
      
      * mailbox/stream.c (_stream_event): New macro.
      (mu_stream_read_unbuffered): Rename to static _stream_read_unbuffered.
      (mu_stream_write_unbuffered): Rename to static _stream_write_unbuffered.
      (_stream_advance_buffer, _stream_buffer_offset)
      (_stream_orig_level): Remove macros.
      (_stream_buffer_freespace): Rewrite.
      (_stream_curp): New macro.
      (_stream_fill_buffer): Make sure the `offset' indicates the offset
      int the transport, corresponding to the beginning of the current
      buffer.
      (_stream_flush_buffer): Essentially rewritten.
      (mu_stream_seek): Reflect changes to the _mu_stream structure. Optimize
      calls to the seek method.
      (_stream_skip_input_bytes): Likewise.
      (mu_stream_read, _stream_scandelim, mu_stream_write): Rewrite using
      new _mu_stream structure.
      
      * mailbox/xscript-stream.c: Rewrite using stream events.
      
      * mailbox/base64.c (_base64_encoder): Bugfix.
      
      * libproto/pop/pop3_stream.c (_pop3_event_cb): Update signature to
      match the changes above.
      * examples/mimetest.c (main): Add more error checking.
      * mail/testsuite/mail/write.exp: Minor fix.
      Sergey Poznyakoff authored
  6. 12 Sep, 2010 3 commits
    • * imap4d/quota.c: New file.
      * imap4d/Makefile.am (imap4d_SOURCES): Add quota.c
      * imap4d/append.c (imap4d_append0): Refuse to append if
      the quota is exceeded or would be exceeded after completing
      the operation.
      * imap4d/copy.c (imap4d_copy0): Refuse to copy messages if
      the quota is exceeded or would be exceeded after completing
      the operation.
      Return a meaningful textual description.
      Attempt to restore mailbox to its original size if the operation failed.
      * imap4d/imap4d.c (imap4d_session_setup0): Call quota_setup.
      * imap4d/imap4d.h (quota_setup, quota_check, quota_update): New functions.
      
      * include/mailutils/folder.h (mu_list_response) <format>: New member.
      * include/mailutils/mailbox.h (mu_mailbox_create_from_record): New
      function.
      * include/mailutils/types.hin (MU_FOLDER_ATTRIBUTE_LINK): New flag.
      * libproto/mbox/folder.c (list_helper): Do not return symbolic links
      unless MU_FOLDER_ATTRIBUTE_LINK is set.
      Fill in the resp->format member.
      * mailbox/mailbox.c (_mailbox_create_from_record): New static function.
      (_create_mailbox0): Rewrite as a wrapper over _mailbox_create_from_record.
      (mu_mailbox_create_from_record): New function.
      Sergey Poznyakoff authored
    • * movemail/movemail.c (guess_mbox_owner): Fix setting GID
      with --owner=set-id.
      (main): Don't attempt to expunge source mailbox if preserve_mail
      is set.
      Sergey Poznyakoff authored
    • * mailbox/amd.c (read_size_file): Fix return value.
      Sergey Poznyakoff authored
  7. 11 Sep, 2010 3 commits
    • Bugfix · dc0dbafe
      * libproto/pop/pop3_stream.c (_pop3_event_cb)
      (mu_pop3_filter_create): Fix buffer size manipulation.
      * libmu_auth/tls.c: Protect gnutls debugging code with
      DEBUG_TLS.
      Sergey Poznyakoff authored
    • As a side note, previous versions of pop3d did not do
      byte-stuffing when sending RETR output.  This commit fixes
      it.
      
      * include/mailutils/filter.h (mu_dot_filter): New filter.
      * mailbox/dot.c: New file.
      * mailbox/Makefile.am (libmailutils_la_SOURCES): Add dot.c
      * mailbox/crlfdot.c (_crlfdot_encoder): Bugfix. Do not
      dereference iobuf until we know it is not NULL.
      * mailbox/filter.c (mu_filter_get_list): Register mu_dot_filter.
      * mailbox/fltstream.c (filter_wr_close, filter_rd_close): New
      close methods, depending on the filter stream mode.
      (mu_filter_stream_create): Set filter_rd_close for MU_STREAM_READ
      and filter_wr_close for MU_STREAM_WRITE streams.
      * mailbox/stream.c (mu_stream_readdelim): Update stream offset
      when using stream->readdelim.
      
      * pop3d/pop3d.h (pop3d_send_payload): New proto.
      * pop3d/retr.c (pop3d_send_payload): Change function to be
      optionally used in pop3d_top.  Use DOT filter on output.
      * pop3d/top.c (pop3d_top): Rewrite using pop3d_send_payload.
      
      * libproto/pop/pop3_retr.c (mu_pop3_retr): Default return
      code is EINPROGRESS.
      * libproto/pop/pop3_stream.c: Remove the filter stuff.
      Use CRLFDOT instead.
      
      * mailbox/amd.c (amd_body_stream_readdelim): Bugfix.  Increase
      offset by nread bytes.
      Sergey Poznyakoff authored
    • * include/mailutils/filter.h (mu_filter_command) <mu_filter_flush> New command.
      (mu_filter_result) <mu_filter_again>: New result code.
      (MU_FILTER_MAX_AGAIN): New constant.
      (mu_crlfdot_filter): New filter.
      * include/mailutils/sys/stream.h (_MU_STR_DIRTY, _MU_STR_WRT)
      (_MU_STR_ERR, _MU_STR_EOF, _MU_STR_INTERN_MASK): Avoid conflicts with
      MU_STREAM_ constants from mailutils/stream.h
      
      * mailbox/crlfdot.c: New source.
      * mailbox/Makefile.am (libmailutils_la_SOURCES): Add crlfdot.c.
      * mailbox/filter.c (mu_filter_get_list): Register mu_crlfdot_filter.
      * mailbox/fltstream.c (init_iobuf): Fix initialization of isize and
      input.
      (filter_read): Redo the loop, allowing xcode to request a new
      iteration by returning mu_filter_again.
      (filter_write_internal): Likewise.
      (filter_wr_flush): Call filter_write_internal with mu_filter_flush, reserving
      mu_filter_lastbuf for really last buffers.
      (filter_close): Call filter_write_internal with mu_filter_lastbuf.
      * mailbox/stream.c (mu_stream_skip_input_bytes): Clear MU_STREAM_SEEK bit
      before actually doing anything.
      
      * include/mailutils/sys/pop3.h [DMALLOC]: Remove unneeded cond.
      Sergey Poznyakoff authored
  8. 09 Sep, 2010 4 commits
    • Sergey Poznyakoff authored
    • New ioctls MU_IOCTL_GET_TRANSPORT_BUFFER and
      MU_IOCTL_SET_TRANSPORT_BUFFER return and modify bufferization
      mode in the lowest level transport stream.  Both server and
      client programs use this to switch to full buffering before
      sending large amounts of data. This has a particular impact
      on the output speed and CPU usage when TLS is in use.
      
      * include/mailutils/stream.h (MU_IOCTL_GET_TRANSPORT_BUFFER)
      (MU_IOCTL_SET_TRANSPORT_BUFFER): New ioctls.
      (MU_TRANSPORT_INPUT, MU_TRANSPORT_OUTPUT): New constants.
      (MU_TRANSPORT_VALID_TYPE): New macro.
      (mu_buffer_query): New struct.
      (mu_stream_get_buffer): New proto.
      
      * libmu_auth/tls.c (_tls_io_ioctl): Return ENOSYS
      if op is not supported.
      (_tls_ioctl): Support MU_IOCTL_[GS]ET_TRANSPORT_BUFFER.
      * mailbox/file_stream.c (fd_ioctl): Support MU_IOCTL_[GS]ET_TRANSPORT_BUFFER.
      Return ENOSYS if op is not supported.
      * mailbox/filter_iconv.c (_icvt_ioctl): Likewise.
      * mailbox/iostream.c (_iostream_ctl): Likewise.
      * mailbox/mapfile_stream.c (_mapfile_ioctl): Likewise.
      * mailbox/memory_stream.c (_memory_ioctl): Likewise.
      * mailbox/rdcache_stream.c (rdcache_ioctl): Likewise.
      * mailbox/xscript-stream.c (_xscript_ctl): Likewise.
      * mailbox/prog_stream.c (_prog_ioctl): Return ENOSYS if op is not
      supported.
      * mailbox/tcp.c (_tcp_ioctl): Likewise.
      
      * mailbox/stream.c (mu_stream_default_buffer_size): New global.
      (mu_stream_seek): Do not call seek method if the requested offset
      is the same as the current one.
      (mu_stream_set_buffer): Size==0 means use the default value.
      (mu_stream_get_buffer): New function.
      (mu_stream_truncate): Flush the buffer before truncating.
      
      * mailbox/mime.c (mime_reset_state): New function.
      (_mime_body_stream_seek): Rewrite using mime_reset_state.
      (_mime_body_stream_ioctl): Return ENOSYS if op is not
      supported.
      (create_mime_body_stream): Reset mime state (_mime_body_stream_seek
      may not be called due to the optimization in mu_stream_seek.
      
      * mailbox/header.c (header_parse): Exit correctly if the buffer is
      not terminated with a \n.
      
      * libproto/mbox/mbox.c (mbox_open): Enforce full buffering on the
      mailbox stream.
      * libproto/pop/mbox.c (pop_header_fill): Minor fix.
      * libproto/pop/pop3_stream.c (_POP3F_DONE)
      (_POP3F_CHBUF): New constants.
      (mu_pop3_stream)<done>: Remove. Replaced with flags.
      <oldbuf>: New member.
      (_pop3_event_cb): If _POP3F_CHBUF flag is set, restore
      the initial buffering mode on the transport stream.
      (mu_pop3_filter_create): Save away current buffering mode
      and enforce full buffering while transferring bulk data.
      
      * mail/from.c (hdr_from): Check return value from mu_message_get_header.
      * mail/mail.c (main): Allow for MAILRC having empty value.
      Always close the mailbox before exiting.
      
      * pop3d/pop3d.c (pop3d_cfg_param): New statement output-buffer-size.
      * pop3d/pop3d.h (pop3d_output_bufsize): New global.
      * pop3d/retr.c (pop3d_send_payload): New function.
      (pop3d_retr): Rewrite using pop3d_send_payload. Save away
      current buffering mode and enforce full buffering while
      transferring bulk data.
      * pop3d/top.c (pop3d_top_: Likewise.
      Sergey Poznyakoff authored
    • * mailbox/url.c (ACCESSOR(is_same,field)): Fix coredump if one
      of the accessors returned MU_ERR_NOENT.
      Sergey Poznyakoff authored
    • Sergey Poznyakoff authored
  9. 08 Sep, 2010 10 commits
    • Sergey Poznyakoff authored
    • * include/mailutils/stream.h (MU_IOCTL_LEVEL): New ioctl op.
      (XSCRIPT_NORMAL, XSCRIPT_SECURE, XSCRIPT_PAYLOAD): New constants.
      * include/mailutils/sys/xscript-stream.h (_mu_xscript_stream)
      <level>: New member.
      * mailbox/xscript-stream.c (TRANS_DISABLED): New flag.
      (print_transcript): Amount of output varies depending on the
      current output level.  For secure data, try to recognize passwords
      and to replace them with *** on output.
      (_xscript_ctl): Support MU_IOCTL_LEVEL.
      * pop3d/extra.c (set_xscript_level): New function.
      * pop3d/pop3d.h (set_xscript_level): New proto.
      * pop3d/retr.c (pop3d_retr): Set XSCRIPT_PAYLOAD level before
      sending actual data and reset it to XSCRIPT_NORMAL afterwards.
      * pop3d/top.c (pop3d_top): Likewise.
      * pop3d/user.c: Set XSCRIPT_SECURE level while expecting the
      PASS command.
      
      * imap4d/fetch.c (imap4d_fetch): Run imap4d_fetch0 in XSCRIPT_PAYLOAD
      level.
      * imap4d/uid.c (imap4d_uid): Likewise.
      * imap4d/imap4d.c (imap4d_mainloop): Unless started in preauth mode,
      select XSCRIPT_SECURE mode until authentication has been passed.
      * imap4d/imap4d.h (set_xscript_level): New proto.
      * imap4d/io.c (io_format_completion_response): Switch to XSCRIPT_NORMAL
      level when changing to the authenticated state.
      (imap4d_readline): Read literals in XSCRIPT_PAYLOAD level.
      * imap4d/util.c (set_xscript_level): New function.
      
      * include/mailutils/pop3.h (mu_pop3_trace_mask): New prototype.
      (MU_POP3_XSCRIPT_MASK): New macro.
      (_mu_pop3_xscript_level): New proto.
      * libproto/pop/pop3_pass.c (mu_pop3_pass): Set XSCRIPT_SECURE
      while sending the password.
      * libproto/pop/pop3_retr.c (mu_pop3_retr): Set XSCRIPT_PAYLOAD before
      going to MU_POP3_RETR_RX state.
      * libproto/pop/pop3_stream.c (_pop3_event_cb): Set XSCRIPT_NORMAL.
      * libproto/pop/pop3_top.c (mu_pop3_top): Set XSCRIPT_PAYLOAD before
      going to MU_POP3_TOP_RX state.
      * libproto/pop/pop3_trace.c (mu_pop3_trace_mask)
      (_mu_pop3_xscript_level): New functions.
      * libproto/pop/mbox.c (pop_open): Set trace masks depending on the
      trace6 and trace7 debug levels.
      
      * examples/pop3client.c (com_verbose): Allow to mask/unmask transcript
      levels.
      Sergey Poznyakoff authored
    • * mailbox/msgscan.c: New file.
      * mailbox/Makefile.am (libmailutils_la_SOURCES): Add it.
      
      * include/mailutils/body.h (mu_body_set_get_stream): New prototype.
      * include/mailutils/message.h (MU_SCAN_SEEK, MU_SCAN_SIZE): New
      defines.
      (mu_message_scan): New structure.
      (mu_stream_scan_message): New prototype.
      (mu_message_set_get_stream): New prototype.
      * include/mailutils/stream.h (mu_stream_copy): Change signature: takes
      4 arguments now.
      * include/mailutils/sys/body.h (_mu_body) <_get_stream>: New method.
      * include/mailutils/sys/message.h (_mu_message) <_get_stream>: New method.
      * mailbox/body.c (_body_get_stream): Call _get_stream, if provided.
      * mailbox/message.c (_message_get_stream): Call _get_stream, if provided.
      
      * mailbox/stream.c (_stream_flush_buffer): Avoid infinite recursion:
      call stream->seek directly.
      * mailbox/streamcpy.c (mu_stream_copy): Return the number of bytes
      actually copied in the fourth argument. All uses updated.
      * mailbox/streamref.c (streamref_return): Do not propagate internal
      flags.
      (_streamref_readdelim): Ensure there is enough buffer space for the
      mu_stream_readdelim call.
      
      * libproto/pop/mbox.c: Finish client implementation.
      
      * mail/print.c (mail_print_msg): Close pager before returning on
      error.
      Sergey Poznyakoff authored
    • * include/mailutils/sys/stdio_stream.h: Remove.
      * include/mailutils/sys/socket_stream.h: Remove.
      * include/mailutils/sys/rdcache_stream.h: New file.
      * include/mailutils/sys/Makefile.am: Update.
      * mailbox/rdcache_stream.c: New file.
      * mailbox/Makefile.am: Update.
      
      * examples/mucat.c: New example.
      * examples/musocio.c: New example.
      * examples/Makefile.am (noinst_PROGRAMS): Build new examples.
      
      * include/mailutils/stream.h (mu_fd_stream_create): New proto.
      (mu_rdcache_stream_create): New proto.
      * include/mailutils/sys/file_stream.h (_mu_file_stream_create): Change
      prototype.
      * mailbox/file_stream.c (fd_open): Raise the MU_STREAM_AUTOCLOSE bit.
      (fd_ioctl): Support MU_IOCTL_SET_TRANSPORT.
      (_mu_file_stream_create): Change signature. All uses updated.
      Allocate a copy of the filename argument, unless it is NULL.
      (mu_fd_stream_create): New function.
      
      * mailbox/socket_stream.c: Rewrite using file_stream directly.
      * mailbox/stdio_stream.c: Rewrite. Use rdcache_stream if
      the seek capability is required on an input stream.
      * mailbox/streamcpy.c (mu_stream_copy): Handle eventual
      EACCES return from mu_stream_seek as equivalent to ENOSYS.
      Sergey Poznyakoff authored
    • * examples/pop3client.c (com_capa): Call mu_pop3_capa_test.
      (com_stat): Count is size_t.
      
      * include/mailutils/opool.h (mu_opool_copy): New proto.
      * mailbox/opool.c (mu_opool_copy): New function.
      * mailbox/xscript-stream.c (_xscript_ctl)
      <MU_IOCTL_SWAP_STREAM>: Avoid coredumping if sp->transport
      is NULL.
      
      * include/mailutils/pop3.h (pop3_capa_test): Rename to
      mu_pop3_capa_test.
      (mu_pop3_stat): Third argument is a pointer to mu_off_t.
      * libproto/pop/pop3_capatst.c (pop3_capa_test): Rename to
      mu_pop3_capa_test.
      * libproto/pop/pop3_stat.c (mu_pop3_stat): Third argument is
      a pointer to mu_off_t.
      
      * libproto/pop/Makefile.am (libmu_pop_la_SOURCES): Put back
      folder.c, url.c and mbox.c.
      * libproto/pop/mbox.c: Begin rewriting.
      Sergey Poznyakoff authored
    • * include/mailutils/sys/stream.h (_MU_STR_EVENT_SET)
      (_MU_STR_EVENT_CLR): New defines.
      (_mu_stream) <event_cb, event_mask>: New members.
      * mailbox/stream.c (_stream_setflag, _stream_clrflag): New static
      functions.
      All functions use these instead of setting/clearing flags directly.
      (_mu_stream_cleareof, _mu_stream_seteof): New extern functions.
      (_stream_cleareof): Remove define, use _mu_stream_cleareof instead.
      (_stream_fill_buffer): Set EOF marker when end of stream is reached.
      
      * mailbox/fltstream.c (filter_read): Call _mu_stream_seteof to set
      EOF flag.
      
      * include/mailutils/pop3.h: Get rid of the superfluous "extern" in
      front of function prototypes.
      Add new prototypes.
      Remove extra whitespace.
      
      * libproto/pop/pop3_capatst.c: New file.
      * libproto/pop/pop3_list_cmd.c: New file.
      * libproto/pop/pop3_listas.c: New file.
      * libproto/pop/pop3_rdlist.c: New file.
      * libproto/pop/pop3_uidl_cmd.c: New file.
      * libproto/pop/pop3_uidlas.c: New file.
      * libproto/pop/Makefile.am: Add new files.
      * libproto/pop/pop3_capa.c (_mu_pop3_fill_list): Remove.
      Use mu_pop3_read_list instead.
      (capa_comp): New comparator for capa lists.
      * libproto/pop/pop3_list.c (mu_pop3_list): Fix format specifier.
      * libproto/pop/pop3_lista.c (mu_pop3_list_all): Rewrite.
      * libproto/pop/pop3_retr.c (mu_pop3_retr) <MU_POP3_RETR_RX>: do not
      reset state, this is done by the EOF event callback.
      * libproto/pop/pop3_top.c (mu_pop3_top) <MU_POP3_TOP_RX>: Likewise.
      * libproto/pop/pop3_stream.c (pop3_decode_state): New state pds_char.
      Change semantics of pds_init.
      (newstate, _pop3_decoder): Handle .\r\n in the initial state.
      (_pop3_event_cb): New event callback.
      (mu_pop3_filter_create): Set event callback on the filter stream.
      * libproto/pop/pop3_uidla.c (mu_pop3_uidl_all): Rewrite.
      
      * examples/Makefile.am (pop3client_CPPFLAGS): Add MU_APP_COMMON_INCLUDES.
      * examples/pop3client.c: Rewrite command parser.
      Sergey Poznyakoff authored
    • * libproto/pop/pop3_create.c (_mu_pop3_init): Fix return value.
      * libproto/pop/pop3_destroy.c: Add missing includes.
      * libproto/pop/pop3_stream.c (_pop3_decoder): Remove the final
      .\r\n altogether.
      * mailbox/fltstream.c (filter_read): Remove the hack for supporting
      buggy filters.
      Sergey Poznyakoff authored
    • * include/mailutils/tls.h (mu_tls_readline_fn)
      (mu_tls_writeline_fn, mu_tls_stream_ctl_fn): Remove typedefs.
      (mu_tls_begin): Remove prototype.
      * libmu_auth/tls.c (mu_tls_begin): Remove function.
      * libproto/mailer/smtp.c: Revamp STARTTLS support.
      Sergey Poznyakoff authored
    • * include/mailutils/filter.h (mu_filter_io) <eof>: New member.
      * mailbox/fltstream.c (init_iobuf): Initialize eof to 0.
      (filter_read): Break the loop if the decoder has set eof.
      * mailbox/xscript-stream.c (_xscript_ctl) <MU_IOCTL_SWAP_STREAM>: Handle
      a special case when the transport does not support stream swapping.
      
      * include/mailutils/pop3.h (mu_pop3_set_debug): Remove.
      (MU_POP3_TRACE_CLR, MU_POP3_TRACE_SET, MU_POP3_TRACE_QRY): New macros.
      (mu_pop3_trace): New proto.
      (mu_pop3_readline): Remove.
      (mu_pop3_getline): New proto.
      (mu_pop3_capa): Change signature.
      * include/mailutils/sys/pop3.h (mu_pop3_state): Remove the *_ACK states.
      (mu_pop3_work_buf): Remove.
      (MU_POP3_ACK, MU_POP3_TRACE): New defines.
      (_mu_pop3): Rewrite the structure.
      (mu_pop3_debug_cmd, mu_pop3_debug_ack): Remove functions.
      (MU_POP3_FISSET, MU_POP3_FSET, MU_POP3_FCLR): New macros.
      (_mu_pop3_trace_enable, _mu_pop3_trace_disable)
      (_mu_pop3_init): New protos.
      
      * include/mailutils/tls.h (mu_tls_stream_ctl_fn)
      (mu_tls_writeline_fn): Change typedefs.
      * libmu_auth/tls.c (mu_tls_begin): Update function calls
      accordingly.
      
      * libproto/pop/pop3_debug.c: Remove.
      * libproto/pop/pop3_trace.c: New function.
      * libproto/pop/Makefile.am (libmu_pop_la_SOURCES): Temporarly
      comment out folder.c, mbox.c and url.c.
      Remove pop3_debug.c.
      Add pop3_trace.c.
      * libproto/pop/pop3_capa.c: Rewrite.
      * libproto/pop/pop3_create.c: Rewrite.
      * libproto/pop/pop3_iterator.c: Rewrite.
      * libproto/pop/pop3_response.c: Rewrite.
      * libproto/pop/pop3_sendline.c: Rewrite.
      * libproto/pop/pop3_stls.c: Rewrite.
      * libproto/pop/pop3_stream.c: Rewrite.
      * libproto/pop/pop3_apop.c: Reflect changes to the pop3 framework.
      * libproto/pop/pop3_carrier.c: Likewise.
      * libproto/pop/pop3_connect.c: Likewise.
      * libproto/pop/pop3_dele.c: Likewise.
      * libproto/pop/pop3_destroy.c: Likewise.
      * libproto/pop/pop3_disconnect.c: Likewise.
      * libproto/pop/pop3_list.c: Likewise.
      * libproto/pop/pop3_lista.c: Likewise.
      * libproto/pop/pop3_noop.c: Likewise.
      * libproto/pop/pop3_pass.c: Likewise.
      * libproto/pop/pop3_quit.c: Likewise.
      * libproto/pop/pop3_retr.c: Likewise.
      * libproto/pop/pop3_readline.c: Likewise.
      * libproto/pop/pop3_rset.c: Likewise.
      * libproto/pop/pop3_stat.c: Likewise.
      * libproto/pop/pop3_top.c: Likewise.
      * libproto/pop/pop3_uidl.c: Likewise.
      * libproto/pop/pop3_uidla.c: Likewise.
      * libproto/pop/pop3_user.c: Likewise.
      
      * examples/pop3client.c: Implement the stls comand.
      (main) [WITH_TLS]: Call mu_init_tls_libs.
      (com_verbose): Redo verbose support.
      (com_capa): Implement "reread" option.
      Sergey Poznyakoff authored