aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-09-12 06:08:40 +0800
committerChris Toshok <toshok@src.gnome.org>2002-09-12 06:08:40 +0800
commit64d454a16c99af0418fbf31e7b6ba070ace6535e (patch)
tree6316ce78200663f4c010d4785a1290f24bbc918f /addressbook
parent9b1732a7825e666762c979da7428019eeb9f1aa4 (diff)
downloadgsoc2013-evolution-64d454a16c99af0418fbf31e7b6ba070ace6535e.tar.gz
gsoc2013-evolution-64d454a16c99af0418fbf31e7b6ba070ace6535e.tar.zst
gsoc2013-evolution-64d454a16c99af0418fbf31e7b6ba070ace6535e.zip
[ fixes #30208 ] if the user clicked cancel in the password dialog, let
2002-09-11 Chris Toshok <toshok@ximian.com> [ fixes #30208 ] * gui/component/addressbook.c (load_uri_auth_cb): if the user clicked cancel in the password dialog, let them off the hook and bind anonymously. Otherwise (if they failed to auth), prompt them for the password again. (addressbook_authenticate): new function, split out 99% of the auth machinery here so it can be called multiple times. Also, call the callback with E_BOOK_STATUS_CANCELLED if the user clicked the cancel button in the dialog. (load_uri_cb): call addressbook_authenticate if the book has auth enabled. (addressbook_load_uri): use g_new0. svn path=/trunk/; revision=18049
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog15
-rw-r--r--addressbook/gui/component/addressbook.c153
2 files changed, 112 insertions, 56 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 591e945183..193b262d5e 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,18 @@
+2002-09-11 Chris Toshok <toshok@ximian.com>
+
+ [ fixes #30208 ]
+ * gui/component/addressbook.c (load_uri_auth_cb): if the user
+ clicked cancel in the password dialog, let them off the hook and
+ bind anonymously. Otherwise (if they failed to auth), prompt them
+ for the password again.
+ (addressbook_authenticate): new function, split out 99% of the
+ auth machinery here so it can be called multiple times. Also,
+ call the callback with E_BOOK_STATUS_CANCELLED if the user clicked
+ the cancel button in the dialog.
+ (load_uri_cb): call addressbook_authenticate if the book has auth
+ enabled.
+ (addressbook_load_uri): use g_new0.
+
2002-09-05 Anna Dirks <anna@ximian.com>
* gui/component/GNOME_Evolution_Addressbook.oaf.in : Changed the
description of the Directory Servers page of the settings dialog
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 6169dd5753..23997a9984 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -72,6 +72,9 @@ typedef struct {
static void addressbook_view_ref (AddressbookView *);
static void addressbook_view_unref (AddressbookView *);
+static void addressbook_authenticate (EBook *book, gboolean previous_failure,
+ AddressbookSource *source, EBookCallback cb, gpointer closure);
+
static void
save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
@@ -563,6 +566,8 @@ get_prop (BonoboPropertyBag *bag,
typedef struct {
EBookCallback cb;
+ char *clean_uri;
+ AddressbookSource *source;
gpointer closure;
} LoadUriData;
@@ -572,15 +577,95 @@ load_uri_auth_cb (EBook *book, EBookStatus status, gpointer closure)
LoadUriData *data = closure;
if (status != E_BOOK_STATUS_SUCCESS) {
- /* pop up a nice dialog, or redo the authentication
- bit some number of times. */
+ if (status == E_BOOK_STATUS_CANCELLED) {
+ /* the user clicked cancel in the password dialog */
+ gnome_warning_dialog (_("Accessing LDAP Server anonymously"));
+ data->cb (book, E_BOOK_STATUS_SUCCESS, data->closure);
+ g_free (data->clean_uri);
+ g_free (data);
+ return;
+ }
+ else {
+ e_passwords_forget_password (data->clean_uri);
+ addressbook_authenticate (book, TRUE, data->source, load_uri_auth_cb, closure);
+ return;
+ }
}
data->cb (book, status, data->closure);
+ g_free (data->clean_uri);
g_free (data);
}
+static void
+addressbook_authenticate (EBook *book, gboolean previous_failure, AddressbookSource *source,
+ EBookCallback cb, gpointer closure)
+{
+ LoadUriData *load_uri_data = closure;
+ const char *password;
+ char *pass_dup = NULL;
+ char *semicolon;
+
+ load_uri_data->clean_uri = g_strdup (e_book_get_uri (book));
+
+ semicolon = strchr (load_uri_data->clean_uri, ';');
+
+ if (semicolon)
+ *semicolon = '\0';
+
+ password = e_passwords_get_password (load_uri_data->clean_uri);
+
+ if (!password) {
+ char *prompt;
+ gboolean remember;
+ char *failed_auth;
+
+ if (previous_failure) {
+ failed_auth = _("Failed to authenticate.\n");
+ }
+ else {
+ failed_auth = "";
+ }
+
+
+ if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
+ prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"),
+ failed_auth, source->name, source->binddn);
+ else
+ prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"),
+ failed_auth, source->name, source->email_addr);
+ remember = source->remember_passwd;
+ pass_dup = e_passwords_ask_password (prompt, load_uri_data->clean_uri, prompt, TRUE,
+ E_PASSWORDS_REMEMBER_FOREVER, &remember,
+ NULL);
+ if (remember != source->remember_passwd) {
+ source->remember_passwd = remember;
+ addressbook_storage_write_sources ();
+ }
+ g_free (prompt);
+ }
+
+ if (password || pass_dup) {
+ char *user;
+
+ if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
+ user = source->binddn;
+ else
+ user = source->email_addr;
+ if (!user)
+ user = "";
+ e_book_authenticate_user (book, user, password ? password : pass_dup,
+ addressbook_storage_auth_type_to_string (source->auth),
+ cb, closure);
+ g_free (pass_dup);
+ return;
+ }
+ else {
+ /* they hit cancel */
+ cb (book, E_BOOK_STATUS_CANCELLED, closure);
+ }
+}
static void
load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
@@ -588,65 +673,21 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
LoadUriData *load_uri_data = closure;
if (status == E_BOOK_STATUS_SUCCESS && book != NULL) {
- AddressbookSource *source;
/* check if the addressbook needs authentication */
- source = addressbook_storage_get_source_by_uri (e_book_get_uri (book));
- if (source &&
- source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
- const char *password;
- char *pass_dup = NULL;
- char *uri = g_strdup (e_book_get_uri (book));
- char *semicolon = strchr (uri, ';');
-
- if (semicolon)
- *semicolon = '\0';
-
- password = e_passwords_get_password (uri);
-
- if (!password) {
- char *prompt;
- gboolean remember;
-
- if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
- prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
- source->name, source->binddn);
- else
- prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
- source->name, source->email_addr);
- remember = source->remember_passwd;
- pass_dup = e_passwords_ask_password (
- prompt, uri, prompt, TRUE,
- E_PASSWORDS_REMEMBER_FOREVER, &remember,
- NULL);
- if (remember != source->remember_passwd) {
- source->remember_passwd = remember;
- addressbook_storage_write_sources ();
- }
- g_free (prompt);
- }
+ load_uri_data->source = addressbook_storage_get_source_by_uri (e_book_get_uri (book));
- g_free (uri);
-
- if (password || pass_dup) {
- char *user;
-
- if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
- user = source->binddn;
- else
- user = source->email_addr;
- if (!user)
- user = "";
- e_book_authenticate_user (book, user, password ? password : pass_dup,
- addressbook_storage_auth_type_to_string (source->auth),
- load_uri_auth_cb, closure);
- g_free (pass_dup);
- return;
- }
+ if (load_uri_data->source &&
+ load_uri_data->source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
+
+ addressbook_authenticate (book, FALSE, load_uri_data->source,
+ load_uri_auth_cb, closure);
+
+ return;
}
}
-
+
load_uri_data->cb (book, status, load_uri_data->closure);
g_free (load_uri_data);
}
@@ -655,7 +696,7 @@ gboolean
addressbook_load_uri (EBook *book, const char *uri,
EBookCallback cb, gpointer closure)
{
- LoadUriData *load_uri_data = g_new (LoadUriData, 1);
+ LoadUriData *load_uri_data = g_new0 (LoadUriData, 1);
gboolean rv;
load_uri_data->cb = cb;
='commitgraph'>* - Respect CC & CFLAGSkrion2004-04-062-24/+5 * - Fix the build by setting the GPT_LOCATION variable when callingkrion2004-04-062-9/+13 * Add xfce4-weather-plugin 0.3.0, XFce 4 weather module for xfce4-panel.ale2004-04-066-0/+115 * Fix buffer overflow (CAN-2003-1023).fjoe2004-04-062-1/+40 * Cosmetic: sort the status report, wrap a long line.des2004-04-052-3/+6 * Update to 2.1.1.marcus2004-04-054-28/+158 * Chase the glib20 update, and bump all affected ports' PORTREVISIONs.marcus2004-04-0532-21/+32 * Add a patch forgotten by the merge script.marcus2004-04-051-0/+11 * Presenting GNOME 2.6.0. The FreeBSD GNOME Team feels this our best releasemarcus2004-04-0512-1683/+2097 * Ding-dong, this is your friendly happy face talking. Please to beade2004-04-031-1/+1 * - Update to version 1.2.4krion2004-04-035-15/+25 * Rework the dependency discovery and update code, as well as the handlingdes2004-04-033-121/+133 * Remove category pkg/COMMENT files in favour of a COMMENT variable in thekris2004-04-022-1/+2 * Follow-up to the initial submission.thierry2004-04-021-1/+1 * Add fortune-mod-bible, King James V Bible in fortune format.pav2004-04-016-0/+51 * Add globus2,krion2004-04-016-0/+2199 * Update to version 0.30.demon2004-04-014-17/+6 * - Update to 0.2.9pav2004-03-313-17/+66 * Use the two-argument version of mkdir() for backward compatibility.des2004-03-312-1/+2 * SIZEify (maintainer timeout)trevor2004-03-31111-0/+113 * Add skyutils 2.6, a library required by smssend (same author).thierry2004-03-316-0/+49 * - Use USE_ICONV knobkrion2004-03-311-1/+1 * Cleanup empty directories for localized manpages.[1]arved2004-03-302-3/+6 * Add support for MOVED.des2004-03-292-13/+64 * - SIZEifymarkus2004-03-291-0/+1 * - Update to version 7.6.0krion2004-03-294-8/+6 * Reword the descriptions. I'm not entirely sure of their accuracy, butadamw2004-03-282-2/+4 * share/gnome/capplets is usually created by gdm2, but it'sadamw2004-03-282-1/+2 * Add some gconf entries.adamw2004-03-282-1/+5 * Add some missing entries.adamw2004-03-282-1/+3 * utf8locale is now merged into -CURRENT.perky2004-03-271-0/+4 * - Fix WWW: linekrion2004-03-261-1/+1 * Drop maintainershipnbm2004-03-261-1/+1 * Support WITHOUT_NLSkris2004-03-254-8/+22 * Add SIZE to distinfo.jkoshy2004-03-251-0/+1 * Add size data, approved by maintainers.trevor2004-03-251-0/+1 * Update to 0.14.marcus2004-03-254-1492/+7 * Add SIZE data.ambrisko2004-03-231-0/+1 * o/~ Everybody was distfile sizing! o/~kris2004-03-221-0/+1 * Correct plist after applying the new MIME patches.marcus2004-03-222-2/+15 * - Update to 1.0.4pav2004-03-224-4/+12 * Reassign maintainership to Serge Gagnon.thierry2004-03-212-2/+2 * Update to version 2.4.4p2. Base loosely on patches submitted byjeh2004-03-2116-28/+72 * Merge all the MIME diffs from Freedesktop CVS. Most notably, this fixesmarcus2004-03-213-0/+1487 * Add size data, approved by maintainers.trevor2004-03-212-0/+5 * Unbreak INDEXmat2004-03-201-1/+1 * Make libpthread default threading library. Since this port is supposedphantom2004-03-201-5/+6 * SIZEfyphantom2004-03-201-0/+1 * Update to 040319.perky2004-03-192-7/+7 * SIZEifymarcus2004-03-192-0/+2 * Add size data.trevor2004-03-191-0/+1 * Add size data, approved by maintainers.trevor2004-03-192-0/+2 * SIZE-ify my ports.thierry2004-03-192-2/+12 * Reassign maintainership to the former maintainer.thierry2004-03-191-4/+4 * - SIZE'ifykrion2004-03-191-0/+1 * Add size data, approved by maintainers.trevor2004-03-191-0/+2 * Add SIZE data.olgeni2004-03-191-0/+1 * - s/USE_SDL=yes/USE_SDL=sdllofi2004-03-191-1/+1 * Add size data, approved by maintainers.trevor2004-03-1916-0/+16 * Add k3b-i18n 0.11, localized messages and documentation for K3b.markus2004-03-195-0/+214 * Use tabs, not spaces.trevor2004-03-191-6/+6 * Niek Bergboer no longer wants to maintain this.trevor2004-03-191-1/+1 * - Add SIZE to GNOME portspav2004-03-186-0/+6 * - Add SIZEpav2004-03-183-0/+3 * Add SIZE.sumikawa2004-03-181-0/+1 * - SIZEify.mich2004-03-186-0/+6 * SIZEify.sf2004-03-181-0/+1 * Add SIZE data.perky2004-03-182-0/+2 * Add SIZE.cy2004-03-181-0/+1 * Add size data.trevor2004-03-184-0/+4 * Add size data.trevor2004-03-1812-0/+13 * SIZEify.lofi2004-03-183-0/+3 * According to the maintainer, there is a dispute about the ownershiptrevor2004-03-181-1/+3 * Correct some typos.ceri2004-03-181-4/+4 * SIZEify.trevor2004-03-1810-0/+10 * - Update to 0.8.5markus2004-03-1615-42/+87 * Chase library bump of libSDL-1.1 for all ports which were dependingedwin2004-03-164-4/+4 * Update to 1.6.1daichi2004-03-154-13/+9 * Don't use PORTREVISION in dependency filenames.lofi2004-03-151-2/+2 * BROKEN on 4.x: Does not compilekris2004-03-153-0/+3 * update to xfce 4.0.4oliver2004-03-157-17/+19 * Resign maintainership of the ports corresponding to software I developedrse2004-03-141-1/+1 * Whoa there, boy, that's a mighty big commit y'all have there...ade2004-03-1417-18/+14 * - Update to version 2.6.3krion2004-03-143-8/+15 * - Update to version 0.35krion2004-03-142-4/+3 * BROKEN on amd64 and ia64: Does not compile (missing -fPIC)kris2004-03-131-1/+7 * - Update to version 9.12krion2004-03-134-19/+5 * Since asami's directory on MASTER_SITE_LOCAL is gone, stow histrevor2004-03-132-2/+2 * Fix another dependency bogon. Bump PORTREVISION.arved2004-03-132-2/+2 * Remove entries for gnect, gnibbles, gnobots2 since they already handledbland2004-03-122-4/+1 * - Update to 0.5markus2004-03-123-3/+29 * Fix depfiles.lofi2004-03-111-2/+2 * Use consistent variable names.lofi2004-03-112-2/+2 * Use all Sourceforge mirrors (MASTER_SITE_SOURCEFORGE_EXTENDED)eik2004-03-111-1/+1 * Upgrade from 4.9.2 to 4.9.4 -- released in December 2002. Reset maintainermi2004-03-114-25/+34 * According to fenner's survey this has been unfetchable since Januarytrevor2004-03-111-0/+1 * Depend on the correct files. Bump PORTREVISION.lofi2004-03-111-1/+3 * - Fix WWW: and utilize INFOkrion2004-03-103-6/+4 * - Update to 0.2.28clement2004-03-102-3/+3 * - Update MAINTAINER-line of my ports to new @FreeBSD.org addressvs2004-03-101-2/+1 * Fix plist, bump PORTREVISION.lofi2004-03-101-2/+2 * Change PKGNAMEPREFIX from sr@Latn to sr-Latn.lofi2004-03-102-2/+4 * Fix PKGNAME. Bump PORTREVISION.lofi2004-03-101-2/+2 * Update to KDE 3.2.1 / QT 3.3.1lofi2004-03-10252-829/+2988 * Add kde3-i18n-tg, localized messages and documentation for KDE3lofi2004-03-109-0/+433 * Add kde3-i18n-uz, localized messages and documentation for KDE3lofi2004-03-095-0/+275 * Add kde3-i18n-sr@Latn, localized messages and documentation for KDE3lofi2004-03-099-0/+1089 * Add kde3-i18n-nds, localized messages and documentation for KDE3lofi2004-03-099-0/+441 * Add kde3-i18n-mn, localized messages and documentation for KDE3lofi2004-03-095-0/+273 * Add kde3-i18n-bn, localized messages and documentation for KDE3lofi2004-03-095-0/+66 * Add renamedlgplugins, additional features for Konqueror's rename function (inlofi2004-03-095-0/+48 * Add ksig, a signature randomiser for KMail (part of kdepim) or standalone.lofi2004-03-095-0/+52 * Add konq-plugins, additional features and plugins for Konqueror (part oflofi2004-03-099-0/+403 * Add Makefile.split, necessary for the kdeaddons slave ports.lofi2004-03-091-0/+90 * Add knewsticker-scripts, utility scripts for knewsticker (part of kdenetwork).lofi2004-03-095-0/+53 * Add kicker-applets, additional applets for kicker (part of kdebase).lofi2004-03-095-0/+85 * Add kfile-plugins, a collection of plugins for konqueror (part of kdebase) inlofi2004-03-095-0/+55 * Add kaddressbook-plugins, a collection of plugins for kaddressbook (part oflofi2004-03-09