summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2022-12-20 20:12:28 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2022-12-20 20:12:28 +0000
commit701cf6f814280ee12e35ddf093e011b34d22b447 (patch)
tree7179d5b4598f1c97dfb97672f169c86aa5f91498
parent0e195717ff07f6eb93eb01970d63a4bfda78a95f (diff)
If we don't have usecommonopt for our application we shouldn't check the
default values for snmp protocol level stuff. Makes snmp mibtree work again which got broken since the defaults changed back in 2021. Reported by Matthias Pitzl (pitzl <at> genua <dot> de) Hint to use usecommonopt and OK gerhard@
-rw-r--r--usr.bin/snmp/snmpc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/snmp/snmpc.c b/usr.bin/snmp/snmpc.c
index 278da529577..a0941213b34 100644
--- a/usr.bin/snmp/snmpc.c
+++ b/usr.bin/snmp/snmpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpc.c,v 1.38 2021/10/21 08:17:34 martijn Exp $ */
+/* $OpenBSD: snmpc.c,v 1.39 2022/12/20 20:12:27 martijn Exp $ */
/*
* Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
@@ -468,7 +468,9 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- if (version == SNMP_V1 || version == SNMP_V2C) {
+ if (!snmp_app->usecommonopt) {
+ /* No SNMP protocol settings */
+ } else if (version == SNMP_V1 || version == SNMP_V2C) {
if (community == NULL || community[0] == '\0')
errx(1, "No community name specified.");
} else if (version == SNMP_V3) {