platform/upstream/curl.git
11 years agoemail-tests: Renamed the IMAP test to be 800
Steve Holme [Sun, 10 Mar 2013 18:50:43 +0000 (18:50 +0000)]
email-tests: Renamed the IMAP test to be 800

Continued segregating the email protocol tests, into their own protocol
based ranges, in preparation of adding more e-mail related tests to the
test suite.

11 years agoemail-tests: Renamed the SMTP tests to be in the range 900-906
Steve Holme [Sun, 10 Mar 2013 18:48:08 +0000 (18:48 +0000)]
email-tests: Renamed the SMTP tests to be in the range 900-906

Continued segregating the email protocol tests, into their own protocol
based ranges, in preparation of adding more e-mail related tests to the
test suite.

11 years agoemail-tests: Renamed the POP3 tests to be in the range 850-857
Steve Holme [Sun, 10 Mar 2013 18:45:24 +0000 (18:45 +0000)]
email-tests: Renamed the POP3 tests to be in the range 850-857

Started segregating the email protocol tests, into their own protocol
based ranges, in preparation of adding more e-mail related tests to the
test suite.

11 years agohiperfifo: updated to use current libevent API
Daniel Stenberg [Sun, 10 Mar 2013 18:44:48 +0000 (19:44 +0100)]
hiperfifo: updated to use current libevent API

Patch by: Myk Taylor

11 years agoimap: Reworked some function descriptions
Steve Holme [Sun, 10 Mar 2013 12:56:45 +0000 (12:56 +0000)]
imap: Reworked some function descriptions

11 years agoimap: Added some missing comments to imap_sendf()
Steve Holme [Sun, 10 Mar 2013 12:47:28 +0000 (12:47 +0000)]
imap: Added some missing comments to imap_sendf()

11 years agoemail: Removed hard returns from init functions
Steve Holme [Sat, 9 Mar 2013 22:25:40 +0000 (22:25 +0000)]
email: Removed hard returns from init functions

11 years agocurl_multi_wait: avoid second loop if nothing to do
Daniel Stenberg [Sat, 9 Mar 2013 21:26:07 +0000 (22:26 +0100)]
curl_multi_wait: avoid second loop if nothing to do

... hopefully this will also make clang-analyzer stop warning on
potentional NULL dereferences (which were false positives anyway).

11 years agomulti_runsingle: avoid NULL dereference
Daniel Stenberg [Sat, 9 Mar 2013 17:05:28 +0000 (18:05 +0100)]
multi_runsingle: avoid NULL dereference

When Curl_do() returns failure, the connection pointer could be NULL so
the code path following needs to that that into account.

Bug: http://curl.haxx.se/mail/lib-2013-03/0062.html
Reported by: Eric Hu

11 years agoimap: Re-factored all perform based functions
Steve Holme [Sat, 9 Mar 2013 18:50:41 +0000 (18:50 +0000)]
imap: Re-factored all perform based functions

Standardised the naming of all perform based functions to be in the form
imap_perform_something().

11 years agoexamples/getinmemory.c: abort the transfer if not enough memory
Cédric Deltheil [Sun, 24 Feb 2013 17:17:30 +0000 (18:17 +0100)]
examples/getinmemory.c: abort the transfer if not enough memory

No more use exit(3) but instead tell libcurl that no byte has been
written to let it return a `CURLE_WRITE_ERROR`. In addition, check
curl easy handle return code.

11 years agoRELEASE-NOTES: synced with ca3c0ed3a9c
Daniel Stenberg [Sat, 9 Mar 2013 15:31:57 +0000 (16:31 +0100)]
RELEASE-NOTES: synced with ca3c0ed3a9c

8 more bugfixes, one change and a bunch of contributors

11 years agoMakefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility
Yang Tse [Sat, 9 Mar 2013 15:23:04 +0000 (16:23 +0100)]
Makefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility

11 years agoimap: Added description comments to all perform based functions
Steve Holme [Sat, 9 Mar 2013 14:02:56 +0000 (14:02 +0000)]
imap: Added description comments to all perform based functions

11 years agoimap: Removed the need for separate custom request functions
Steve Holme [Sat, 9 Mar 2013 13:26:59 +0000 (13:26 +0000)]
imap: Removed the need for separate custom request functions

Moved the custom request processing into the LIST command as the logic
is the same.

11 years agoimap: Corrected typo in comment
Steve Holme [Sat, 9 Mar 2013 13:25:15 +0000 (13:25 +0000)]
imap: Corrected typo in comment

11 years agoMakefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility
Yang Tse [Sat, 9 Mar 2013 12:57:55 +0000 (13:57 +0100)]
Makefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility

11 years agoimap: Moved imap_logout() to be grouped with the other perform functions
Steve Holme [Sat, 9 Mar 2013 12:12:20 +0000 (12:12 +0000)]
imap: Moved imap_logout() to be grouped with the other perform functions

11 years agoemail: Updated the function descriptions for the logout / quit functions
Steve Holme [Sat, 9 Mar 2013 12:10:01 +0000 (12:10 +0000)]
email: Updated the function descriptions for the logout / quit functions

Updated the function description comments following commit 4838d196fdbf.

11 years agoemail: Simplified the logout / quit functions
Steve Holme [Sat, 9 Mar 2013 11:55:48 +0000 (11:55 +0000)]
email: Simplified the logout / quit functions

Moved the blocking state machine to the disconnect functions so that the
logout / quit functions are only responsible for sending the actual
command needed to logout or quit.

Additionally removed the hard return on failure.

11 years agoemail: Tidied up the *_regular_transfer() functions
Steve Holme [Fri, 8 Mar 2013 23:25:04 +0000 (23:25 +0000)]
email: Tidied up the *_regular_transfer() functions

Added comments and simplified convoluted dophase_done comparison.

11 years agoemail: Simplified nesting of if statements in *_doing() functions
Steve Holme [Fri, 8 Mar 2013 23:02:20 +0000 (23:02 +0000)]
email: Simplified nesting of if statements in *_doing() functions

11 years agoRELEASE-NOTES: mention that krb4 is up for consideration
Daniel Stenberg [Fri, 8 Mar 2013 15:34:40 +0000 (16:34 +0100)]
RELEASE-NOTES: mention that krb4 is up for consideration

11 years agoimap: Fixed handling of untagged responses for the STORE custom command
Steve Holme [Fri, 8 Mar 2013 21:18:36 +0000 (21:18 +0000)]
imap: Fixed handling of untagged responses for the STORE custom command

Added an exception, for the STORE command, to the untagged response
processor in imap_endofresp() as servers will back respones containing
the FETCH keyword instead.

11 years agocurlbuild.h.dist: enhance non-configure GCC ABI detection logic
Yang Tse [Fri, 8 Mar 2013 17:43:03 +0000 (18:43 +0100)]
curlbuild.h.dist: enhance non-configure GCC ABI detection logic

GCC specific adjustments:

- check __ILP32__ before 32 and 64bit processor architectures in
  order to detect ILP32 programming model on 64 bit processors
  which, of course, also support LP64 programming model, when using
  gcc 4.7 or newer.

- keep 32bit processor architecture checks in order to support gcc
  versions older than 4.7 which don't define __ILP32__

- check __LP64__ for gcc 3.3 and newer, while keeping 64bit processor
  architecture checks for older versions which don't define __LP64__

11 years agocurlbuild.h.dist: fix GCC build on ARM systems without configure script
Yang Tse [Fri, 8 Mar 2013 14:30:44 +0000 (15:30 +0100)]
curlbuild.h.dist: fix GCC build on ARM systems without configure script

Bug: http://curl.haxx.se/bug/view.cgi?id=1205
Reported by: technion

11 years agopolarssl.c: fix header filename typo
Gisle Vanem [Fri, 8 Mar 2013 13:02:01 +0000 (14:02 +0100)]
polarssl.c: fix header filename typo

11 years agoconfigure: use XC_LIBTOOL for portability across libtool versions
Yang Tse [Fri, 8 Mar 2013 12:26:08 +0000 (13:26 +0100)]
configure: use XC_LIBTOOL for portability across libtool versions

11 years agoxc-lt-iface.m4: provide XC_LIBTOOL macro
Yang Tse [Fri, 8 Mar 2013 12:25:07 +0000 (13:25 +0100)]
xc-lt-iface.m4: provide XC_LIBTOOL macro

11 years agoimap: Fixed SELECT not being performed for custom requests
Steve Holme [Thu, 7 Mar 2013 22:56:19 +0000 (22:56 +0000)]
imap: Fixed SELECT not being performed for custom requests

11 years agoemail: Minor code tidy up following recent changes
Steve Holme [Thu, 7 Mar 2013 22:44:10 +0000 (22:44 +0000)]
email: Minor code tidy up following recent changes

Removed unwanted braces and added variable initialisation.

11 years agoDOCS: Corrected the IMAP URL grammar of the UIDVALIDITY parameter
Steve Holme [Thu, 7 Mar 2013 20:53:15 +0000 (20:53 +0000)]
DOCS: Corrected the IMAP URL grammar of the UIDVALIDITY parameter

11 years agoFEATURES: Provided a little clarity in some IMAP features
Steve Holme [Thu, 7 Mar 2013 18:31:48 +0000 (18:31 +0000)]
FEATURES: Provided a little clarity in some IMAP features

11 years agoemail: Optimised block_statemach() functions
Steve Holme [Thu, 7 Mar 2013 18:21:58 +0000 (18:21 +0000)]
email: Optimised block_statemach() functions

Optimised the result test in each of the block_statemach() functions.

11 years agoDOCS: Added the list command to the IMAP URL section
Steve Holme [Thu, 7 Mar 2013 11:51:40 +0000 (11:51 +0000)]
DOCS: Added the list command to the IMAP URL section

Added examples of the list command and clarified existing example URLs
following recent changes.

11 years agoFEATURES: Updated for recent imap additions
Steve Holme [Thu, 7 Mar 2013 11:03:16 +0000 (11:03 +0000)]
FEATURES: Updated for recent imap additions

Updated the imap features list, corrected a typo in the smtp features
and clarified a pop3 feature.

11 years agoversion bump: the next release will be 7.30.0
Daniel Stenberg [Thu, 7 Mar 2013 10:14:16 +0000 (11:14 +0100)]
version bump: the next release will be 7.30.0

11 years agochecksrc: ban unsafe functions
Daniel Stenberg [Wed, 6 Mar 2013 12:27:51 +0000 (13:27 +0100)]
checksrc: ban unsafe functions

The list of unsafe functions currently consists of sprintf, vsprintf,
strcat, strncat and gets.

Subsequently, some existing code needed updating to avoid warnings on
this.

11 years agoRELEASE-NOTES: Added missing imap fixes and additions
Steve Holme [Thu, 7 Mar 2013 10:03:28 +0000 (10:03 +0000)]
RELEASE-NOTES: Added missing imap fixes and additions

With all the recent imap changes it wasn't clear what new features and
fixes should be included in the release notes.

11 years agoRELEASE-NOTES: brought this up-to-date with the latest changes
Nick Zitzmann [Thu, 7 Mar 2013 03:03:18 +0000 (20:03 -0700)]
RELEASE-NOTES: brought this up-to-date with the latest changes

11 years agoimap: Fixed test801 and test1321 to specify a message UID
Jiri Hruska [Wed, 6 Mar 2013 21:19:17 +0000 (22:19 +0100)]
imap: Fixed test801 and test1321 to specify a message UID

Just a folder list would be retrieved if UID was not specified now.

11 years agoimap: Fixed ftpserver.pl to allow verification even through LIST command
Jiri Hruska [Wed, 6 Mar 2013 21:16:19 +0000 (22:16 +0100)]
imap: Fixed ftpserver.pl to allow verification even through LIST command

Commit 198012ee inadvertently broke LIST_imap().

11 years agoimap: Tidied up the APPEND and final APPEND response functions
Steve Holme [Wed, 6 Mar 2013 20:31:53 +0000 (20:31 +0000)]
imap: Tidied up the APPEND and final APPEND response functions

Removed unnecessary state changes on failure and setting of result codes
on success.

11 years agoimap: Tidied up the final FETCH response function
Steve Holme [Wed, 6 Mar 2013 20:19:46 +0000 (20:19 +0000)]
imap: Tidied up the final FETCH response function

Removed unnecessary state change on failure and setting of result code on
success.

11 years agoimap: Tidied up the LIST response function
Steve Holme [Wed, 6 Mar 2013 20:10:53 +0000 (20:10 +0000)]
imap: Tidied up the LIST response function

Reworked comments as they referenced custom commands, removed
unnecessary state change on failure and setting of result code on
success.

11 years agoimap: Removed the custom request response function
Steve Holme [Wed, 6 Mar 2013 19:58:34 +0000 (19:58 +0000)]
imap: Removed the custom request response function

Removed imap_state_custom_resp() as imap_state_list_resp() provides the
same functionality.

