Bug 29680 - remove of last group member leads to an empty uniqueMember attribute
remove of last group member leads to an empty uniqueMember attribute
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Groups
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 3.2
Assigned To: Dirk Wiesenthal
Florian Best
: interim-3
: 30265 (view as bug list)
Depends on:
Blocks: 33379
  Show dependency treegraph
 
Reported: 2012-12-10 14:01 CET by Dirk Wiesenthal
Modified: 2013-11-19 06:42 CET (History)
5 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2012-12-10 14:01:03 CET
Folgende Schritte sind unternommen worden:
Samba-Gruppe angelegt
Samba-Computer angelegt mit dieser Gruppe als primärer
Aus der Samba-Gruppe diesen Computer aus "enthaltene Computer" gelöscht

Jetzt gibt ein udm/get u.a. das zurück: "users": [""]

Das macht einen Eintrag in "enthaltene Benutzer". Und zwar einen leeren (d.h. CheckBox ist da, Name fehlt).

root@master:~# univention-ldapsearch -LLL cn=mygroup
dn: cn=mygroup,cn=groups,dc=dirk,dc=ucs31,dc=qa
sambaGroupType: 2
cn: mygroup
objectClass: top
objectClass: posixGroup
objectClass: univentionGroup
objectClass: sambaGroupMapping
objectClass: univentionObject
univentionObjectType: groups/group
gidNumber: 8039
sambaSID: S-1-4-8039
uniqueMember:

Es _könnte_ sich um Bug #13946 handeln.
Comment 1 Alexander Kläser univentionstaff 2013-01-02 14:27:28 CET
Die Primary Group ist eine eigene Eigenschaft für sich, weitere Gruppen sind über die Eigenschaft "groups" gespeichert. 

root@master55:~# udm users/user list --filter uid=testuser | grep -e DN -e group
DN: uid=testuser,cn=users,dc=ucs31,dc=qa
  groups: cn=Domain Users,cn=groups,dc=ucs31,dc=qa
  primaryGroup: cn=testgroup,cn=groups,dc=ucs31,dc=qa

Das Herauslöschen eines Mitgliedes einer Gruppe wirkt sich nicht auf seine Primary Group aus.
Comment 2 Dirk Wiesenthal univentionstaff 2013-01-02 16:53:09 CET
(In reply to comment #1)
> Die Primary Group ist eine eigene Eigenschaft für sich, weitere Gruppen sind
> über die Eigenschaft "groups" gespeichert. 
> Das Herauslöschen eines Mitgliedes einer Gruppe wirkt sich nicht auf seine
> Primary Group aus.

Das ist doch aber gar nicht das Problem. Das Problem ist, dass bei udm/get für die Gruppe auf einmal "users": [""] zurückgegeben wird, obwohl die Gruppe gar keine Benutzer hat (und schon gar keinen mit leerem Namen). Nachzustellen, indem man einen Computer wieder aus "enthaltene Computer" löscht.

Tatsächlich bleibt in diesem Fall die Primary Group des Rechners auf "mygroup". Das kann auch nicht ganz korrekt sein.
Comment 3 Alexander Kläser univentionstaff 2013-01-02 18:25:00 CET
(In reply to comment #2)
> Das ist doch aber gar nicht das Problem. Das Problem ist, dass bei udm/get für
> die Gruppe auf einmal "users": [""] zurückgegeben wird, obwohl die Gruppe gar
> keine Benutzer hat (und schon gar keinen mit leerem Namen). Nachzustellen,
> indem man einen Computer wieder aus "enthaltene Computer" löscht.

Ok, das hatte ich missverstanden. [""] ist wahrscheinlich noch ein Relikt aus
UDM < 3.0, wo leere Listen häufiger so zurückgegeben wurden.
Comment 4 Dirk Wiesenthal univentionstaff 2013-02-04 13:45:03 CET
*** Bug 30265 has been marked as a duplicate of this bug. ***
Comment 5 Dirk Wiesenthal univentionstaff 2013-02-04 13:45:29 CET
Siehe Screenshot aus Bug#30265
Comment 6 Ingo Steuwer univentionstaff 2013-09-11 09:46:35 CEST
The Bug has been reported by a customer (2013090621001846) and is more generic:

After removing the last group member (independent of its type) using UMC an empty uniqueMember attribute is left, in the example I removed the last user in the group:

-----------------
# testgruppe, groups, dhcptest.local
dn: cn=testgruppe,cn=groups,dc=dhcptest,dc=local
sambaGroupType: 2
cn: testgruppe
objectClass: top
objectClass: posixGroup
objectClass: univentionGroup
objectClass: sambaGroupMapping
objectClass: univentionObject
univentionObjectType: groups/group
gidNumber: 5037
sambaSID: S-1-5-21-1139408302-3084351321-3475345008-1115
uniqueMember:
-----------------

This is displayed as an "empty" user-membership in UMC.

Removing the Member using UDM commandline the attribute uniqueMember fully removed, the bug only occures using the UMC module.
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2013-09-11 09:52:35 CEST
(In reply to Ingo Steuwer from comment #6)
> The Bug has been reported by a customer (2013090621001846) and is more
> generic:
> 
> After removing the last group member (independent of its type) using UMC an
> empty uniqueMember attribute is left, in the example I removed the last user
> in the group:

Something similar happens, if the last IP address gets removed from a windows client (other computer type have not been tested yet): an empty aRecord attribute remains.

---[cut]---
dn: cn=foobar,cn=computers,dc=example,dc=com
univentionServerRole: windows_client
displayName: foobar
cn: foobar
objectClass: top
objectClass: person
objectClass: univentionHost
[...]
uid: foobar$
gidNumber: 1005
aRecord:
---[cut]---
Comment 8 Alexander Kläser univentionstaff 2013-09-11 12:54:21 CEST
I would vote for completely removing any [""] for empty multi values. Do we know in advance whether this could this harm any other code parts in UDM?
Comment 9 Dirk Wiesenthal univentionstaff 2013-10-09 17:15:34 CEST
Changed the default for MULTI-VALUE properties to [], not [''] in
  univention-directory-manager-modules 9.0.52-1.1111.201310091658

[''] is used throughout UDM, but mostly when working with raw ldap data. I hope this patch does not break anything. At least the test results are the same with and without the patch.

This either means my patch is fine or we have weak code coverage. Or both.
Comment 10 Florian Best univentionstaff 2013-10-21 16:27:49 CEST
Hmm, there are about 200 things which rely on this(!?!):

>>> c = univention.uldap.getMachineConnection()
>>> g=univention.admin.handlers.groups.group.lookup(None, c, 'cn=noobs')[0]
>>> g.open()
>>> g.get('users', [''])
[]
>>> g.get('users', [''])[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range

$ cd  ~/svn/dev/branches/ucs-3.2/ucs-3.2-0
$ ack "\['']"
Comment 11 Florian Best univentionstaff 2013-10-22 09:38:08 CEST
(In reply to Florian Best from comment #10)
> Hmm, there are about 200 things which rely on this(!?!):
> 
> >>> c = univention.uldap.getMachineConnection()
> >>> g=univention.admin.handlers.groups.group.lookup(None, c, 'cn=noobs')[0]
> >>> g.open()
> >>> g.get('users', [''])
> []
> >>> g.get('users', [''])[0]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> IndexError: list index out of range
> 
> $ cd  ~/svn/dev/branches/ucs-3.2/ucs-3.2-0
> $ ack "\['']"

no, they are all either no multivalue fields or a check "if not value" is done.
Comment 12 Florian Best univentionstaff 2013-10-23 12:12:49 CEST
seems to work, no problems detected.

Changelog OK
Comment 13 Florian Best univentionstaff 2013-11-14 15:38:39 CET
Code-review:
* oxse4ucs OK
* zarafa4ucs OK
* asterisk4ucs OK
Comment 14 Stefan Gohmann univentionstaff 2013-11-19 06:42:44 CET
UCS 3.2 has been released:
 http://docs.univention.de/release-notes-3.2-en.html
 http://docs.univention.de/release-notes-3.2-de.html

If this error occurs again, please use "Clone This Bug".