[evolution-data-server] Authorization domains are no longer used in password storage.



commit 8bd4202f6118795a105f3f10a32ee01f4f50a97a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jul 4 09:21:02 2011 -0400

    Authorization domains are no longer used in password storage.
    
    They are a relic of keyfile-based password storage, where the auth
    domain was merely the keyfile group name.  Keyring-based password
    storage, which we now use exclusively, has no such concept.
    
    Rename all "component_name" parameters in e-passwords.c to "unused" and
    remove their argument guards from functions.
    
    Remove all AUTH_DOMAIN definitions from ECredentials.  Better to nip
    that in the bud before we're stuck with those symbols.  DO NOT bump the
    libedataserver soname, however, since that would be highly disruptive to
    distros and nothing uses ECredentials yet.
    
    Remove the "domain" parameter from CamelSession password methods.  Also
    remove any mention of "auth_domain" URL parameters.  This is a genuine
    API break requiring a libcamel soname bump, but no one cares.

 camel/camel-gpg-context.c                          |    4 +-
 camel/camel-sasl-popb4smtp.c                       |    2 +-
 camel/camel-session.c                              |    7 +--
 camel/camel-session.h                              |    4 -
 camel/providers/imap/camel-imap-store.c            |    4 +-
 camel/providers/imapx/camel-imapx-server.c         |    5 +-
 camel/providers/nntp/camel-nntp-store.c            |    8 ++-
 camel/providers/pop3/camel-pop3-store.c            |    2 +-
 camel/providers/smtp/camel-smtp-transport.c        |    2 +-
 configure.ac                                       |    2 +-
 docs/reference/camel/tmpl/camel-session.sgml       |    2 -
 .../libedataserver/libedataserver-sections.txt     |    4 -
 .../libedataserver/tmpl/e-credentials.sgml         |   28 ---------
 .../libedataserverui/tmpl/e-passwords.sgml         |   10 ++--
 libedataserver/e-credentials.h                     |    5 --
 libedataserverui/e-book-auth-util.c                |   35 ++---------
 libedataserverui/e-client-utils.c                  |   63 ++++----------------
 libedataserverui/e-passwords.c                     |   30 ++++------
 libedataserverui/e-passwords.h                     |   10 ++--
 19 files changed, 55 insertions(+), 172 deletions(-)
---
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index d1edf23..703ff46 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -803,7 +803,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 		}
 
 		flags = CAMEL_SESSION_PASSWORD_SECRET | CAMEL_SESSION_PASSPHRASE;
