1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00
Commit Graph

340 Commits

Author SHA1 Message Date
Daniel Stenberg
11e8066ef9 vtls: renamed sslgen.[ch] to vtls.[ch] 2013-12-20 17:12:42 +01:00
Daniel Stenberg
eccf4fb7ee vtls: created subdir, moved sslgen.[ch] there, updated all include lines 2013-12-20 17:12:42 +01:00
Steve Holme
48043f87b6 imap/pop3/smtp: Added support for SASL authentication downgrades
Added support for downgrading the SASL authentication mechanism when the
decoding of CRAM-MD5, DIGEST-MD5 and NTLM messages fails. This enhances
the previously added support for graceful cancellation by allowing the
client to retry a lesser SASL mechanism such as LOGIN or PLAIN, or even
APOP / clear text (in the case of POP3 and IMAP) when supported by the
server.
2013-12-18 20:45:17 +00:00
Steve Holme
933e6c9d16 imap: Moved the calculation of SASL login details into a separate function 2013-12-18 12:43:28 +00:00
Steve Holme
bd3a59ad41 imap: Moved the sending of the AUTHENICATE command into a separate function 2013-12-18 00:10:39 +00:00
Steve Holme
c0245cc591 email: Renamed *_perform_authenticate() functions
In preparation for the upcoming SASL downgrade feature renamed the
imap__perform_authenticate(), pop3__perform_authenticate() and
smtp__perform_authenticate() functions.
2013-12-17 23:08:32 +00:00
Steve Holme
32b9c30e67 imap: Fixed exclude of clear text when using auth=* in commit 75cd7fd667
It is not 100% clear whether * should include clear text LOGIN or not
from RFC-5092, however, including it is then consistent with current
POP3 behaviour where clear text, APOP or SASL may be chosen.
2013-12-14 12:24:17 +00:00
Steve Holme
75cd7fd667 imap: Fixed incorrect fallback to clear text authentication
If a specific SASL authentication mechanism was requested by the user
as part of the login options but wasn't supported by the server then
curl would fallback to clear text, when it shouldn't, rather than
reporting "No known authentication mechanisms supported" as the POP3
and SMTP protocols do.
2013-12-13 23:15:43 +00:00
Steve Holme
2c0ecac9d3 imap/pop3: Post graceful cancellation consistency changes 2013-12-04 20:19:36 +00:00
Steve Holme
43400b4086 email: Post graceful SASL authentication cancellation tidy up 2013-10-30 20:58:24 +00:00
Steve Holme
f68559c086 email: Added support for cancelling NTLM authentication 2013-10-27 22:25:18 +00:00
Steve Holme
b87ba2c942 email: Added support for cancelling DIGEST-MD5 authentication 2013-10-27 16:27:38 +00:00
Steve Holme
1e39b95682 email: Added support for canceling CRAM-MD5 authentication 2013-10-27 12:42:30 +00:00
Steve Holme
7de4cc35f8 email: Added initial support for cancelling authentication
Should a client application fail to decode an authentication message
received from a server, or not support any of the parameters given by
the server in the message, then the authentication phrase should be
cancelled gracefully by the client rather than simply terminating the
connection.

The authentication phrase should be cancelled by simply sending a '*'
to the server, in response to erroneous data being received, as per
RFC-3501, RFC-4954 and RFC-5034.

This patch adds the necessary state machine constants and appropriate
response handlers in order to add this functionality for the CRAM-MD5,
DIGEST-MD5 and NTLM authentication mechanisms.
2013-10-27 09:17:03 +00:00
Steve Holme
aa0eaef483 email: Moved authentication message parsing into a separate function
...in preparation for upcoming modifications.
2013-10-27 09:04:59 +00:00
Steve Holme
0adad07690 email: Added references to SASL LOGIN authentication draft proposal 2013-10-26 14:35:27 +01:00
Steve Holme
ce61510127 email: Fixed QUIT / LOGOUT being sent when SSL connect fails 2013-10-18 19:28:20 +01:00
Steve Holme
09a13a1c01 imap: Added clarification to the code about odd continuation responses 2013-09-25 17:44:51 +01:00
Steve Holme
733a4419d0 sasl: Centralised the authentication mechanism strings
Moved the standard SASL mechanism strings into curl_sasl.h rather than
hard coding the same values over and over again in the protocols that
use SASL authentication.

For more information about the mechanism strings see:

http://www.iana.org/assignments/sasl-mechanisms
2013-09-24 20:12:50 +01:00
Steve Holme
fbcefc0ce0 imap: Fixed response check for NOOP command 2013-09-14 10:44:28 +01:00
Steve Holme
f3c9749a40 imap: Fixed response check for LSUB and UID commands 2013-09-11 20:15:21 +01:00
Jiri Hruska
5c14a7f068 imap/pop3/smtp: Speed up SSL connection initialization
Don't wait for the next callback call (usually 1 second) before
continuing with protocol specific connection initialization.
2013-09-10 19:47:54 +01:00
Steve Holme
e20e48cbf2 imap: Fixed calculation of transfer when partial FETCH received
The transfer size would be calculated incorrectly if the email contained
within the FETCH response, had been partially received by the pingpong
layer. As such the following, example output, would be seen if the
amount remaining was smaller than the amount received:

* Excess found in a non pipelined read: excess = 1394, size = 262,
  maxdownload = 262, bytecount = 1374
* transfer closed with -1112 bytes remaining to read

Bug: http://curl.haxx.se/mail/lib-2013-08/0170.html
Reported-by: John Dunn
2013-09-09 07:40:38 +01:00
Daniel Stenberg
e9de8e78f0 SASL: fix compiler warnings
comparison between signed and unsigned integer expressions

suggest parentheses around '&&' within '||' (twice)
2013-09-04 22:33:29 +02:00
Steve Holme
9e8ced9890 imap/smtp: Fixed incorrect SASL mechanism selection with XOAUTH2 servers
XOAUTH2 would be selected in preference to LOGIN and PLAIN if the IMAP
or SMTP server advertised support for it even though a user's password
was supplied but bearer token wasn't.

Modified the selection logic so that XOAUTH2 will only be selected if
the server supports it and A) The curl user/libcurl programmer has
specifically asked for XOAUTH via the ;AUTH=XOAUTH login option or 2)
The bearer token is specified. Obviously if XOAUTH is asked for via
the login option but no token is specified the user will receive a
authentication failure which makes more sense than no known
authentication mechanisms supported!
2013-09-04 21:27:01 +01:00
Steve Holme
f3849a7b84 imap: Fixed response check for EXPUNGE command 2013-08-31 10:49:49 +01:00
Kyle L. Huff
34122800b8 imap: added basic SASL XOAUTH2 support
Added the ability to use an XOAUTH2 bearer token [RFC6750] with IMAP for
authentication using RFC6749 "OAuth 2.0 Authorization Framework".

The bearer token is expected to be valid for the user specified in
conn->user. If CURLOPT_XOAUTH2_BEARER is defined and the connection has
an advertised auth mechanism of "XOAUTH2", the user and access token are
formatted as a base64 encoded string and sent to the server as
"A001 AUTHENTICATE XOAUTH2 <bearer token>".
2013-08-26 10:16:32 +01:00
Alex McLellan
9281be36d5 imap: Fixed response check for SEARCH command
Adding this line allows libcurl to return the server response when
performing a search command via a custom request.
2013-08-19 10:23:14 +01:00
Daniel Stenberg
e79535bc5e SessionHandle: the protocol specific pointer is now a void *
All protocol handler structs are now opaque (void *) in the
SessionHandle struct and moved in the request-specific sub-struct
'SingleRequest'. The intension is to keep the protocol specific
knowledge in their own dedicated source files [protocol].c etc.

There's some "leakage" where this policy is violated, to be addressed at
a later point in time.
2013-08-12 13:17:57 +02:00
Daniel Stenberg
4ad8e142da urldata: clean up the use of the protocol specific structs
1 - always allocate the struct in protocol->setup_connection. Some
protocol handlers had to get this function added.

2 - always free at the end of a request. This is also an attempt to keep
less memory in the handle after it is completed.
2013-08-12 13:17:57 +02:00
Daniel Stenberg
2af0b10c95 comments: remove old and wrong multi/easy interface statements 2013-08-09 23:39:09 +02:00
Yang Tse
ca89a0a092 string formatting: fix zero-length printf format string 2013-07-24 17:05:02 +02:00
Yang Tse
8c1e3bb713 imap.c: imap_sendf() fix va_start/va_end matching 2013-07-24 16:46:25 +02:00
Yang Tse
de052ca6fc string formatting: fix 25+ printf-style format strings 2013-07-24 01:21:26 +02:00
Steve Holme
9ea5145952 email: Tidy up of *_perform_authenticate()
Removed the hard returns from imap and pop3 by using the same style for
sending the authentication string as smtp. Moved the "Other mechanisms
not supported" check in smtp to match that of imap and pop3 to provide
consistency between the three email protocols.
2013-04-28 12:57:42 +01:00
Steve Holme
dacbdaab94 imap: Added support for overriding the SASL initial response
In addition to checking for the SASL-IR capability the user can override
the sending of the client's initial response in the AUTHENTICATION
command with the use of CURLOPT_SASL_IR should the server erroneously
not report SASL-IR when it does support it.
2013-04-27 12:12:59 +01:00
Steve Holme
00045a3009 imap: Added support for ;auth=<mech> in the URL
Added support for specifying the preferred authentication mechanism in
the URL as per RFC-5092.
2013-04-13 16:11:27 +01:00
Steve Holme
fd399cde00 imap: Added function description to imap_parse_custom_request() 2013-04-12 18:27:51 +01:00
Steve Holme
00c74019f4 imap: Moved utility functions to end of imap.c (Part 3/3)
Moved imap_is_bchar() be with the other utility based functions.
2013-04-12 18:24:46 +01:00
Steve Holme
9d0063befa imap: Moved utility functions to end of imap.c (Part 2/3)
Moved imap_parse_url_path() and imap_parse_custom_request() to the end of the
file allowing all utility functions to be grouped together.
2013-04-12 18:24:44 +01:00
Steve Holme
01e55ebb26 imap: Moved utility functions to end of imap.c (Part 1/3)
Moved imap_atom() and imap_sendf() to the end of the file allowing all
utility functions to be grouped together.
2013-04-12 18:24:43 +01:00
Steve Holme
4bbad1dac7 imap: Corrected function description for imap_connect() 2013-04-12 18:14:43 +01:00
Steve Holme
b3440f490f imap: Fixed incorrect initial response generation for SASL AUTHENTICATE
Fixed incorrect initial response generation for the NTLM and LOGIN SASL
authentication mechanisms when the SASL-IR was detected.

