Describe the bug
If you set Time options to Day(s) and input a large number, it will cause a 500 error. The error will change based on how big the number is. 123123123123 will give an InvalidTimeZoneDisplacementValue error with the message
time zone displacement out of range: "-337097637-05-20 16:00"
LINE 18: acctstoptime >= timestamp '-33709763...
while 123123123123123 gives an OverflowError with the message timestamp out of range for platform time_t
To Reproduce
Steps to reproduce the behavior
- Go to
/radius/acctsearch
- Enter a username (doesnt have to be real) in the box beneath where it says
Username
- Change
Time options to Day(s)
- Put
123123123123 in the box beneath where it says Day(s)
- Click
Search
- See error
Expected behavior
If there is a logical limit to how big the number should be, then either the form shouldnt allow you to
click Search until you enter a valid number, or an error should be shown saying something along the lines of Days must be between X and Y after you click the button.
If there shouldnt be a limit on how big the number can be, then it should work the same as it does with a smaller number.
Tracebacks
Traceback (most recent call last):
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/source/python/nav/web/radius/views.py", line 246, in account_search
query.execute()
File "/source/python/nav/web/radius/db.py", line 512, in execute
super(AcctSearchQuery, self).execute()
File "/source/python/nav/web/radius/db.py", line 56, in execute
cursor.execute(self.query, self.parameters)
Exception Type: InvalidTimeZoneDisplacementValue at /radius/acctsearch
Exception Value: time zone displacement out of range: "-337097637-05-20 16:01"
LINE 18: acctstoptime >= timestamp '-33709763...
^
Traceback (most recent call last):
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/source/python/nav/web/radius/views.py", line 233, in account_search
query = AcctSearchQuery(
File "/source/python/nav/web/radius/db.py", line 405, in __init__
DATEFORMAT_SEARCH, time.localtime(time.time() - searchtime)
Exception Type: OverflowError at /radius/acctsearch
Exception Value: timestamp out of range for platform time_t
Describe the bug
If you set
Time optionstoDay(s)and input a large number, it will cause a 500 error. The error will change based on how big the number is.123123123123will give anInvalidTimeZoneDisplacementValueerror with the messagewhile
123123123123123gives anOverflowErrorwith the messagetimestamp out of range for platform time_tTo Reproduce
Steps to reproduce the behavior
/radius/acctsearchUsernameTime optionstoDay(s)123123123123in the box beneath where it saysDay(s)SearchExpected behavior
If there is a logical limit to how big the number should be, then either the form shouldnt allow you to
click
Searchuntil you enter a valid number, or an error should be shown saying something along the lines ofDays must be between X and Yafter you click the button.If there shouldnt be a limit on how big the number can be, then it should work the same as it does with a smaller number.
Tracebacks