11 years agoimap: Updated ftpserver.pl to be more compliant, added new commands
Jiri Hruska [Tue, 5 Mar 2013 17:03:48 +0000 (18:03 +0100)]
imap: Updated ftpserver.pl to be more compliant, added new commands

Enriched IMAP capabilities of ftpserver.pl in order to be able to
add tests for the new IMAP features.

* Added support for APPEND - Saves uploaded data to log/upload.$testno
* Added support for LIST - Returns the contents of <reply/> section in
  the current test, like e.g FETCH.
* Added support for STORE - Returns hardcoded updated flags
* Changed handling of SELECT - Returns much more information in the
  usual set of untagged responses; uses hardcoded data from an example
  in the IMAP RFC
* Changed handling of FETCH - Fixed response format

11 years agoimap: Added check for empty UID in FETCH command
Steve Holme [Wed, 6 Mar 2013 19:33:49 +0000 (19:33 +0000)]
imap: Added check for empty UID in FETCH command

As the UID has to be specified by the user for the FETCH command to work
correctly, added a check to imap_fetch(), although strictly speaking it
is protected by the call from imap_perform().

11 years agonss: fix misplaced code enabling non-blocking socket mode
Kamil Dudka [Tue, 5 Mar 2013 16:51:01 +0000 (17:51 +0100)]
nss: fix misplaced code enabling non-blocking socket mode

The option needs to be set on the SSL socket.  Setting it on the model
takes no effect.  Note that the non-blocking mode is still not enabled
for the handshake because the code is not yet ready for that.

11 years agoimap: fix compiler warning
Daniel Stenberg [Wed, 6 Mar 2013 07:28:05 +0000 (08:28 +0100)]
imap: fix compiler warning

imap.c:694:21: error: unused variable 'imapc' [-Werror=unused-variable]

11 years agoimap: Added support for list command
Steve Holme [Tue, 5 Mar 2013 22:04:03 +0000 (22:04 +0000)]
imap: Added support for list command

11 years agoimap: Added list perform and response handler functions
Steve Holme [Tue, 5 Mar 2013 21:36:25 +0000 (21:36 +0000)]
imap: Added list perform and response handler functions

11 years agoimap: Introduced IMAP_LIST state
Steve Holme [Tue, 5 Mar 2013 21:34:53 +0000 (21:34 +0000)]
imap: Introduced IMAP_LIST state

11 years agoimap: Small tidy up of imap_select() to match imap_append()
Steve Holme [Tue, 5 Mar 2013 19:59:53 +0000 (19:59 +0000)]
imap: Small tidy up of imap_select() to match imap_append()

Updated the style of imap_select() before adding the LIST command.

11 years agoimap: Moved mailbox check from the imap_do() function
Steve Holme [Tue, 5 Mar 2013 19:52:11 +0000 (19:52 +0000)]
imap: Moved mailbox check from the imap_do() function

In preparation for the addition of the LIST command, moved the mailbox
check from imap_do() to imap_select() and imap_append().

11 years agocurl_setup.h: Added S_IRDIR() macro for compilers that don't support it
Steve Holme [Tue, 5 Mar 2013 19:45:51 +0000 (19:45 +0000)]
curl_setup.h: Added S_IRDIR() macro for compilers that don't support it

Commit 26eaa8383001 introduces the use of S_ISDIR() yet some compilers,
such as MSVC don't support it, so we must define a substitute using
file flags and mask.

11 years agoAddFormData: prevent only directories from being posted
Daniel Stenberg [Mon, 4 Mar 2013 14:20:22 +0000 (15:20 +0100)]
AddFormData: prevent only directories from being posted

Commit f4cc54cb4746ae5a6d (shipped as part of the 7.29.0 release) was a
bug fix that introduced a regression in that while trying to avoid
allowing directory names, it also forbade "special" files like character
devices and more. like "/dev/null" as was used by Oliver who reported
this regression.

Reported by: Oliver Gondža
Bug: http://curl.haxx.se/mail/archive-2013-02/0040.html

11 years agodarwinssl: fix infinite loop if server disconnected abruptly
Nick Zitzmann [Mon, 4 Mar 2013 05:11:10 +0000 (22:11 -0700)]
darwinssl: fix infinite loop if server disconnected abruptly

If the server hung up the connection without sending a closure alert,
then we'd keep probing the socket for data even though it's dead. Now
we're ready for this situation.

Bug: http://curl.haxx.se/mail/lib-2013-03/0014.html
Reported by: Aki Koskinen

11 years agoimap: Added comments to imap_append()
Steve Holme [Sun, 3 Mar 2013 16:44:53 +0000 (16:44 +0000)]
imap: Added comments to imap_append()

11 years agoimap: Added required mailbox check for FETCH and APPEND commands
Jiri Hruska [Sun, 3 Mar 2013 10:37:10 +0000 (11:37 +0100)]
imap: Added required mailbox check for FETCH and APPEND commands

11 years agopingpong.c: Fix enumerated type mixed with another type
Steve Holme [Sun, 3 Mar 2013 13:55:01 +0000 (13:55 +0000)]
pingpong.c: Fix enumerated type mixed with another type

11 years agosmtp: Updated the coding style for state changes after a send operation
Steve Holme [Sun, 3 Mar 2013 13:48:22 +0000 (13:48 +0000)]
smtp: Updated the coding style for state changes after a send operation

Some state changes would be performed after a failure test that
performed a hard return, whilst others would be performed within a test
for success. Updated the code, for consistency, so all instances are
performed within a success test.

11 years agopop3: Updated the coding style for state changes after a send operation
Steve Holme [Sun, 3 Mar 2013 13:36:12 +0000 (13:36 +0000)]
pop3: Updated the coding style for state changes after a send operation

Some state changes would be performed after a failure test that
performed a hard return, whilst others would be performed within a test
for success. Updated the code, for consistency, so all instances are
performed within a success test.

11 years agoimap: Fixed typo in variable assignment
Steve Holme [Sun, 3 Mar 2013 13:13:59 +0000 (13:13 +0000)]
imap: Fixed typo in variable assignment

11 years agoimap: Fixed custom request handling in imap_done()
Jiri Hruska [Sun, 3 Mar 2013 10:33:53 +0000 (11:33 +0100)]
imap: Fixed custom request handling in imap_done()

Fixed imap_done() so that neither the FINAL states are not entered when
a custom command has been performed.

11 years agoimap: Enabled custom requests in imap_select_resp()
Jiri Hruska [Sun, 3 Mar 2013 10:27:18 +0000 (11:27 +0100)]
imap: Enabled custom requests in imap_select_resp()

Changed imap_select_resp() to invoke imap_custom() instead of
imap_fetch() after the mailbox has been selected if a custom
command has been set.

11 years agoimap: Enabled custom requests in imap_perform()
Jiri Hruska [Sun, 3 Mar 2013 10:21:29 +0000 (11:21 +0100)]
imap: Enabled custom requests in imap_perform()

Modified imap_perform() to start with the custom command instead of
SELECT when a custom command is to be performed and no mailbox has
been given.

11 years agoimap: Added custom request perform and response handler functions
Jiri Hruska [Sun, 3 Mar 2013 10:09:44 +0000 (11:09 +0100)]
imap: Added custom request perform and response handler functions

Added imap_custom(), which initiates the custom command processing,
and an associated response handler imap_state_custom_resp(), which
handles any responses by sending them to the client as body data.

All untagged responses with the same name as the first word of the
custom request string are accepted, with the exception of SELECT and
EXAMINE which have responses that cannot be easily identified. An
extra check has been provided for them so that any untagged responses
are accepted for them.

11 years agopop3: Fixed unnecessary parent structure reference
Steve Holme [Sun, 3 Mar 2013 11:10:24 +0000 (11:10 +0000)]
pop3: Fixed unnecessary parent structure reference

Updated pop3 code following recent imap changes.

11 years agoimap: Added custom request parsing
Jiri Hruska [Sun, 3 Mar 2013 09:49:37 +0000 (10:49 +0100)]
imap: Added custom request parsing

Added imap_parse_custom_request() for parsing the CURLOPT_CUSTOMREQUEST
parameter which URL decodes the value and separates the request from
any parameters - This makes it easier to filter untagged responses
by the request command.

11 years agoimap: Introduced custom request parameters
Jiri Hruska [Sun, 3 Mar 2013 09:12:27 +0000 (10:12 +0100)]
imap: Introduced custom request parameters

Added custom request parameters to the per-request structure.

11 years agoimap: Introduced IMAP_CUSTOM state
Jiri Hruska [Sun, 3 Mar 2013 09:10:01 +0000 (10:10 +0100)]
imap: Introduced IMAP_CUSTOM state

11 years agoimap: Minor code tidy up
Steve Holme [Sat, 2 Mar 2013 21:22:44 +0000 (21:22 +0000)]
imap: Minor code tidy up

