From bba6af69b9d09d511c1cff2af5283b51fc732afb Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 15 Jun 2001 07:25:56 +0000 Subject: implement this properly, using base and (objectclass=*). 2001-06-15 Chris Toshok * backend/pas/pas-backend-ldap.c (search_for_dn): implement this properly, using base and (objectclass=*). svn path=/trunk/; revision=10249 --- addressbook/backend/pas/pas-backend-ldap.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'addressbook/backend/pas') diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 4acfaef225..ae683594c5 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -958,29 +958,14 @@ typedef struct { static ECardSimple * search_for_dn (PASBackendLDAP *bl, const char *dn) { -#if 0 - char **attrs; -#endif - char *query; LDAP *ldap = bl->priv->ldap; LDAPMessage *res, *e; ECardSimple *result = NULL; -#if 0 - /* this is broken because if we (say) modify the cn and can't - modify the dn (because it overlaps), we lose the ability to - search by that component of the dn. */ - attrs = ldap_explode_dn (dn, 0); - query = g_strdup_printf ("(%s)", attrs[0]); - printf ("searching for %s\n", query); -#else - query = g_strdup ("(objectclass=*)"); -#endif - if (ldap_search_s (ldap, - bl->priv->ldap_rootdn, - bl->priv->ldap_scope, - query, + dn, + LDAP_SCOPE_BASE, + "(objectclass=*)", NULL, 0, &res) != -1) { e = ldap_first_entry (ldap, res); while (NULL != e) { @@ -995,7 +980,6 @@ search_for_dn (PASBackendLDAP *bl, const char *dn) ldap_msgfree(res); } - g_free (query); return result; } @@ -1628,6 +1612,12 @@ func_is(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) *list = g_list_prepend(*list, g_strdup_printf("(%s=%s)", ldap_attr, str)); + else { + g_warning ("unknown query property\n"); + /* we want something that'll always be false */ + *list = g_list_prepend(*list, + g_strdup("objectClass=MyBarnIsBiggerThanYourBarn")); + } } r = e_sexp_result_new(f, ESEXP_RES_BOOL); -- cgit