Commit Graph

83 Commits

Author SHA1 Message Date
Lefteris Chatzimparmpas
362a123cd4 Correct variable error in one of the examples. 2012-05-23 20:44:31 +02:00
Lefteris Chatzimparmpas
0d77e9d9a8 Set variable's type based on OpenSSL version. 2012-04-25 00:09:12 +03:00
Lefteris Chatzimparmpas
4e03494df6 Correct wording and typo error. 2012-04-25 00:03:12 +03:00
Lefteris Chatzimparmpas
a9ac2cf100 Prepare release v2.5.2. 2012-02-29 21:16:07 +01:00
Lefteris Chatzimparmpas
3690506986 Ignore errors and retry later when in daemon mode
A persistent failure that could lead to a session not being able to be
recovered, or a failure during the login process (which is not covered
by the recovery function), would normally cause the process to
terminate.  This is expected when the configuration is run once, but not
desirable when running in daemon mode.

And thus just after the process has become a daemon, a session that
could not be restored, either because the connection to the server could
not be established or the login and its related negotiations failed, is
now disabled temporarily, and a recoqnection is attempted at the
beginning of the next daemon loop iteration.

There is one exception to that, and that is when there is an
authentication error, for example when a wrong username or password has
been supplied, and in this case the process terminates and a relevant
error is printed.
2012-02-29 21:01:11 +01:00
Lefteris Chatzimparmpas
dba6d38403 Improve the failure handling during login/logout
Some of the requests/responses need to close connection, while some
don't.

Also, now a login error returns a different status value.
2012-02-28 19:54:20 +01:00
Lefteris Chatzimparmpas
a4616e5ca5 Prepare release v2.5.1. 2012-02-27 22:53:47 +01:00
Lefteris Chatzimparmpas
7496761c25 Check function return values during login/logout
The login and logout requests are not candidates for recovery, but the return
values of all the network functions that are called from inside them, should be
checked thorougly.
2012-02-27 22:51:06 +01:00
Lefteris Chatzimparmpas
e519bb1a71 Describe the recover option in a better way. 2012-02-27 22:40:57 +01:00
Lefteris Chatzimparmpas
7435dc6d1d Add support to recover when BYE is received
Previously only network errors could cause a restoration of a session,
but now a BYE response sent by the server can also trigger it.

An option has been also added to control if and when the recover
function will be called.
2012-02-27 01:22:37 +01:00
Lefteris Chatzimparmpas
2dd1b5ebc6 Forward the BYE response properly all the way up
Some methods didn't return the correct value when a BYE response was
received from the server.
2012-02-27 01:10:56 +01:00
Lefteris Chatzimparmpas
e66c58926f Prepare release v2.5. 2012-02-24 01:19:04 +01:00
Lefteris Chatzimparmpas
47521ace3f Change SSL variables' names in session structure. 2012-02-24 01:19:04 +01:00
Lefteris Chatzimparmpas
716ee036dc Skip normal SSL shutdown only after an error
This disables the sending of the "close notify" shutdown alert, only
after a network failure took place, and not during normal closing of a
connection.
2012-02-24 01:18:08 +01:00
Lefteris Chatzimparmpas
5011966115 Ignore network errors during logout
In case of a network failure during a logout request, there's no point
in restoring the connection, but it is better to just close it.
2012-02-23 00:04:10 +01:00
Lefteris Chatzimparmpas
861aa6fd45 Keep trying when a connection has been restored. 2012-02-23 00:03:23 +01:00
Lefteris Chatzimparmpas
8c468f585f Fix the fatal failure caused by an SSL error
When a "Connection reset by peer" error was caused while reading through SSL, a
restoration of the session should have taken place after all the connection
related structures were resetted.  But instead a silent, unexpected and
unaccountable exit was the end result.  This was caused by the underlying
socket being closed while trying to shutdown the SSL session.
2012-02-22 18:59:28 +01:00
Lefteris Chatzimparmpas
83e406b70e Distinguish SSL read/write error messages printed. 2012-02-22 18:58:35 +01:00
Lefteris Chatzimparmpas
239435ba9e Use the same quotation for all the strings. 2012-02-22 18:57:54 +01:00
Lefteris Chatzimparmpas
befefb55a1 Name better the public shortcut function. 2012-02-22 18:56:45 +01:00
Lefteris Chatzimparmpas
dda48edbab Replace simple function with a static string. 2012-02-22 18:55:38 +01:00
Lefteris Chatzimparmpas
3f1059b355 Use newly added helper functions for common checks
Some of the functionality that was repeated in many places, regarding checks
and printing of informational messages, was replaced with common functions.
2012-02-22 08:18:38 +01:00
Lefteris Chatzimparmpas
95ce717bcf Add shortcuts to some possibly useful functions. 2012-02-21 20:13:55 +01:00
Lefteris Chatzimparmpas
51da675056 Don't do a protected call for the daemon commands
The errors produced by the ifcore module methods are important and thus
should not be ignored.
2012-02-21 17:49:38 +01:00
Lefteris Chatzimparmpas
8b0e8943e3 Don't allow a login if a session already exists. 2012-02-21 17:48:22 +01:00
Lefteris Chatzimparmpas
18940cc9f2 Make all the calls that pass the session safe
The session and selected variables should be reset if there has been a
connection problem or other failure.

