Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

ValueError: day is out of range for month #478

Open
Elinvention opened this issue Dec 9, 2017 · 9 comments
Open

ValueError: day is out of range for month #478

Elinvention opened this issue Dec 9, 2017 · 9 comments

Comments

@Elinvention
Copy link

DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: ssl_cert
ERROR:sleekxmpp.basexmpp:day is out of range for month
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process
    if not self.__read_xml():
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml
    self.__spawn_event(xml)
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in __spawn_event
    handler.prerun(stanza_copy)
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
    self.run(payload, True)
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
    self._pointer(payload)
  File "/usr/lib/python3/dist-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 889, in start_tls
    cert.verify(self._expected_server_name, self._der_cert)
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/cert.py", line 133, in verify
    not_before, not_after = extract_dates(raw_cert)
  File "/usr/lib/python3/dist-packages/sleekxmpp/xmlstream/cert.py", line 111, in extract_dates
    not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
  File "/usr/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/usr/lib/python3.6/_strptime.py", line 528, in _strptime
    datetime_date(year, 1, 1).toordinal() + 1
ValueError: day is out of range for month
DEBUG:sleekxmpp.xmlstream.xmlstream:reconnecting...

I can't connect anymore... Version 1.3.3-1 from Debian.

@ThomasChiroux
Copy link

ThomasChiroux commented Feb 21, 2018

Had the same today on one server (in a pool of dozen of other servers, all using sleek 1.3.3, still dont know why this server is different).
The reason is the not_before year date from here:

not_before = validity.getComponentByName('notBefore')

was in two digit instead of 4, so strptime with %Y is not working.

Writed a work around in cert.py like this one:

try:
    not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
except ValueError:
    not_before = datetime.strptime(not_before, '%y%m%d%H%M%SZ')

same for not_after

@jowrjowr
Copy link

This is still an issue in 1.3.3

@OverloadUT
Copy link

Hi there @fritzy - I'm a contributor to https://github.com/homeassistant/homeassistant

I experience this issue, and it has also come up from many users of Home Assistant, which uses this library by way of https://github.com/wpietri/sucks

Any chance of a new release going out that fixes this issue? We could alternatively pin our dependency to 1.3.2, but I'd rather not do that if a release is forthcoming.

@tobiasBora
Copy link

Hello,
I confirm this bug with the jwchat.org webservers. Any news?

@nicandris
Copy link

I confirm it also on a pi

@Neustradamus
Copy link

It is now solved in the develop branche no?
The 1.3.2 was good and the 1.3.3 was broken.

@meyerdenney
Copy link

FWIW worth I'm still having this issue on Hassio. The sucks library (https://github.com/wpietri/sucks) relies on this dependency which throws a day out of range error, thus breaking everyone who uses the sucks library in Hassio (which runs on a docker container on a raspberry pi).

So even though this problem might seem fixed for those on desktop computers, it still exists for other environments.

@meyerdenney
Copy link

Hi there @fritzy - I'm a contributor to https://github.com/homeassistant/homeassistant

I experience this issue, and it has also come up from many users of Home Assistant, which uses this library by way of https://github.com/wpietri/sucks

Any chance of a new release going out that fixes this issue? We could alternatively pin our dependency to 1.3.2, but I'd rather not do that if a release is forthcoming.

@OverloadUT - doesn't hassio use slixmpp and sucks uses sleekxmpp. So wouldn't we have to revert sucks (https://github.com/wpietri/sucks) to use an older version of sleekxmpp and then re-pull sucks into into the hassio? Would that solve the issue? If so, I could always fork sucks if @wpietri doesn't want to revert sleekxmpp

@Neustradamus
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants