Re: [evolution-patches] 62856, all, asking passwords in offline mode




Hmm, the last mail of course had a completely unrelated patch attached instead of this correct one.

On Fri, 2004-08-27 at 16:28 +0800, Not Zed wrote:

this is a fairly clean but sort of dirty workaround for asking passwords in offline mode.  it assumes if the calendar or addressbook is asking for a password then it must be a remote resource.  mail doesn't need it as it does the right thing already, and smime should only be local resources.  gpg w/ remote keyservers is another issue, i don't know what happens right now or if we can really do anything about it anyway.

If the app is offline, we just return that the user has cancelled the password request, it is up to the backend as to what it does with no auth.  some annoying popup boxes may be likely from the addressbook at least (the mailer explicitly surpresses any followon error boxes after user expliclty cancels something).

this works since everything is in-proc now.

--
Michael Zucchi <notzed ximian com>
"born to die, live to work, it's all downhill from here"
Novell's Evolution and Free Software Developer
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1822
diff -u -3 -r1.1822 ChangeLog
--- addressbook/ChangeLog	27 Aug 2004 05:13:12 -0000	1.1822
+++ addressbook/ChangeLog	27 Aug 2004 08:20:26 -0000
@@ -1,3 +1,16 @@
+2004-08-27  Not Zed  <NotZed Ximian com>
+
+	** See bug #62856 (workaround).
+
+	* gui/component/addressbook.c (addressbook_authenticate): add
+	online flag to password request.
+
+	** See bug #64011.
+
+	* gui/component/addressbook-view.c (edit_addressbook_cb): Remove
+	double ;; in declaration section (c99 extension).  From Vincent
+	Noel <vnoel cox net>.
+
 2004-08-26  Hans Petter Jansson  <hpj ximian com>
 
 	Really fixes #61833 and #63697.
Index: addressbook/gui/component/addressbook.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook.c,v
retrieving revision 1.241
diff -u -3 -r1.241 addressbook.c
--- addressbook/gui/component/addressbook.c	12 Aug 2004 06:54:17 -0000	1.241
+++ addressbook/gui/component/addressbook.c	27 Aug 2004 08:20:26 -0000
@@ -178,7 +178,7 @@
 		char *prompt;
 		gboolean remember;
 		char *failed_auth;
-		guint32 flags = E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET;
+		guint32 flags = E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET|E_PASSWORDS_ONLINE;
 
 		if (previous_failure) {
 			failed_auth = _("Failed to authenticate.\n");
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2496
diff -u -3 -r1.2496 ChangeLog
--- calendar/ChangeLog	26 Aug 2004 16:16:53 -0000	1.2496
+++ calendar/ChangeLog	27 Aug 2004 08:20:28 -0000
@@ -1,3 +1,14 @@
+2004-08-27  Not Zed  <NotZed Ximian com>
+
+	* common/authentication.c (auth_func_cb): constify the strings to
+	remove a warning.
+
+	** See bug #64856 (workaround).
+
+	* common/authentication.c (auth_func_cb): 
+	* gui/e-pub-utils.c(e_pub_publish): add ONLINE flag to password
+	request.
+
 2004-08-26  Christian Neumair  <chris gnome-de org>
 
 	* gui/GNOME_Evolution_Calendar.server.in.in:
Index: calendar/common/authentication.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/common/authentication.c,v
retrieving revision 1.7
diff -u -3 -r1.7 authentication.c
--- calendar/common/authentication.c	12 Aug 2004 06:55:23 -0000	1.7
+++ calendar/common/authentication.c	27 Aug 2004 08:20:28 -0000
@@ -36,8 +36,7 @@
 	gboolean remember;
 	char *password;
 	ESource *source;
-	gchar *auth_domain;
-	gchar *component_name;
+	const gchar *auth_domain, *component_name;
 
 	source = e_cal_get_source (ecal);
 	auth_domain = e_source_get_property (source, "auth-domain");
@@ -46,7 +45,8 @@
 	
 	if (!password)
 		password = e_passwords_ask_password (_("Enter password"), component_name, key, prompt,
-						     E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET, &remember,
+						     E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET|E_PASSWORDS_ONLINE,
+						     &remember,
 						     NULL);
 
 	return password;
Index: calendar/gui/e-pub-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-pub-utils.c,v
retrieving revision 1.4
diff -u -3 -r1.4 e-pub-utils.c
--- calendar/gui/e-pub-utils.c	12 Aug 2004 06:55:23 -0000	1.4
+++ calendar/gui/e-pub-utils.c	27 Aug 2004 08:20:28 -0000
@@ -301,7 +301,7 @@
 				password = e_passwords_ask_password (_("Enter password"), 
 								     "Calendar", (gchar *)uri->location, 
 								     prompt,
-								     E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET,
+								     E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET|E_PASSWORDS_ONLINE,
 								     &remember, NULL);
 
 				g_free (prompt);
Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.481
diff -u -3 -r1.481 ChangeLog
--- e-util/ChangeLog	27 Aug 2004 00:21:33 -0000	1.481
+++ e-util/ChangeLog	27 Aug 2004 08:20:29 -0000
@@ -1,3 +1,8 @@
+2004-08-27  Not Zed  <NotZed Ximian com>
+
+	* e-passwords.c (e_passwords_ask_password): return cancelled if
+	we're in an offline state.
+
 2004-08-26  Rodrigo Moya <rodrigo novell com>
 
 	* eggtrayicon.[ch]: updated from libegg.
Index: e-util/e-passwords.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-passwords.c,v
retrieving revision 1.20
diff -u -3 -r1.20 e-passwords.c
--- e-util/e-passwords.c	25 Aug 2004 10:59:00 -0000	1.20
+++ e-util/e-passwords.c	27 Aug 2004 08:20:29 -0000
@@ -102,6 +102,7 @@
 static GtkDialog *password_dialog;
 static EDList request_list = E_DLIST_INITIALISER(request_list);
 static int idle_id;
+static int ep_online_state = TRUE;
 
 static char *decode_base64 (char *base64);
 static int base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save);
