Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/ldap-nss.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2007-02-01 22:51:56 +0100
committerArthur de Jong <arthur@arthurdejong.org>2007-02-01 22:51:56 +0100
commit7e126ec34ee493043efc55971135d7e132e2e175 (patch)
treebf2a764459d1f567e1fe4bf0ae1f0b339c1b0d98 /nslcd/ldap-nss.c
parent20481e8d3b817d2f9c560aaf4a56581325ad1572 (diff)
add new dictionary module and use it for the attribute mapping stuff
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@231 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/ldap-nss.c')
-rw-r--r--nslcd/ldap-nss.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/nslcd/ldap-nss.c b/nslcd/ldap-nss.c
index 7423617..9df6cf2 100644
--- a/nslcd/ldap-nss.c
+++ b/nslcd/ldap-nss.c
@@ -3117,38 +3117,23 @@ _nss_ldap_map_get (enum ldap_map_selector sel,
enum ldap_map_type type,
const char *from, const char **to)
{
- struct ldap_datum key, val;
- void *map;
- enum nss_status stat;
-
+ DICT *map;
if (_nss_ldap_map_get == NULL || sel > LM_NONE || type > MAP_MAX)
+ return NSS_STATUS_NOTFOUND;
+ map=nslcd_cfg->ldc_maps[sel][type];
+ if (map!=NULL)
+ {
+ *to=(const char *)dict_get(map,from);
+ if ((*to==NULL) && (sel!=LM_NONE))
{
- return NSS_STATUS_NOTFOUND;
- }
-
- map = nslcd_cfg->ldc_maps[sel][type];
- assert (map != NULL);
-
- NSS_LDAP_DATUM_ZERO (&key);
- key.data = from;
- key.size = strlen (from) + 1;
-
- NSS_LDAP_DATUM_ZERO (&val);
-
- stat = dict_get (map, NSS_LDAP_DB_NORMALIZE_CASE, &key, &val);
- if (stat == NSS_STATUS_NOTFOUND && sel != LM_NONE)
- {
- map = nslcd_cfg->ldc_maps[LM_NONE][type];
- assert (map != NULL);
- stat = dict_get (map, NSS_LDAP_DB_NORMALIZE_CASE, &key, &val);
+ map=nslcd_cfg->ldc_maps[LM_NONE][type];
+ if (map!=NULL)
+ *to=(const char *)dict_get(map,from);
}
-
- if (stat == NSS_STATUS_SUCCESS)
- *to = (char *) val.data;
- else
- *to = NULL;
-
- return stat;
+ }
+ if (*to==NULL)
+ return NSS_STATUS_NOTFOUND;
+ return NSS_STATUS_SUCCESS;
}
/*
@@ -3221,7 +3206,7 @@ do_proxy_rebind (LDAP * ld, char **whop, char **credp, int *methodp,
}
#endif
-enum nss_status
+static enum nss_status
_nss_ldap_proxy_bind (const char *user, const char *password)
{
struct ldap_args args;
@@ -3322,7 +3307,7 @@ _nss_ldap_proxy_bind (const char *user, const char *password)
return stat;
}
-const char **
+static const char **
_nss_ldap_get_attributes (enum ldap_map_selector sel)
{
const char **attrs = NULL;