Bug 18929 - Fehlerhaftes if-elif-else-Konstrukt in uldap.py
Fehlerhaftes if-elif-else-Konstrukt in uldap.py
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: LDAP
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 3.2
Assigned To: Erik Damrose
Arvid Requate
: interim-1
Depends on: 18926
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-07 08:20 CEST by Andreas Büsching
Modified: 2013-11-19 06:42 CET (History)
3 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 Andreas Büsching univentionstaff 2010-07-07 08:20:25 CEST
Dieses Segment sollte noch einmal geprüft werden. Wieso müssen genau diese Attribute hier eine Sonderbehandlung erfahren? Ist das notwendig?

+++ This bug was initially created as a clone of Bug #18926 +++

Created an attachment (id=2489)
Test-Skript

In dev/ucs/base/univention-python/modules/uldap.py#modify gibt es folgendes
Konstrukt:

  if key == 'homePostalAddress': ...
    val=homePostalAddress
  if key == 'pager': ...
    val=postalAddress
  if key == 'mobile': ...
    val=mobileTelephoneNumber
  if key == 'pagerTelephoneNumber': ...
    val=pagerTelephoneNumber
  if key == "jpegPhoto":
    val=None
  else:
    val=oldvalue

Da dort "if" statt "elif" verwendet wird, tritt für die ersten 4 Fälle auch
immer der 'else'-Fall ein, der 'val' überschreibt.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2010-07-07 09:55:29 CEST
(In reply to comment #0)
> Dieses Segment sollte noch einmal geprüft werden. Wieso müssen genau diese
> Attribute hier eine Sonderbehandlung erfahren? Ist das notwendig?

Bei den Attributen handelt es sich um Multivalue-Attribute. Beim Löschen eines Wertes wird über das Konstrukt nicht gezielt der einzelne Wert herausgelöscht, sondern ein REPLACE durchgeführt, wobei die Liste der neuen Werte den zu löschenden Wert nicht enthält.
Mal abgesehen davon, dass fraglich ist, ob man diese Vorgehensweise noch braucht, sollte der Code etwas generischer aufgebaut werden (derzeit viel Copy'n'Paste).
Comment 2 Erik Damrose univentionstaff 2013-07-01 14:49:04 CEST
Deprecated checks for multivalue attributes have been removed. 

Build for UCS 3.2: univention-python 7.0.2-1.132.201307011439
Comment 3 Arvid Requate univentionstaff 2013-08-19 19:10:07 CEST
* selective multivalue modifications on 'mobile' and 'pager' still work
* no code found which could rely on a feature like this
* changelog ok
Comment 4 Stefan Gohmann univentionstaff 2013-11-19 06:42:29 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".