aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-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__ */