From d3c9e5d100082faa2283b2f8e8d347d38f6463b4 Mon Sep 17 00:00:00 2001 From: Gerhard Roth Date: Thu, 27 Jul 2017 14:04:17 +0000 Subject: Heed the non-repeaters of GetBulkRequests and make sure to set error-status and error-index to zero in the response PDU. ok sthen@ --- usr.sbin/snmpd/snmpe.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.sbin/snmpd/snmpe.c') diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index ec50621a6eb..34fe283baa5 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.47 2017/04/21 13:50:23 jca Exp $ */ +/* $OpenBSD: snmpe.c,v 1.48 2017/07/27 14:04:16 gerhard Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -439,7 +439,8 @@ snmpe_parsevarbinds(struct snmp_message *msg) case SNMP_C_GETBULKREQ: ret = mps_getbulkreq(msg, &msg->sm_c, &msg->sm_end, &o, - msg->sm_maxrepetitions); + (msg->sm_i <= msg->sm_nonrepeaters) + ? 1 : msg->sm_maxrepetitions); if (ret == 0 || ret == 1) break; msg->sm_error = SNMP_ERROR_NOSUCHNAME; @@ -467,6 +468,8 @@ snmpe_parsevarbinds(struct snmp_message *msg) } msg->sm_errstr = "none"; + msg->sm_error = 0; + msg->sm_errorindex = 0; return (ret); varfail: -- cgit v1.2.3