Minor tidy up of code layout and comments following recent changes.

11 years agoimap: Simplified the imap_state_append_resp() function
Steve Holme [Sat, 2 Mar 2013 20:40:38 +0000 (20:40 +0000)]
imap: Simplified the imap_state_append_resp() function

Introduced the result code variable to simplify the state changes and
remove the hard returns.

11 years agoimap: Changed successful response logic in imap_state_append_resp()
Steve Holme [Sat, 2 Mar 2013 20:35:03 +0000 (20:35 +0000)]
imap: Changed successful response logic in imap_state_append_resp()

For consistency changed the logic of the imap_state_append_resp()
function to test for an unsucessful continuation response rather than a
succesful one.

11 years agoimap: Standardised imapcode condition tests
Steve Holme [Sat, 2 Mar 2013 20:29:27 +0000 (20:29 +0000)]
imap: Standardised imapcode condition tests

For consistency changed two if(constant != imapcode) tests to be
if(imapcode != constant).

11 years agoimap: Moved imap_append() to be with the other perform functions
Steve Holme [Sat, 2 Mar 2013 20:24:49 +0000 (20:24 +0000)]
imap: Moved imap_append() to be with the other perform functions

11 years agoimap: Enabled APPEND support in imap_perform()
Jiri Hruska [Fri, 1 Mar 2013 19:49:14 +0000 (20:49 +0100)]
imap: Enabled APPEND support in imap_perform()

Added logic in imap_perform() to perform an APPEND rather than SELECT
and FETCH if an upload has been specified.

11 years agoimap: Implemented APPEND final processing
Jiri Hruska [Fri, 1 Mar 2013 19:34:51 +0000 (20:34 +0100)]
imap: Implemented APPEND final processing

The APPEND operation needs to be performed in several steps:
  1) We send "<tag> APPEND <mailbox> <flags> {<size>}\r\n"
  2) Server responds with continuation respose "+ ...\r\n"
  3) We start the transfer and send <size> bytes of data
  4) Only now we end the request command line by sending "\r\n"
  5) Server responds with "<tag> OK ...\r\n"

This commit performs steps 4 and 5, in the DONE phase, as more
processing is required after the transfer.

11 years agoimap: Added APPEND perform and response handler functions
Jiri Hruska [Fri, 1 Mar 2013 19:06:18 +0000 (20:06 +0100)]
imap: Added APPEND perform and response handler functions

Added imap_append() function to initiate upload and imap_append_resp()
to handle the continuation response and start the transfer.

11 years agoimap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL states
Jiri Hruska [Fri, 1 Mar 2013 19:04:56 +0000 (20:04 +0100)]
imap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL states

11 years agoimap: Updated setting of transfer variables in imap_state_fetch_resp()
Jiri Hruska [Fri, 1 Mar 2013 18:38:27 +0000 (19:38 +0100)]
imap: Updated setting of transfer variables in imap_state_fetch_resp()

Add number of bytes retrieved from the PP cache to req.bytecount and set
req.maxdownload only when starting a proper download.

11 years agoimap: Improved FETCH response parsing
Jiri Hruska [Fri, 1 Mar 2013 18:24:56 +0000 (19:24 +0100)]
imap: Improved FETCH response parsing

Added safer parsing of the untagged FETCH response line and the size of
continuation data.

11 years agoimap: Fixed accidentally lossing the result code
Steve Holme [Thu, 28 Feb 2013 23:09:28 +0000 (23:09 +0000)]
imap: Fixed accidentally lossing the result code

Accidentally lost the result code in imap_state_capability() and
imap_state_login() with commit b06a78622609.

11 years agoimap: Another minor comment addition / tidy up
Steve Holme [Thu, 28 Feb 2013 22:51:32 +0000 (22:51 +0000)]
imap: Another minor comment addition / tidy up

11 years agoimap: Updated the coding style for state changes after a send operation
Steve Holme [Thu, 28 Feb 2013 22:46:22 +0000 (22:46 +0000)]
imap: Updated the coding style for state changes after a send operation

Some state changes would be performed after a failure test that
performed a hard return, whilst others would be performed within a test
for success. Updated the code, for consistency, so all instances are
performed within a success test.

11 years agopop3 / smtp: Small comment tidy up
Steve Holme [Thu, 28 Feb 2013 22:26:46 +0000 (22:26 +0000)]
pop3 / smtp: Small comment tidy up

