Bug 41108 - syntax.py#date accepts 31 february
syntax.py#date accepts 31 february
Status: REOPENED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.4
Other Linux
: P5 minor (vote)
: ---
Assigned To: UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-25 10:00 CEST by Florian Best
Modified: 2019-02-06 11:44 CET (History)
2 users (show)

See Also:
What kind of report is it?: Security Issue
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, Security, Troubleshooting, Usability
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 2016-04-25 10:00:32 CEST
>>> import univention.admin
>>> univention.admin.syntax.date().parse('31.02.01')
'31.02.01'

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

>>> import univention.admin.modules
>>> univention.admin.syntax.date().parse('01x02y02')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 625, in parse
    day, month, year = map(lambda(x): int(x), text.split('.'))
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 625, in <lambda>
    day, month, year = map(lambda(x): int(x), text.split('.'))
ValueError: invalid literal for int(): 01x02y02
>>> univention.admin.syntax.date().parse('01.02.00')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 628, in parse
    raise univention.admin.uexceptions.valueError,_("Not a valid Date")
univention.admin.uexceptions.valueError: Not a valid Date
>>> univention.admin.syntax.date().parse('01.02.99')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 628, in parse
    raise univention.admin.uexceptions.valueError,_("Not a valid Date")
univention.admin.uexceptions.valueError: Not a valid Date
>>> univention.admin.syntax.date().parse('31.02.01')
'31.02.01'
>>> univention.admin.syntax.date().parse('00.00.01')
'00.00.01'

ucs/management/univention-directory-manager-modules/modules/univentio
n/admin/syntax.py:821
- _re_de = re.compile('^[0-9]+.[0-9]+.[0-9]+$')
+ _re_de = re.compile('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$')

- if year > 1962 and year < 2100 and month < 13 and day < 32:
+ if 1962 < year < 2100 and 1 <= month <= 12 and 1 <= day <= 31:

- if year > 0 and year < 99 and month < 13 and day < 32:
+ if 0 <= year <= 99 and 1 <= month <= 12 and 1 <= day < 31:
Comment 1 Stefan Gohmann univentionstaff 2019-01-03 07:23:06 CET
This issue has been filled against UCS 4.1. The maintenance with bug and security fixes for UCS 4.1 has ended on 5st of April 2018.

Customers still on UCS 4.1 are encouraged to update to UCS 4.3. Please contact
your partner or Univention for any questions.

If this issue still occurs in newer UCS versions, please use "Clone this bug" or simply reopen the issue. In this case please provide detailed information on how this issue is affecting you.