[SSSD] [PATCH] memberof: Do not create request with 0 attribute values

Lukas Slebodnik lslebodn at redhat.com
Tue Mar 17 08:59:03 UTC 2015


ehlo,

at first I thought it is related to ticket "#2576"
but after simplification of reproducer I found out it just looks
bad in log file.

ldb failed to add attribute with 0 values to ldb entry, but it would not have
any effect.

BTW The best would be to immediately skip request. I'm not sure how to do it
with plain ldb.

How to reproduce?
* import attached ldif
* getent group "Escalation"
* sss_cache -E
* getent group "Escalation"

BTW you can see more warnings if nested hierarchy is deeper and each
group directly contains the same user.

LS
-------------- next part --------------
>From 78d4f1f3ae5d45819b31ba500549b717182231ad Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 11 Mar 2015 18:11:13 +0100
Subject: [PATCH] memberof: Do not create request with 0 attribute values

[sysdb_set_entry_attr] (0x0080): ldb_modify failed: [Constraint violation](19)
  [attribute 'ghost': attribute on 'name=Escalation,cn=groups,cn=LDAP,cn=sysdb'
  specified, but with 0 values (illegal)]
[sysdb_error_to_errno] (0x0020): LDB returned unexpected error:
  [Constraint violation]
[sysdb_set_entry_attr] (0x0040): Error: 14 (Bad address)
[sdap_store_group_with_gid] (0x0040): Could not store group Escalation
[sdap_save_group] (0x0080): Could not store group with GID: [Bad address]
[sdap_save_group] (0x0080): Failed to save group [Escalation]: [Bad address]
[sdap_save_groups] (0x0040): Failed to store group 1. Ignoring.
---
 src/ldb_modules/memberof.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index c26a13bb94bafe62299572565cab4b53c77f3d94..1fce91cc1b4f472a09f8ce5b68f2c35c601dd573 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -3303,6 +3303,12 @@ static int mbof_inherited_mod(struct mbof_mod_ctx *mod_ctx)
     }
     el->num_values = j;
 
+    if (el->num_values == 0) {
+        /* nothing to do */
+        /* We cannot modifiy elment which has 0 values */
+        msg->num_elements = 0;
+    }
+
     mod_ctx->igh->mod_msg = msg;
     mod_ctx->igh->el = el;
 
-- 
2.3.2

-------------- next part --------------
dn: ou=Users,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Users

dn: ou=Groups,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Groups

dn: uid=bill,ou=Users,dc=example,dc=com
changetype: add
objectClass: account
objectClass: posixAccount
cn: bill
uidNumber: 11001
gidNumber: 11001
homeDirectory: /home/mof_user1
loginShell: /bin/bash
gecos: Bill C.
userPassword: Secret123

dn: cn=bill,ou=Groups,dc=example,dc=com
changetype: add
gidNumber: 11001
objectClass: extensibleObject
objectClass: groupOfNames

dn: cn=Images,ou=Groups,dc=example,dc=com
changetype: add
gidNumber: 11003
objectClass: extensibleObject
objectClass: groupOfNames
member: uid=bill,ou=Users,dc=example,dc=com

dn: cn=Escalation,ou=Groups,dc=example,dc=com
changetype: add
gidNumber: 11005
objectClass: extensibleObject
objectClass: groupOfNames
member: cn=Images,ou=Groups,dc=example,dc=com
member: uid=bill,ou=Users,dc=example,dc=com


More information about the sssd-devel mailing list