diff options
Diffstat (limited to 'addressbook/gui/component/addressbook-storage.c')
-rw-r--r-- | addressbook/gui/component/addressbook-storage.c | 30 |
1 files changed, 23 insertions, 7 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); |