Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:pchenthill
evolution-data-server
fix-bnc-pwd-reset-211520-eds.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-bnc-pwd-reset-211520-eds.diff of Package evolution-data-server
Index: servers/groupwise/e-gw-connection.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v retrieving revision 1.148 diff -u -p -r1.148 e-gw-connection.c --- servers/groupwise/e-gw-connection.c 4 Dec 2006 09:16:47 -0000 1.148 +++ servers/groupwise/e-gw-connection.c 27 Dec 2006 08:29:35 -0000 @@ -62,6 +62,10 @@ struct _EGwConnectionPrivate { EGwSendOptions *opts; GMutex *reauth_mutex; EProxy *proxy; + + /* Every function exposed through e-gw-connection.h should make use of these two members to handle errors. */ + int error_code; + char *error_description; }; static void @@ -319,6 +323,9 @@ e_gw_connection_dispose (GObject *object g_free (priv->server_time) ; priv->server_time = NULL ; } + + if (priv->error_description) + g_free (priv->error_description); } if (parent_class->dispose) @@ -377,6 +384,9 @@ e_gw_connection_init (EGwConnection *cnc priv->categories_by_name = NULL; priv->book_list = NULL; priv->opts = NULL; + priv->error_code = 0; + priv->error_description = NULL; + priv->session_id = NULL; } GType @@ -492,6 +502,21 @@ e_gw_connection_new (const char *uri, co } } + + if (status != E_GW_CONNECTION_STATUS_OK) { + + param = soup_soap_response_get_first_parameter_by_name (response, "code"); + if (param) { + cnc->priv->error_code = soup_soap_parameter_get_int_value (param); + param = soup_soap_response_get_first_parameter_by_name (response, "description"); + if (param) + cnc->priv->error_description = soup_soap_parameter_get_string_value (param); + g_object_unref (response); + g_object_unref (msg); + g_static_mutex_unlock (&connecting); + return cnc; + } + } param = soup_soap_response_get_first_parameter_by_name (response, "session"); if (!param) { g_object_unref (response); @@ -4045,4 +4070,20 @@ e_gw_connection_get_proxy_connection (EG g_free (name); g_static_mutex_unlock (&connecting); return cnc; +} + +int e_gw_connection_get_error_code (EGwConnection *cnc) +{ + return cnc->priv->error_code; +} + +const char *e_gw_connection_get_error_description (EGwConnection *cnc) +{ + return cnc->priv->error_description; +} + +void e_gw_connection_clear_errors (EGwConnection *cnc) +{ + cnc->priv->error_code = 0; + g_free (cnc->priv->error_description); } Index: servers/groupwise/e-gw-connection.h =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.h,v retrieving revision 1.71 diff -u -p -r1.71 e-gw-connection.h --- servers/groupwise/e-gw-connection.h 12 Jun 2006 09:19:40 -0000 1.71 +++ servers/groupwise/e-gw-connection.h 27 Dec 2006 08:29:35 -0000 @@ -79,7 +79,8 @@ typedef enum { E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED, E_GW_CONNECTION_STATUS_REDIRECT, E_GW_CONNECTION_STATUS_OTHER, - E_GW_CONNECTION_STATUS_UNKNOWN + E_GW_CONNECTION_STATUS_UNKNOWN, + E_GW_CONNECTION_STATUS_INVALID_PASSWORD = 53273 } EGwConnectionStatus; #define E_GW_CURSOR_POSITION_CURRENT "current" @@ -176,6 +177,13 @@ EGwConnectionStatus e_gw_connection_get_ EGwConnection *e_gw_connection_get_proxy_connection (EGwConnection *cnc1, char *username, const char *password, const char *proxy, int* permissions); EGwConnectionStatus e_gw_connection_get_all_mail_uids (EGwConnection *cnc, const char *container, int cursor, gboolean forward, int count, const char *cursor_seek, GList **list); +int e_gw_connection_get_error_code (EGwConnection *cnc); +const char *e_gw_connection_get_error_description (EGwConnection *cnc); + +/* Call this function once you have made use of the error description. Otherwise, the description +string's memory will not be freed until the next SOAP call */ +void e_gw_connection_clear_errors (EGwConnection *cnc); + G_END_DECLS #endif Index: camel/providers/groupwise/camel-groupwise-store.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-store.c,v retrieving revision 1.105 diff -u -p -r1.105 camel-groupwise-store.c --- camel/providers/groupwise/camel-groupwise-store.c 7 Dec 2006 12:48:31 -0000 1.105 +++ camel/providers/groupwise/camel-groupwise-store.c 27 Dec 2006 08:29:36 -0000 @@ -178,9 +178,10 @@ groupwise_auth_loop (CamelService *servi CamelStore *store = CAMEL_STORE (service); CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store); CamelGroupwiseStorePrivate *priv = groupwise_store->priv; - char *errbuf = NULL; gboolean authenticated = FALSE; char *uri; + int connection_errors; + gboolean forget_passwd = FALSE; CAMEL_SERVICE_ASSERT_LOCKED (groupwise_store, connect_lock); if (priv->use_ssl && !g_str_equal (priv->use_ssl, "never")) @@ -192,7 +192,7 @@ groupwise_auth_loop (CamelService *servi while (!authenticated) { - if (errbuf) { + if (forget_passwd) { /* We need to un-cache the password before prompting again */ camel_session_forget_password (session, service, "Groupwise", "password", ex); g_free (service->url->passwd); @@ -202,18 +202,16 @@ groupwise_auth_loop (CamelService *servi if (!service->url->passwd && !(store->flags & CAMEL_STORE_PROXY)) { char *prompt; + + prompt = g_strdup_printf (_("Please enter the GroupWise " + "password for %s@%s"), + service->url->user, + service->url->host); - prompt = g_strdup_printf (_("%sPlease enter the GroupWise " - "password for %s@%s"), - errbuf ? errbuf : "", - service->url->user, - service->url->host); service->url->passwd = camel_session_get_password (session, service, "Groupwise", prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex); g_free (prompt); - g_free (errbuf); - errbuf = NULL; if (!service->url->passwd) { camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, @@ -228,14 +226,30 @@ groupwise_auth_loop (CamelService *servi priv->cnc = e_gw_connection_new (http_uri, priv->user, service->url->passwd); g_free (http_uri); } - if (!E_IS_GW_CONNECTION(priv->cnc)) { - errbuf = g_strdup_printf (_("Unable to authenticate " - "to GroupWise server. ")); - - camel_exception_clear (ex); - } else - authenticated = TRUE; - + + if (E_IS_GW_CONNECTION(priv->cnc)) { + connection_errors = e_gw_connection_get_error_code (priv->cnc); + if ( connection_errors & E_GW_CONNECTION_STATUS_INVALID_PASSWORD ) { + e_gw_connection_clear_errors (priv->cnc); + /* This connection object should be reusable. */ + g_object_unref (priv->cnc); + forget_passwd = TRUE; + continue; + } else if (connection_errors) { + char *error_description ; + error_description = g_strdup_printf ("Connection Failed : %s", e_gw_connection_get_error_description (priv->cnc)); + camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _(error_description)); + e_gw_connection_clear_errors (priv->cnc); + /* This connection object should be reusable. */ + g_object_unref (priv->cnc); + g_free (error_description); + return FALSE; + } else + authenticated = TRUE; + } else { + camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Authentication Failed")); + return FALSE; + } } return TRUE; @@ -582,7 +597,6 @@ groupwise_get_folder (CamelStore *store, if (!E_IS_GW_CONNECTION( priv->cnc)) { if (!groupwise_connect (CAMEL_SERVICE(store), ex)) { - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Authentication failed")); CAMEL_SERVICE_UNLOCK (gw_store, connect_lock); return NULL; } @@ -708,7 +722,6 @@ gw_store_reload_folder (CamelGroupwiseSt if (!E_IS_GW_CONNECTION( priv->cnc)) { if (!groupwise_connect (CAMEL_SERVICE((CamelStore*)gw_store), ex)) { - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Authentication failed")); CAMEL_SERVICE_UNLOCK (gw_store, connect_lock); return; } @@ -1252,7 +1265,6 @@ groupwise_create_folder(CamelStore *stor if (!E_IS_GW_CONNECTION( priv->cnc)) { if (!groupwise_connect (CAMEL_SERVICE(store), ex)) { - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Authentication failed")); return NULL; } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor