aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-01-26 05:08:00 +0800
committerChris Toshok <toshok@src.gnome.org>2002-01-26 05:08:00 +0800
commitcf8038f6dd6c638cf4b2c68765da88722a9a01da (patch)
tree828476ecaa698836239c9896313fd6ad88dffe1b
parent22e539d53689ac5a9efce0cc360987923d54d6ba (diff)
downloadgsoc2013-evolution-cf8038f6dd6c638cf4b2c68765da88722a9a01da.tar
gsoc2013-evolution-cf8038f6dd6c638cf4b2c68765da88722a9a01da.tar.gz
gsoc2013-evolution-cf8038f6dd6c638cf4b2c68765da88722a9a01da.tar.bz2
gsoc2013-evolution-cf8038f6dd6c638cf4b2c68765da88722a9a01da.tar.lz
gsoc2013-evolution-cf8038f6dd6c638cf4b2c68765da88722a9a01da.tar.xz
gsoc2013-evolution-cf8038f6dd6c638cf4b2c68765da88722a9a01da.tar.zst
gsoc2013-evolution-cf8038f6dd6c638cf4b2c68765da88722a9a01da.zip
[ fixes bug 16097 ] gui love for the new auth stuff.
2002-01-24 Chris Toshok <toshok@ximian.com> [ fixes bug 16097 ] * gui/component/addressbook-config.glade: gui love for the new auth stuff. * gui/component/addressbook.c (load_uri_cb): track change to auth, and offer up different prompt strings depending on which method (binddn or email) we're using. * gui/component/addressbook-storage.c (ldap_unparse_auth): use the new auth types for ldap. (ldap_parse_auth): same. (addressbook_storage_auth_type_to_string): new function. (load_source_data): get the binddn too. (ldap_source_foreach): store out binddn or emailaddr, depending on the auth type chosen. * gui/component/addressbook-storage.h: add the more detailed auth types, add "binddn" to the source structure, and add a prototype for addressbook_storage_auth_type_to_string. * gui/component/addressbook-config.c (auth_checkbutton_changed): set the auth stuff (in)sensitive. (auth_optionmenu_activated): new function. (addressbook_source_dialog_set_source): track UI change. (addressbook_source_dialog_get_source): same. (add_scope_activate_cb): rename add_activate_cb to this to distinguish it from the auth stuff. (add_auth_activate_cb): new function. (addressbook_source_dialog): track change to auth UI stuff. (addressbook_storage_auth_type_to_string): new function. * backend/ebook/e-book.h: add auth_method arg to e_book_authenticate_user. * backend/ebook/e-book.c (e_book_authenticate_user): track change to prototype - add auth_method arg, and pass it along to the CORBA call. * backend/ebook/test-client.c (book_open_cb): track api change - keep this building. * backend/pas/pas-book.h: add auth_method slot in PASRequest. * backend/pas/pas-book.c (pas_book_queue_authenticate_user): add auth_method arg and add it to the PASRequest. (impl_GNOME_Evolution_Addressbook_Book_authenticateUser): track idl change, add auth_method and pass it along to pas_book_queue_authenticate_user. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_authenticate_user): support both "ldap/simple-email" and "ldap/simple-binddn" auth methods. * backend/idl/addressbook.idl: add "in string authMethod" to authenticateUser. svn path=/trunk/; revision=15475
-rw-r--r--addressbook/gui/component/addressbook-storage.c30
-rw-r--r--addressbook/gui/component/addressbook-storage.h8
2 files changed, 28 insertions, 10 deletions
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index ed8a58ed11..794876bca8 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -264,8 +264,10 @@ ldap_unparse_auth (AddressbookLDAPAuthType auth_type)
switch (auth_type) {
case ADDRESSBOOK_LDAP_AUTH_NONE:
return "none";
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE:
- return "simple";
+ case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL:
+ return "ldap/simple-email";
+ case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN:
+ return "ldap/simple-binddn";
default:
g_assert(0);
return "none";
@@ -279,8 +281,10 @@ ldap_parse_auth (const char *auth)
if (!auth)
return ADDRESSBOOK_LDAP_AUTH_NONE;
- if (!strcmp (auth, "simple"))
- return ADDRESSBOOK_LDAP_AUTH_SIMPLE;
+ if (!strcmp (auth, "ldap/simple-email") || !strcmp (auth, "simple"))
+ return ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL;
+ else if (!strcmp (auth, "ldap/simple-binddn"))
+ return ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN;
else
return ADDRESSBOOK_LDAP_AUTH_NONE;
}
@@ -318,6 +322,12 @@ ldap_parse_scope (const char *scope)
}
#endif
+const char*
+addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type)
+{
+ return ldap_unparse_auth (auth_type);
+}
+
void
addressbook_storage_init_source_uri (AddressbookSource *source)
{
@@ -392,6 +402,7 @@ load_source_data (const char *file_path)
source->scope = ldap_parse_scope (get_string_value (child, "scope"));
source->auth = ldap_parse_auth (get_string_value (child, "authmethod"));
source->email_addr = get_string_value (child, "emailaddr");
+ source->binddn = get_string_value (child, "binddn");
source->limit = get_integer_value (child, "limit", 100);
}
else {
@@ -455,9 +466,14 @@ ldap_source_foreach(AddressbookSource *source, xmlNode *root)
g_free (string);
}
- if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
- xmlNewChild (source_root, NULL, (xmlChar *) "emailaddr",
- (xmlChar *) source->email_addr);
+ if (source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
+ if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
+ xmlNewChild (source_root, NULL, (xmlChar *) "binddn",
+ (xmlChar *) source->binddn);
+ else
+ xmlNewChild (source_root, NULL, (xmlChar *) "emailaddr",
+ (xmlChar *) source->email_addr);
+
if (source->remember_passwd)
xmlNewChild (source_root, NULL, (xmlChar *) "rememberpass",
NULL);
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
index b59ec467f7..6d0c6252cf 100644
--- a/addressbook/gui/component/addressbook-storage.h
+++ b/addressbook/gui/component/addressbook-storage.h
@@ -34,8 +34,8 @@ typedef enum {
typedef enum {
ADDRESSBOOK_LDAP_AUTH_NONE,
- ADDRESSBOOK_LDAP_AUTH_SIMPLE,
- ADDRESSBOOK_LDAP_AUTH_LAST
+ ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL,
+ ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN,
} AddressbookLDAPAuthType;
typedef enum {
@@ -54,7 +54,8 @@ typedef struct {
char *rootdn;
AddressbookLDAPScopeType scope;
AddressbookLDAPAuthType auth;
- char *email_addr; /* used in AUTH_SIMPLE */
+ char *email_addr; /* used in AUTH_SIMPLE_EMAIL */
+ char *binddn; /* used in AUTH_SIMPLE_BINDDN */
gboolean remember_passwd;
char *uri; /* filled in from the above */
int limit;
@@ -74,5 +75,6 @@ void addressbook_storage_init_source_uri (AddressbookSource *sourc
void addressbook_storage_add_source (AddressbookSource *source);
void addressbook_storage_remove_source (const char *name);
+const char* addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type);
#endif /* __ADDRESSBOOK_STORAGE_H__ */