The ifcore module methods that rely on the session should only be called
if there is a valid session variable defined.
2012-02-21 01:04:24 +01:00
Lefteris Chatzimparmpas
6a1771da04 Avoid closing the connection twice
If there's a network problem the connection has been already closed in
the relevant socket read/write functions.
2012-02-21 00:23:32 +01:00
Lefteris Chatzimparmpas
f78ed3c3d7 Add forgotten mailbox close command. 2012-02-21 00:12:23 +01:00
Lefteris Chatzimparmpas
4160f7c708 Set default network timeout value to 60. 2012-02-20 00:09:14 +01:00
Lefteris Chatzimparmpas
81b09d1f01 Print some details on append and fetch actions. 2012-02-19 23:56:54 +01:00
Lefteris Chatzimparmpas
644d6988ed Correct the TRYCREATE functionality
It's better not to continuesly try to create a mailbox, when the server
continues to report TRYCREATE.

When appending messages it failed to create a mailbox when the mailbox
didn't exist and the server responded with TRYCREATE.
2012-02-19 14:58:36 +01:00
Lefteris Chatzimparmpas
cf33e1bb61 Correct the option order in the usage details. 2012-02-19 13:40:31 +01:00
Lefteris Chatzimparmpas
7199aa249f Update the -d option and its description
Some of the descriptions of the other options have been also updated.
2012-02-19 13:25:47 +01:00
Lefteris Chatzimparmpas
6d39df8b70 Remove the BUGS section. 2012-02-19 13:25:05 +01:00
Lefteris Chatzimparmpas
e907fe5fdf Make OpenSSL a mandatory requirement
There is no point in having SSL/TLS IMAP support as optional, it's as
useful if not more than the the non-encrypted connections.

The Makefile was better organized to make it easier to change some
options during compile.

The SHAREDIR variable passed as configuration option has changed name.
2012-02-19 12:36:44 +01:00
Lefteris Chatzimparmpas
820e9db522 Correct some small details here and there. 2012-02-16 18:49:57 +01:00
Lefteris Chatzimparmpas
b67ae8209b Print a debug message on connection recovery. 2012-02-16 18:49:20 +01:00
Lefteris Chatzimparmpas
14091fc7bf Use Lua strings for common account details
Instead of using duplicates in the C structure, the Lua strings are used
directly from C for the accounts' details.
2012-02-15 22:20:19 +01:00
Lefteris Chatzimparmpas
69b4207db1 Reset session and selected mailbox after logout. 2012-02-15 21:32:49 +01:00
Lefteris Chatzimparmpas
23f1257c3f Correct SSL error reporting during a failure. 2012-02-15 20:48:46 +01:00
Lefteris Chatzimparmpas
c7f507e76f Close connection when an account is deleted
Added a __gc metamethod to take care of the finalization of active
connections by logging out, when an account is deleted, or at the end of
the configuration (for Lua 5.2).
2012-02-15 19:45:40 +01:00
Lefteris Chatzimparmpas
89c1366665 Correct reference to a deprecated function. 2012-02-15 19:44:46 +01:00
Lefteris Chatzimparmpas
64df3b0682 Get NAMESPACE only the first time to login
The NAMESPACE doesn't need to be retrieved after each recovery.
2012-02-15 08:42:23 +01:00
Lefteris Chatzimparmpas
fe5f789f8e Fix disabled STARTTLS functionality. 2012-02-15 08:41:13 +01:00
Lefteris Chatzimparmpas
2cafede975 Use session pointer to denote accounts
Instead of the account details, a pointer to the C structure is used in
Lua, stored as light userdata.

The 1.x deprecated configuration format has been removed, partly due to
the above change, and partly because it has been included for long
enough now.
2012-02-14 22:13:15 +01:00
Lefteris Chatzimparmpas
05a358133e Fix problem with the recover functionality
The whole function that implements a request needs to be called again,
when there is a failure that leads to re-login, and not just the last
receive or send function that failed.
2012-02-14 21:52:29 +01:00
Lefteris Chatzimparmpas
09b2cc3a25 Hide passwords from logs
After the last code refactoring, the hiding of the passwords from logs
feature was left out accidentally.
2012-02-14 20:30:50 +01:00
Lefteris Chatzimparmpas
df1e0c172b Refactor the code that handles the client requests
The functions that send the client requests to the server have been
simplified, as a layer of abstraction has been removed.
2012-02-12 22:00:18 +01:00
Lefteris Chatzimparmpas
2c70382775 Remove control structures' optional parentheses. 2012-02-11 22:55:03 +01:00
Lefteris Chatzimparmpas
18b012c2a2 Improve robustness and recoverability
Many extensive changes were made to better handle network errors, while
on some cases it is now possible to recover from previously fatal
failures.
2012-02-11 22:47:08 +01:00