@@ -538,6 +539,23 @@
 }
 
 /**
+ * e_passwords_set_online:
+ * @state: 
+ * 
+ * Set the offline-state of the application.  This is a work-around
+ * for having the backends fully offline aware, and returns a
+ * cancellation response instead of prompting for passwords.
+ *
+ * FIXME: This is not a permanent api, review post 2.0.
+ **/
+void
+e_passwords_set_online(int state)
+{
+	ep_online_state = state;
+	/* TODO: we could check that a request is open and close it, or maybe who cares */
+}
+
+/**
  * e_passwords_forget_passwords:
  *
  * Forgets all cached passwords, in memory and on disk.
@@ -697,6 +715,9 @@
 {
 	char *passwd;
 	EPassMsg *msg = ep_msg_new(ep_ask_password);
+
+	if ((type & E_PASSWORDS_ONLINE) && !ep_online_state)
+		return NULL;
 
 	msg->title = title;
 	msg->component = component_name;
Index: e-util/e-passwords.h
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-passwords.h,v
retrieving revision 1.9
diff -u -3 -r1.9 e-passwords.h
--- e-util/e-passwords.h	12 Aug 2004 06:53:12 -0000	1.9
+++ e-util/e-passwords.h	27 Aug 2004 08:20:29 -0000
@@ -39,6 +39,7 @@
 
 void        e_passwords_shutdown          (void);
 void	    e_passwords_cancel(void);
+void        e_passwords_set_online(int state);
 void        e_passwords_remember_password (const char *component, const char *key);
 void        e_passwords_add_password      (const char *key, const char *passwd);
 char       *e_passwords_get_password      (const char *component, const char *key);
@@ -55,6 +56,7 @@
 	/* option bits */
 	E_PASSWORDS_SECRET = 1<<8,
 	E_PASSWORDS_REPROMPT = 1<<9,
+	E_PASSWORDS_ONLINE = 1<<10, /* only ask if we're online */
 } EPasswordsRememberType;
 
 char *      e_passwords_ask_password      (const char *title, 
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1468
diff -u -3 -r1.1468 ChangeLog
--- shell/ChangeLog	26 Aug 2004 14:33:24 -0000	1.1468
+++ shell/ChangeLog	27 Aug 2004 08:20:29 -0000
@@ -1,3 +1,10 @@
+2004-08-27  Not Zed  <NotZed Ximian com>
+
+	** See bug #62856 (workaround only)
+
+	* e-shell.c (impl_Shell_setLineStatus, e_shell_construct): set the
+	online state on e_passwords.
+
 2004-08-26  Rodney Dawes  <dobey novell com>
 
 	* apps_evolution_shell.schemas.in.in: Don't translate the default
Index: shell/e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.252
diff -u -3 -r1.252 e-shell.c
--- shell/e-shell.c	1 Aug 2004 17:58:08 -0000	1.252
+++ shell/e-shell.c	27 Aug 2004 08:20:30 -0000
@@ -32,6 +32,7 @@
 #include "e-util/e-dialog-utils.h"
 #include "e-util/e-bconf-map.h"
 #include "e-util/e-fsutils.h"
+#include "e-util/e-passwords.h"
 #include "widgets/misc/e-error.h"
 
 #include "e-shell-constants.h"
@@ -287,6 +288,9 @@
 	bonobo_object = bonobo_object_from_servant (servant);
 	shell = E_SHELL (bonobo_object);
 
+	/* let the password manager know out online status */
+	e_passwords_set_online(online);
+
 	if (online)
 		e_shell_go_online (shell, NULL);
 	else
@@ -660,6 +664,8 @@
 		start_online = FALSE; /* Make compiler happy.  */
 		g_assert_not_reached ();
 	}
+
+	e_passwords_set_online(start_online);
 
 	if (start_online)
 		e_shell_go_online (shell, NULL);


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