-		if ((passwd = camel_session_get_password (gpg->session, NULL, NULL, prompt, gpg->need_id, flags, &local_error))) {
+		if ((passwd = camel_session_get_password (gpg->session, NULL, prompt, gpg->need_id, flags, &local_error))) {
 			if (!gpg->utf8) {
 				gchar *opasswd = passwd;
 
@@ -837,7 +837,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
 	} else if (!strncmp ((gchar *) status, "BAD_PASSPHRASE", 14)) {
 		gpg->bad_passwds++;
 
-		camel_session_forget_password (gpg->session, NULL, NULL, gpg->need_id, error);
+		camel_session_forget_password (gpg->session, NULL, gpg->need_id, error);
 
 		if (gpg->bad_passwds == 3) {
 			g_set_error (
diff --git a/camel/camel-sasl-popb4smtp.c b/camel/camel-sasl-popb4smtp.c
index f98cee4..1e915c7 100644
--- a/camel/camel-sasl-popb4smtp.c
+++ b/camel/camel-sasl-popb4smtp.c
@@ -77,7 +77,7 @@ sasl_popb4smtp_challenge_sync (CamelSasl *sasl,
 	camel_sasl_set_authenticated (sasl, FALSE);
 
 	pop_uid = camel_session_get_password (
-		session, service, NULL, _("POP Source UID"),
+		session, service, _("POP Source UID"),
 		"popb4smtp_uid", 0, error);
 
 	if (pop_uid != NULL)
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 373b39a..69ff38a 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -671,7 +671,6 @@ camel_session_list_services (CamelSession *session)
  * camel_session_get_password:
  * @session: a #CamelSession
  * @service: the #CamelService this query is being made by
- * @domain: domain of password request.  May be null to use the default.
  * @prompt: prompt to provide to user
  * @item: an identifier, unique within this service, for the information
  * @flags: %CAMEL_SESSION_PASSWORD_REPROMPT, the prompt should force a reprompt
@@ -702,7 +701,6 @@ camel_session_list_services (CamelSession *session)
 gchar *
 camel_session_get_password (CamelSession *session,
                             CamelService *service,
-                            const gchar *domain,
                             const gchar *prompt,
                             const gchar *item,
                             guint32 flags,
@@ -719,7 +717,7 @@ camel_session_get_password (CamelSession *session,
 	g_return_val_if_fail (class->get_password != NULL, NULL);
 
 	password = class->get_password (
-		session, service, domain, prompt, item, flags, error);
+		session, service, prompt, item, flags, error);
 	CAMEL_CHECK_GERROR (session, get_password, password != NULL, error);
 
 	return password;
@@ -746,7 +744,6 @@ camel_session_get_password (CamelSession *session,
 gboolean
 camel_session_forget_password (CamelSession *session,
                                CamelService *service,
-                               const gchar *domain,
                                const gchar *item,
                                GError **error)
 {
@@ -759,7 +756,7 @@ camel_session_forget_password (CamelSession *session,
 	class = CAMEL_SESSION_GET_CLASS (session);
 	g_return_val_if_fail (class->forget_password, FALSE);
 
-	success = class->forget_password (session, service, domain, item, error);
+	success = class->forget_password (session, service, item, error);
 	CAMEL_CHECK_GERROR (session, forget_password, success, error);
 
 	return success;
diff --git a/camel/camel-session.h b/camel/camel-session.h
index 466f98f..0018adf 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -119,14 +119,12 @@ struct _CamelSessionClass {
 						 GError **error);
 	gchar *		(*get_password)		(CamelSession *session,
 						 CamelService *service,
-						 const gchar *domain,
 						 const gchar *prompt,
 						 const gchar *item,
 						 guint32 flags,
 						 GError **error);
 	gboolean	(*forget_password)	(CamelSession *session,
 						 CamelService *service,
-						 const gchar *domain,
 						 const gchar *item,
 						 GError **error);
 	gboolean	(*alert_user)		(CamelSession *session,
@@ -175,14 +173,12 @@ CamelService *	camel_session_get_service_by_url
 GList *		camel_session_list_services	(CamelSession *session);
 gchar *		camel_session_get_password	(CamelSession *session,
 						 CamelService *service,
-						 const gchar *domain,
 						 const gchar *prompt,
 						 const gchar *item,
 						 guint32 flags,
 						 GError **error);
 gboolean	camel_session_forget_password	(CamelSession *session,
 						 CamelService *service,
-						 const gchar *domain,
 						 const gchar *item,
 						 GError **error);
 gboolean	camel_session_alert_user	(CamelSession *session,
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 15ff0c1..e5a56e5 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -748,11 +748,9 @@ imap_auth_loop (CamelService *service,
 	CamelURL *url;
 	gchar *errbuf = NULL;
 	gboolean authenticated = FALSE;
-	const gchar *auth_domain;
 	guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
 
 	url = camel_service_get_camel_url (service);
-	auth_domain = camel_url_get_param (url, "auth-domain");
 
 	if (store->preauthed) {
 		if (camel_verbose_debug)
@@ -824,7 +822,7 @@ imap_auth_loop (CamelService *service,
 				full_prompt = g_strdup (base_prompt);
 
 			url->passwd = camel_session_get_password (
-				session, service, auth_domain, full_prompt,
+				session, service, full_prompt,
 				"password", prompt_flags, error);
 
 			g_free (base_prompt);
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 3c36f03..3df3d14 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -3076,7 +3076,6 @@ imapx_reconnect (CamelIMAPXServer *is,
 	gchar *errbuf = NULL;
 	CamelService *service;
 	CamelURL *url;
-	const gchar *auth_domain = NULL;
 	gboolean authenticated = FALSE;
 	CamelServiceAuthType *authtype = NULL;
 	guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
@@ -3154,11 +3153,9 @@ imapx_reconnect (CamelIMAPXServer *is,
 			else
 				full_prompt = g_strdup (base_prompt);
 
-			auth_domain = camel_url_get_param (url, "auth-domain");
 			url->passwd = camel_session_get_password (
 				is->session, (CamelService *) is->store,
-				auth_domain, full_prompt, "password",
-				prompt_flags, error);
+				full_prompt, "password", prompt_flags, error);
 
 			g_free (base_prompt);
 			g_free (full_prompt);
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index e0acb3e..14ec5f8 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -105,8 +105,12 @@ camel_nntp_try_authenticate (CamelNNTPStore *store,
 		}
 
 		url->passwd =
-			camel_session_get_password (session, service, NULL,
-						    prompt, "password", CAMEL_SESSION_PASSWORD_SECRET | (store->password_reprompt ? CAMEL_SESSION_PASSWORD_REPROMPT : 0), error);
+			camel_session_get_password (
+				session, service, prompt, "password",
+				CAMEL_SESSION_PASSWORD_SECRET |
+				(store->password_reprompt ?
+					CAMEL_SESSION_PASSWORD_REPROMPT : 0),
+				error);
 		g_free (prompt);
 		g_free (base);
 
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 22e5526..bf3b064 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -425,7 +425,7 @@ pop3_try_authenticate (CamelService *service,
 
 		url->passwd = camel_session_get_password (
 			camel_service_get_session (service), service,
-			NULL, full_prompt, "password", flags, error);
+			full_prompt, "password", flags, error);
 
 		g_free (base_prompt);
 		g_free (full_prompt);
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 5c7c95d..3ecbe08 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -486,7 +486,7 @@ smtp_connect_sync (CamelService *service,
 					full_prompt = g_strdup (base_prompt);
 
 				url->passwd = camel_session_get_password (
-					session, service, NULL, full_prompt,
+					session, service, full_prompt,
 					"password", password_flags, error);
 
 				g_free (base_prompt);
diff --git a/configure.ac b/configure.ac
index 746b2c8..3612c71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,7 @@ LIBEGROUPWISE_CURRENT=13
 LIBEGROUPWISE_REVISION=1
 LIBEGROUPWISE_AGE=0
 
-LIBCAMEL_CURRENT=27
+LIBCAMEL_CURRENT=28
 LIBCAMEL_REVISION=0
 LIBCAMEL_AGE=0
 
diff --git a/docs/reference/camel/tmpl/camel-session.sgml b/docs/reference/camel/tmpl/camel-session.sgml
index ad229f6..59e9a6e 100644
--- a/docs/reference/camel/tmpl/camel-session.sgml
+++ b/docs/reference/camel/tmpl/camel-session.sgml
@@ -151,7 +151,6 @@ CamelSession
 
 @session: 
 @service: 
- domain: 
 @prompt: 
 @item: 
 @flags: 
@@ -166,7 +165,6 @@ CamelSession
 
 @session: 
 @service: 
- domain: 
 @item: 
 @error: 
 @Returns: 
diff --git a/docs/reference/libedataserver/libedataserver-sections.txt b/docs/reference/libedataserver/libedataserver-sections.txt
index 159b120..0289062 100644
--- a/docs/reference/libedataserver/libedataserver-sections.txt
+++ b/docs/reference/libedataserver/libedataserver-sections.txt
@@ -154,15 +154,11 @@ ECredentials
 E_CREDENTIALS_KEY_USERNAME
 E_CREDENTIALS_KEY_PASSWORD
 E_CREDENTIALS_KEY_AUTH_METHOD
-E_CREDENTIALS_KEY_AUTH_DOMAIN
 E_CREDENTIALS_KEY_PROMPT_TITLE
 E_CREDENTIALS_KEY_PROMPT_TEXT
 E_CREDENTIALS_KEY_PROMPT_REASON
 E_CREDENTIALS_KEY_PROMPT_KEY
 E_CREDENTIALS_KEY_PROMPT_FLAGS
-E_CREDENTIALS_AUTH_DOMAIN_ADDRESSBOOK
-E_CREDENTIALS_AUTH_DOMAIN_CALENDAR
-E_CREDENTIALS_AUTH_DOMAIN_MAIL
 ECredentialsPromptFlags
 e_credentials_new
 e_credentials_new_strv
diff --git a/docs/reference/libedataserver/tmpl/e-credentials.sgml b/docs/reference/libedataserver/tmpl/e-credentials.sgml
index a78b1fb..547a5a6 100644
--- a/docs/reference/libedataserver/tmpl/e-credentials.sgml
+++ b/docs/reference/libedataserver/tmpl/e-credentials.sgml
@@ -48,13 +48,6 @@ ECredentials
 
 
 
-<!-- ##### MACRO E_CREDENTIALS_KEY_AUTH_DOMAIN ##### -->
-<para>
-
-</para>
-
-
-
 <!-- ##### MACRO E_CREDENTIALS_KEY_PROMPT_TITLE ##### -->
 <para>
 
@@ -90,27 +83,6 @@ ECredentials
 
 
 
-<!-- ##### MACRO E_CREDENTIALS_AUTH_DOMAIN_ADDRESSBOOK ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO E_CREDENTIALS_AUTH_DOMAIN_CALENDAR ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO E_CREDENTIALS_AUTH_DOMAIN_MAIL ##### -->
-<para>
-
-</para>
-
-
-
 <!-- ##### ENUM ECredentialsPromptFlags ##### -->
 <para>
 
diff --git a/docs/reference/libedataserverui/tmpl/e-passwords.sgml b/docs/reference/libedataserverui/tmpl/e-passwords.sgml
index 1e94e02..dacf0ca 100644
--- a/docs/reference/libedataserverui/tmpl/e-passwords.sgml
+++ b/docs/reference/libedataserverui/tmpl/e-passwords.sgml
@@ -57,7 +57,7 @@ e-passwords
 
 </para>
 
- component: 
+ unused: 
 @key: 
 
 
@@ -75,7 +75,7 @@ e-passwords
 
 </para>
 
- component: 
+ unused: 
 @key: 
 @Returns: 
 
@@ -85,7 +85,7 @@ e-passwords
 
 </para>
 
- component: 
+ unused: 
 @key: 
 
 
@@ -102,7 +102,7 @@ e-passwords
 
 </para>
 
- component: 
+ unused: 
 
 
 <!-- ##### ENUM EPasswordsRememberType ##### -->
@@ -126,7 +126,7 @@ e-passwords
 </para>
 
 @title: 
- component_name: 
+ unused: 
 @key: 
 @prompt: 
 @remember_type: 
diff --git a/libedataserver/e-credentials.h b/libedataserver/e-credentials.h
index 85812e0..d6b9992 100644
--- a/libedataserver/e-credentials.h
+++ b/libedataserver/e-credentials.h
@@ -36,17 +36,12 @@ struct _ECredentials {
 #define E_CREDENTIALS_KEY_USERNAME	"username"
 #define E_CREDENTIALS_KEY_PASSWORD	"password"
 #define E_CREDENTIALS_KEY_AUTH_METHOD	"auth-method"
-#define E_CREDENTIALS_KEY_AUTH_DOMAIN	"auth-domain"
 #define E_CREDENTIALS_KEY_PROMPT_TITLE	"prompt-title"
 #define E_CREDENTIALS_KEY_PROMPT_TEXT	"prompt-text"
 #define E_CREDENTIALS_KEY_PROMPT_REASON	"prompt-reason"
 #define E_CREDENTIALS_KEY_PROMPT_KEY	"prompt-key"
 #define E_CREDENTIALS_KEY_PROMPT_FLAGS	"prompt-flags"
 
-#define E_CREDENTIALS_AUTH_DOMAIN_ADDRESSBOOK	"Addressbook"
-#define E_CREDENTIALS_AUTH_DOMAIN_CALENDAR	"Calendar"
-#define E_CREDENTIALS_AUTH_DOMAIN_MAIL		"Mail"
-
 /* this is 1:1 with EPasswordsRememberType */
 typedef enum {
 	E_CREDENTIALS_PROMPT_FLAG_REMEMBER_NEVER,
diff --git a/libedataserverui/e-book-auth-util.c b/libedataserverui/e-book-auth-util.c
index 88d682c..c23228f 100644
--- a/libedataserverui/e-book-auth-util.c
+++ b/libedataserverui/e-book-auth-util.c
@@ -111,13 +111,9 @@ load_source_auth_cb (EBook *book, const GError *error, gpointer closure)
 		{
 			const gchar *uri = e_book_get_uri (book);
 			gchar *stripped_uri = remove_parameters_from_uri (uri);
-			const gchar *auth_domain = e_source_get_property (data->source, "auth-domain");
-			const gchar *component_name;
-
-			component_name = auth_domain ? auth_domain : "Addressbook";
 
 			if (error->code == E_BOOK_ERROR_AUTHENTICATION_FAILED)
-				e_passwords_forget_password (component_name, stripped_uri);
+				e_passwords_forget_password (NULL, stripped_uri);
 
 			addressbook_authenticate (book, TRUE, data->source, load_source_auth_cb, closure);
 
@@ -165,16 +161,13 @@ addressbook_authenticate (EBook *book, gboolean previous_failure, ESource *sourc
 {
 	const gchar *auth;
 	const gchar *user;
-	const gchar *component_name;
 	gchar *password = NULL;
 	const gchar *uri = e_book_get_uri (book);
 	gchar *stripped_uri = remove_parameters_from_uri (uri);
-	const gchar *auth_domain = e_source_get_property (source, "auth-domain");
 
-	component_name = auth_domain ? auth_domain : "Addressbook";
 	uri = stripped_uri;
 
-	password = e_passwords_get_password (component_name, uri);
+	password = e_passwords_get_password (NULL, uri);
 
 	auth = e_source_get_property (source, "auth");
 
@@ -215,7 +208,7 @@ addressbook_authenticate (EBook *book, gboolean previous_failure, ESource *sourc
 		g_free (password_prompt);
 
 		remember = get_remember_password (source);
-		password = e_passwords_ask_password (prompt, component_name, uri, prompt,
+		password = e_passwords_ask_password (prompt, NULL, uri, prompt,
 						     flags, &remember,
 						     NULL);
 		if (remember != get_remember_password (source))
@@ -339,7 +332,6 @@ typedef struct {
 	gchar *auth_uri;
 	gchar *auth_method;
 	gchar *auth_username;
-	gchar *auth_component;
 	gboolean auth_remember;
 } LoadContext;
 
@@ -358,7 +350,6 @@ load_book_source_context_free (LoadContext *context)
 	g_free (context->auth_uri);
 	g_free (context->auth_method);
 	g_free (context->auth_username);
-	g_free (context->auth_component);
 
 	g_slice_free (LoadContext, context);
 }
@@ -403,15 +394,6 @@ load_book_source_get_auth_details (ESource *source,
 
 	context->auth_username = g_strdup (property);
 
-	/* auth_component */
-
-	property = e_source_get_property (source, "auth-domain");
-
-	if (property == NULL)
-		property = "Addressbook";
-
-	context->auth_component = g_strdup (property);
-
 	/* auth_remember */
 
 	property = e_source_get_property (source, "remember_password");
@@ -449,9 +431,8 @@ load_book_source_password_prompt (EBook *book,
 	title = "";
 
 	password = e_passwords_ask_password (
-		title, context->auth_component,
-		context->auth_uri, string->str, flags,
-		&context->auth_remember, context->parent);
+		title, NULL, context->auth_uri, string->str,
+		flags, &context->auth_remember, context->parent);
 
 	g_string_free (string, TRUE);
 
@@ -503,8 +484,7 @@ load_book_source_thread (GSimpleAsyncResult *simple,
 	if (context->auth_method == NULL)
 		goto exit;
 
-	password = e_passwords_get_password (
-		context->auth_component, context->auth_uri);
+	password = e_passwords_get_password (NULL, context->auth_uri);
 
 prompt:
 	if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
@@ -545,8 +525,7 @@ prompt:
 	/* If authentication failed, forget the password and reprompt. */
 	if (g_error_matches (
 		error, E_BOOK_ERROR, E_BOOK_ERROR_AUTHENTICATION_FAILED)) {
-		e_passwords_forget_password (
-			context->auth_component, context->auth_uri);
+		e_passwords_forget_password (NULL, context->auth_uri);
 		g_clear_error (&error);
 		goto prompt;
 
diff --git a/libedataserverui/e-client-utils.c b/libedataserverui/e-client-utils.c
index 6d0a619..48334dd 100644
--- a/libedataserverui/e-client-utils.c
+++ b/libedataserverui/e-client-utils.c
@@ -417,14 +417,13 @@ finish_or_retry_open (EClientUtilsAsyncOpData *async_data, const GError *error)
 
 	if (async_data->auth_handler && error && g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
 		if (async_data->used_credentials) {
-			const gchar *auth_domain, *prompt_key;
+			const gchar *prompt_key;
 
-			auth_domain = e_credentials_peek (async_data->used_credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN);
 			prompt_key = e_credentials_peek (async_data->used_credentials, E_CREDENTIALS_KEY_PROMPT_KEY);
 
 			/* make sure the old password is forgotten when authentication failed */
-			if (auth_domain && prompt_key)
-				e_passwords_forget_password (auth_domain, prompt_key);
+			if (prompt_key)
+				e_passwords_forget_password (NULL, prompt_key);
 
 			e_credentials_set (async_data->used_credentials, E_CREDENTIALS_KEY_PROMPT_REASON, error->message);
 		}
@@ -668,30 +667,6 @@ e_client_utils_open_new_finish (ESource *source, GAsyncResult *result, EClient *
 
 /* free returned pointer with g_free() */
 static gchar *
-get_auth_domain (EClient *client)
-{
-	ESource *source;
-	const gchar *auth_domain;
-
-	g_return_val_if_fail (client != NULL, NULL);
-
-	source = e_client_get_source (client);
-	g_return_val_if_fail (source != NULL, NULL);
-
-	auth_domain = e_source_get_property (source, "auth-domain");
-	if (auth_domain && *auth_domain)
-		return g_strdup (auth_domain);
-
-	if (E_IS_BOOK_CLIENT (client))
-		return g_strdup (E_CREDENTIALS_AUTH_DOMAIN_ADDRESSBOOK);
-	if (E_IS_CAL_CLIENT (client))
-		return g_strdup (E_CREDENTIALS_AUTH_DOMAIN_CALENDAR);
-
-	g_return_val_if_reached (NULL);
-}
-
-/* free returned pointer with g_free() */
-static gchar *
 get_prompt_key (EClient *client, const gchar *user_name)
 {
 	SoupURI *suri;
@@ -761,14 +736,6 @@ e_client_utils_authenticate_handler (EClient *client, ECredentials *credentials,
 			return FALSE;
 	}
 
-	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN)) {
-		gchar *auth_domain = get_auth_domain (client);
-
-		e_credentials_set (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN, auth_domain);
-
-		g_free (auth_domain);
-	}
-
 	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_KEY)) {
 		gchar *prompt_key = get_prompt_key (client, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME));
 
@@ -821,7 +788,7 @@ e_client_utils_authenticate_handler (EClient *client, ECredentials *credentials,
 void
 e_client_utils_forget_password (EClient *client)
 {
-	gchar *auth_domain, *prompt_key;
+	gchar *prompt_key;
 	ESource *source;
 
 	g_return_if_fail (client != NULL);
@@ -830,19 +797,16 @@ e_client_utils_forget_password (EClient *client)
 	source = e_client_get_source (client);
 	g_return_if_fail (source != NULL);
 
-	auth_domain = get_auth_domain (client);
 	prompt_key = get_prompt_key (client, e_source_get_property (source, "username"));
 
-	e_passwords_forget_password (auth_domain, prompt_key);
+	e_passwords_forget_password (NULL, prompt_key);
 
-	g_free (auth_domain);
 	g_free (prompt_key);
 }
 
 /* Asks for a password based on the provided credentials information.
    Credentials should have set following keys:
       E_CREDENTIALS_KEY_USERNAME
-      E_CREDENTIALS_KEY_AUTH_DOMAIN
       E_CREDENTIALS_KEY_PROMPT_KEY
       E_CREDENTIALS_KEY_PROMPT_TEXT
    all other keys are optional. If also E_CREDENTIALS_KEY_PASSWORD key is provided,
@@ -857,11 +821,10 @@ e_credentials_authenticate_helper (ECredentials *credentials, GtkWindow *parent,
 	gboolean res, fake_remember_password = FALSE;
 	guint prompt_flags;
 	gchar *password = NULL;
-	const gchar *title, *auth_domain, *prompt_key;
+	const gchar *title, *prompt_key;
 
 	g_return_val_if_fail (credentials != NULL, FALSE);
 	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME), FALSE);
-	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN), FALSE);
 	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_KEY), FALSE);
 	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT), FALSE);
 
@@ -888,14 +851,13 @@ e_credentials_authenticate_helper (ECredentials *credentials, GtkWindow *parent,
 	else
 		title = _("Enter Password");
 
-	auth_domain = e_credentials_peek (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN);
 	prompt_key = e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_KEY);
 
 	if (!(prompt_flags & E_CREDENTIALS_PROMPT_FLAG_REPROMPT))
-		password = e_passwords_get_password (auth_domain, prompt_key);
+		password = e_passwords_get_password (NULL, prompt_key);
 
 	if (!password)
-		password = e_passwords_ask_password (title, auth_domain, prompt_key,
+		password = e_passwords_ask_password (title, NULL, prompt_key,
 				e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT),
 				prompt_flags, remember_password, parent);
 
@@ -915,24 +877,21 @@ e_credentials_authenticate_helper (ECredentials *credentials, GtkWindow *parent,
  * @credentials: an #ECredentials
  *
  * Forgets stored password for given @credentials, which should contain
- * E_CREDENTIALS_KEY_AUTH_DOMAIN and E_CREDENTIALS_KEY_PROMPT_KEY.
+ * E_CREDENTIALS_KEY_PROMPT_KEY.
  *
  * Since: 3.2
  **/
 void
 e_credentials_forget_password (const ECredentials *credentials)
 {
-	gchar *auth_domain, *prompt_key;
+	gchar *prompt_key;
 
 	g_return_if_fail (credentials != NULL);
-	g_return_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN));
 	g_return_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_KEY));
 
-	auth_domain = e_credentials_get (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN);
 	prompt_key = e_credentials_get (credentials, E_CREDENTIALS_KEY_PROMPT_KEY);
 
-	e_passwords_forget_password (auth_domain, prompt_key);
+	e_passwords_forget_password (NULL, prompt_key);
 
-	g_free (auth_domain);
 	g_free (prompt_key);
 }
diff --git a/libedataserverui/e-passwords.c b/libedataserverui/e-passwords.c
index 001fb5c..580ddcf 100644
--- a/libedataserverui/e-passwords.c
+++ b/libedataserverui/e-passwords.c
@@ -62,7 +62,6 @@ struct _EPassMsg {
 
 	/* input */
 	GtkWindow *parent;
-	const gchar *component;
 	const gchar *key;
 	const gchar *title;
 	const gchar *prompt;
@@ -658,8 +657,7 @@ pass_response (GtkDialog *dialog, gint response, gpointer data)
 		if ((pending->dispatch == ep_forget_password
 		     || pending->dispatch == ep_get_password
 		     || pending->dispatch == ep_ask_password)
-		    && (strcmp (pending->component, msg->component) == 0
-			&& strcmp (pending->key, msg->key) == 0)) {
+			&& strcmp (pending->key, msg->key) == 0) {
 
 			/* Satisfy the pending operation. */
 			pending->password = g_strdup (msg->password);
@@ -965,11 +963,10 @@ e_passwords_forget_passwords (void)
  * Forgets all disk cached passwords for the component.
  **/
 void
-e_passwords_clear_passwords (const gchar *component_name)
+e_passwords_clear_passwords (const gchar *unused)
 {
 	EPassMsg *msg = ep_msg_new (ep_clear_passwords);
 
-	msg->component = component_name;
 	ep_msg_send (msg);
 	ep_msg_free (msg);
 }
@@ -981,15 +978,14 @@ e_passwords_clear_passwords (const gchar *component_name)
  * Saves the password associated with @key to disk.
  **/
 void
-e_passwords_remember_password (const gchar *component_name, const gchar *key)
+e_passwords_remember_password (const gchar *unused,
+                               const gchar *key)
 {
 	EPassMsg *msg;
 
-	g_return_if_fail (component_name != NULL);
 	g_return_if_fail (key != NULL);
 
 	msg = ep_msg_new (ep_remember_password);
-	msg->component = component_name;
 	msg->key = key;
 
 	ep_msg_send (msg);
@@ -1003,15 +999,14 @@ e_passwords_remember_password (const gchar *component_name, const gchar *key)
  * Forgets the password associated with @key, in memory and on disk.
  **/
 void
-e_passwords_forget_password (const gchar *component_name, const gchar *key)
+e_passwords_forget_password (const gchar *unused,
+                             const gchar *key)
 {
 	EPassMsg *msg;
 
-	g_return_if_fail (component_name != NULL);
 	g_return_if_fail (key != NULL);
 
 	msg = ep_msg_new (ep_forget_password);
-	msg->component = component_name;
 	msg->key = key;
 
 	ep_msg_send (msg);
@@ -1026,16 +1021,15 @@ e_passwords_forget_password (const gchar *component_name, const gchar *key)
  * must free the returned password.
  **/
 gchar *
-e_passwords_get_password (const gchar *component_name, const gchar *key)
+e_passwords_get_password (const gchar *unused,
+                          const gchar *key)
 {
 	EPassMsg *msg;
 	gchar *passwd;
 
-	g_return_val_if_fail (component_name != NULL, NULL);
 	g_return_val_if_fail (key != NULL, NULL);
 
 	msg = ep_msg_new (ep_get_password);
-	msg->component = component_name;
 	msg->key = key;
 
 	ep_msg_send (msg);
@@ -1074,8 +1068,7 @@ e_passwords_add_password (const gchar *key, const gchar *passwd)
 /**
  * e_passwords_ask_password:
  * @title: title for the password dialog
- * @component_name: the name of the component for which we're storing
- * the password (e.g. Mail, Addressbook, etc.)
+ * @unused: this argument is no longer used
  * @key: key to store the password under
  * @prompt: prompt string
  * @type: whether or not to offer to remember the password,
@@ -1092,7 +1085,8 @@ e_passwords_add_password (const gchar *key, const gchar *passwd)
  * E_PASSWORDS_DO_NOT_REMEMBER.
  **/
 gchar *
-e_passwords_ask_password (const gchar *title, const gchar *component_name,
+e_passwords_ask_password (const gchar *title,
+                          const gchar *unused,
                           const gchar *key,
                           const gchar *prompt,
                           EPasswordsRememberType type,
@@ -1102,7 +1096,6 @@ e_passwords_ask_password (const gchar *title, const gchar *component_name,
 	gchar *passwd;
 	EPassMsg *msg;
 
-	g_return_val_if_fail (component_name != NULL, NULL);
 	g_return_val_if_fail (key != NULL, NULL);
 
 	if ((type & E_PASSWORDS_ONLINE) && !ep_online_state)
@@ -1110,7 +1103,6 @@ e_passwords_ask_password (const gchar *title, const gchar *component_name,
 
 	msg = ep_msg_new (ep_ask_password);
 	msg->title = title;
-	msg->component = component_name;
 	msg->key = key;
 	msg->prompt = prompt;
 	msg->flags = type;
diff --git a/libedataserverui/e-passwords.h b/libedataserverui/e-passwords.h
index 0bbdc37..e3ea84a 100644
--- a/libedataserverui/e-passwords.h
+++ b/libedataserverui/e-passwords.h
@@ -39,12 +39,12 @@ void e_passwords_init (void);
 void        e_passwords_shutdown          (void);
 void	    e_passwords_cancel (void);
 void        e_passwords_set_online (gint state);
-void        e_passwords_remember_password (const gchar *component, const gchar *key);
+void        e_passwords_remember_password (const gchar *unused, const gchar *key);
 void        e_passwords_add_password      (const gchar *key, const gchar *passwd);
-gchar       *e_passwords_get_password      (const gchar *component, const gchar *key);
-void        e_passwords_forget_password   (const gchar *component, const gchar *key);
+gchar       *e_passwords_get_password      (const gchar *unused, const gchar *key);
+void        e_passwords_forget_password   (const gchar *unused, const gchar *key);
 void        e_passwords_forget_passwords  (void);
-void        e_passwords_clear_passwords (const gchar *component);
+void        e_passwords_clear_passwords (const gchar *unused);
 
 typedef enum {
 	E_PASSWORDS_REMEMBER_NEVER,
@@ -61,7 +61,7 @@ typedef enum {
 } EPasswordsRememberType;
 
 gchar *      e_passwords_ask_password      (const gchar *title,
-					   const gchar *component_name, const gchar *key,
+					   const gchar *unused, const gchar *key,
 					   const gchar *prompt,
 					   EPasswordsRememberType remember_type,
 					   gboolean *remember,



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