Skip to content

Commit

Permalink
Fix silly errors in the 'security' module.
Browse files Browse the repository at this point in the history
* Check the correct variable for whether it's a Privacy type.
* Convert the inputs into bools first when performing security level lookup.
  • Loading branch information
jpeacock-zenoss committed Oct 31, 2024
1 parent 8e160e0 commit 8aea1fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pynetsnmp/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, name, auth=None, priv=None, engine=None, context=None):
if not isinstance(auth, (type(None), Authentication)):
raise ValueError("invalid authentication protocol")
self.auth = auth
if not isinstance(auth, (type(None), Privacy)):
if not isinstance(priv, (type(None), Privacy)):
raise ValueError("invalid privacy protocol")
self.priv = priv
self.engine = engine
Expand All @@ -54,7 +54,10 @@ def getArguments(self):
)
else:
priv = ()
seclevel = ("-l", _sec_level.get((auth, priv), "noAuthNoPriv"))
seclevel = (
"-l",
_sec_level.get((bool(auth), bool(priv)), "noAuthNoPriv"),
)

return (
("-v", self.version)
Expand Down

0 comments on commit 8aea1fc

Please sign in to comment.