Problem: Internal Server-Error in "udm/query (users/user)" on a specific user

Problem

When accessing a user through the Univention web interface (UMC) you get an internal server error similar to the following:

Interner Server-Fehler in "udm/query (users/user)".
Request: udm/query (users/user)
 
[...]
  File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/users/user.py", line 1186, in unmapWindowsFiletime
    return time.strftime('%Y%m%d%H%M%SZ', time.gmtime(unixtime))
ValueError: timestamp out of range for platform time_t

Environment

For some reason the field “sambaBadPasswordTime” has been set to an invalid value and the conversion fails.

Solution

The field is more or less informational and resetting it has now drawbacks. As the field usually is not changeable through UMC (nor udm) it has to be fixed with ldapmodify as follows:

Step 1

Create a file called modify.ldif with the following content (replace “USERNAME” and the domain content):

dn: uid=USERNAME,cn=users,dc=mydomain,dc=intranet
changetype: modify
replace: sambaBadPasswordTime
sambaBadPasswordTime: 0

Step 2

Apply the modification:
ldapmodify -D "cn=admin,$(ucr get ldap/base)" -y /etc/ldap.secret -f modify.ldif

Step 3

Repeat the above for all affected users. They can be identified by
univention-ldapsearch '(&(sambaBadPasswordTime=*)(!(sambaBadPasswordTime=0)))' uid

Mastodon