summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@inai.de>2013-02-21 13:12:25 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-02-26 17:22:16 +0100
commit7cd86ef19cdde175f318aeca4ef2530d33158342 (patch)
treeb4b3bab72f54df26ef5baa612522e2285d218afe /src/providers/ldap/sdap.c
parent92b7275fae0e4767c01edb094f0b1d7f8a7439ac (diff)
downloadsssd-7cd86ef19cdde175f318aeca4ef2530d33158342.tar.gz
sssd-7cd86ef19cdde175f318aeca4ef2530d33158342.tar.xz
sssd-7cd86ef19cdde175f318aeca4ef2530d33158342.zip
sysdb: try dealing with binary-content attributessssd-1-8
https://fedorahosted.org/sssd/ticket/1818 I have here a LDAP user entry which has this attribute loginAllowedTimeMap:: AAAAAAAAAP///38AAP///38AAP///38AAP///38AAP///38AAAAAAAAA In the function sysdb_attrs_add_string(), called from sdap_attrs_add_ldap_attr(), strlen() is called on this blob, which is the wrong thing to do. The result of strlen is then used to populate the .v_length member of a struct ldb_val - and this will set it to zero in this case. (There is also the problem that there may not be a '\0' at all in the blob.) Subsequently, .v_length being 0 makes ldb_modify(), called from sysdb_set_entry_attr(), return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX. End result is that users do not get stored in the sysdb, and programs like `id` or `getent ...` show incomplete information. The bug was encountered with sssd-1.8.5. sssd-1.5.11 seemed to behave fine, but that may not mean that is the absolute lower boundary of introduction of the problem.
Diffstat (limited to 'src/providers/ldap/sdap.c')
-rw-r--r--src/providers/ldap/sdap.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c
index 01c6bcfd8..895f46d53 100644
--- a/src/providers/ldap/sdap.c
+++ b/src/providers/ldap/sdap.c
@@ -312,7 +312,6 @@ errno_t sdap_parse_deref(TALLOC_CTX *mem_ctx,
const char **ocs;
struct sdap_attr_map *map;
int num_attrs;
- struct ldb_val v;
int ret, i, a, mi;
const char *name;
size_t len;
@@ -443,10 +442,9 @@ errno_t sdap_parse_deref(TALLOC_CTX *mem_ctx,
for (i=0; dval->vals[i].bv_val; i++) {
DEBUG(9, ("Dereferenced attribute value: %s\n",
dval->vals[i].bv_val));
- v.data = (uint8_t *) dval->vals[i].bv_val;
- v.length = dval->vals[i].bv_len;
-
- ret = sysdb_attrs_add_val(res[mi]->attrs, name, &v);
+ ret = sysdb_attrs_add_mem(res[mi]->attrs, name,
+ dval->vals[i].bv_val,
+ dval->vals[i].bv_len);
if (ret) goto done;
}
}