Bug 56514 - removing accountActivationDate causes LDAP Error: No such attribute: modify/delete: krb5ValidStart: no such value.
removing accountActivationDate causes LDAP Error: No such attribute: modify/d...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 5.2
Other Linux
: P5 normal (vote)
: UCS 5.0-5-errata
Assigned To: Florian Best
Juan Carlos
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-01 12:59 CEST by Florian Best
Modified: 2023-10-11 16:36 CEST (History)
0 users

See Also:
What kind of report is it?: Development Internal
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):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2023-09-01 12:59:58 CEST
In UCS 5.2 the removal of accountActivationDate doesn't work anymore.

# udm users/user create --set password=univention --set lastname=foo --set username=acc1 --set accountActivationDate="$(TZ="Europe/Berlin" date -d '+1 minute' +'%Y-%m-%d %H:%M Europe/Berlin')"      
WARNING: The object is not going to be created underneath of its default containers.                                                                                                                                                          
Object created: uid=acc1,dc=school,dc=dev
# udm users/user modify --dn uid=acc1,$(ucr get ldap/base) --remove accountActivationDate                                                                                                             
LDAP Error: No such attribute: modify/delete: krb5ValidStart: no such value.


[('krb5ValidStart', [b'20230901084500Z'], b''), ('displayName', b'foo', b'foo')]
(Pdb) self.oldattr['krb5ValidStart']
[b'20230901104500Z']
(Pdb) self.oldinfo['accountActivationDate']
['2023-09-01', '10:45', 'UTC']
(Pdb) univention.admin.handlers.users.user.mapDateTimeTimezoneTupleToUTCDateTimeString(self.oldinfo['accountActivationDate'])
[b'20230901084500Z']
(Pdb) univention.admin.handlers.users.user.mapDateTimeTimezoneTupleToUTCDateTimeString(self.oldinfo['accountActivationDate']) == ml[0][1]
True

→ The modlist contains the value which the map-function produces for UTC but in LDAP a different value is stored.

The changes in users/user in git:c62d968c35856f06c3b10bb990016dc9618b6b02 for Py3.11 compatibility could be the cause.
Comment 3 Florian Best univentionstaff 2023-09-18 14:20:25 CEST
It was caused by git:c62d968c35856f06c3b10bb990016dc9618b6b02.
Fixed via:

diff --git management/univention-directory-manager-modules/modules/univention/admin/handlers/users/user.py management/univention-directory-manager-modules/modules/univention/admin/handlers/users/user.py
index 17ef8d4256..4c5080eb1b 100644
--- management/univention-directory-manager-modules/modules/univention/admin/handlers/users/user.py
+++ management/univention-directory-manager-modules/modules/univention/admin/handlers/users/user.py
@@ -1039,7 +1039,7 @@ def datetime_from_local_datetimetimezone_tuple(local_datetimetimezone_tuple):  #
     # dttz_str = module.property_descriptions[key].syntax.tostring(local_datetimetimezone_tuple)
     naive_dt = datetime.strptime("%s %s" % (d, t), "%Y-%m-%d %H:%M")
     if zoneinfo:
-        return naive_dt.astimezone(zoneinfo.ZoneInfo(tz))
+        return naive_dt.replace(tzinfo=zoneinfo.ZoneInfo(tz))
     return pytz.timezone(tz).localize(naive_dt)
Comment 4 Florian Best univentionstaff 2023-10-05 12:24:54 CEST
Backported the fix to UCS 5.0-5:

univention-directory-manager-modules.yaml
c19ca49c594a | fix(udm): fix Python 3.11 compatibility for timezone handling

univention-directory-manager-modules (15.0.24-18)
c19ca49c594a | fix(udm): fix Python 3.11 compatibility for timezone handling
Comment 5 Juan Carlos univentionstaff 2023-10-05 12:50:05 CEST
QA:

- package built.
- changelog and advisory.
- Changes in code works.
Comment 6 Iván.Delgado univentionstaff 2023-10-11 16:36:29 CEST
<https://errata.software-univention.de/#/?erratum=5.0x832>