[evolution-patches] 68556, nntp auth and other fixes




there are still some very strange problems with disco-store running unlocked but they don't happen under normal circumstances.

this fixes the bug and some other issues, like it not reprompting for a password if it failed, etc.

--
Michael Zucchi <notzed ximian com>
"Free Software, putting the Free back in Free Market."
Novell's Evolution and Free Software Developer
? camel/providers/nntp/camel-gpg.0.verify.data
? camel/providers/nntp/camel-gpg.0.verify.signature
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2251.2.21
diff -u -p -r1.2251.2.21 ChangeLog
--- camel/ChangeLog	10 Nov 2004 03:56:02 -0000	1.2251.2.21
+++ camel/ChangeLog	18 Nov 2004 08:32:43 -0000
@@ -1,3 +1,34 @@
+2004-11-18  Not Zed  <NotZed Ximian com>
+
+	* providers/nntp/camel-nntp-stream.c:
+	* providers/nntp/camel-nntp-store.c:
+	* providers/nntp/camel-nntp-summary.c: Make debug run based on
+	'nntp' debug option.
+
+	* providers/nntp/camel-nntp-stream.c (stream_fill): if we get a 0
+	read, return ECONNRESET.  This should really have been put on the
+	stream for that imap hack fix.
+
+	* providers/nntp/camel-nntp-store.c (camel_nntp_try_authenticate):
+	retry if the password attempt failed.
+
+	** See bug #68556.
+
+	* providers/nntp/camel-nntp-store.c (xover_setup): don't overwrite
+	exception if we get a failure.
+	(camel_nntp_command): if we continue, then set the return code to
+	-1, so we re-loop rather than abort.
+
+2004-11-10  Not Zed  <NotZed Ximian com>
+
+	** See bug #69109.
+	
+	* camel-service.c (cs_getnameinfo): honour the NI_NAMEREQD flag.
+
+	* providers/smtp/camel-smtp-transport.c (smtp_helo): change the
+	nameinfo flags a bit so we know when we got a numeric name and
+	need to wrap it in [].
+
 2004-11-09  Not Zed  <NotZed Ximian com>
 
 	* providers/imap/camel-imap-folder.c (imap_get_message): before
Index: camel/providers/nntp/camel-nntp-store.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/nntp/camel-nntp-store.c,v
retrieving revision 1.65.14.8
diff -u -p -r1.65.14.8 camel-nntp-store.c
--- camel/providers/nntp/camel-nntp-store.c	13 Oct 2004 01:28:03 -0000	1.65.14.8
+++ camel/providers/nntp/camel-nntp-store.c	18 Nov 2004 08:32:43 -0000
@@ -45,6 +45,7 @@
 #include <camel/camel-disco-store.h>
 #include <camel/camel-disco-diary.h>
 #include "camel/camel-private.h"
+#include <camel/camel-debug.h>
 
 #include "camel-nntp-summary.h"
 #include "camel-nntp-store.h"
@@ -54,8 +55,7 @@
 #include "camel-nntp-resp-codes.h"
 
 #define w(x)
-extern int camel_verbose_debug;
-#define dd(x) (camel_verbose_debug?(x):0)
+#define dd(x) (camel_debug("nntp")?(x):0)
 
 #define NNTP_PORT  "119"
 #define NNTPS_PORT "563"
@@ -116,8 +116,6 @@ xover_setup(CamelNNTPStore *store, Camel
 
 	ret = camel_nntp_raw_command_auth(store, ex, &line, "list overview.fmt");
 	if (ret == -1) {
-		camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
-				     _("NNTP Command failed: %s"), g_strerror(errno));
 		return -1;
 	} else if (ret != 215)
 		/* unsupported command?  ignore */