Small tidy up to keep some comments consistant across each of the email
protocols.

11 years agoimap: FETCH response handler cleanup before further changes
Jiri Hruska [Thu, 28 Feb 2013 20:32:10 +0000 (21:32 +0100)]
imap: FETCH response handler cleanup before further changes

Removed superfluous NULL assignment after Curl_safefree() and rewrote
some comments and logging messages.

11 years agopop3: Small tidy up of function arguments
Steve Holme [Thu, 28 Feb 2013 21:22:49 +0000 (21:22 +0000)]
pop3: Small tidy up of function arguments

11 years agoimap: Small tidy up of function arguments
Steve Holme [Thu, 28 Feb 2013 21:18:36 +0000 (21:18 +0000)]
imap: Small tidy up of function arguments

11 years agosmtp: Corrected debug message for POP3_AUTH_FINAL constant
Steve Holme [Thu, 28 Feb 2013 21:11:02 +0000 (21:11 +0000)]
smtp: Corrected debug message for POP3_AUTH_FINAL constant

Following commit ad3177da24b8 corrected the debug message in state()
from AUTH to AUTH_FINAL.

11 years agopop3: Corrected debug message for POP3_AUTH_FINAL constant
Steve Holme [Thu, 28 Feb 2013 21:10:11 +0000 (21:10 +0000)]
pop3: Corrected debug message for POP3_AUTH_FINAL constant

Following commit afad1ce753a1 corrected the debug message in state()
from AUTH to AUTH_FINAL.

11 years agoimap: Corrected debug message for IMAP_AUTHENTICATE_FINAL constant
Steve Holme [Thu, 28 Feb 2013 21:09:27 +0000 (21:09 +0000)]
imap: Corrected debug message for IMAP_AUTHENTICATE_FINAL constant

Following commit 13006f3de9ec corrected the debug message in state()
from AUTHENTICATE to AUTHENTICATE_FINAL.

11 years agoimap: Fixed error code returned for invalid FETCH response
Jiri Hruska [Thu, 28 Feb 2013 18:56:52 +0000 (19:56 +0100)]
imap: Fixed error code returned for invalid FETCH response

If the FETCH command does not result in an untagged response the the
UID is probably invalid. As such do not return CURLE_OK.

11 years agoimap: Added processing of the final FETCH responses
Jiri Hruska [Thu, 28 Feb 2013 18:42:42 +0000 (19:42 +0100)]
imap: Added processing of the final FETCH responses

Not processing the final FETCH responses was not optimal, not only
because the response code would be ignored but it would also leave data
unread on the socket which would prohibit connection reuse.

11 years agoimap: Introduced FETCH_FINAL state for processing final fetch responses
Jiri Hruska [Thu, 28 Feb 2013 18:16:33 +0000 (19:16 +0100)]
imap: Introduced FETCH_FINAL state for processing final fetch responses

A typical FETCH response can be broken down into four parts:

  1) "* <uid> FETCH (<what> {<size>}\r\n", using continuation syntax
  2) <size> bytes of the actual message
  3) ")\r\n", finishing the untagged response
  4) "<tag> OK ...", finishing the command

Part 1 is read in imap_fetch_resp(), part 2 is consumed in the PERFORM
phase by the transfer subsystem, parts 3 and 4 are currently ignored.

11 years agoimap: fix autobuild warning
Steve Holme [Thu, 28 Feb 2013 10:23:50 +0000 (10:23 +0000)]
imap: fix autobuild warning

Removed whitespace from imap_perform()

11 years agoimap: fix compiler warning
Steve Holme [Thu, 28 Feb 2013 07:31:41 +0000 (07:31 +0000)]
imap: fix compiler warning

error: declaration of 'imap' shadows a previous local

11 years agosmtp: Re-factored the final SMTP_AUTH constant
Steve Holme [Wed, 27 Feb 2013 21:20:55 +0000 (21:20 +0000)]
smtp: Re-factored the final SMTP_AUTH constant

Changed the final SMTP_AUTH constant to SMTP_AUTH_FINAL for consistency
with the response function.

11 years agopop3: Re-factored the final POP3_AUTH constant
Steve Holme [Wed, 27 Feb 2013 21:20:11 +0000 (21:20 +0000)]
pop3: Re-factored the final POP3_AUTH constant

Changed the final POP3_AUTH constant to POP3_AUTH_FINAL for consistency
with the response function.