From: martijn Date: Tue, 20 Dec 2022 20:12:27 +0000 (+0000) Subject: If we don't have usecommonopt for our application we shouldn't check the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=697caf84b136438d5c64d5d1370cf4a9df0970c0;p=openbsd 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 genua de) Hint to use usecommonopt and OK gerhard@ --- 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 @@ -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) {