|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
--- evolution-data-server-1.11.4/libedataserverui/e-passwords.h.e-passwords 2007-04-18 06:10:16.000000000 -0400
|
|
|
|
|
+++ evolution-data-server-1.11.4/libedataserverui/e-passwords.h 2007-06-18 16:19:44.000000000 -0400
|
|
|
|
|
--- evolution-data-server-1.11.90/libedataserverui/e-passwords.h.e-passwords 2007-07-05 02:01:52.000000000 -0400
|
|
|
|
|
+++ evolution-data-server-1.11.90/libedataserverui/e-passwords.h 2007-08-13 16:52:07.000000000 -0400
|
|
|
|
|
@@ -28,45 +28,65 @@
|
|
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
@ -97,8 +97,8 @@
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
--- evolution-data-server-1.11.4/libedataserverui/e-passwords.c.e-passwords 2007-06-17 23:25:35.000000000 -0400
|
|
|
|
|
+++ evolution-data-server-1.11.4/libedataserverui/e-passwords.c 2007-06-18 16:26:02.000000000 -0400
|
|
|
|
|
--- evolution-data-server-1.11.90/libedataserverui/e-passwords.c.e-passwords 2007-08-12 23:59:40.000000000 -0400
|
|
|
|
|
+++ evolution-data-server-1.11.90/libedataserverui/e-passwords.c 2007-08-13 16:52:07.000000000 -0400
|
|
|
|
|
@@ -23,18 +23,29 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
@ -240,7 +240,7 @@
|
|
|
|
|
+static void ep_msg_dispatch (EPassMsg *msg);
|
|
|
|
|
|
|
|
|
|
-static GHashTable *passwords = NULL;
|
|
|
|
|
-static GtkDialog *password_dialog;
|
|
|
|
|
-static GtkDialog *password_dialog = NULL;
|
|
|
|
|
-static EDList request_list = E_DLIST_INITIALISER(request_list);
|
|
|
|
|
-static int idle_id;
|
|
|
|
|
-static int ep_online_state = TRUE;
|
|
|
|
@ -285,7 +285,8 @@
|
|
|
|
|
+{
|
|
|
|
|
+ return g_strconcat (KEY_FILE_GROUP_PREFIX, component, NULL);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- LOCK();
|
|
|
|
|
+static gchar *
|
|
|
|
|
+ep_key_file_normalize_key (const gchar *key)
|
|
|
|
|
+{
|
|
|
|
@ -312,8 +313,7 @@
|
|
|
|
|
+ GError *error = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ filename = ep_key_file_get_filename ();
|
|
|
|
|
|
|
|
|
|
- LOCK();
|
|
|
|
|
+
|
|
|
|
|
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
|
|
|
|
|
+ goto exit;
|
|
|
|
|
+
|
|
|
|
@ -379,11 +379,17 @@
|
|
|
|
|
+
|
|
|
|
|
+ gchar *password;
|
|
|
|
|
+ gsize length;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- e_passwords_init();
|
|
|
|
|
+ password = (gchar *) g_base64_decode (encoded_password, &length);
|
|
|
|
|
+ password = g_realloc (password, length + 1);
|
|
|
|
|
+ password[length] = '\0';
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- msg = g_malloc0(sizeof(*msg));
|
|
|
|
|
- msg->dispatch = dispatch;
|
|
|
|
|
- msg->msg.reply_port = e_msgport_new();
|
|
|
|
|
-#ifdef ENABLE_THREADS
|
|
|
|
|
- msg->ismain = pthread_equal(pthread_self(), main_thread);
|
|
|
|
|
+ return password;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
@ -397,15 +403,9 @@
|
|
|
|
|
+
|
|
|
|
|
+ password_cache = g_hash_table_new_full (
|
|
|
|
|
+ g_str_hash, g_str_equal, g_free, g_free);
|
|
|
|
|
|
|
|
|
|
- e_passwords_init();
|
|
|
|
|
+
|
|
|
|
|
+ express_queue = g_async_queue_new ();
|
|
|
|
|
|
|
|
|
|
- msg = g_malloc0(sizeof(*msg));
|
|
|
|
|
- msg->dispatch = dispatch;
|
|
|
|
|
- msg->msg.reply_port = e_msgport_new();
|
|
|
|
|
-#ifdef ENABLE_THREADS
|
|
|
|
|
- msg->ismain = pthread_equal(pthread_self(), main_thread);
|
|
|
|
|
+
|
|
|
|
|
+#ifdef WITH_GNOME_KEYRING
|
|
|
|
|
+ if (!gnome_keyring_is_available ()) {
|
|
|
|
|
+ key_file = g_key_file_new ();
|
|
|
|
@ -439,7 +439,10 @@
|
|
|
|
|
static void
|
|
|
|
|
-ep_msg_free(EPassMsg *msg)
|
|
|
|
|
+ep_msg_dispatch (EPassMsg *msg)
|
|
|
|
|
+{
|
|
|
|
|
{
|
|
|
|
|
- e_msgport_destroy(msg->msg.reply_port);
|
|
|
|
|
- g_free(msg->password);
|
|
|
|
|
- g_free(msg);
|
|
|
|
|
+ msg->callback (msg);
|
|
|
|
|
+ e_flag_set (msg->done);
|
|
|
|
|
+}
|
|
|
|
@ -457,14 +460,13 @@
|
|
|
|
|
+ g_async_queue_unlock (express_queue);
|
|
|
|
|
+
|
|
|
|
|
+ return success;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
-ep_msg_send(EPassMsg *msg)
|
|
|
|
|
+ep_msg_send (EPassMsg *msg)
|
|
|
|
|
{
|
|
|
|
|
- e_msgport_destroy(msg->msg.reply_port);
|
|
|
|
|
- g_free(msg->password);
|
|
|
|
|
- g_free(msg);
|
|
|
|
|
- int needidle = 0;
|
|
|
|
|
+ GMainContext *context;
|
|
|
|
|
+
|
|
|
|
|
+ context = g_main_context_default ();
|
|
|
|
@ -474,20 +476,23 @@
|
|
|
|
|
+
|
|
|
|
|
+ if (!(msg->expedite && ep_msg_expedite (msg)))
|
|
|
|
|
+ g_thread_pool_push (dispatcher, msg, NULL);
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- LOCK();
|
|
|
|
|
- e_dlist_addtail(&request_list, (EDListNode *)&msg->msg);
|
|
|
|
|
- if (!idle_id) {
|
|
|
|
|
- if (!msg->ismain)
|
|
|
|
|
- idle_id = g_idle_add(ep_idle_dispatch, NULL);
|
|
|
|
|
+ /* Don't block the main loop. */
|
|
|
|
|
+ if (g_main_context_is_owner (context))
|
|
|
|
|
+ while (!e_flag_is_set (msg->done))
|
|
|
|
|
+ g_main_context_iteration (context, TRUE);
|
|
|
|
|
+ else
|
|
|
|
|
+ e_flag_wait (msg->done);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
-ep_msg_send(EPassMsg *msg)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
|
+ep_msg_free (EPassMsg *msg)
|
|
|
|
|
{
|
|
|
|
|
- int needidle = 0;
|
|
|
|
|
+{
|
|
|
|
|
+ e_flag_free (msg->done);
|
|
|
|
|
+ g_slice_free (EPassMsg, msg);
|
|
|
|
|
+}
|
|
|
|
@ -516,12 +521,7 @@
|
|
|
|
|
+ e_flag_free (data->done);
|
|
|
|
|
+ g_slice_free (EPassDialogData, data);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
- LOCK();
|
|
|
|
|
- e_dlist_addtail(&request_list, (EDListNode *)&msg->msg);
|
|
|
|
|
- if (!idle_id) {
|
|
|
|
|
- if (!msg->ismain)
|
|
|
|
|
- idle_id = g_idle_add(ep_idle_dispatch, NULL);
|
|
|
|
|
+
|
|
|
|
|
+static gboolean
|
|
|
|
|
+ep_dialog_run (EPassMsg *msg)
|
|
|
|
|
+{
|
|
|
|
@ -991,7 +991,7 @@
|
|
|
|
|
} else {
|
|
|
|
|
EUri *uri = e_uri_new (msg->key);
|
|
|
|
|
|
|
|
|
|
@@ -681,284 +902,154 @@ ep_get_password_keyring (EPassMsg *msg)
|
|
|
|
|
@@ -683,288 +904,154 @@ ep_get_password_keyring (EPassMsg *msg)
|
|
|
|
|
|
|
|
|
|
e_uri_free (uri);
|
|
|
|
|
}
|
|
|
|
@ -1081,18 +1081,16 @@
|
|
|
|
|
- int type = msg->flags & E_PASSWORDS_REMEMBER_MASK;
|
|
|
|
|
- EDList pending = E_DLIST_INITIALISER(pending);
|
|
|
|
|
- EPassMsg *mw, *mn;
|
|
|
|
|
-
|
|
|
|
|
- if (response == GTK_RESPONSE_OK) {
|
|
|
|
|
- msg->password = g_strdup(gtk_entry_get_text((GtkEntry *)msg->entry));
|
|
|
|
|
+ gchar *key = g_strdup (msg->key);
|
|
|
|
|
+ gchar *password = g_strdup (msg->password);
|
|
|
|
|
|
|
|
|
|
- if (type != E_PASSWORDS_REMEMBER_NEVER) {
|
|
|
|
|
- int noreply = msg->noreply;
|
|
|
|
|
- if (response == GTK_RESPONSE_OK) {
|
|
|
|
|
- msg->password = g_strdup(gtk_entry_get_text((GtkEntry *)msg->entry));
|
|
|
|
|
+ g_hash_table_insert (password_cache, key, password);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
- *msg->remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (msg->check));
|
|
|
|
|
- if (type != E_PASSWORDS_REMEMBER_NEVER) {
|
|
|
|
|
- int noreply = msg->noreply;
|
|
|
|
|
+static void
|
|
|
|
|
+ep_ask_password (EPassMsg *msg)
|
|
|
|
|
+{
|
|
|
|
@ -1100,7 +1098,7 @@
|
|
|
|
|
+ gchar *password;
|
|
|
|
|
+ gint remember;
|
|
|
|
|
|
|
|
|
|
- msg->noreply = 1;
|
|
|
|
|
- *msg->remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (msg->check));
|
|
|
|
|
+ /* Open the express queue for this key. This allows us to catch
|
|
|
|
|
+ * incoming operations on this key while waiting for the user to
|
|
|
|
|
+ * provide a password. Once we have the password, immediately
|
|
|
|
@ -1109,6 +1107,10 @@
|
|
|
|
|
+ express_key = msg->key;
|
|
|
|
|
+ g_async_queue_unlock (express_queue);
|
|
|
|
|
|
|
|
|
|
- msg->noreply = 1;
|
|
|
|
|
+ if (data->flags & E_PASSWORDS_REPROMPT)
|
|
|
|
|
+ ep_get_password (msg);
|
|
|
|
|
|
|
|
|
|
- if (*msg->remember || type == E_PASSWORDS_REMEMBER_FOREVER) {
|
|
|
|
|
- msg->oldpass = msg->password;
|
|
|
|
|
- ep_add_password(msg);
|
|
|
|
@ -1124,20 +1126,18 @@
|
|
|
|
|
- if (*msg->remember && type == E_PASSWORDS_REMEMBER_FOREVER)
|
|
|
|
|
- ep_remember_password_file(msg);
|
|
|
|
|
-#endif
|
|
|
|
|
+ if (data->flags & E_PASSWORDS_REPROMPT)
|
|
|
|
|
+ ep_get_password (msg);
|
|
|
|
|
+ /* Run the password dialog in the main thread. */
|
|
|
|
|
+ g_idle_add ((GSourceFunc) ep_dialog_run, msg);
|
|
|
|
|
|
|
|
|
|
- msg->noreply = noreply;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
+ /* Run the password dialog in the main thread. */
|
|
|
|
|
+ g_idle_add ((GSourceFunc) ep_dialog_run, msg);
|
|
|
|
|
|
|
|
|
|
- gtk_widget_destroy((GtkWidget *)dialog);
|
|
|
|
|
- password_dialog = NULL;
|
|
|
|
|
+ /* Wait for the user to respond. */
|
|
|
|
|
+ e_flag_wait (data->done);
|
|
|
|
|
|
|
|
|
|
- gtk_widget_destroy((GtkWidget *)dialog);
|
|
|
|
|
- password_dialog = NULL;
|
|
|
|
|
-
|
|
|
|
|
- /* ok, here things get interesting, we suck up any pending
|
|
|
|
|
- * operations on this specific password, and return the same
|
|
|
|
|
- * result or ignore other operations */
|
|
|
|
@ -1179,10 +1179,10 @@
|
|
|
|
|
-
|
|
|
|
|
- if (!msg->noreply)
|
|
|
|
|
- e_msgport_reply(&msg->msg);
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- ep_idle_dispatch(NULL);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
-static void
|
|
|
|
|
-ep_ask_password(EPassMsg *msg)
|
|
|
|
|
-{
|
|
|
|
@ -1277,6 +1277,10 @@
|
|
|
|
|
- msg->noreply = noreply;
|
|
|
|
|
-
|
|
|
|
|
- g_signal_connect(password_dialog, "response", G_CALLBACK (pass_response), msg);
|
|
|
|
|
-
|
|
|
|
|
- if (msg->parent)
|
|
|
|
|
- gtk_dialog_run (GTK_DIALOG (password_dialog));
|
|
|
|
|
- else
|
|
|
|
|
- gtk_widget_show((GtkWidget *)password_dialog);
|
|
|
|
|
+ g_free (password);
|
|
|
|
|
}
|
|
|
|
@ -1365,7 +1369,7 @@
|
|
|
|
|
*
|
|
|
|
|
* Set the offline-state of the application. This is a work-around
|
|
|
|
|
* for having the backends fully offline aware, and returns a
|
|
|
|
|
@@ -967,10 +1058,11 @@ e_passwords_shutdown (void)
|
|
|
|
|
@@ -973,10 +1060,11 @@ e_passwords_shutdown (void)
|
|
|
|
|
* FIXME: This is not a permanent api, review post 2.0.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
@ -1380,7 +1384,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -981,151 +1073,138 @@ e_passwords_set_online(int state)
|
|
|
|
|
@@ -987,151 +1075,138 @@ e_passwords_set_online(int state)
|
|
|
|
|
void
|
|
|
|
|
e_passwords_forget_passwords (void)
|
|
|
|
|
{
|
|
|
|
@ -1416,15 +1420,15 @@
|
|
|
|
|
- EPassMsg *msg = ep_msg_new(ep_clear_passwords_file);
|
|
|
|
|
-#endif
|
|
|
|
|
+ EPassMsg *msg;
|
|
|
|
|
|
|
|
|
|
- msg->component = component_name;
|
|
|
|
|
- ep_msg_send(msg);
|
|
|
|
|
- ep_msg_free(msg);
|
|
|
|
|
+
|
|
|
|
|
+ g_return_if_fail (component != NULL);
|
|
|
|
|
+
|
|
|
|
|
+ msg = ep_msg_new (ep_clear_passwords, FALSE);
|
|
|
|
|
+ msg->component = component;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- msg->component = component_name;
|
|
|
|
|
- ep_msg_send(msg);
|
|
|
|
|
- ep_msg_free(msg);
|
|
|
|
|
+ ep_msg_send (msg);
|
|
|
|
|
+ ep_msg_free (msg);
|
|
|
|
|
}
|
|
|
|
@ -1511,19 +1515,19 @@
|
|
|
|
|
{
|
|
|
|
|
EPassMsg *msg;
|
|
|
|
|
- char *passwd;
|
|
|
|
|
+ char *password;
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- g_return_val_if_fail(component_name != NULL, NULL);
|
|
|
|
|
- g_return_val_if_fail(key != NULL, NULL);
|
|
|
|
|
+ g_return_val_if_fail (component != NULL, NULL);
|
|
|
|
|
+ g_return_val_if_fail (key != NULL, NULL);
|
|
|
|
|
+ char *password;
|
|
|
|
|
|
|
|
|
|
-#ifdef WITH_GNOME_KEYRING
|
|
|
|
|
- msg = ep_msg_new(gnome_keyring_is_available() ? ep_get_password_keyring : ep_get_password_file);
|
|
|
|
|
-#else
|
|
|
|
|
- msg = ep_msg_new(ep_get_password_file);
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|
|
|
+ g_return_val_if_fail (component != NULL, NULL);
|
|
|
|
|
+ g_return_val_if_fail (key != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
- msg->component = component_name;
|
|
|
|
|
+ msg = ep_msg_new (ep_get_password, TRUE);
|
|
|
|
|
+ msg->component = component;
|
|
|
|
@ -1586,7 +1590,7 @@
|
|
|
|
|
* @prompt: prompt string
|
|
|
|
|
* @type: whether or not to offer to remember the password,
|
|
|
|
|
* and for how long.
|
|
|
|
|
@@ -1140,241 +1219,44 @@ e_passwords_add_password (const char *ke
|
|
|
|
|
@@ -1146,241 +1221,44 @@ e_passwords_add_password (const char *ke
|
|
|
|
|
* return value is non-%NULL and @remember_type is not
|
|
|
|
|
* E_PASSWORDS_DO_NOT_REMEMBER.
|
|
|
|
|
**/
|
|
|
|
@ -1668,9 +1672,7 @@
|
|
|
|
|
-
|
|
|
|
|
- if (inlen>0)
|
|
|
|
|
- outptr += base64_encode_step(in, inlen, break_lines, outptr, state, save);
|
|
|
|
|
+ remember = (p_remember != NULL) ? *p_remember : FALSE;
|
|
|
|
|
+ data = ep_dialog_data_new (parent, title, prompt, remember, type);
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- c1 = ((unsigned char *)save)[1];
|
|
|
|
|
- c2 = ((unsigned char *)save)[2];
|
|
|
|
|
-
|
|
|
|
@ -1690,21 +1692,13 @@
|
|
|
|
|
- }
|
|
|
|
|
- if (break_lines)
|
|
|
|
|
- *outptr++ = '\n';
|
|
|
|
|
+ msg = ep_msg_new (ep_ask_password, TRUE);
|
|
|
|
|
+ msg->component = component;
|
|
|
|
|
+ msg->key = (key != NULL) ? key : "";
|
|
|
|
|
+ msg->data = data;
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- *save = 0;
|
|
|
|
|
- *state = 0;
|
|
|
|
|
-
|
|
|
|
|
- return outptr-out;
|
|
|
|
|
-}
|
|
|
|
|
+ ep_msg_send (msg);
|
|
|
|
|
+ password = msg->password;
|
|
|
|
|
+ remember = data->remember;
|
|
|
|
|
+ ep_msg_free (msg);
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-/*
|
|
|
|
|
- performs an 'encode step', only encodes blocks of 3 characters to the
|
|
|
|
|
- output at a time, saves left-over state in state and save (initialise to
|
|
|
|
@ -1770,13 +1764,20 @@
|
|
|
|
|
- }
|
|
|
|
|
- ((char *)save)[0]+=len;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
+ remember = (p_remember != NULL) ? *p_remember : FALSE;
|
|
|
|
|
+ data = ep_dialog_data_new (parent, title, prompt, remember, type);
|
|
|
|
|
|
|
|
|
|
- return outptr-out;
|
|
|
|
|
-}
|
|
|
|
|
+ ep_dialog_data_free (data);
|
|
|
|
|
+ msg = ep_msg_new (ep_ask_password, TRUE);
|
|
|
|
|
+ msg->component = component;
|
|
|
|
|
+ msg->key = (key != NULL) ? key : "";
|
|
|
|
|
+ msg->data = data;
|
|
|
|
|
|
|
|
|
|
+ if (p_remember != NULL)
|
|
|
|
|
+ *p_remember = remember;
|
|
|
|
|
+ ep_msg_send (msg);
|
|
|
|
|
+ password = msg->password;
|
|
|
|
|
+ remember = data->remember;
|
|
|
|
|
+ ep_msg_free (msg);
|
|
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * base64_decode_step: decode a chunk of base64 encoded data
|
|
|
|
@ -1816,10 +1817,13 @@
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
+ ep_dialog_data_free (data);
|
|
|
|
|
|
|
|
|
|
- *save = v;
|
|
|
|
|
- *state = i;
|
|
|
|
|
-
|
|
|
|
|
+ if (p_remember != NULL)
|
|
|
|
|
+ *p_remember = remember;
|
|
|
|
|
|
|
|
|
|
- /* quick scan back for '=' on the end somewhere */
|
|
|
|
|
- /* fortunately we can drop 1 output char for each trailing = (upto 2) */
|
|
|
|
|
- i=2;
|
|
|
|
@ -1856,8 +1860,8 @@
|
|
|
|
|
- return (char *)plain;
|
|
|
|
|
+ return password;
|
|
|
|
|
}
|
|
|
|
|
--- evolution-data-server-1.11.4/libedataserver/e-msgport.h.e-passwords 2007-04-18 06:10:18.000000000 -0400
|
|
|
|
|
+++ evolution-data-server-1.11.4/libedataserver/e-msgport.h 2007-06-18 16:19:44.000000000 -0400
|
|
|
|
|
--- evolution-data-server-1.11.90/libedataserver/e-msgport.h.e-passwords 2007-07-05 02:01:55.000000000 -0400
|
|
|
|
|
+++ evolution-data-server-1.11.90/libedataserver/e-msgport.h 2007-08-13 16:52:07.000000000 -0400
|
|
|
|
|
@@ -54,7 +54,7 @@ typedef struct _EMsgPort EMsgPort;
|
|
|
|
|
|
|
|
|
|
/* header for any message */
|
|
|
|
|