Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: cannot convert <class 'NoneType'> to bytes #36

Open
kanstantsin-nikitsin1 opened this issue Oct 28, 2022 · 0 comments · May be fixed by #37
Open

TypeError: cannot convert <class 'NoneType'> to bytes #36

kanstantsin-nikitsin1 opened this issue Oct 28, 2022 · 0 comments · May be fixed by #37

Comments

@kanstantsin-nikitsin1
Copy link

kanstantsin-nikitsin1 commented Oct 28, 2022

OS: Arch Linux
pan-globalprotect-okta revision: da771a4

Output

[INFO] load conf
[INFO] prelogin request [vpn_url]
[INFO] okta saml request [okta_url]
Traceback (most recent call last):
  File "/opt/pan-globalprotect-okta/./gp-okta.py", line 1226, in <module>
    sys.exit(main())
  File "/opt/pan-globalprotect-okta/./gp-okta.py", line 1178, in main
    rsaml, redirect_url = okta_saml(conf, saml_xml)
  File "/opt/pan-globalprotect-okta/./gp-okta.py", line 475, in okta_saml
    redirect_url = get_redirect_url(conf, c, url)
  File "/opt/pan-globalprotect-okta/./gp-okta.py", line 377, in get_redirect_url
    from_uri = _refx(rx_from_uri)
  File "/opt/pan-globalprotect-okta/./gp-okta.py", line 155, in <lambda>
    _refx = lambda mx: to_b(mx.group(1)).decode('unicode_escape').strip()
  File "/opt/pan-globalprotect-okta/./gp-okta.py", line 91, in to_b
    raise _type_err(v, 'bytes')
TypeError: cannot convert <class 'NoneType'> to bytes

Config details:
I use totp.google

execute = 1
openconnect_cmd = sudo openconnect
openconnect_args =
ikey8k added a commit to ikey8k/pan-globalprotect-okta that referenced this issue Nov 3, 2022
The regex uses seoarate capture groups for alternative expressions that
match a single-quoted or a double-quoted string. This is more robust
with strings that may contain quotes.

However the code using the match objects doesn't currently take the two
capture groups into account and always expects the results in group 1,
which only matches double-quoted strings.

This change introduces a check so that if group 1 is None, the function
will use the matched substring in group 2.

Closes arthepsy#36
ikey8k added a commit to ikey8k/pan-globalprotect-okta that referenced this issue Nov 3, 2022
The regex uses separate capture groups for alternative expressions that
match a single-quoted or a double-quoted string. This is more robust
with strings that may contain quotes.

However the code using the match objects doesn't currently take the two
capture groups into account and always expects the results in group 1,
which only matches double-quoted strings.

This change introduces a check so that if group 1 is None, the function
will use the matched substring in group 2.

Closes arthepsy#36
@ikey8k ikey8k linked a pull request Nov 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant