Bugfix: guard case when error msg is not returned

This commit is contained in:
Tino Lange
2019-07-03 23:46:50 +02:00
parent 9ee875bf56
commit 54145a7545
+6 -1
View File
@@ -248,7 +248,12 @@ def paloalto_prelogin(conf, s, gateway=None):
saml_req = x.find('.//saml-request') saml_req = x.find('.//saml-request')
if saml_req is None: if saml_req is None:
msg = x.find('.//msg') msg = x.find('.//msg')
msg = msg.text.strip() if msg is not None else 'Probably you need a certificate?' if msg is not None:
msg = msg.text
if msg is not None:
msg = msg.strip()
else:
msg = 'Probably you need a certificate?'
err('did not find saml request. {0}'.format(msg)) err('did not find saml request. {0}'.format(msg))
if len(saml_req.text.strip()) == 0: if len(saml_req.text.strip()) == 0:
err('empty saml request') err('empty saml request')