Introduced in commit: 6da7dc026c.
2013-03-17 00:20:42 +00:00
Steve Holme
1fcf52cae4 imap: Reworked some function descriptions 2013-03-10 12:56:45 +00:00
Steve Holme
cbea345f61 imap: Added some missing comments to imap_sendf() 2013-03-10 12:47:28 +00:00
Steve Holme
059647f398 email: Removed hard returns from init functions 2013-03-09 22:25:40 +00:00
Steve Holme
8826435571 imap: Re-factored all perform based functions
Standardised the naming of all perform based functions to be in the form
imap_perform_something().
2013-03-09 18:50:41 +00:00
Steve Holme
ca3c0ed3a9 imap: Added description comments to all perform based functions 2013-03-09 14:02:56 +00:00
Steve Holme
6bdd3d4a88 imap: Removed the need for separate custom request functions
Moved the custom request processing into the LIST command as the logic
is the same.
2013-03-09 13:27:16 +00:00
Steve Holme
69eca5c252 imap: Corrected typo in comment 2013-03-09 13:25:15 +00:00
Steve Holme
b4c9b515aa imap: Moved imap_logout() to be grouped with the other perform functions 2013-03-09 12:12:20 +00:00
Steve Holme
b482417ac4 email: Updated the function descriptions for the logout / quit functions
Updated the function description comments following commit 4838d196fd.
2013-03-09 12:10:01 +00:00
Steve Holme
4838d196fd 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.
2013-03-09 11:55:48 +00:00
Steve Holme
f691f9609c email: Tidied up the *_regular_transfer() functions
Added comments and simplified convoluted dophase_done comparison.
2013-03-08 23:25:04 +00:00
Steve Holme
e5bb4e86ac email: Simplified nesting of if statements in *_doing() functions 2013-03-08 23:02:20 +00:00
Steve Holme
1f41772bef 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.
2013-03-08 21:18:36 +00:00
Steve Holme
170ae51c47 imap: Fixed SELECT not being performed for custom requests 2013-03-07 22:56:19 +00:00
Steve Holme
cc890906b1 email: Minor code tidy up following recent changes
Removed unwanted braces and added variable initialisation.
2013-03-07 22:44:10 +00:00
Steve Holme
67b6fa5f95 email: Optimised block_statemach() functions
Optimised the result test in each of the block_statemach() functions.
2013-03-07 18:21:58 +00:00
Steve Holme
5c89413b24 imap: Tidied up the APPEND and final APPEND response functions
Removed unnecessary state changes on failure and setting of result codes
on success.
2013-03-06 20:31:53 +00:00
Steve Holme
37f3fcd631 imap: Tidied up the final FETCH response function
Removed unnecessary state change on failure and setting of result code on
success.
2013-03-06 20:19:46 +00:00
Steve Holme
c9f9f601b8 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.
2013-03-06 20:10:53 +00:00
Steve Holme
24ffceed81 imap: Removed the custom request response function
Removed imap_state_custom_resp() as imap_state_list_resp() provides the
same functionality.
2013-03-06 19:58:34 +00:00
Steve Holme
b7f39156d4 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().
2013-03-06 19:33:49 +00:00
Daniel Stenberg
fa9748df11 imap: fix compiler warning
imap.c:694:21: error: unused variable 'imapc' [-Werror=unused-variable]
2013-03-06 08:28:05 +01:00
Steve Holme
198012ee13 imap: Added support for list command 2013-03-05 22:04:03 +00:00
Steve Holme
742544aad0 imap: Added list perform and response handler functions 2013-03-05 21:39:18 +00:00
Steve Holme
041754e3fa imap: Introduced IMAP_LIST state 2013-03-05 21:35:16 +00:00
Steve Holme
b960f1e8bd imap: Small tidy up of imap_select() to match imap_append()
Updated the style of imap_select() before adding the LIST command.
2013-03-05 19:59:53 +00:00
Steve Holme
c29346613d 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().
2013-03-05 19:52:11 +00:00
Steve Holme
298f806d01 imap: Added comments to imap_append() 2013-03-03 16:44:53 +00:00
Jiri Hruska
e6b7dae947 imap: Added required mailbox check for FETCH and APPEND commands 2013-03-03 16:39:50 +00:00
Steve Holme
b1ebf4bda1 imap: Fixed typo in variable assignment 2013-03-03 13:13:59 +00:00
Jiri Hruska
284ea5f924 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.
2013-03-03 13:10:36 +00:00
Jiri Hruska
c03cad3a61 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.
2013-03-03 13:10:34 +00:00
Jiri Hruska
ad8b76d094 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.
2013-03-03 13:10:32 +00:00
Jiri Hruska
226c1c6876 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.
2013-03-03 13:10:31 +00:00
Jiri Hruska
ee7034800d 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.
2013-03-03 11:06:55 +00:00
Jiri Hruska
1d3ccf27ec imap: Introduced custom request parameters
Added custom request parameters to the per-request structure.
2013-03-03 11:03:45 +00:00
Jiri Hruska
51dbaae432 imap: Introduced IMAP_CUSTOM state 2013-03-03 10:13:13 +00:00
Steve Holme
dcffd936e1 imap: Minor code tidy up
Minor tidy up of code layout and comments following recent changes.
2013-03-02 21:22:44 +00:00
Steve Holme
e94fbcabd7 imap: Simplified the imap_state_append_resp() function
Introduced the result code variable to simplify the state changes and
remove the hard returns.
2013-03-02 20:40:38 +00:00
Steve Holme
ec38ac38c7 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.
2013-03-02 20:35:03 +00:00
Steve Holme
0f64dd086a imap: Standardised imapcode condition tests
For consistency changed two if(constant != imapcode) tests to be
if(imapcode != constant).
2013-03-02 20:29:27 +00:00
Steve Holme
459e1bffee imap: Moved imap_append() to be with the other perform functions 2013-03-02 20:24:49 +00:00
Jiri Hruska
7b471fb344 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.
2013-03-02 20:17:45 +00:00
Jiri Hruska
f8c8c76d39 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.
2013-03-02 19:34:25 +00:00
Jiri Hruska
90b7d0ea59 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.
2013-03-02 19:17:18 +00:00
Jiri Hruska
1383522e3a imap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL states 2013-03-02 19:06:35 +00:00
Jiri Hruska
d46d107e0c 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.
2013-03-02 18:37:56 +00:00
Jiri Hruska
25884aa197 imap: Improved FETCH response parsing
Added safer parsing of the untagged FETCH response line and the size of
continuation data.
2013-03-02 18:37:54 +00:00
Steve Holme
be51a46353 imap: Fixed accidentally lossing the result code
Accidentally lost the result code in imap_state_capability() and
imap_state_login() with commit b06a786226.
2013-02-28 23:09:28 +00:00
Steve Holme
48596f87a9 imap: Another minor comment addition / tidy up 2013-02-28 22:51:32 +00:00
Steve Holme
b06a786226 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.
2013-02-28 22:46:22 +00:00
Jiri Hruska
10549ee08f imap: FETCH response handler cleanup before further changes
Removed superfluous NULL assignment after Curl_safefree() and rewrote
some comments and logging messages.
2013-02-28 22:13:34 +00:00
Steve Holme
6ff7197e70 imap: Small tidy up of function arguments 2013-02-28 21:18:36 +00:00
Steve Holme
11a22f3264 imap: Corrected debug message for IMAP_AUTHENTICATE_FINAL constant
Following commit 13006f3de9 corrected the debug message in state()
from AUTHENTICATE to AUTHENTICATE_FINAL.
2013-02-28 21:09:27 +00:00
Jiri Hruska
025ba6e9be 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.
2013-02-28 21:00:13 +00:00
Jiri Hruska
cdea86ff67 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.
2013-02-28 21:00:11 +00:00
Jiri Hruska
974c663471 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.
2013-02-28 21:00:10 +00:00
Steve Holme
692ef0e158 imap: fix autobuild warning
Removed whitespace from imap_perform()
2013-02-28 10:23:50 +00:00
Steve Holme
17f032c0d9 imap: fix compiler warning
error: declaration of 'imap' shadows a previous local
2013-02-28 07:31:41 +00:00
Steve Holme
13006f3de9 imap: Re-factored final IMAP_AUTHENTICATE constant
Changed the final IMAP_AUTHENTICATE constant to IMAP_AUTHENTICATE_FINAL
for consistency with the response function.
2013-02-27 21:19:48 +00:00
Steve Holme
1d86d813c3 imap: Updated the coding style of imap_state_servergreet_resp()
Updated the coding style, in this function, to be consistant with other
response functions rather then performing a hard return on failure.
2013-02-27 21:00:35 +00:00
Steve Holme
f53ed631b3 imap: Reversed the logic of the (un)successful tagged SELECT response
Reversed the logic of the unsuccessful vs successful tagged SELECT
response in imap_state_select_resp() to be more logical to read.
2013-02-27 20:53:34 +00:00
Steve Holme
5b3736b533 imap: Reversed the logic of the (un)successful tagged CAPABILITY response
Reversed the logic of the unsuccessful vs successful tagged CAPABILITY
response in imap_state_capability_resp() to be more logical to read.
2013-02-27 20:48:24 +00:00
Steve Holme
cce08581ac imap: Corrected char* references with char *
Corrected char* references made in commit: 709b3506cd.
2013-02-27 20:35:04 +00:00
Jiri Hruska
c368fbcb10 imap: Added processing of more than one response when sent in same packet
Added a loop to imap_statemach_act() in which Curl_pp_readresp() is
called until the cache is drained. Without this multiple responses
received in a single packet could result in a hang or delay.
2013-02-27 20:08:04 +00:00
Jiri Hruska
b644c47192 imap: Added skipping of SELECT command if already in the same mailbox
Added storage and checking of the last mailbox userd to prevent
unnecessary switching.
2013-02-27 20:08:02 +00:00
Jiri Hruska
d03aa16164 imap: Introduced the mailbox variable
Added the mailbox variable to the per-connection structure in
preparation for checking for an already selected mailbox.
2013-02-27 20:08:00 +00:00
Jiri Hruska
a8eb059203 imap: Added verification of UIDVALIDITY mailbox attribute
Added support for checking the UIDVALIDITY, and aborting the request, if
it has been specified in the URL and the server response is different.
2013-02-26 22:09:21 +00:00
Jiri Hruska
59c71c7fc7 imap: Added support for parsing the UIDVALIDITY property
Added support for parsing the UIDVALIDITY property from the SELECT
response and storing it in the per-connection structure.
2013-02-26 22:09:19 +00:00
Jiri Hruska
58efa46a5d imap: Introduced the mailbox_uidvalidity variable
Added the mailbox_uidvalidity variable to the per-connection structure
in preparation for checking the UIDVALIDITY mailbox attribute.
2013-02-26 22:09:18 +00:00
Steve Holme
acd22f05dd imap: Corrected comment in imap_endofresp() 2013-02-26 20:40:22 +00:00
Steve Holme
ce9a0a6d65 imap: Corrected whitespace 2013-02-26 20:37:08 +00:00
Jiri Hruska
f92f341a3f imap: Added filtering of CAPABILITY and FETCH untagged responses
Only responses that contain "CAPABILITY" and "FETCH", respectively,
will be sent to their response handler.
2013-02-26 20:35:41 +00:00
Jiri Hruska
91b2184e1b imap: Added a helper function for upcoming untagged response filtering
RFC 3501 states that "the client MUST be prepared to accept any response
at all times" yet we assume anything received with "* " at the beginning
is the untagged response we want.

Introduced a helper function that checks whether the input looks like a
response to specified command, so that we may filter the ones we are
interested in according to the current state.
2013-02-26 20:23:13 +00:00
Jiri Hruska
1ffdc5058e imap: Moved CAPABILITY response handling to imap_state_capability_resp()
Introduced similar handling to the FETCH responses, where even the
untagged data responses are handled by the response handler of the
individual state.
2013-02-26 19:51:16 +00:00
Steve Holme
764b818934 email: Small tidy up following recent changes 2013-02-25 23:00:08 +00:00
Jiri Hruska
005ad9e60d imap: Removed bytecountp from the per-request structure
Removed this pointer to a downloaded bytes counter because it was set in
imap_init() to point to the same variable the transfer functions keep
the count in (k->bytecount), effectively making the code in transfer.c
"*k->bytecountp = k->bytecount" a no-op.
2013-02-25 22:05:20 +00:00
Jiri Hruska
a360944ed6 imap: Adjusted SELECT and FETCH function order
Moved imap_select() and imap_fetch() to be grouped with the other
perform functions.
2013-02-25 21:40:32 +00:00
Jiri Hruska
6f02209cc8 imap: Adjusted SELECT and FETCH state order in imap_statemach_act()
Exchanged the position of these states in the switch statements to
match the state enum, execution and function order.
2013-02-25 21:26:40 +00:00
Steve Holme
015ceb4706 imap: Minor tidy up of comments in imap_parse_url_path()
Tidy up of comments before next round of imap changes.
2013-02-25 15:53:24 +00:00
Steve Holme
e63c33d88d imap: Fixed incorrect comparison for STARTTLS in imap_endofresp()
Corrected the comparison type in addition to commit 1dac29fa83.
2013-02-25 09:43:23 +00:00
Steve Holme
d23d2f2bd8 imap: Added check for new internal imap response code 2013-02-24 19:23:33 +00:00
Steve Holme
37f0caeabd imap: Changed the order of the response types in imap_endofresp()
From a maintenance point of view the code reads better to view tagged
responses, then untagged followed by continuation responses.

