makes snmp_passpersist ignore empty input lines#16
Open
insatomcat wants to merge 1 commit into
Open
Conversation
On debian stable (net-snmp 5.9.3), net-snmp makes snmp_passpersist crash on every "set" command. It appears net-snmp sends an empty line after receiving the "DONE" message. I solved this problem by making snmp_passpersist ignores all empty input lines. Signed-off-by: Florent CARLI <florent.carli@rte-france.com>
|
Hi! I've also found this bug when receiving SET commands with snmp 5.8+dfsg-2ubuntu2.9 in Ubuntu 20.04. I've tested this patch but unfortunately the pass persist script breaks when receiving subsequent commands. The patch below does the job, at least up to my testing: diff --git a/snmp_passpersist.py b/snmp_passpersist.py
index e40da7a..31680b7 100644
--- a/snmp_passpersist.py
+++ b/snmp_passpersist.py
@@ -248,7 +248,9 @@ class PassPersist(object):
raise EOFError()
line = line.strip()
- if 'PING' in line:
+ if line == '':
+ pass
+ elif 'PING' in line:
print("PONG")
elif 'getnext' in line:
oid = self.cut_oid(sys.stdin.readline().strip()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On debian stable (net-snmp 5.9.3), net-snmp makes snmp_passpersist crash on every "set" command.
It appears net-snmp sends an empty line after receiving the "DONE" message.
I solved this problem by making snmp_passpersist ignore all empty input lines.