Bug 36330 - Failed to create user with expired password - invalid date format
Failed to create user with expired password - invalid date format
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Users
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.0-0-errata
Assigned To: Florian Best
Arvid Requate
:
: 36486 36747 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-28 16:57 CET by Florian Best
Modified: 2015-01-22 11:55 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):
Max CVSS v3 score:


Attachments
regression test (1.03 KB, text/x-sh)
2014-12-03 18:53 CET, Florian Best
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2014-10-28 16:57:59 CET
Change e.g. the Konto-Ablaufdatum of a user in a german UMC session:

File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 398, in _thread
    module.modify( properties )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 184, in wrapper_func
    ret = func( *args, **kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 441, in modify
    obj.modify()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 364, in modify
    return self._modify(modify_childs,ignore_license=ignore_license)
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 823, in _modify
    ml=self._ldap_modlist()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 2201, in _ldap_modlist
    shadowExpire="%d" % long(time.mktime(time.strptime(self['userexpiry'],"%Y-%m-%d"))/3600/24+1)
  File "/usr/lib/python2.7/_strptime.py", line 467, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))

ValueError: time data '22.10.14' does not match format '%Y-%m-%d'
Comment 1 Alexander Kramer univentionstaff 2014-10-31 11:25:28 CET
wasn't able to reproduce the bug. it works for me in chromium and firefox without any error.
Comment 2 Alexander Kläser univentionstaff 2014-10-31 13:09:21 CET
(In reply to Alexander Kramer from comment #1)
> wasn't able to reproduce the bug. it works for me in chromium and firefox
> without any error.

Then WORKSFORME ;) .
Comment 3 Florian Best univentionstaff 2014-11-04 12:14:45 CET
Hmm, I could not reproduce either... weird... We'll see if it occurs again somewhen.
Comment 4 Philipp Hahn univentionstaff 2014-11-17 13:39:34 CET
<http://10.200.17.70/univention-management-console/?lang=en-US>
→ User
→ "exp"
→ Account
Account deactivation := None
Account expiry date := "11/14/2014"
→ Save




On more on unset (Bug #25279):
  File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 881, in _thread
    property_obj.syntax.parse( value )
  File "/usr/lib/pymodules/python2.7/univention/admin/syntax.py", line 1177, in parse
    if self._re_iso.match(text) != None:

TypeError: expected string or bu
Comment 5 Philipp Hahn univentionstaff 2014-11-17 13:49:30 CET
Remote Address:10.200.17.70:80
Request URL:http://10.200.17.70/umcp/command/udm/validate
Request Method:POST
Status Code:200 OK
Request Headersview parsed
POST /umcp/command/udm/validate HTTP/1.1
Host: 10.200.17.70
Connection: keep-alive
Content-Length: 175
Origin: http://10.200.17.70
X-Requested-With: XMLHttpRequest
Accept-Language: en-US
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
Content-Type: application/json
Accept: */*
Referer: http://10.200.17.70/univention-management-console/?lang=en-US
Accept-Encoding: gzip,deflate
Cookie: UMCSessionId=de746cdc-5a55-4e2f-bdd5-dcac235535ce; UMCUsername=Administrator; _pk_id.14.ec52=a5e93d57e42d5a6b.1415881519.5.1416228112.1415985564.; _pk_ses.14.ec52=*
Request Payloadview parsed
{"options":{"objectType":"users/user","properties":{"disabled":"none","userexpiry":"2014-11-14","CtxBrokenSession":"0000","CtxReconnectSession":"0000"}},"flavor":"users/user"}
Response Headersview parsed
HTTP/1.1 200 OK
Date: Mon, 17 Nov 2014 12:42:42 GMT
Server: CherryPy/3.2.2
Content-Length: 229
Content-Type: application/json
Via: 1.1 h70.phahn.pt
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive



Remote Address:10.200.17.70:80
Request URL:http://10.200.17.70/umcp/command/udm/put
Request Method:POST
Status Code:500 Internal Server Error
Request Headersview parsed
POST /umcp/command/udm/put HTTP/1.1
Host: 10.200.17.70
Connection: keep-alive
Content-Length: 203
Origin: http://10.200.17.70
X-Requested-With: XMLHttpRequest
Accept-Language: en-US
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
Content-Type: application/json
Accept: */*
Referer: http://10.200.17.70/univention-management-console/?lang=en-US
Accept-Encoding: gzip,deflate
Cookie: UMCSessionId=de746cdc-5a55-4e2f-bdd5-dcac235535ce; UMCUsername=Administrator; _pk_id.14.ec52=a5e93d57e42d5a6b.1415881519.5.1416228163.1415985564.; _pk_ses.14.ec52=*
Request Payloadview parsed
{"options":[{"object":{"disabled":"none","userexpiry":"2014-11-14","CtxBrokenSession":"0000","CtxReconnectSession":"0000","$dn$":"uid=exp,cn=users,dc=phahn,dc=pt"},"options":null}],"flavor":"users/user"}
Response Headersview source
Connection:Keep-Alive
Content-Length:1607
Content-Type:application/json
Date:Mon, 17 Nov 2014 12:42:42 GMT
Keep-Alive:timeout=5, max=99
Server:CherryPy/3.2.2
Via:1.1 h70.phahn.pt
Comment 6 Alexander Kläser univentionstaff 2014-11-18 11:23:46 CET
This seems to be some internal error in the handling of the account expiry. To reproduce, create a normal user "test" in UMC. Then configure the following parameters:

> eval "$(ucr shell)"
> udm users/user modify --dn "uid=test,cn=users,$ldap_base" --set userexpiry= --set disabled=all

Open the user in UMC, and change

> Account deactiviation → None
> Account expiry date → any date

et voilà, the traceback occurs.
Comment 7 Florian Best univentionstaff 2014-11-18 11:34:03 CET
*** Bug 36747 has been marked as a duplicate of this bug. ***
Comment 8 Florian Best univentionstaff 2014-11-28 15:45:19 CET
# udm users/user modify --dn "uid=test2,cn=users,$ldap_base" --set userexpiry= --set disabled=all
LDAP Error: No such attribute: modify/delete: shadowExpire: no such value
Comment 9 Florian Best univentionstaff 2014-11-28 15:49:10 CET
(In reply to Florian Best from comment #8)
> # udm users/user modify --dn "uid=test2,cn=users,$ldap_base" --set
> userexpiry= --set disabled=all
> LDAP Error: No such attribute: modify/delete: shadowExpire: no such value

~# univention-ldapsearch -xLLL uid=test2 shadowExpire | ldapsearch-wrapper 
dn: uid=test2,cn=users,dc=ucs,dc=dev
shadowExpire: 10858
Comment 10 Florian Best univentionstaff 2014-11-28 19:15:11 CET
*** Bug 36486 has been marked as a duplicate of this bug. ***
Comment 11 Florian Best univentionstaff 2014-11-28 21:26:58 CET
Fixed the time format. It internally tried to parse a format %Y-%m-%d. This is also the format which is sent by the frontend. But(!) in the backend there is the date syntax which converts this format into %d.%m.%y. (dunno who had the idea to use this format for the date syntax class).

Along with this fix the concurrent setting of both setting has been fixed.
It's now possible to set userexpiry and disabled attribute in one request.

root@master5:~# univention-ldapsearch -xLLL uid=test2 shadowExpire | ldapsearch-wrapper                                                                                                                                                       
dn: uid=test2,cn=users,dc=ucs,dc=dev

root@master5:~# udm users/user modify --dn "uid=test2,cn=users,$ldap_base" --set userexpiry= --set disabled=all
Object modified: uid=test2,cn=users,dc=ucs,dc=dev
root@master5:~# univention-ldapsearch -xLLL uid=test2 shadowExpire | ldapsearch-wrapper                                                                                                                                                       
dn: uid=test2,cn=users,dc=ucs,dc=dev
shadowExpire: 1

root@master5:~# udm users/user modify --dn "uid=test2,cn=users,$ldap_base" --set userexpiry= --set disabled=none
Object modified: uid=test2,cn=users,dc=ucs,dc=dev
root@master5:~# univention-ldapsearch -xLLL uid=test2 shadowExpire | ldapsearch-wrapper                                                                                                                                                       
dn: uid=test2,cn=users,dc=ucs,dc=dev

root@master5:~# udm users/user modify --dn "uid=test2,cn=users,$ldap_base" --set userexpiry=01.01.14 --set disabled=none                                                                                                                      
Object modified: uid=test2,cn=users,dc=ucs,dc=dev
root@master5:~# univention-ldapsearch -xLLL uid=test2 shadowExpire | ldapsearch-wrapper                                                                                                                                                       
dn: uid=test2,cn=users,dc=ucs,dc=dev
shadowExpire: 16071

root@master5:~# udm users/user modify --dn "uid=test2,cn=users,$ldap_base" --set userexpiry=01.01.14 --set disabled=all
Object modified: uid=test2,cn=users,dc=ucs,dc=dev
root@master5:~# univention-ldapsearch -xLLL uid=test2 shadowExpire | ldapsearch-wrapper                                                                                                                                                       
dn: uid=test2,cn=users,dc=ucs,dc=dev
shadowExpire: 1


I could imagine that internally some more things are broken but i am not sure what things are sanitized by the syntax class and what not. E.g.: Bug #37108
Comment 12 Florian Best univentionstaff 2014-11-28 22:24:28 CET
Just to be sure: it is okay if a user account (posix) which is disabled cannot have a expiry date, right? (because he is disabled so the shadowExpire value is always '1'). Otherwise I have to exchange two lines.
Comment 13 Florian Best univentionstaff 2014-12-03 15:52:44 CET
attachment 6494 [details]
Comment 14 Florian Best univentionstaff 2014-12-03 18:53:20 CET
Created attachment 6499 [details]
regression test

(In reply to Florian Best from comment #12)
> Just to be sure: it is okay if a user account (posix) which is disabled
> cannot have a expiry date, right? (because he is disabled so the
> shadowExpire value is always '1'). Otherwise I have to exchange two lines.
I changed this again so that the code doesn't have a regression. Attached is a script which can be executed before and after the changes which will result in the same output.

I changed the syntax of userexpiry to the new class "date2" which is able to have the century and which returns always %Y-%m-%d format.
Comment 15 Arvid Requate univentionstaff 2015-01-12 18:01:34 CET
Test: 61_udm-users/26_password_expire_date
Advisory: Ok.
Comment 16 Janek Walkenhorst univentionstaff 2015-01-22 11:55:49 CET
<http://errata.univention.de/ucs/4.0/43.html>