@@ -1138,25 +1136,36 @@ camel_nntp_try_authenticate (CamelNNTPSt
 	CamelService *service = (CamelService *) store;
 	CamelSession *session = camel_service_get_session (service);
 	int ret;
-	char *line;
+	char *line = NULL;
 	
 	if (!service->url->user) {
 		camel_exception_setv(ex, CAMEL_EXCEPTION_INVALID_PARAM,
 				     _("Authentication requested but no username provided"));
 		return -1;
 	}
-	
+
 	/* if nessecary, prompt for the password */
 	if (!service->url->passwd) {
-		char *prompt;
-		
-		prompt = g_strdup_printf (_("Please enter the NNTP password for %s %s"),
-					  service->url->user,
-					  service->url->host);
+		char *prompt, *base;
+	retry:
+		base = g_strdup_printf (_("Please enter the NNTP password for %s %s"),
+					service->url->user,
+					service->url->host);
+		if (line) {
+			char *top = g_strdup_printf(_("Cannot authenticate to server: %s"), line);
+
+			prompt = g_strdup_printf("%s\n\n%s", top, base);
+			g_free(top);
+		} else {
+			prompt = base;
+			base = NULL;
+		}
+
 		service->url->passwd =
 			camel_session_get_password (session, service, NULL,
 						    prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
-		g_free (prompt);
+		g_free(prompt);
+		g_free(base);
 		
 		if (!service->url->passwd)
 			return -1;
@@ -1171,8 +1180,7 @@ camel_nntp_try_authenticate (CamelNNTPSt
 		if (ret != -1) {
 			/* Need to forget the password here since we have no context on it */
 			camel_session_forget_password(session, service, NULL, "password", ex);
-			camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-					     _("Cannot authenticate to server: %s"), line);
+			goto retry;
 		}
 		return -1;
 	}
@@ -1364,6 +1372,8 @@ camel_nntp_command (CamelNNTPStore *stor
 		case NNTP_AUTH_REQUIRED:
 			if (camel_nntp_try_authenticate(store, ex) != NNTP_AUTH_ACCEPTED)
 				return -1;
+			retry--;
+			ret = -1;
 			continue;
 		case 411:	/* no such group */
 			camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID,
@@ -1373,6 +1383,7 @@ camel_nntp_command (CamelNNTPStore *stor
 		case 401:	/* wrong client state - this should quit but this is what the old code did */
 		case 503:	/* information not available - this should quit but this is what the old code did (?) */
 			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+			ret = -1;
 			continue;
 		case -1:	/* i/o error */
 			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
Index: camel/providers/nntp/camel-nntp-stream.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/nntp/camel-nntp-stream.c,v
retrieving revision 1.2
diff -u -p -r1.2 camel-nntp-stream.c
--- camel/providers/nntp/camel-nntp-stream.c	31 May 2002 01:05:44 -0000	1.2
+++ camel/providers/nntp/camel-nntp-stream.c	18 Nov 2004 08:32:43 -0000
@@ -32,9 +32,9 @@
 #include <glib.h>
 
 #include "camel-nntp-stream.h"
+#include "camel-debug.h"
 
-extern int camel_verbose_debug;
-#define dd(x) (camel_verbose_debug?(x):0)
+#define dd(x) (camel_debug("nntp:stream";)?(x):0)
 
 static CamelObjectClass *parent_class = NULL;
 
@@ -60,7 +60,9 @@ stream_fill(CamelNNTPStream *is)
 			is->end[0] = '\n';
 			return is->end - is->ptr;
 		} else {
-			dd(printf("NNTP_STREAM_FILL(ERROR): '%s'\n", strerror(errno)));
+			if (left == 0)
+				errno = ECONNRESET;
+			dd(printf("NNTP_STREAM_FILL(ERROR): %d - '%s'\n", left, strerror(errno)));
 			return -1;
 		}
 	}
Index: camel/providers/nntp/camel-nntp-summary.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/nntp/camel-nntp-summary.c,v
retrieving revision 1.15.14.1
diff -u -p -r1.15.14.1 camel-nntp-summary.c
--- camel/providers/nntp/camel-nntp-summary.c	13 Oct 2004 01:28:03 -0000	1.15.14.1
+++ camel/providers/nntp/camel-nntp-summary.c	18 Nov 2004 08:32:43 -0000
@@ -36,6 +36,7 @@
 #include "camel/camel-stream-null.h"
 #include "camel/camel-operation.h"
 #include "camel/camel-data-cache.h"
+#include "camel/camel-debug.h"
 
 #include "camel-nntp-summary.h"
 #include "camel-nntp-folder.h"
@@ -45,8 +46,7 @@
 #define w(x)
 #define io(x)
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-extern int camel_verbose_debug;
-#define dd(x) (camel_verbose_debug?(x):0)
+#define dd(x) (camel_debug("nntp")?(x):0)
 
 #define CAMEL_NNTP_SUMMARY_VERSION (1)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]