tacacs_plus
tacacs_plus copied to clipboard
removed utf8 encoding and exception message
This example doesn't work with django 3.2.5 and latest tacacs_plus 2.6.0
Looking like its calling six to handle python 2.7 and python 3 interop with byte encoding because of this encoding user pass and other arguments to utf-8 cause an exception within the six library.
web_1 | [2021-07-09 20:43:13 +0000] [11] [DEBUG] POST /login/ web_1 | auth function web_1 | 192.168.64.222 49 ciscotacacskey ascii iosadmin cisco web_1 | username <class 'str'> web_1 | password <class 'str'> web_1 | TACACS+ Authentication Error: 'bytes' object has no attribute 'encode' web_1 | Traceback (most recent call last): web_1 | File "/home/app/web/core/tacacs.py", line 44, in authenticate web_1 | auth = TACACSClient( web_1 | File "/usr/local/lib/python3.9/site-packages/tacacs_plus/client.py", line 200, in authenticate web_1 | packet = self.send( web_1 | File "/usr/local/lib/python3.9/site-packages/tacacs_plus/client.py", line 121, in send web_1 | self.sock.send(bytes(packet)) web_1 | File "/usr/local/lib/python3.9/site-packages/tacacs_plus/packet.py", line 104, in bytes web_1 | return self.header.packed + self.body web_1 | File "/usr/local/lib/python3.9/site-packages/tacacs_plus/packet.py", line 97, in body web_1 | return self.crypt web_1 | File "/usr/local/lib/python3.9/site-packages/tacacs_plus/packet.py", line 108, in crypt web_1 | return crypt(self.header, self.body_bytes, self.secret) web_1 | File "/usr/local/lib/python3.9/site-packages/tacacs_plus/packet.py", line 49, in crypt web_1 | six.b(secret) + web_1 | File "/usr/local/lib/python3.9/site-packages/six.py", line 644, in b web_1 | return s.encode("latin-1") web_1 | AttributeError: 'bytes' object has no attribute 'encode'
Thanks a lot for the contribution and sorry if this hasn't been addressed in years. I have some time in my hands, so I am working a little to make sure the package is in good state :)