Additionally, this matches the order of responses in POP3.
2013-02-24 16:14:16 +00:00
Jiri Hruska
671f896c0b imap: Added stricter parsing of continuation responses
Enhanced the parsing to only allow continuation responses in some
states.
2013-02-24 14:38:54 +00:00
Steve Holme
7f5824a106 imap: Simplified memcmp() in tagged response parsing 2013-02-24 12:45:04 +00:00
Jiri Hruska
797b004738 imap: Reworked the logic of untagged command responses 2013-02-24 12:39:09 +00:00
Steve Holme
1ff6a8338d imap: Corrected spacing of trailing brace 2013-02-24 12:05:15 +00:00
Jiri Hruska
66149248ba imap: Added stricter parsing of tagged command responses
Enhanced the parsing of tagged responses which must start with "OK",
"NO" or "BAD"
2013-02-24 12:02:59 +00:00
Jiri Hruska
c38d69f06a imap: Simplified command response test in imap_endofresp() 2013-02-24 12:02:57 +00:00
Jiri Hruska
324b7fe47b imap: Corrected comment in imap_endofresp() 2013-02-24 12:02:55 +00:00
Jiri Hruska
5c5b7c7146 imap: Added the ability to FETCH a specific UID and SECTION
Updated the FETCH command to send the UID and SECTION parsed from the
URL. By default the BODY specifier doesn't include a section, BODY[] is
now sent whereas BODY[TEXT] was previously sent. In my opinion
retrieving just the message text is rarely useful when dealing with
emails, as the headers are required for example, so that functionality
is not retained. In can however be simulated by adding SECTION=TEXT to
the URL.

Also updated test801 and test1321 due to the BODY change.
2013-02-23 21:11:47 +00:00
Steve Holme
7f6c7331b2 email: Additional tidy up of comments following recent changes 2013-02-23 20:02:05 +00:00
Steve Holme
8960d81b0d imap: Minor correction of comments for max line length 2013-02-23 19:04:13 +00:00
Jiri Hruska
e756641040 imap: Added URL parsing of new variables
Updated the imap_parse_url_path() function to parse uidvalidity, uid and
section parameters based on RFC-5092.
2013-02-23 18:40:47 +00:00
Jiri Hruska
2f638a8f5e imap: Introduced imap_is_bchar() function
Added imap_is_bchar() for testing if a given character is a valid bchar
or not.
2013-02-23 18:40:45 +00:00
Jiri Hruska
b6f32464e9 imap: Introduced new per-request veriables
Added uidvalidity, uid and section variables to the per-request IMAP
structure in preparation for upcoming URL parsing.
2013-02-23 17:26:51 +00:00
Jiri Hruska
4cfc7f951c imap: Fixed escaping of mailbox names
Used imap_atom() to escape mailbox names in imap_select().
2013-02-23 15:42:33 +00:00
Steve Holme
d415327bd7 email: Minor tidy up following IMAP changes 2013-02-23 11:34:52 +00:00
Jiri Hruska
35fb6bee0e imap: Removed more FTP leftovers
Changed some variables and comments still using FTP terminology.
2013-02-23 11:27:05 +00:00
Jiri Hruska
13625a0d09 imap: Removed some FTP heritage leftovers
Removed user and passwd from the IMAP struct as these cannot be set on
a per-request basis and are leftover from legacy FTP code.
2013-02-23 11:27:04 +00:00
Jiri Hruska
2476b34b95 imap: Introduced a custom IMAP structure for per-request data
Created a new IMAP structure and changed the type of the imap proto
variable in connectdata from FTP* to the new IMAP*.

Moved the mailbox variable from the per-connection struct imap_conn to
the new per-request struct and fixed references accordingly.
2013-02-23 11:27:02 +00:00
Steve Holme
65644b8335 imap: Fixed memory leak when performing multiple selects
Moved the clean-up of the mailbox variable from imap_disconnect() to
imap_done() as this variable is allocated in the do phase, yet would
have only been freed only once if multiple selects where preformed
on a single connection.
2013-02-22 23:29:33 +00:00
Steve Holme
1dac29fa83 imap.c: Fixed an incorrect variable reference
Fixed an incorrect variable reference which was introduced in commit
a1701eea28 as a result of a copy and paste from SMTP/POP3.
2013-02-22 19:58:42 +00:00
Steve Holme
e52fc1e297 email: Tidied up result code variables
Tidied up result variables to be consistent in name, declaration order
and default values.
2013-02-16 23:37:50 +00:00
Steve Holme
39b79c6b75 email: Removed unnecessary forward declaration
Due to the reordering of functions in commit 586f5d3614 the forward
declaration to state_upgrade_tls() are no longer required.
2013-02-16 10:28:32 +00:00
Steve Holme
673b7ba80a imap: Removed unnecessary state change on failure 2013-02-15 18:33:10 +00:00
Daniel Stenberg
c25383ae13 rename "easy" statemachines: call them block instead
... since they're not used by the easy interface really, I wanted to
remove the association. Also, I unified the pingpong statemachine driver
into a single function with a 'wait' argument: Curl_pp_statemach.
2013-02-15 11:10:18 +01:00