The package rpms/net-snmp.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/net-snmp.git/commit/?id=81c40c1ab....
Change:
-%ifarch sparc64 s390 s390x
Thanks.
Full change:
============
commit 81c40c1ab48bc9fdcba5ada2f0491c22315b12dc
Author: Josef dk <jridky(a)redhat.com>
Date: Thu Sep 19 08:39:51 2019 +0200
Resolves: #1753506 - fix invalid free
diff --git a/net-snmp-5.8-v3-forward.patch b/net-snmp-5.8-v3-forward.patch
new file mode 100644
index 0000000..24ac379
--- /dev/null
+++ b/net-snmp-5.8-v3-forward.patch
@@ -0,0 +1,357 @@
+diff -urNp c/agent/snmp_agent.c d/agent/snmp_agent.c
+--- c/agent/snmp_agent.c 2019-09-18 08:44:53.833601845 +0200
++++ d/agent/snmp_agent.c 2019-09-18 08:46:38.176595597 +0200
+@@ -1604,6 +1604,13 @@ free_agent_snmp_session(netsnmp_agent_se
+
+ DEBUGMSGTL(("verbose:asp", "asp %p reqinfo %p freed\n",
+ asp, asp->reqinfo));
++
++ /* Clean up securityStateRef here to prevent a double free */
++ if (asp->orig_pdu && asp->orig_pdu->securityStateRef)
++ snmp_free_securityStateRef(asp->orig_pdu);
++ if (asp->pdu && asp->pdu->securityStateRef)
++ snmp_free_securityStateRef(asp->pdu);
++
+ if (asp->orig_pdu)
+ snmp_free_pdu(asp->orig_pdu);
+ if (asp->pdu)
+diff -urNp c/include/net-snmp/pdu_api.h d/include/net-snmp/pdu_api.h
+--- c/include/net-snmp/pdu_api.h 2019-09-18 08:44:53.822601740 +0200
++++ d/include/net-snmp/pdu_api.h 2019-09-18 08:47:03.620838212 +0200
+@@ -19,6 +19,8 @@ NETSNMP_IMPORT
+ netsnmp_pdu *snmp_fix_pdu( netsnmp_pdu *pdu, int idx);
+ NETSNMP_IMPORT
+ void snmp_free_pdu( netsnmp_pdu *pdu);
++NETSNMP_IMPORT
++void snmp_free_securityStateRef( netsnmp_pdu *pdu);
+
+ #ifdef __cplusplus
+ }
+diff -urNp c/snmplib/snmp_api.c d/snmplib/snmp_api.c
+--- c/snmplib/snmp_api.c 2019-09-18 08:44:53.807601597 +0200
++++ d/snmplib/snmp_api.c 2019-09-18 08:53:19.937435576 +0200
+@@ -4012,7 +4012,12 @@ snmpv3_parse(netsnmp_pdu *pdu,
+ static void
+ free_securityStateRef(netsnmp_pdu* pdu)
+ {
+- struct snmp_secmod_def *sptr = find_sec_mod(pdu->securityModel);
++ struct snmp_secmod_def *sptr;
++
++ if(!pdu->securityStateRef)
++ return;
++
++ sptr = find_sec_mod(pdu->securityModel);
+ if (sptr) {
+ if (sptr->pdu_free_state_ref) {
+ (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
+@@ -4029,6 +4034,17 @@ free_securityStateRef(netsnmp_pdu* pdu)
+ pdu->securityStateRef = NULL;
+ }
+
++/*
++ * This function is here to provide a separate call to
++ * free the securityStateRef memory. This is needed to prevent
++ * a double free if this memory is freed in snmp_free_pdu.
++ */
++void
++snmp_free_securityStateRef(netsnmp_pdu* pdu)
++{
++ free_securityStateRef(pdu);
++}
++
+ #define ERROR_STAT_LENGTH 11
+
+ int
+diff -urNp c/snmplib/snmpusm.c d/snmplib/snmpusm.c
+--- c/snmplib/snmpusm.c 2019-09-18 08:44:53.802601550 +0200
++++ d/snmplib/snmpusm.c 2019-09-18 08:57:35.696872662 +0200
+@@ -299,16 +299,20 @@ usm_free_usmStateReference(void *old)
+
+ if (old_ref) {
+
+- SNMP_FREE(old_ref->usr_name);
+- SNMP_FREE(old_ref->usr_engine_id);
+- SNMP_FREE(old_ref->usr_auth_protocol);
+- SNMP_FREE(old_ref->usr_priv_protocol);
++ if (old_ref->usr_name_length)
++ SNMP_FREE(old_ref->usr_name);
++ if (old_ref->usr_engine_id_length)
++ SNMP_FREE(old_ref->usr_engine_id);
++ if (old_ref->usr_auth_protocol_length)
++ SNMP_FREE(old_ref->usr_auth_protocol);
++ if (old_ref->usr_priv_protocol_length)
++ SNMP_FREE(old_ref->usr_priv_protocol);
+
+- if (old_ref->usr_auth_key) {
++ if (old_ref->usr_auth_key_length && old_ref->usr_auth_key) {
+ SNMP_ZERO(old_ref->usr_auth_key, old_ref->usr_auth_key_length);
+ SNMP_FREE(old_ref->usr_auth_key);
+ }
+- if (old_ref->usr_priv_key) {
++ if (old_ref->usr_priv_key_length && old_ref->usr_priv_key) {
+ SNMP_ZERO(old_ref->usr_priv_key, old_ref->usr_priv_key_length);
+ SNMP_FREE(old_ref->usr_priv_key);
+ }
+@@ -1039,7 +1043,6 @@ usm_generate_out_msg(int msgProcModel,
+ if ((user = usm_get_user(secEngineID, secEngineIDLen, secName))
+ == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
+ DEBUGMSGTL(("usm", "Unknown User(%s)\n", secName));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_UNKNOWNSECURITYNAME;
+ }
+
+@@ -1091,7 +1094,6 @@ usm_generate_out_msg(int msgProcModel,
+ thePrivProtocolLength) == 1) {
+ DEBUGMSGTL(("usm", "Unsupported Security Level (%d)\n",
+ theSecLevel));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
+ }
+
+@@ -1121,7 +1123,6 @@ usm_generate_out_msg(int msgProcModel,
+ &msgAuthParmLen, &msgPrivParmLen, &otstlen,
+ &seq_len, &msgSecParmLen) == -1) {
+ DEBUGMSGTL(("usm", "Failed calculating offsets.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_GENERICERROR;
+ }
+
+@@ -1143,7 +1144,6 @@ usm_generate_out_msg(int msgProcModel,
+ ptr = *wholeMsg = globalData;
+ if (theTotalLength > *wholeMsgLen) {
+ DEBUGMSGTL(("usm", "Message won't fit in buffer.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_GENERICERROR;
+ }
+
+@@ -1169,7 +1169,6 @@ usm_generate_out_msg(int msgProcModel,
+ htonl(boots_uint), htonl(time_uint),
+ &ptr[privParamsOffset]) == -1) {
+ DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_GENERICERROR;
+ }
+ }
+@@ -1185,7 +1184,6 @@ usm_generate_out_msg(int msgProcModel,
+ &ptr[privParamsOffset])
+ == -1)) {
+ DEBUGMSGTL(("usm", "Can't set DES-CBC
salt.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_GENERICERROR;
+ }
+ }
+@@ -1198,7 +1196,6 @@ usm_generate_out_msg(int msgProcModel,
+ &ptr[dataOffset], &encrypted_length)
+ != SNMP_ERR_NOERROR) {
+ DEBUGMSGTL(("usm", "encryption error.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_ENCRYPTIONERROR;
+ }
+ #ifdef NETSNMP_ENABLE_TESTING_CODE
+@@ -1226,7 +1223,6 @@ usm_generate_out_msg(int msgProcModel,
+ if ((encrypted_length != (theTotalLength - dataOffset))
+ || (salt_length != msgPrivParmLen)) {
+ DEBUGMSGTL(("usm", "encryption length error.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_ENCRYPTIONERROR;
+ }
+
+@@ -1362,7 +1358,6 @@ usm_generate_out_msg(int msgProcModel,
+
+ if (temp_sig == NULL) {
+ DEBUGMSGTL(("usm", "Out of memory.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_GENERICERROR;
+ }
+
+@@ -1376,7 +1371,6 @@ usm_generate_out_msg(int msgProcModel,
+ SNMP_ZERO(temp_sig, temp_sig_len);
+ SNMP_FREE(temp_sig);
+ DEBUGMSGTL(("usm", "Signing failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_AUTHENTICATIONFAILURE;
+ }
+
+@@ -1384,7 +1378,6 @@ usm_generate_out_msg(int msgProcModel,
+ SNMP_ZERO(temp_sig, temp_sig_len);
+ SNMP_FREE(temp_sig);
+ DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_AUTHENTICATIONFAILURE;
+ }
+
+@@ -1398,7 +1391,6 @@ usm_generate_out_msg(int msgProcModel,
+ /*
+ * endif -- create keyed hash
+ */
+- usm_free_usmStateReference(secStateRef);
+
+ DEBUGMSGTL(("usm", "USM processing completed.\n"));
+
+@@ -1548,7 +1540,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ if ((user = usm_get_user(secEngineID, secEngineIDLen, secName))
+ == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
+ DEBUGMSGTL(("usm", "Unknown User\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_UNKNOWNSECURITYNAME;
+ }
+
+@@ -1601,7 +1592,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ DEBUGMSGTL(("usm", "Unsupported Security Level or type
(%d)\n",
+ theSecLevel));
+
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
+ }
+
+@@ -1636,7 +1626,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ DEBUGMSGTL(("usm",
+ "couldn't malloc %d bytes for encrypted PDU\n",
+ (int)ciphertextlen));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_MALLOC;
+ }
+
+@@ -1652,7 +1641,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ htonl(boots_uint), htonl(time_uint),
+ iv) == -1) {
+ DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
+- usm_free_usmStateReference(secStateRef);
+ SNMP_FREE(ciphertext);
+ return SNMPERR_USM_GENERICERROR;
+ }
+@@ -1667,7 +1655,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ thePrivKeyLength - 8,
+ iv) == -1)) {
+ DEBUGMSGTL(("usm", "Can't set DES-CBC
salt.\n"));
+- usm_free_usmStateReference(secStateRef);
+ SNMP_FREE(ciphertext);
+ return SNMPERR_USM_GENERICERROR;
+ }
+@@ -1686,7 +1673,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ scopedPdu, scopedPduLen,
+ ciphertext, &ciphertextlen) != SNMP_ERR_NOERROR) {
+ DEBUGMSGTL(("usm", "encryption error.\n"));
+- usm_free_usmStateReference(secStateRef);
+ SNMP_FREE(ciphertext);
+ return SNMPERR_USM_ENCRYPTIONERROR;
+ }
+@@ -1703,7 +1689,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ ciphertext, ciphertextlen);
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "Encryption failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ SNMP_FREE(ciphertext);
+ return SNMPERR_USM_ENCRYPTIONERROR;
+ }
+@@ -1743,7 +1728,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ DEBUGINDENTLESS();
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "building privParams failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1766,7 +1750,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ DEBUGINDENTLESS();
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "building authParams failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1789,7 +1772,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ DEBUGINDENTLESS();
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "building authParams failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1805,7 +1787,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ if (rc == 0) {
+ DEBUGMSGTL(("usm",
+ "building msgAuthoritativeEngineTime failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1821,7 +1802,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ if (rc == 0) {
+ DEBUGMSGTL(("usm",
+ "building msgAuthoritativeEngineBoots failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1833,7 +1813,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ DEBUGINDENTLESS();
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "building msgAuthoritativeEngineID
failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1846,7 +1825,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ *offset - sp_offset);
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "building usm security parameters
failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1860,7 +1838,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "building msgSecurityParameters
failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1870,7 +1847,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ while ((*wholeMsgLen - *offset) < globalDataLen) {
+ if (!asn_realloc(wholeMsg, wholeMsgLen)) {
+ DEBUGMSGTL(("usm", "building global data failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+ }
+@@ -1886,7 +1862,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ ASN_CONSTRUCTOR), *offset);
+ if (rc == 0) {
+ DEBUGMSGTL(("usm", "building master packet sequence
failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_TOO_LONG;
+ }
+
+@@ -1904,7 +1879,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+
+ if (temp_sig == NULL) {
+ DEBUGMSGTL(("usm", "Out of memory.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_GENERICERROR;
+ }
+
+@@ -1915,14 +1889,12 @@ usm_rgenerate_out_msg(int msgProcModel,
+ != SNMP_ERR_NOERROR) {
+ SNMP_FREE(temp_sig);
+ DEBUGMSGTL(("usm", "Signing failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_AUTHENTICATIONFAILURE;
+ }
+
+ if (temp_sig_len != msgAuthParmLen) {
+ SNMP_FREE(temp_sig);
+ DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
+- usm_free_usmStateReference(secStateRef);
+ return SNMPERR_USM_AUTHENTICATIONFAILURE;
+ }
+
+@@ -1933,7 +1905,6 @@ usm_rgenerate_out_msg(int msgProcModel,
+ /*
+ * endif -- create keyed hash
+ */
+- usm_free_usmStateReference(secStateRef);
+ DEBUGMSGTL(("usm", "USM processing completed.\n"));
+ return SNMPERR_SUCCESS;
+ } /* end usm_rgenerate_out_msg() */
diff --git a/net-snmp.spec b/net-snmp.spec
index 17bb1c9..28ad55f 100644
--- a/net-snmp.spec
+++ b/net-snmp.spec
@@ -10,7 +10,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.8
-Release: 12%{?dist}
+Release: 13%{?dist}
Epoch: 1
License: BSD
@@ -45,6 +45,7 @@ Patch15: net-snmp-5.8-ipv6-clientaddr.patch
Patch16: net-snmp-5.8-licensing.patch
Patch17: net-snmp-5.8-agent-of-death.patch
Patch18: net-snmp-5.8-trapsink.patch
+Patch19: net-snmp-5.8-v3-forward.patch
# Modern RPM API means at least EL6
Patch101: net-snmp-5.8-modern-rpm-api.patch
@@ -217,14 +218,12 @@ cp %{SOURCE10} .
%patch16 -p1
%patch17 -p1 -b .agent-of-death
%patch18 -p1 -b .trapsink
-
+%patch19 -p1 -b .v3-forward
%patch101 -p1 -b .modern-rpm-api
%patch102 -p1
-%ifarch sparc64 s390 s390x
# disable failing test - see
https://bugzilla.redhat.com/show_bug.cgi?id=680697
rm testing/fulltests/default/T200*
-%endif
%build
@@ -487,6 +486,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
%{_libdir}/libnetsnmptrapd*.so.%{soname}*
%changelog
+* Thu Sep 19 2019 Josef Ridky <jridky(a)redhat.com> - 1:5.8-13
+- Fix snmpv3 trap forwarding (#1753506)
+
* Mon Aug 19 2019 Miro Hronok <mhroncok(a)redhat.com> - 1:5.8-12
- Rebuilt for Python 3.8
commit 7dc11217eceb4e603bb622d09ff97a12fb00129b
Merge: f5c7c11 e2746cb
Author: Josef dk <jridky(a)redhat.com>
Date: Wed Sep 18 08:39:46 2019 +0200
Merge branch 'master' of
ssh://pkgs.fedoraproject.org/rpms/net-snmp
commit f5c7c112d1e74fd38cde81b9df98ef4aa509d52b
Author: Josef dk <jridky(a)redhat.com>
Date: Thu Jul 25 08:08:06 2019 +0200
Update autofs skip patch based on upstream code
diff --git a/net-snmp-5.8-autofs-skip.patch b/net-snmp-5.8-autofs-skip.patch
index e6de4f3..a9927d2 100644
--- a/net-snmp-5.8-autofs-skip.patch
+++ b/net-snmp-5.8-autofs-skip.patch
@@ -1,6 +1,31 @@
-diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c
---- b/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:12:20.674499629 +0200
-+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:15:46.782859398
+0200
+From cf41e6e910158fb4c4cb546c49acd587c5f58232 Mon Sep 17 00:00:00 2001
+From: Josef Ridky <jridky(a)redhat.com>
+Date: Wed, 24 Jul 2019 07:23:47 -0700
+Subject: [PATCH] HOST-MIB: Skip autofs entries
+
+Do not call statfs() for autofs entries.
+
+See also
https://sourceforge.net/p/net-snmp/patches/1350/.
+See also
https://sourceforge.net/p/net-snmp/bugs/2968/.
+
+[ bvanassche: Made several small edits ]
+---
+ agent/mibgroup/hardware/fsys/fsys_mntctl.c | 8 ++++++--
+ agent/mibgroup/hardware/fsys/fsys_mntent.c | 11 +++++++++++
+ agent/mibgroup/hardware/fsys/mnttypes.h | 3 +++
+ agent/mibgroup/host/hr_filesys.c | 21 +++++++++++++++++++++
+ agent/mibgroup/host/hr_filesys.h | 1 +
+ agent/mibgroup/host/hr_storage.c | 5 ++++-
+ agent/mibgroup/host/hrh_filesys.c | 6 ++++++
+ agent/mibgroup/host/hrh_filesys.h | 1 +
+ agent/mibgroup/host/hrh_storage.c | 5 ++++-
+ include/net-snmp/agent/hardware/fsys.h | 1 +
+ 10 files changed, 58 insertions(+), 4 deletions(-)
+
+diff --git a/agent/mibgroup/hardware/fsys/fsys_mntctl.c
b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
+index e7d9a1c5a..782c8edd2 100644
+--- a/agent/mibgroup/hardware/fsys/fsys_mntctl.c
++++ b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
@@ -43,8 +43,9 @@ _fsys_type( int type)
case MNT_NFS:
@@ -12,24 +37,27 @@ diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
net-snmp-5.8/agent/mibgr
/*
* The following code covers selected filesystems
-@@ -156,10 +157,12 @@ netsnmp_fsys_arch_load( void )
+@@ -155,12 +156,15 @@ netsnmp_fsys_arch_load( void )
+ */
/*
- * Optionally skip retrieving statistics for remote mounts
-+ * AUTOFS is skipped by default
+- * Optionally skip retrieving statistics for remote mounts
++ * Skip retrieving statistics for AUTOFS and optionally for remote
++ * mounts.
*/
-- if ( (entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
-+ if ( ((entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
+ if ( (entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
-- NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
-+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) ||
-+ entry->type == (NETSNMP_FS_TYPE_AUTOFS))
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
continue;
++ if (entry->type == NETSNMP_FS_TYPE_AUTOFS)
++ continue;
if ( statfs( entry->path, &stat_buf ) < 0 ) {
-diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntent.c
net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c
---- b/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:12:20.674499629 +0200
-+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:15:46.782859398
+0200
+ snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s",
entry->path );
+diff --git a/agent/mibgroup/hardware/fsys/fsys_mntent.c
b/agent/mibgroup/hardware/fsys/fsys_mntent.c
+index 3cdcea1fb..79e6e4f72 100644
+--- a/agent/mibgroup/hardware/fsys/fsys_mntent.c
++++ b/agent/mibgroup/hardware/fsys/fsys_mntent.c
@@ -150,6 +150,13 @@ _fsys_type( char *typename )
!strcmp(typename, MNTTYPE_LOFS))
return NETSNMP_FS_TYPE_OTHER;
@@ -37,7 +65,7 @@ diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntent.c
net-snmp-5.8/agent/mibgr
+ /* Detection of AUTOFS.
+ * This file system will be ignored by default
+ */
-+ else if ( !strcmp(typename, MNTTYPE_AUTOFS))
++ else if (!strcmp(typename, MNTTYPE_AUTOFS))
+ return NETSNMP_FS_TYPE_AUTOFS;
+
+
@@ -48,16 +76,17 @@ diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntent.c
net-snmp-5.8/agent/mibgr
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
continue;
-+ /* Skip AUTOFS enteries */
-+ if ( entry->type == (NETSNMP_FS_TYPE_AUTOFS))
++ /* Skip AUTOFS entries */
++ if (entry->type == NETSNMP_FS_TYPE_AUTOFS)
+ continue;
+
#ifdef irix6
if ( NSFS_STATFS( entry->path, &stat_buf, sizeof(struct statfs), 0) <
0 )
#else
-diff -urNp b/agent/mibgroup/hardware/fsys/mnttypes.h
net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h
---- b/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:12:20.674499629 +0200
-+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:15:46.782859398
+0200
+diff --git a/agent/mibgroup/hardware/fsys/mnttypes.h
b/agent/mibgroup/hardware/fsys/mnttypes.h
+index bb1b40173..53f1cc896 100644
+--- a/agent/mibgroup/hardware/fsys/mnttypes.h
++++ b/agent/mibgroup/hardware/fsys/mnttypes.h
@@ -165,6 +165,9 @@
#ifndef MNTTYPE_APP
#define MNTTYPE_APP "app"
@@ -68,9 +97,10 @@ diff -urNp b/agent/mibgroup/hardware/fsys/mnttypes.h
net-snmp-5.8/agent/mibgroup
#ifndef MNTTYPE_DEVPTS
#define MNTTYPE_DEVPTS "devpts"
#endif
-diff -urNp b/agent/mibgroup/host/hr_filesys.c
net-snmp-5.8/agent/mibgroup/host/hr_filesys.c
---- b/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:12:20.668499652 +0200
-+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:15:46.783859399 +0200
+diff --git a/agent/mibgroup/host/hr_filesys.c b/agent/mibgroup/host/hr_filesys.c
+index 56c8b2095..8caeecf4e 100644
+--- a/agent/mibgroup/host/hr_filesys.c
++++ b/agent/mibgroup/host/hr_filesys.c
@@ -834,6 +834,27 @@ Check_HR_FileSys_NFS (void)
return 0; /* no NFS file system */
}
@@ -80,14 +110,14 @@ diff -urNp b/agent/mibgroup/host/hr_filesys.c
net-snmp-5.8/agent/mibgroup/host/h
+ * return 1 if AutoFs, 0 otherwise
+ */
+int
-+Check_HR_FileSys_AutoFs (void)
++Check_HR_FileSys_AutoFs(void)
+{
+#if HAVE_GETFSSTAT
-+ if ( HRFS_entry->HRFS_type != NULL &&
++ if (HRFS_entry->HRFS_type != NULL &&
+#if defined(MNTTYPE_AUTOFS)
-+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_AUTOFS)
++ !strcmp(HRFS_entry->HRFS_type, MNTTYPE_AUTOFS)
+#else
-+ !strcmp( HRFS_entry->HRFS_type, "autofs")
++ !strcmp(HRFS_entry->HRFS_type, "autofs")
+#endif
+ )
+#endif /* HAVE_GETFSSTAT */
@@ -99,9 +129,10 @@ diff -urNp b/agent/mibgroup/host/hr_filesys.c
net-snmp-5.8/agent/mibgroup/host/h
void
End_HR_FileSys(void)
{
-diff -urNp b/agent/mibgroup/host/hr_filesys.h
net-snmp-5.8/agent/mibgroup/host/hr_filesys.h
---- b/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:12:20.669499648 +0200
-+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:15:46.784859400 +0200
+diff --git a/agent/mibgroup/host/hr_filesys.h b/agent/mibgroup/host/hr_filesys.h
+index 2f00355f3..36cd7dd08 100644
+--- a/agent/mibgroup/host/hr_filesys.h
++++ b/agent/mibgroup/host/hr_filesys.h
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
extern FindVarMethod var_hrfilesys;
extern int Get_Next_HR_FileSys(void);
@@ -110,9 +141,33 @@ diff -urNp b/agent/mibgroup/host/hr_filesys.h
net-snmp-5.8/agent/mibgroup/host/h
extern int Get_FSIndex(char *);
extern long Get_FSSize(char *); /* Temporary */
-diff -urNp b/agent/mibgroup/host/hrh_filesys.c
net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c
---- b/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:12:20.668499652 +0200
-+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:15:46.785859402 +0200
+diff --git a/agent/mibgroup/host/hr_storage.c b/agent/mibgroup/host/hr_storage.c
+index a86898451..6b459ec51 100644
+--- a/agent/mibgroup/host/hr_storage.c
++++ b/agent/mibgroup/host/hr_storage.c
+@@ -544,6 +544,8 @@ var_hrstore(struct variable *vp,
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)
&&
+ Check_HR_FileSys_NFS())
+ return NULL; /* or goto try_next; */
++ if (Check_HR_FileSys_AutoFs())
++ return NULL;
+ if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) {
+ snmp_log_perror(HRFS_entry->HRFS_mount);
+ goto try_next;
+@@ -683,7 +685,8 @@ Get_Next_HR_Store(void)
+ if (HRS_index >= 0) {
+ if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
+- Check_HR_FileSys_NFS())) {
++ Check_HR_FileSys_NFS()) &&
++ !Check_HR_FileSys_AutoFs()) {
+ return HRS_index + NETSNMP_MEM_TYPE_MAX;
+ }
+ } else {
+diff --git a/agent/mibgroup/host/hrh_filesys.c b/agent/mibgroup/host/hrh_filesys.c
+index 5ad82b20f..5d2102e24 100644
+--- a/agent/mibgroup/host/hrh_filesys.c
++++ b/agent/mibgroup/host/hrh_filesys.c
@@ -429,3 +429,9 @@ Check_HR_FileSys_NFS (void)
{
return (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) ? 1 : 0;
@@ -121,11 +176,12 @@ diff -urNp b/agent/mibgroup/host/hrh_filesys.c
net-snmp-5.8/agent/mibgroup/host/
+int
+Check_HR_FileSys_AutoFs (void)
+{
-+ return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0;
++ return HRFS_entry->type == NETSNMP_FS_TYPE_AUTOFS;
+}
-diff -urNp b/agent/mibgroup/host/hrh_filesys.h
net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h
---- b/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:12:20.669499648 +0200
-+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:15:46.785859402 +0200
+diff --git a/agent/mibgroup/host/hrh_filesys.h b/agent/mibgroup/host/hrh_filesys.h
+index 568917e09..c0f5d6e8c 100644
+--- a/agent/mibgroup/host/hrh_filesys.h
++++ b/agent/mibgroup/host/hrh_filesys.h
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
extern FindVarMethod var_hrhfilesys;
extern int Get_Next_HR_FileSys(void);
@@ -134,23 +190,20 @@ diff -urNp b/agent/mibgroup/host/hrh_filesys.h
net-snmp-5.8/agent/mibgroup/host/
extern int Get_FSIndex(char *);
extern long Get_FSSize(char *); /* Temporary */
-diff -urNp b/agent/mibgroup/host/hrh_storage.c
net-snmp-5.8/agent/mibgroup/host/hrh_storage.c
---- b/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:12:20.668499652 +0200
-+++ net-snmp-5.8/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:15:46.786859402 +0200
-@@ -367,9 +367,10 @@ really_try_next:
- store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
- if (HRFS_entry &&
- store_idx > NETSNMP_MEM_TYPE_MAX &&
-- netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
-+ ((netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+diff --git a/agent/mibgroup/host/hrh_storage.c b/agent/mibgroup/host/hrh_storage.c
+index 810766946..6f8ff6c53 100644
+--- a/agent/mibgroup/host/hrh_storage.c
++++ b/agent/mibgroup/host/hrh_storage.c
+@@ -371,6 +371,8 @@ var_hrstore(struct variable *vp,
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
-- Check_HR_FileSys_NFS())
-+ Check_HR_FileSys_NFS()) ||
-+ Check_HR_FileSys_AutoFs()))
+ Check_HR_FileSys_NFS())
return NULL;
++ if (Check_HR_FileSys_AutoFs())
++ return NULL;
if (store_idx <= NETSNMP_MEM_TYPE_MAX ) {
mem = (netsnmp_memory_info*)ptr;
-@@ -508,7 +509,8 @@ Get_Next_HR_Store(void)
+ }
+@@ -508,7 +510,8 @@ Get_Next_HR_Store(void)
if (HRS_index >= 0) {
if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
@@ -160,40 +213,16 @@ diff -urNp b/agent/mibgroup/host/hrh_storage.c
net-snmp-5.8/agent/mibgroup/host/
return HRS_index + NETSNMP_MEM_TYPE_MAX;
}
} else {
-diff -urNp b/agent/mibgroup/host/hr_storage.c
net-snmp-5.8/agent/mibgroup/host/hr_storage.c
---- b/agent/mibgroup/host/hr_storage.c 2018-07-18 16:12:20.670499644 +0200
-+++ net-snmp-5.8/agent/mibgroup/host/hr_storage.c 2018-07-18 16:15:46.786859402 +0200
-@@ -540,9 +540,10 @@ really_try_next:
-
- store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
- if (store_idx > NETSNMP_MEM_TYPE_MAX ) {
-- if ( netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
-+ if ( (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
- NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)
&&
-- Check_HR_FileSys_NFS())
-+ Check_HR_FileSys_NFS()) ||
-+ Check_HR_FileSys_AutoFs())
- return NULL; /* or goto try_next; */
- if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) {
- snmp_log_perror(HRFS_entry->HRFS_mount);
-@@ -683,7 +684,8 @@ Get_Next_HR_Store(void)
- if (HRS_index >= 0) {
- if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
- NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
-- Check_HR_FileSys_NFS())) {
-+ Check_HR_FileSys_NFS()) &&
-+ !Check_HR_FileSys_AutoFs()) {
- return HRS_index + NETSNMP_MEM_TYPE_MAX;
- }
- } else {
-diff -urNp b/include/net-snmp/agent/hardware/fsys.h
net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h
---- b/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:12:20.649499726 +0200
-+++ net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:19:33.994918912
+0200
-@@ -41,6 +41,7 @@ typedef struct netsnmp_fsys_info_s netsn
+diff --git a/include/net-snmp/agent/hardware/fsys.h
b/include/net-snmp/agent/hardware/fsys.h
+index 3f2b28440..54ab9d806 100644
+--- a/include/net-snmp/agent/hardware/fsys.h
++++ b/include/net-snmp/agent/hardware/fsys.h
+@@ -41,6 +41,7 @@ typedef struct netsnmp_fsys_info_s netsnmp_fsys_info;
#define NETSNMP_FS_TYPE_SYSFS (4 | _NETSNMP_FS_TYPE_LOCAL |
_NETSNMP_FS_TYPE_SKIP_BIT)
#define NETSNMP_FS_TYPE_TMPFS (5 | _NETSNMP_FS_TYPE_LOCAL)
#define NETSNMP_FS_TYPE_USBFS (6 | _NETSNMP_FS_TYPE_LOCAL)
-+#define NETSNMP_FS_TYPE_AUTOFS (7 | _NETSNMP_FS_TYPE_LOCAL |
_NETSNMP_FS_TYPE_SKIP_BIT)
++#define NETSNMP_FS_TYPE_AUTOFS (7 | _NETSNMP_FS_TYPE_LOCAL |
_NETSNMP_FS_TYPE_SKIP_BIT)
#define NETSNMP_FS_FLAG_ACTIVE 0x01
#define NETSNMP_FS_FLAG_REMOTE 0x02
+