From: <pdo...@us...> - 2022-05-24 04:43:40
|
Revision: 14964 http://sourceforge.net/p/squirrelmail/code/14964 Author: pdontthink Date: 2022-05-24 04:43:39 +0000 (Tue, 24 May 2022) Log Message: ----------- Add contrib directory Added Paths: ----------- trunk/imap_proxy/contrib/ trunk/imap_proxy/contrib/0001-icc-add-possibility-to-explicit-set-the-last-logout-time.patch trunk/imap_proxy/contrib/0002-request-close-the-server-connection-on-error.patch trunk/imap_proxy/contrib/README Added: trunk/imap_proxy/contrib/0001-icc-add-possibility-to-explicit-set-the-last-logout-time.patch =================================================================== --- trunk/imap_proxy/contrib/0001-icc-add-possibility-to-explicit-set-the-last-logout-time.patch (rev 0) +++ trunk/imap_proxy/contrib/0001-icc-add-possibility-to-explicit-set-the-last-logout-time.patch 2022-05-24 04:43:39 UTC (rev 14964) @@ -0,0 +1,60 @@ +From a820b6b2e87800b53a7b63723d491120d645ff0a Mon Sep 17 00:00:00 2001 +From: Alexander Sulfrian <ale...@fu...> +Date: Mon, 29 Oct 2012 16:25:32 +0100 +Subject: [PATCH 1/2] icc: add possibility to explicit set the last logout time + +--- + src/icc.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/icc.c b/src/icc.c +index 3fc0363..03fe639 100644 +--- a/src/icc.c ++++ b/src/icc.c +@@ -248,19 +248,20 @@ extern void ICC_Recycle_Loop( void ) + + + /*++ +- * Function: ICC_Logout ++ * Function: ICC_Set_Logout_Time + * + * Purpose: set the last logout time for an IMAP connection context. + * + * Parameters: char *Username + * int server-side socket descriptor ++ * time_t logout time to set + * + * Returns: nada + * + * Authors: Dave McMurtrie <dav...@ho...> + *-- + */ +-extern void ICC_Logout( char *Username, ICD_Struct *conn ) ++extern void ICC_Set_Logout_Time( char *Username, ICD_Struct *conn, time_t time ) + { + char *fn = "ICC_Logout()"; + unsigned int HashIndex; +@@ -298,7 +299,7 @@ extern void ICC_Logout( char *Username, ICD_Struct *conn ) + return; + } + +- ICC_Active->logouttime = time(0); ++ ICC_Active->logouttime = time; + + UnLockMutex( &mp ); + +@@ -307,6 +308,11 @@ extern void ICC_Logout( char *Username, ICD_Struct *conn ) + return; + } + ++extern void ICC_Logout( char *Username, ICD_Struct *conn ) ++{ ++ return ICC_Set_Logout_Time(Username, conn, time(0)); ++} ++ + + + /* +-- +1.7.12.3-zedat + Added: trunk/imap_proxy/contrib/0002-request-close-the-server-connection-on-error.patch =================================================================== --- trunk/imap_proxy/contrib/0002-request-close-the-server-connection-on-error.patch (rev 0) +++ trunk/imap_proxy/contrib/0002-request-close-the-server-connection-on-error.patch 2022-05-24 04:43:39 UTC (rev 14964) @@ -0,0 +1,51 @@ +From de0585cdae6cf7d5025f990e06ef474192b5e9d4 Mon Sep 17 00:00:00 2001 +From: Alexander Sulfrian <ale...@fu...> +Date: Mon, 29 Oct 2012 16:28:18 +0100 +Subject: [PATCH 2/2] request: close the server connection on error + +if an error occurs during the connection proxy the the server +(f.e. caused by a connection close from the client during attachment +transfer) the connection to the server is also closed to force a new +connection on the next connection attempt from the client +--- + src/request.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/src/request.c b/src/request.c +index 627036f..622fb09 100644 +--- a/src/request.c ++++ b/src/request.c +@@ -910,7 +910,12 @@ static int cmd_authenticate_login( ITD_Struct *Client, + Client->TraceOn = 0; + Server.TraceOn = 0; + +- ICC_Logout( Username, Server.conn ); ++ if ( rc < 0 ) { ++ ICC_Set_Logout_Time( Username, Server.conn, 1 ); ++ } ++ else { ++ ICC_Logout( Username, Server.conn ); ++ } + + return( rc ); + } +@@ -1070,8 +1075,14 @@ static int cmd_login( ITD_Struct *Client, + Client->TraceOn = 0; + Server.TraceOn = 0; + +- /* update the logout time for this cached connection */ +- ICC_Logout( Username, Server.conn ); ++ if ( rc < 0 ) { ++ /* close the server connection on error (timeout) */ ++ ICC_Set_Logout_Time( Username, Server.conn, 1 ); ++ } ++ else { ++ /* update the logout time for this cached connection */ ++ ICC_Logout( Username, Server.conn ); ++ } + + return( rc ); + } +-- +1.7.12.3-zedat + Added: trunk/imap_proxy/contrib/README =================================================================== --- trunk/imap_proxy/contrib/README (rev 0) +++ trunk/imap_proxy/contrib/README 2022-05-24 04:43:39 UTC (rev 14964) @@ -0,0 +1,41 @@ +The contrib directory contains miscellaneous information or resources +related to SquirrelMail IMAP Proxy. + +=============================================================================== + +Alexander contributed a patch for solving a problem +he had with hung connections: + +https://sourceforge.net/p/squirrelmail/patches/480/ + +------------------------------------------------------------------------------- + +Hi, + +in our setup we had a problem with imapproxy. The problem occurs if a user cancels a attachment download within squirrelmail. After that all folder seems empty and the user has to wait the configured time until imapproxy closes the connections. Debugging the situation we found out, that imapproxy preserves the closed connection and continue to send the attachment data within the next imap connection. + +I have prepared a series of two patches to fix this issue: + +The first patch renames the ICC_Logout function to ICC_Set_Logout_Time, that accepts a third parameter, that is the value to set the logouttime to. ICC_Logout is a simple wrapper of that function to set the logout time time to the current time (the same behavior as before). + +The second patch closes the connection to the server (by setting the logouttime to 1) if an error occurs in the Raw_Proxy method (returning a status code less than 0). This is exactly the case if the client does close the connection within a transfer. The error that occurs is a write error on the closed client fd. If no error occurs the logouttime is set to the current time exactly as before. + +The two patches fixes the problem for our setup. + +Thanks, +Alex + +------------------------------------------------------------------------------- + +These patches are believed to be unnecessary because +they were based on an older version (pre 1.2.8) where +newer code already has changes that help invalidate +hung server connections. + +Nevertheless, the patch files are included herein for posterity as: + +0001-icc-add-possibility-to-explicit-set-the-last-logout-time.patch +0002-request-close-the-server-connection-on-error.patch + +=============================================================================== + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |