Skip to content

Commit

Permalink
Update cleanDN.py
Browse files Browse the repository at this point in the history
Convert from bytes object to string object
  • Loading branch information
dougbenjamin authored Apr 17, 2024
1 parent df13534 commit dccbfa0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pandaharvester/harvestertest/cleanDN.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ def clean_user_id(id):
p = subprocess.Popen(com.split() + [certFile], stdout=subprocess.PIPE)
out, err = p.communicate()

# Convert bytes object to string object if needed
try:
out = out.decode("utf-8")
except (UnicodeDecodeError, AttributeError):
pass

out = re.sub("^subject=", "", out)
out = out.strip()
print(f'DN: "{out}"')
Expand Down

0 comments on commit dccbfa0

Please sign in to comment.