1*4882a593SmuzhiyunFrom 2a0fe384eec254643ca2176ccfcbbd036a5aad06 Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Luca Ceresoli <luca@lucaceresoli.net> 3*4882a593SmuzhiyunDate: Tue, 14 Jul 2020 10:30:10 +0200 4*4882a593SmuzhiyunSubject: [PATCH] Fix build when SNMPv3 is disabled 5*4882a593Smuzhiyun 6*4882a593Smuzhiyunagentpp has ifdefs to disable v3 code when SNMPv3 is disabled. However it 7*4882a593Smuzhiyunis missing one and it has a few ones in excess. Fix them. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunUpstream is aware, says "will fix in later version", but thinks to make v3 10*4882a593Smuzhiyunmandatory. See discussion at 11*4882a593Smuzhiyunhttps://forum.snmp.app/t/agent-compile-fails-if-snmp-has-disable-snmpv3/326 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunUpstream status: none, upstream is not welcoming contributions. 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunSigned-off-by: Luca Ceresoli <luca@lucaceresoli.net> 16*4882a593Smuzhiyun--- 17*4882a593Smuzhiyun include/agent_pp/notification_log_mib.h | 4 ++-- 18*4882a593Smuzhiyun include/agent_pp/notification_originator.h | 2 ++ 19*4882a593Smuzhiyun include/agent_pp/snmp_community_mib.h | 4 ++-- 20*4882a593Smuzhiyun src/notification_originator.cpp | 2 ++ 21*4882a593Smuzhiyun 4 files changed, 8 insertions(+), 4 deletions(-) 22*4882a593Smuzhiyun 23*4882a593Smuzhiyundiff --git a/include/agent_pp/notification_log_mib.h b/include/agent_pp/notification_log_mib.h 24*4882a593Smuzhiyunindex ddac05e515d9..8fd8cfec32ca 100644 25*4882a593Smuzhiyun--- a/include/agent_pp/notification_log_mib.h 26*4882a593Smuzhiyun+++ b/include/agent_pp/notification_log_mib.h 27*4882a593Smuzhiyun@@ -22,7 +22,7 @@ 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun //--AgentGen BEGIN=_BEGIN 30*4882a593Smuzhiyun #include <agent_pp/agent++.h> 31*4882a593Smuzhiyun-#ifdef _SNMPv3 32*4882a593Smuzhiyun+// #ifdef _SNMPv3 // This file deos not look SNMPv3-specific 33*4882a593Smuzhiyun #include <agent_pp/mib_complex_entry.h> 34*4882a593Smuzhiyun //--AgentGen END 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun@@ -688,6 +688,6 @@ protected: 37*4882a593Smuzhiyun */ 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun-#endif 41*4882a593Smuzhiyun+// #endif // _SNMPv3 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun 44*4882a593Smuzhiyundiff --git a/include/agent_pp/notification_originator.h b/include/agent_pp/notification_originator.h 45*4882a593Smuzhiyunindex 95e8b4e1836d..6f50cd52625b 100644 46*4882a593Smuzhiyun--- a/include/agent_pp/notification_originator.h 47*4882a593Smuzhiyun+++ b/include/agent_pp/notification_originator.h 48*4882a593Smuzhiyun@@ -307,7 +307,9 @@ class AGENTPP_DECL NotificationOriginator: public NotificationSender { 49*4882a593Smuzhiyun */ 50*4882a593Smuzhiyun virtual nlmLogEntry* get_nlm_log_entry(); 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun+#ifdef _SNMPv3 53*4882a593Smuzhiyun virtual v3MP* get_v3mp(); 54*4882a593Smuzhiyun+#endif 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun protected: 57*4882a593Smuzhiyun 58*4882a593Smuzhiyundiff --git a/include/agent_pp/snmp_community_mib.h b/include/agent_pp/snmp_community_mib.h 59*4882a593Smuzhiyunindex 7d5c4558f36d..d9eb2b4a87ec 100644 60*4882a593Smuzhiyun--- a/include/agent_pp/snmp_community_mib.h 61*4882a593Smuzhiyun+++ b/include/agent_pp/snmp_community_mib.h 62*4882a593Smuzhiyun@@ -49,7 +49,7 @@ namespace Agentpp { 63*4882a593Smuzhiyun #define oidSnmpTrapAddress "1.3.6.1.6.3.18.1.3.0" 64*4882a593Smuzhiyun #define oidSnmpTrapCommunity "1.3.6.1.6.3.18.1.4.0" 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun-#ifdef _SNMPv3 67*4882a593Smuzhiyun+// #ifdef _SNMPv3 // This file deos not look SNMPv3-specific 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun /** 70*4882a593Smuzhiyun * snmpCommunityName 71*4882a593Smuzhiyun@@ -346,7 +346,7 @@ class AGENTPP_DECL snmp_community_mib: public MibGroup 72*4882a593Smuzhiyun static void add_public(); 73*4882a593Smuzhiyun static void add_public(Mib* mib); 74*4882a593Smuzhiyun }; 75*4882a593Smuzhiyun-#endif 76*4882a593Smuzhiyun+// #endif // _SNMPv3 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun #ifdef AGENTPP_NAMESPACE 79*4882a593Smuzhiyun } 80*4882a593Smuzhiyundiff --git a/src/notification_originator.cpp b/src/notification_originator.cpp 81*4882a593Smuzhiyunindex d7d566869998..39ddbe08cdeb 100644 82*4882a593Smuzhiyun--- a/src/notification_originator.cpp 83*4882a593Smuzhiyun+++ b/src/notification_originator.cpp 84*4882a593Smuzhiyun@@ -237,6 +237,7 @@ nlmLogEntry* NotificationOriginator::get_nlm_log_entry() { 85*4882a593Smuzhiyun return nlmLogEntry::instance; 86*4882a593Smuzhiyun } 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun+#ifdef _SNMPv3 89*4882a593Smuzhiyun v3MP* NotificationOriginator::get_v3mp() { 90*4882a593Smuzhiyun if (mib) { 91*4882a593Smuzhiyun return mib->get_request_list()->get_v3mp(); 92*4882a593Smuzhiyun@@ -244,6 +245,7 @@ v3MP* NotificationOriginator::get_v3mp() { 93*4882a593Smuzhiyun return v3MP::I; 94*4882a593Smuzhiyun } 95*4882a593Smuzhiyun } 96*4882a593Smuzhiyun+#endif 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun bool NotificationOriginator::check_access(ListCursor<MibTableRow>& cur, 100*4882a593Smuzhiyun-- 101*4882a593Smuzhiyun2.27.0 102*4882a593Smuzhiyun 103