Bug 16262 - Fehlerhafte Tests in modules/univention/admin/syntax.py
Fehlerhafte Tests in modules/univention/admin/syntax.py
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UNSTABLE
Other Linux
: P5 normal (vote)
: UCS 2.4
Assigned To: Janek Walkenhorst
Andreas Büsching
:
: 17938 (view as bug list)
Depends on:
Blocks: 15417
  Show dependency treegraph
 
Reported: 2009-11-04 17:45 CET by Philipp Hahn
Modified: 2010-08-31 13:23 CEST (History)
4 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

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2009-11-04 17:45:34 CET
Beim testen von Bug #15417 sind Probleme beim Validieren der verschiedenen Syntax-varianten aufgefallen:

1. ucr set directory/manager/web/modules/users/user/properties/firstname/syntax=date
2. Neuen Benutzer anlegen, dabei als Vorname den 31. eines Monats wählen, der 31 Tage hat
	
A Python exception has occured:
Traceback (most recent call last):
  File "/usr/share/univention-webui/modules/requests.py", line 232, in run_request     self.dialog.apply()
  File "./unidialog.py", line 372, in apply     self.mod.apply()
  File "/usr/share/univention-directory-manager/uniconf/modedit.py", line 5205, in apply     current_object[key]=new
  File "/usr/lib/python2.4/site-packages/univention/admin/handlers/__init__.py", line 237, in __setitem__     p=s.parse(value)
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 612, in parse     day, month, year = map(lambda(x): int(x), text.split('.'))
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 612, in <lambda>     day, month, year = map(lambda(x): int(x), text.split('.'))
ValueError: invalid literal for int(): 2009-12-31 

Fix: univention-directory-manager-modules/modules/univention/admin/syntax.py:609 <date>
'< 31' durch '<= 31' oder '< 32' ersetzen.

Weitere Anmerkungen:

univention-directory-manager-modules/modules/univention/admin/syntax.py:415 <passwd>
In der Fehlermeldung ist die Zahl 8 fest verdrahtet, ggf. besser _('... %d ...') % self.min_length

univention-directory-manager-modules/modules/univention/admin/syntax.py:540 <ipRange>
'Last Address' ist vom Typ 'string'?
Ist 'Last < First' erlaubt?

univention-directory-manager-modules/modules/univention/admin/syntax.py:569 <emailAddress>
Die RegEx ist zu restriktiv, heutzutage ist viel mehr erlaubt. Im local-name fast alles erlaubt, insbesondere das '+'.

univention-directory-manager-modules/modules/univention/admin/syntax.py:592 <iso8601Date>
Die RegEx (Datum als YYYY-MM-DD oder YYYY-Woche-Tag oder YYYY-DDD) passt nicht zum Beispiel (Datum+Zeit). Siehe http://www.w3.org/TR/NOTE-datetime
Comment 1 Philipp Hahn univentionstaff 2009-11-04 18:23:57 CET
Die Klassen "HourSimple" und "MinuteSimple" sind jeweils doppelt vorhanden.
Comment 2 Philipp Hahn univentionstaff 2010-03-22 16:06:29 CET
*** Bug 17938 has been marked as a duplicate of this bug. ***
Comment 3 Philipp Hahn univentionstaff 2010-07-12 16:20:46 CEST
'string_numbers_letters_dots', "..._spaces", "uid" akzeptieren übrigend nur Strings mit Länge >= 2

"phone" akzeptiert keine Klammern: _re = re.compile('(?u)[a-zA-Z0-9._ \(\)\\\/+-]*$')

"uid" akzeptiert "Admin". Gewollt?
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2010-07-12 17:38:25 CEST
(In reply to comment #3)
> 'string_numbers_letters_dots', "..._spaces", "uid" akzeptieren übrigend nur
> Strings mit Länge >= 2
> 
> "phone" akzeptiert keine Klammern: _re = re.compile('(?u)[a-zA-Z0-9._
> \(\)\\\/+-]*$')
> 
> "uid" akzeptiert "Admin". Gewollt?

Wird die uid-Syntax noch an anderen Stellen verwendet, um auf einen gültigen Benutzernamen zu testen?
Comment 5 Janek Walkenhorst univentionstaff 2010-07-15 16:16:27 CEST
(In reply to comment #4)
> Wird die uid-Syntax noch an anderen Stellen verwendet, um auf einen gültigen
> Benutzernamen zu testen?

passwd.py (users/passwd) Attribut "username"
shared.py (dhcp/shared) Attribut "name"
Comment 6 Janek Walkenhorst univentionstaff 2010-07-20 17:31:30 CEST
(In reply to comment #0)
> univention-directory-manager-modules/modules/univention/admin/syntax.py:569
> <emailAddress>
> Die RegEx ist zu restriktiv, heutzutage ist viel mehr erlaubt. Im local-name
> fast alles erlaubt, insbesondere das '+'.
Durch Bug #17429 obsolet.

(In reply to comment #3)
> "phone" akzeptiert keine Klammern: _re = re.compile('(?u)[a-zA-Z0-9._
> \(\)\\\/+-]*$')
"phone" akzeptiert Klammern.
Comment 7 Janek Walkenhorst univentionstaff 2010-07-21 10:10:21 CEST
(In reply to comment #0)
> univention-directory-manager-modules/modules/univention/admin/syntax.py:540
> <ipRange>
> 'Last Address' ist vom Typ 'string'?
> Ist 'Last < First' erlaubt?
=> Bug #19057
Comment 8 Janek Walkenhorst univentionstaff 2010-07-21 10:38:25 CEST
univention-directory-manager-modules (6.0.12-1) unstable; urgency=low

  * fix iso8601-syntax (Bug #16262)
  * improve documentation
  * improve error messages
  * remove duplicate code
  * fix date-syntax

Changelog:
\item Fehler in den Syntax Prüfungen wurden korrigiert und die Fehlermeldungen
  verbessert (\ucsBug{16262}).
Comment 9 Andreas Büsching univentionstaff 2010-08-18 17:47:52 CEST
> univention-directory-manager-modules/modules/univention/admin/syntax.py:592
> <iso8601Date>
> Die RegEx (Datum als YYYY-MM-DD oder YYYY-Woche-Tag oder YYYY-DDD) passt nicht
> zum Beispiel (Datum+Zeit). Siehe http://www.w3.org/TR/NOTE-datetime

Was ist mit diesem Fall?
Comment 10 Janek Walkenhorst univentionstaff 2010-08-19 09:31:21 CEST
(In reply to comment #9)
> > univention-directory-manager-modules/modules/univention/admin/syntax.py:592
> > <iso8601Date>
> > Die RegEx (Datum als YYYY-MM-DD oder YYYY-Woche-Tag oder YYYY-DDD) passt nicht
> > zum Beispiel (Datum+Zeit). Siehe http://www.w3.org/TR/NOTE-datetime
> 
> Was ist mit diesem Fall?

Das wurde Dokumentiert:
hier:
class iso8601Date(simple):
	'''A date of the format:
	yyyy-ddd   (2009-213)
	yyyy-mm    (2009-05)
	yyyy-mm-dd (2009-05-13)
	yyyy-Www   (2009-W21)
	yyyy-Www-D (2009-W21-4)
	with the dashes being optional
	'''
sowie hier:
raise univention.admin.uexceptions.valueError,_("The given date does not conform to iso8601, example: \"2009-01-01\".")


und ein Fehler in dem RegEx korrigiert.
Comment 11 Andreas Büsching univentionstaff 2010-08-19 10:29:56 CEST
Gut, dann verified
Comment 12 Stefan Gohmann univentionstaff 2010-08-31 13:23:15 CEST
UCS 2.4 wurde veröffentlicht. Sollte der hier beschriebene Bug mit einer
neueren Version von UCS erneut auftreten, so sollte der Bug dupliziert werden:
"Clone This Bug".