diff --git a/avoid-triggering-undefined-shift-left.patch b/avoid-triggering-undefined-shift-left.patch deleted file mode 100644 index 260a239d3b316330f9cb715caf33b1ac40aa795f..0000000000000000000000000000000000000000 --- a/avoid-triggering-undefined-shift-left.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 79857f794c1d2b17d058b949fc8b30632d8c4e40 Mon Sep 17 00:00:00 2001 -From: Bart Van Assche -Date: Sat, 27 Apr 2019 21:12:55 -0700 -Subject: [PATCH] libsnmp, ASN parsing: Avoid triggering undefined shift-left - behavior - -A quote from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7199: - -So this is a fun corner case of asn.1 integer parsing: the C standard says -that shifting a negative number left has undefined behavior. The other -obvious way to do this is to use the same code on an unsigned long, and -then cast to long. The result of a cast to a signed value is -implementation-defined. Linus Torvalds' argument on this is that there -is no sensible way for the implementation to define it other than "copy -the 2's complement bits". - -Avoid triggering all these corner cases by using byte-copying instead of -using shift operations. - -Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7199 ---- - snmplib/asn1.c | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -diff --git a/snmplib/asn1.c b/snmplib/asn1.c -index 333870c95..fb672c5d5 100644 ---- a/snmplib/asn1.c -+++ b/snmplib/asn1.c -@@ -579,7 +579,11 @@ asn_parse_int(u_char * data, - static const char *errpre = "parse int"; - register u_char *bufp = data; - u_long asn_length; -- register long value = 0; -+ int i; -+ union { -+ long l; -+ unsigned char b[sizeof(long)]; -+ } value; - - if (NULL == data || NULL == datalength || NULL == type || NULL == intp) { - ERROR_MSG("parse int: NULL pointer"); -@@ -615,19 +619,23 @@ asn_parse_int(u_char * data, - } - - *datalength -= (int) asn_length + (bufp - data); -- if (*bufp & 0x80) -- value = -1; /* integer is negative */ - - DEBUGDUMPSETUP("recv", data, bufp - data + asn_length); - -- while (asn_length--) -- value = (value << 8) | *bufp++; -+ memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b)); -+#ifdef WORDS_BIGENDIAN -+ for (i = sizeof(long) - asn_length; asn_length--; i++) -+ value.b[i] = *bufp++; -+#else -+ for (i = asn_length - 1; asn_length--; i--) -+ value.b[i] = *bufp++; -+#endif - -- CHECK_OVERFLOW_S(value,1); -+ CHECK_OVERFLOW_S(value.l, 1); - -- DEBUGMSG(("dumpv_recv", " Integer:\t%ld (0x%.2lX)\n", value, value)); -+ DEBUGMSG(("dumpv_recv", " Integer:\t%ld (0x%.2lX)\n", value.l, value.l)); - -- *intp = value; -+ *intp = value.l; - return bufp; - } - diff --git a/net-snmp-5.7.2-autoreconf.patch b/net-snmp-5.7.2-autoreconf.patch deleted file mode 100644 index a5618e8b11c77117d1184c041f8ed0295e9d7a4d..0000000000000000000000000000000000000000 --- a/net-snmp-5.7.2-autoreconf.patch +++ /dev/null @@ -1,10 +0,0 @@ -926223 - net-snmp: Does not support aarch64 in f19 and rawhide - -Update autoconf version to make the test suite happy. - -diff -up net-snmp-5.7.2/dist/autoconf-version.autoreconf net-snmp-5.7.2/dist/autoconf-version ---- net-snmp-5.7.2/dist/autoconf-version.autoreconf 2013-03-25 13:00:15.002745347 +0100 -+++ net-snmp-5.7.2/dist/autoconf-version 2013-03-25 13:00:17.207736442 +0100 -@@ -1 +1 @@ --2.68 -+2.69 diff --git a/net-snmp-5.7.3-iterator-fix.patch b/net-snmp-5.7.3-iterator-fix.patch index 1505ca9a2f4b2a238d421a7494a9348162e2ebbf..fb34caff7b82248d75c5962e25ea509b6f0b8fc1 100644 --- a/net-snmp-5.7.3-iterator-fix.patch +++ b/net-snmp-5.7.3-iterator-fix.patch @@ -1,14 +1,14 @@ diff -urNp old/agent/mibgroup/host/data_access/swrun.c new/agent/mibgroup/host/data_access/swrun.c ---- old/agent/mibgroup/host/data_access/swrun.c 2018-03-26 09:00:39.932335587 +0200 -+++ new/agent/mibgroup/host/data_access/swrun.c 2018-03-26 09:03:00.845876681 +0200 -@@ -102,7 +102,9 @@ swrun_count_processes_by_name( char *nam +--- old/agent/mibgroup/host/data_access/swrun.c 2017-07-18 09:44:00.626109526 +0200 ++++ new/agent/mibgroup/host/data_access/swrun.c 2017-07-19 15:27:50.452255836 +0200 +@@ -102,6 +102,10 @@ swrun_count_processes_by_name( char *nam return 0; /* or -1 */ it = CONTAINER_ITERATOR( swrun_container ); -- while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) { -+ for (entry = (netsnmp_swrun_entry*)ITERATOR_FIRST( it ); -+ entry; -+ entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) { ++ if((entry = (netsnmp_swrun_entry*)ITERATOR_FIRST( it )) != NULL) { ++ if (0 == strcmp( entry->hrSWRunName, name )) ++ i++; ++ } + while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) { if (0 == strcmp( entry->hrSWRunName, name )) i++; - } diff --git a/net-snmp-5.8-agentx-disconnect-crash.patch b/net-snmp-5.8-agentx-disconnect-crash.patch deleted file mode 100644 index da8431355b8013ac2cee33663dfc25d3d0d0130c..0000000000000000000000000000000000000000 --- a/net-snmp-5.8-agentx-disconnect-crash.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urNp a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c ---- a/agent/mibgroup/agentx/master.c 2018-07-18 12:13:49.953014652 +0200 -+++ b/agent/mibgroup/agentx/master.c 2018-07-18 12:20:23.537626773 +0200 -@@ -221,7 +221,7 @@ agentx_got_response(int operation, - /* response is too late, free the cache */ - if (magic) - netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic); -- return 0; -+ return 1; - } - requests = cache->requests; - diff --git a/net-snmp-5.8-autofs-skip.patch b/net-snmp-5.8-autofs-skip.patch deleted file mode 100644 index e6de4f313533c05af8542c86e37d15a4eebc0e6a..0000000000000000000000000000000000000000 --- a/net-snmp-5.8-autofs-skip.patch +++ /dev/null @@ -1,199 +0,0 @@ -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 -@@ -43,8 +43,9 @@ _fsys_type( int type) - - case MNT_NFS: - case MNT_NFS3: -- case MNT_AUTOFS: - return NETSNMP_FS_TYPE_NFS; -+ case MNT_AUTOFS: -+ return NETSNMP_FS_TYPE_AUTOFS; - - /* - * The following code covers selected filesystems -@@ -156,10 +157,12 @@ netsnmp_fsys_arch_load( void ) - - /* - * Optionally skip retrieving statistics for remote mounts -+ * AUTOFS is skipped by default - */ -- 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)) - 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 -@@ -150,6 +150,13 @@ _fsys_type( char *typename ) - !strcmp(typename, MNTTYPE_LOFS)) - return NETSNMP_FS_TYPE_OTHER; - -+ /* Detection of AUTOFS. -+ * This file system will be ignored by default -+ */ -+ else if ( !strcmp(typename, MNTTYPE_AUTOFS)) -+ return NETSNMP_FS_TYPE_AUTOFS; -+ -+ - /* - * All other types are silently skipped - */ -@@ -239,6 +246,10 @@ netsnmp_fsys_arch_load( void ) - NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) - continue; - -+ /* Skip AUTOFS enteries */ -+ 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 -@@ -165,6 +165,9 @@ - #ifndef MNTTYPE_APP - #define MNTTYPE_APP "app" - #endif -+#ifndef MNTTYPE_AUTOFS -+#define MNTTYPE_AUTOFS "autofs" -+#endif - #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 -@@ -834,6 +834,27 @@ Check_HR_FileSys_NFS (void) - return 0; /* no NFS file system */ - } - -+/* This function checks whether current file system is an AutoFs -+ * HRFS_entry must be valid prior to calling this function -+ * return 1 if AutoFs, 0 otherwise -+ */ -+int -+Check_HR_FileSys_AutoFs (void) -+{ -+#if HAVE_GETFSSTAT -+ if ( HRFS_entry->HRFS_type != NULL && -+#if defined(MNTTYPE_AUTOFS) -+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_AUTOFS) -+#else -+ !strcmp( HRFS_entry->HRFS_type, "autofs") -+#endif -+ ) -+#endif /* HAVE_GETFSSTAT */ -+ return 1; /* AUTOFS */ -+ -+ return 0; /* no AUTOFS */ -+} -+ - 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 -@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void); - extern FindVarMethod var_hrfilesys; - extern int Get_Next_HR_FileSys(void); - extern int Check_HR_FileSys_NFS(void); -+extern int Check_HR_FileSys_AutoFs(void); - - 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 -@@ -429,3 +429,9 @@ Check_HR_FileSys_NFS (void) - { - return (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) ? 1 : 0; - } -+ -+int -+Check_HR_FileSys_AutoFs (void) -+{ -+ return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0; -+} -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 -@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void); - extern FindVarMethod var_hrhfilesys; - extern int Get_Next_HR_FileSys(void); - extern int Check_HR_FileSys_NFS(void); -+extern int Check_HR_FileSys_AutoFs(void); - - 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, - NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) && -- Check_HR_FileSys_NFS()) -+ Check_HR_FileSys_NFS()) || -+ 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) - 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/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 - #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_FLAG_ACTIVE 0x01 - #define NETSNMP_FS_FLAG_REMOTE 0x02 diff --git a/net-snmp-5.8-cflags.patch b/net-snmp-5.8-cflags.patch deleted file mode 100644 index 180972607c5e512d6531e2fb6c2b8cba6c12552d..0000000000000000000000000000000000000000 --- a/net-snmp-5.8-cflags.patch +++ /dev/null @@ -1,112 +0,0 @@ -diff -urNp a/net-snmp-config.in b/net-snmp-config.in ---- a/net-snmp-config.in 2018-07-18 13:43:12.264426052 +0200 -+++ b/net-snmp-config.in 2018-07-18 13:52:06.917089518 +0200 -@@ -140,10 +140,10 @@ else - ;; - #################################################### compile - --base-cflags) -- echo @CFLAGS@ @CPPFLAGS@ -I${NSC_INCLUDEDIR} -+ echo -I${NSC_INCLUDEDIR} - ;; - --cflags|--cf*) -- echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR} -+ echo @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR} - ;; - --srcdir) - echo $NSC_SRCDIR -diff -urNp a/perl/agent/default_store/Makefile.PL b/perl/agent/default_store/Makefile.PL ---- a/perl/agent/default_store/Makefile.PL 2018-07-18 13:43:12.170426290 +0200 -+++ b/perl/agent/default_store/Makefile.PL 2018-07-18 13:51:31.812176486 +0200 -@@ -83,7 +83,7 @@ sub AgentDefaultStoreInitMakeParams { - " " . $Params{'LIBS'}; - $Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'}; - } -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; -diff -urNp a/perl/agent/Makefile.PL b/perl/agent/Makefile.PL ---- a/perl/agent/Makefile.PL 2018-07-18 13:43:12.169426292 +0200 -+++ b/perl/agent/Makefile.PL 2018-07-18 13:52:53.884973275 +0200 -@@ -98,7 +98,7 @@ sub AgentInitMakeParams { - $Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'}; - # $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'}; - } -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; -diff -urNp a/perl/agent/Support/Makefile.PL b/perl/agent/Support/Makefile.PL ---- a/perl/agent/Support/Makefile.PL 2018-07-18 13:43:12.169426292 +0200 -+++ b/perl/agent/Support/Makefile.PL 2018-07-18 13:53:11.414929921 +0200 -@@ -90,7 +90,7 @@ sub SupportInitMakeParams { - " " . $Params{'LIBS'}; - $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'}; - } -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; -diff -urNp a/perl/ASN/Makefile.PL b/perl/ASN/Makefile.PL ---- a/perl/ASN/Makefile.PL 2018-07-18 13:43:12.171426287 +0200 -+++ b/perl/ASN/Makefile.PL 2018-07-18 13:53:46.652842822 +0200 -@@ -93,7 +93,7 @@ sub AsnInitMakeParams { - " " . $Params{'LIBS'}; - $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'}; - } -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; -diff -urNp a/perl/default_store/Makefile.PL b/perl/default_store/Makefile.PL ---- a/perl/default_store/Makefile.PL 2018-07-18 13:43:12.175426277 +0200 -+++ b/perl/default_store/Makefile.PL 2018-07-18 13:54:20.814758441 +0200 -@@ -83,7 +83,7 @@ sub DefaultStoreInitMakeParams { - " " . $Params{'LIBS'}; - $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'}; - } -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; -diff -urNp a/perl/OID/Makefile.PL b/perl/OID/Makefile.PL ---- a/perl/OID/Makefile.PL 2018-07-18 13:43:12.175426277 +0200 -+++ b/perl/OID/Makefile.PL 2018-07-18 13:54:43.348702811 +0200 -@@ -90,7 +90,7 @@ sub OidInitMakeParams { - # } else { - # $Params{'PREREQ_PM'} = {'SNMP' => '5.0'}; - } -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; -diff -urNp a/perl/SNMP/Makefile.PL b/perl/SNMP/Makefile.PL ---- a/perl/SNMP/Makefile.PL 2018-07-18 13:43:12.173426282 +0200 -+++ b/perl/SNMP/Makefile.PL 2018-07-18 13:55:07.220643903 +0200 -@@ -103,7 +103,7 @@ sub SnmpInitMakeParams { - # } else { - # $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 }; - } -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if (!$ENV{'NETSNMP_PREFIX'}) { - $prefix = `$opts->{'nsconfig'} --prefix`; -diff -urNp a/perl/TrapReceiver/Makefile.PL b/perl/TrapReceiver/Makefile.PL ---- a/perl/TrapReceiver/Makefile.PL 2018-07-18 13:43:12.172426285 +0200 -+++ b/perl/TrapReceiver/Makefile.PL 2018-07-18 13:55:43.100647233 +0200 -@@ -132,7 +132,7 @@ sub TrapReceiverInitMakeParams { - $Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . " $Params{'LIBS'}"; - } - -- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings -+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings - $Params{'CCFLAGS'} .= ' -Wformat'; - if ($Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; diff --git a/net-snmp-5.8-dir-fix.patch b/net-snmp-5.8-dir-fix.patch deleted file mode 100644 index 2c47d524a779db91a2c84ed6a4b7ef49319271a2..0000000000000000000000000000000000000000 --- a/net-snmp-5.8-dir-fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urNp a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in ---- a/net-snmp-create-v3-user.in 2018-07-18 11:11:53.227015237 +0200 -+++ b/net-snmp-create-v3-user.in 2018-07-18 11:12:13.375010176 +0200 -@@ -137,7 +137,7 @@ fi - echo $line >> $outfile - prefix="@prefix@" - datarootdir="@datarootdir@" --outfile="@datadir@/snmp/snmpd.conf" -+outfile="/etc/snmp/snmpd.conf" - line="$token $user" - echo "adding the following line to $outfile:" - echo " " $line diff --git a/net-snmp-5.8-duplicate-ipAddress.patch b/net-snmp-5.8-duplicate-ipAddress.patch new file mode 100644 index 0000000000000000000000000000000000000000..075976a4ede9258736283dec02ab5da7309860ab --- /dev/null +++ b/net-snmp-5.8-duplicate-ipAddress.patch @@ -0,0 +1,11 @@ +diff -urNp a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c +--- a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2020-06-10 13:27:03.213904398 +0200 ++++ b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2020-06-10 13:28:41.025863050 +0200 +@@ -121,6 +121,7 @@ _remove_duplicates(netsnmp_container *co + for (entry = ITERATOR_FIRST(it); entry; entry = ITERATOR_NEXT(it)) { + if (prev_entry && _access_ipaddress_entry_compare_addr(prev_entry, entry) == 0) { + /* 'entry' is duplicate of the previous one -> delete it */ ++ NETSNMP_LOGONCE((LOG_ERR, "Duplicate IPv4 address detected, some interfaces may not be visible in IP-MIB\n")); + netsnmp_access_ipaddress_entry_free(entry); + } else { + CONTAINER_INSERT(ret, entry); diff --git a/net-snmp-5.8-expand-SNMPCONFPATH.patch b/net-snmp-5.8-expand-SNMPCONFPATH.patch new file mode 100644 index 0000000000000000000000000000000000000000..a812cf4d304418e418dcb32146846cf65e2d6e49 --- /dev/null +++ b/net-snmp-5.8-expand-SNMPCONFPATH.patch @@ -0,0 +1,12 @@ +diff -ruNp a/snmplib/read_config.c b/snmplib/read_config.c +--- a/snmplib/read_config.c 2020-06-10 09:51:57.184786510 +0200 ++++ b/snmplib/read_config.c 2020-06-10 09:53:13.257507112 +0200 +@@ -1642,7 +1642,7 @@ snmp_save_persistent(const char *type) + * save a warning header to the top of the new file + */ + snprintf(fileold, sizeof(fileold), +- "%s%s# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s", ++ "%s%s# Please save normal configuration tokens for %s in /etc/snmp/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s", + "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n", + "#\n# **** DO NOT EDIT THIS FILE ****\n#\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n############################################################################\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n", + type, type, type, diff --git a/net-snmp-5.8-ipAddress-faster-load.patch b/net-snmp-5.8-ipAddress-faster-load.patch new file mode 100644 index 0000000000000000000000000000000000000000..db95998f0b342e5d68559613c87680d936556fe4 --- /dev/null +++ b/net-snmp-5.8-ipAddress-faster-load.patch @@ -0,0 +1,82 @@ +diff -urNp a/agent/mibgroup/mibII/ipAddr.c b/agent/mibgroup/mibII/ipAddr.c +--- a/agent/mibgroup/mibII/ipAddr.c 2020-06-10 14:14:30.113696471 +0200 ++++ b/agent/mibgroup/mibII/ipAddr.c 2020-06-10 14:27:15.345354018 +0200 +@@ -495,14 +495,16 @@ Address_Scan_Next(Index, Retin_ifaddr) + } + + #elif defined(linux) ++#include + static struct ifreq *ifr; + static int ifr_counter; + + static void + Address_Scan_Init(void) + { +- int num_interfaces = 0; ++ int i; + int fd; ++ int lastlen = 0; + + /* get info about all interfaces */ + +@@ -510,28 +512,45 @@ Address_Scan_Init(void) + SNMP_FREE(ifc.ifc_buf); + ifr_counter = 0; + +- do +- { + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + { + DEBUGMSGTL(("snmpd", "socket open failure in Address_Scan_Init\n")); + return; + } +- num_interfaces += 16; + +- ifc.ifc_len = sizeof(struct ifreq) * num_interfaces; +- ifc.ifc_buf = (char*) realloc(ifc.ifc_buf, ifc.ifc_len); +- +- if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) +- { +- ifr=NULL; +- close(fd); +- return; +- } +- close(fd); ++ /* ++ * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF ++ * on some platforms; see W. R. Stevens, ``Unix Network Programming ++ * Volume I'', p.435... ++ */ ++ ++ for (i = 8;; i *= 2) { ++ ifc.ifc_len = sizeof(struct ifreq) * i; ++ ifc.ifc_req = calloc(i, sizeof(struct ifreq)); ++ ++ if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) { ++ if (errno != EINVAL || lastlen != 0) { ++ /* ++ * Something has gone genuinely wrong... ++ */ ++ snmp_log(LOG_ERR, "bad rc from ioctl, errno %d", errno); ++ SNMP_FREE(ifc.ifc_buf); ++ close(fd); ++ return; ++ } ++ } else { ++ if (ifc.ifc_len == lastlen) { ++ /* ++ * The length is the same as the last time; we're done... ++ */ ++ break; ++ } ++ lastlen = ifc.ifc_len; ++ } ++ free(ifc.ifc_buf); /* no SNMP_FREE, getting ready to reassign */ + } +- while (ifc.ifc_len >= (sizeof(struct ifreq) * num_interfaces)); +- ++ ++ close(fd); + ifr = ifc.ifc_req; + } + diff --git a/net-snmp-5.8-man-page.patch b/net-snmp-5.8-man-page.patch new file mode 100644 index 0000000000000000000000000000000000000000..dc78e14b6e00ab643dd137346697de4f11d35e4b --- /dev/null +++ b/net-snmp-5.8-man-page.patch @@ -0,0 +1,36 @@ +diff -urNp a/man/net-snmp-create-v3-user.1.def b/man/net-snmp-create-v3-user.1.def +--- a/man/net-snmp-create-v3-user.1.def 2020-06-10 13:43:18.443070961 +0200 ++++ b/man/net-snmp-create-v3-user.1.def 2020-06-10 13:49:25.975363441 +0200 +@@ -3,7 +3,7 @@ + net-snmp-create-v3-user \- create a SNMPv3 user in net-snmp configuration file + .SH SYNOPSIS + .PP +-.B net-snmp-create-v3-user [-ro] [-a authpass] [-x privpass] [-X DES|AES] ++.B net-snmp-create-v3-user [-ro] [-A authpass] [-a MD5|SHA] [-X privpass] [-x DES|AES] + .B [username] + .SH DESCRIPTION + .PP +@@ -16,13 +16,16 @@ new user in net-snmp configuration file + displays the net-snmp version number + .TP + \fB\-ro\fR +-create an user with read-only permissions ++creates a user with read-only permissions + .TP +-\fB\-a authpass\fR +-specify authentication password ++\fB\-A authpass\fR ++specifies the authentication password + .TP +-\fB\-x privpass\fR +-specify encryption password ++\fB\-a MD5|SHA\fR ++specifies the authentication password hashing algorithm + .TP +-\fB\-X DES|AES\fR +-specify encryption algorithm ++\fB\-X privpass\fR ++specifies the encryption password ++.TP ++\fB\-x DES|AES\fR ++specifies the encryption algorithm diff --git a/net-snmp-5.8-python3.patch b/net-snmp-5.8-python3.patch deleted file mode 100644 index 8edab40dc512cf1e0446625be9950957fd739480..0000000000000000000000000000000000000000 --- a/net-snmp-5.8-python3.patch +++ /dev/null @@ -1,720 +0,0 @@ -diff -urNp a/configure b/configure ---- a/configure 2018-07-18 17:11:53.178147565 +0200 -+++ b/configure 2018-07-18 17:14:01.254774416 +0200 -@@ -7742,8 +7742,8 @@ $as_echo "no" >&6; } - fi - - --# Extract the first word of "python", so it can be a program name with args. --set dummy python; ac_word=$2 -+# Extract the first word of "python3", so it can be a program name with args. -+set dummy python3; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } - if ${ac_cv_path_PYTHONPROG+:} false; then : -diff -urNp a/configure.d/config_os_progs b/configure.d/config_os_progs ---- a/configure.d/config_os_progs 2018-07-18 17:11:53.197147510 +0200 -+++ b/configure.d/config_os_progs 2018-07-18 17:14:29.963690646 +0200 -@@ -57,7 +57,7 @@ AC_PATH_PROG(AUTOCONF, autoconf, [: - AC_PATH_PROG(AUTOHEADER, autoheader, [:]) - AC_PATH_PROG([PERLPROG], perl) - AC_PATH_PROG([PSPROG], ps) --AC_PATH_PROG([PYTHONPROG],python) -+AC_PATH_PROG([PYTHONPROG],python3) - - AC_PATH_PROG([UNAMEPROG], uname) - AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG", [Where is the uname command]) -diff -urNp a/Makefile.in b/Makefile.in ---- a/Makefile.in 2018-07-18 17:11:53.175147574 +0200 -+++ b/Makefile.in 2018-07-18 17:16:21.331365317 +0200 -@@ -226,7 +226,7 @@ perlcleanfeatures: - - # python specific build rules - # --PYMAKE=$(PYTHON) setup.py $(PYTHONARGS) -+PYMAKE=/usr/bin/python3 setup.py $(PYTHONARGS) - pythonmodules: subdirs - @(dir=`pwd`; cd python; $(PYMAKE) build --basedir=$$dir) ; \ - if test $$? != 0 ; then \ -diff -urNp a/python/netsnmp/client_intf.c b/python/netsnmp/client_intf.c ---- a/python/netsnmp/client_intf.c 2018-07-18 17:11:53.262147321 +0200 -+++ b/python/netsnmp/client_intf.c 2018-07-18 17:33:16.495712833 +0200 -@@ -1,11 +1,5 @@ - #include - --#if PY_VERSION_HEX < 0x02050000 --typedef int Py_ssize_t; --#define PY_SSIZE_T_MAX INT_MAX --#define PY_SSIZE_T_MIN INT_MIN --#endif -- - #include - #include - #include -@@ -852,8 +846,40 @@ py_netsnmp_attr_string(PyObject *obj, ch - if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) { - PyObject *attr = PyObject_GetAttrString(obj, attr_name); - if (attr) { -+ *val = PyUnicode_AsUTF8AndSize(attr, len); -+ Py_DECREF(attr); -+ return 0; -+ } -+ } -+ -+ return -1; -+} -+ -+static int -+py_netsnmp_attr_set_bytes(PyObject *obj, char *attr_name, -+ char *val, size_t len) -+{ -+ int ret = -1; -+ if (obj && attr_name) { -+ PyObject* val_obj = (val ? -+ PyBytes_FromStringAndSize(val, len) : -+ Py_BuildValue("")); -+ ret = PyObject_SetAttrString(obj, attr_name, val_obj); -+ Py_DECREF(val_obj); -+ } -+ return ret; -+} -+ -+static int -+py_netsnmp_attr_bytes(PyObject *obj, char * attr_name, char **val, -+ Py_ssize_t *len) -+{ -+ *val = NULL; -+ if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) { -+ PyObject *attr = PyObject_GetAttrString(obj, attr_name); -+ if (attr) { - int retval; -- retval = PyString_AsStringAndSize(attr, val, len); -+ retval = PyBytes_AsStringAndSize(attr, val, len); - Py_DECREF(attr); - return retval; - } -@@ -870,7 +896,7 @@ py_netsnmp_attr_long(PyObject *obj, char - if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) { - PyObject *attr = PyObject_GetAttrString(obj, attr_name); - if (attr) { -- val = PyInt_AsLong(attr); -+ val = PyLong_AsLong(attr); - Py_DECREF(attr); - } - } -@@ -955,13 +981,13 @@ __py_netsnmp_update_session_errors(PyObj - - py_netsnmp_attr_set_string(session, "ErrorStr", err_str, STRLEN(err_str)); - -- tmp_for_conversion = PyInt_FromLong(err_num); -+ tmp_for_conversion = PyLong_FromLong(err_num); - if (!tmp_for_conversion) - return; /* nothing better to do? */ - PyObject_SetAttrString(session, "ErrorNum", tmp_for_conversion); - Py_DECREF(tmp_for_conversion); - -- tmp_for_conversion = PyInt_FromLong(err_ind); -+ tmp_for_conversion = PyLong_FromLong(err_ind); - if (!tmp_for_conversion) - return; /* nothing better to do? */ - PyObject_SetAttrString(session, "ErrorInd", tmp_for_conversion); -@@ -1323,7 +1349,7 @@ netsnmp_get(PyObject *self, PyObject *ar - - ss = (SnmpSession *)py_netsnmp_attr_void_ptr(session, "sess_ptr"); - -- if (py_netsnmp_attr_string(session, "ErrorStr", &tmpstr, &tmplen) < 0) { -+ if (py_netsnmp_attr_bytes(session, "ErrorStr", &tmpstr, &tmplen) < 0) { - goto done; - } - -@@ -2015,7 +2041,7 @@ netsnmp_walk(PyObject *self, PyObject *a - vars, tp, type, sprintval_flag); - str_buf[len] = '\0'; - -- py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf, -+ py_netsnmp_attr_set_bytes(varbind, "val", (char *) str_buf, - len); - - /* push the varbind onto the return varbinds */ -@@ -2266,7 +2292,7 @@ netsnmp_getbulk(PyObject *self, PyObject - - __get_type_str(type, type_str); - -- py_netsnmp_attr_set_string(varbind, "type", type_str, -+ py_netsnmp_attr_set_bytes(varbind, "type", type_str, - strlen(type_str)); - - len = __snprint_value((char **)&str_buf, &str_buf_len, -@@ -2409,7 +2435,7 @@ netsnmp_set(PyObject *self, PyObject *ar - } - } - -- if (py_netsnmp_attr_string(varbind, "val", &val, &tmplen) < 0) { -+ if (py_netsnmp_attr_bytes(varbind, "val", &val, &tmplen) < 0) { - snmp_free_pdu(pdu); - goto done; - } -@@ -2467,7 +2493,6 @@ netsnmp_set(PyObject *self, PyObject *ar - return (ret ? ret : Py_BuildValue("")); - } - -- - static PyMethodDef ClientMethods[] = { - {"session", netsnmp_create_session, METH_VARARGS, - "create a netsnmp session."}, -@@ -2490,10 +2515,23 @@ static PyMethodDef ClientMethods[] = { - {NULL, NULL, 0, NULL} /* Sentinel */ - }; - -+static struct PyModuleDef ModuleDefinition = { -+ PyModuleDef_HEAD_INIT, -+ "client_intf", -+ NULL, -+ -1, -+ ClientMethods, -+ NULL, -+ NULL, -+ NULL, -+ NULL -+}; -+ - PyMODINIT_FUNC --initclient_intf(void) -+PyInit_client_intf(void) - { -- (void) Py_InitModule("client_intf", ClientMethods); -+ PyObject *module = PyModule_Create(&ModuleDefinition); -+ return module; - } - - -diff -urNp a/python/netsnmp/client.py b/python/netsnmp/client.py ---- a/python/netsnmp/client.py 2018-07-18 17:11:53.262147321 +0200 -+++ b/python/netsnmp/client.py 2018-07-18 17:37:10.489221397 +0200 -@@ -34,12 +34,12 @@ def _parse_session_args(kargs): - 'TheirHostname':'', - 'TrustCert':'' - } -- keys = kargs.keys() -+ keys = list(kargs.keys()) - for key in keys: -- if sessArgs.has_key(key): -+ if key in sessArgs: - sessArgs[key] = kargs[key] - else: -- print >>stderr, "ERROR: unknown key", key -+ print("ERROR: unknown key", key, file=stderr) - return sessArgs - - def STR(obj): -@@ -55,7 +55,7 @@ class Varbind(object): - def __init__(self, tag=None, iid=None, val=None, type_arg=None): - self.tag = STR(tag) - self.iid = STR(iid) -- self.val = STR(val) -+ self.val = val - self.type = STR(type_arg) - # parse iid out of tag if needed - if iid is None and tag is not None: -@@ -65,7 +65,10 @@ class Varbind(object): - (self.tag, self.iid) = match.group(1, 2) - - def __setattr__(self, name, val): -- self.__dict__[name] = STR(val) -+ if name == 'val': -+ self.__dict__[name] = val -+ else: -+ self.__dict__[name] = STR(val) - - def __str__(self): - return obj_to_str(self) -@@ -132,7 +135,7 @@ class Session(object): - - sess_args = _parse_session_args(args) - -- for k, v in sess_args.items(): -+ for k, v in list(sess_args.items()): - self.__dict__[k] = v - - -diff -urNp a/python/netsnmp/__init__.py b/python/netsnmp/__init__.py ---- a/python/netsnmp/__init__.py 2018-07-18 17:11:53.262147321 +0200 -+++ b/python/netsnmp/__init__.py 2018-07-18 17:37:32.553172525 +0200 -@@ -1 +1 @@ --from client import * -+from .client import * -diff -urNp a/python/netsnmp/tests/test.py b/python/netsnmp/tests/test.py ---- a/python/netsnmp/tests/test.py 2018-07-18 17:11:53.263147318 +0200 -+++ b/python/netsnmp/tests/test.py 2018-07-18 17:38:21.272063355 +0200 -@@ -12,7 +12,7 @@ def snmp_dest(**kwargs): - 'DestHost': 'localhost:' + os.environ.get("SNMP_SNMPD_PORT", 161), - 'Community': 'public', - } -- for key, value in kwargs.iteritems(): -+ for key, value in kwargs.items(): - dest[key] = value - return dest - -@@ -62,107 +62,107 @@ class BasicTests(unittest.TestCase): - self.assertEqual(var.iid, '') - - def test_v1_get(self): -- print "\n" -- print "---v1 GET tests -------------------------------------\n" -+ print("\n") -+ print("---v1 GET tests -------------------------------------\n") - var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0') - res = netsnmp.snmpget(var, **snmp_dest()) - -- print "v1 snmpget result: ", res, "\n" -+ print("v1 snmpget result: ", res, "\n") - self.assertEqual(len(res), 1) - -- print "v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print("v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - self.assertEqual(var.tag, 'sysDescr') - self.assertEqual(var.iid, '0') - self.assertEqual(var.val, res[0]) - self.assertEqual(var.type, 'OCTETSTR') - - def test_v1_getnext(self): -- print "\n" -- print "---v1 GETNEXT tests-------------------------------------\n" -+ print("\n") -+ print("---v1 GETNEXT tests-------------------------------------\n") - var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0') - res = netsnmp.snmpgetnext(var, **snmp_dest()) - -- print "v1 snmpgetnext result: ", res, "\n" -+ print("v1 snmpgetnext result: ", res, "\n") - self.assertEqual(len(res), 1) - -- print "v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print("v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - self.assertTrue(var.tag is not None) - self.assertTrue(var.iid is not None) - self.assertTrue(var.val is not None) - self.assertTrue(var.type is not None) - - def test_v1_set(self): -- print "\n" -- print "---v1 SET tests-------------------------------------\n" -+ print("\n") -+ print("---v1 SET tests-------------------------------------\n") - var = netsnmp.Varbind('sysLocation', '0', 'my new location') - res = netsnmp.snmpset(var, **snmp_dest()) - -- print "v1 snmpset result: ", res, "\n" -+ print("v1 snmpset result: ", res, "\n") - self.assertEqual(res, 1) - -- print "v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print("v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - self.assertEqual(var.tag, 'sysLocation') - self.assertEqual(var.iid, '0') - self.assertEqual(var.val, 'my new location') - self.assertTrue(var.type is None) - - def test_v1_walk(self): -- print "\n" -- print "---v1 walk tests-------------------------------------\n" -+ print("\n") -+ print("---v1 walk tests-------------------------------------\n") - varlist = netsnmp.VarList(netsnmp.Varbind('system')) - -- print "v1 varlist walk in: " -+ print("v1 varlist walk in: ") - for var in varlist: -- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - - res = netsnmp.snmpwalk(varlist, **snmp_dest()) -- print "v1 snmpwalk result: ", res, "\n" -+ print("v1 snmpwalk result: ", res, "\n") - self.assertTrue(len(res) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') - - def test_v1_walk_2(self): -- print "\n" -- print "---v1 walk 2-------------------------------------\n" -+ print("\n") -+ print("---v1 walk 2-------------------------------------\n") - -- print "v1 varbind walk in: " -+ print("v1 varbind walk in: ") - var = netsnmp.Varbind('system') - self.assertEqual(var.tag, 'system') - self.assertEqual(var.iid, '') - self.assertEqual(var.val, None) - self.assertEqual(var.type, None) - res = netsnmp.snmpwalk(var, **snmp_dest()) -- print "v1 snmpwalk result (should be = orig): ", res, "\n" -+ print("v1 snmpwalk result (should be = orig): ", res, "\n") - self.assertTrue(len(res) > 0) - -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') - self.assertEqual(var.tag, 'system') - self.assertEqual(var.iid, '') - self.assertEqual(var.val, None) - self.assertEqual(var.type, None) - - def test_v1_mv_get(self): -- print "\n" -- print "---v1 multi-varbind test-------------------------------------\n" -+ print("\n") -+ print("---v1 multi-varbind test-------------------------------------\n") - sess = setup_v1() - - varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), - netsnmp.Varbind('sysContact', 0), - netsnmp.Varbind('sysLocation', 0)) - vals = sess.get(varlist) -- print "v1 sess.get result: ", vals, "\n" -+ print("v1 sess.get result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') - - vals = sess.getnext(varlist) -- print "v1 sess.getnext result: ", vals, "\n" -+ print("v1 sess.getnext result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') - - varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'), - netsnmp.Varbind('sysORLastChange'), -@@ -171,71 +171,71 @@ class BasicTests(unittest.TestCase): - netsnmp.Varbind('sysORUpTime')) - - vals = sess.getbulk(2, 8, varlist) -- print "v1 sess.getbulk result: ", vals, "\n" -+ print("v1 sess.getbulk result: ", vals, "\n") - self.assertEqual(vals, None) # GetBulk is not supported for v1 - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') - - def test_v1_set_2(self): -- print "\n" -- print "---v1 set2-------------------------------------\n" -+ print("\n") -+ print("---v1 set2-------------------------------------\n") - - sess = setup_v1() - varlist = netsnmp.VarList( - netsnmp.Varbind('sysLocation', '0', 'my newer location')) - res = sess.set(varlist) -- print "v1 sess.set result: ", res, "\n" -+ print("v1 sess.set result: ", res, "\n") - - def test_v1_walk_3(self): -- print "\n" -- print "---v1 walk3-------------------------------------\n" -+ print("\n") -+ print("---v1 walk3-------------------------------------\n") - - sess = setup_v1() - varlist = netsnmp.VarList(netsnmp.Varbind('system')) - - vals = sess.walk(varlist) -- print "v1 sess.walk result: ", vals, "\n" -+ print("v1 sess.walk result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - - def test_v2c_get(self): -- print "\n" -- print "---v2c get-------------------------------------\n" -+ print("\n") -+ print("---v2c get-------------------------------------\n") - - sess = setup_v2() - varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), - netsnmp.Varbind('sysContact', 0), - netsnmp.Varbind('sysLocation', 0)) - vals = sess.get(varlist) -- print "v2 sess.get result: ", vals, "\n" -+ print("v2 sess.get result: ", vals, "\n") - self.assertEqual(len(vals), 3) - - def test_v2c_getnext(self): -- print "\n" -- print "---v2c getnext-------------------------------------\n" -+ print("\n") -+ print("---v2c getnext-------------------------------------\n") - - sess = setup_v2() - varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), - netsnmp.Varbind('sysContact', 0), - netsnmp.Varbind('sysLocation', 0)) - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - - vals = sess.getnext(varlist) -- print "v2 sess.getnext result: ", vals, "\n" -+ print("v2 sess.getnext result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - - def test_v2c_getbulk(self): -- print "\n" -- print "---v2c getbulk-------------------------------------\n" -+ print("\n") -+ print("---v2c getbulk-------------------------------------\n") - - sess = setup_v2() - varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'), -@@ -245,16 +245,16 @@ class BasicTests(unittest.TestCase): - netsnmp.Varbind('sysORUpTime')) - - vals = sess.getbulk(2, 8, varlist) -- print "v2 sess.getbulk result: ", vals, "\n" -+ print("v2 sess.getbulk result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - - def test_v2c_set(self): -- print "\n" -- print "---v2c set-------------------------------------\n" -+ print("\n") -+ print("---v2c set-------------------------------------\n") - - sess = setup_v2() - -@@ -262,54 +262,54 @@ class BasicTests(unittest.TestCase): - netsnmp.Varbind('sysLocation', '0', 'my even newer location')) - - res = sess.set(varlist) -- print "v2 sess.set result: ", res, "\n" -+ print("v2 sess.set result: ", res, "\n") - self.assertEqual(res, 1) - - def test_v2c_walk(self): -- print "\n" -- print "---v2c walk-------------------------------------\n" -+ print("\n") -+ print("---v2c walk-------------------------------------\n") - - sess = setup_v2() - - varlist = netsnmp.VarList(netsnmp.Varbind('system')) - - vals = sess.walk(varlist) -- print "v2 sess.walk result: ", vals, "\n" -+ print("v2 sess.walk result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - - def test_v3_get(self): -- print "\n" -+ print("\n") - sess = setup_v3(); - varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), - netsnmp.Varbind('sysContact', 0), - netsnmp.Varbind('sysLocation', 0)) -- print "---v3 get-------------------------------------\n" -+ print("---v3 get-------------------------------------\n") - vals = sess.get(varlist) -- print "v3 sess.get result: ", vals, "\n" -+ print("v3 sess.get result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - - def test_v3_getnext(self): -- print "\n" -- print "---v3 getnext-------------------------------------\n" -+ print("\n") -+ print("---v3 getnext-------------------------------------\n") - - sess = setup_v3(); - varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), - netsnmp.Varbind('sysContact', 0), - netsnmp.Varbind('sysLocation', 0)) - vals = sess.getnext(varlist) -- print "v3 sess.getnext result: ", vals, "\n" -+ print("v3 sess.getnext result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - - def test_v3_getbulk(self): - sess = setup_v3(); -@@ -320,47 +320,47 @@ class BasicTests(unittest.TestCase): - netsnmp.Varbind('sysORUpTime')) - - vals = sess.getbulk(2, 8, varlist) -- print "v3 sess.getbulk result: ", vals, "\n" -+ print("v3 sess.getbulk result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - - def test_v3_set(self): -- print "\n" -- print "---v3 set-------------------------------------\n" -+ print("\n") -+ print("---v3 set-------------------------------------\n") - - sess = setup_v3(); - varlist = netsnmp.VarList( - netsnmp.Varbind('sysLocation', '0', 'my final destination')) - res = sess.set(varlist) -- print "v3 sess.set result: ", res, "\n" -+ print("v3 sess.set result: ", res, "\n") - self.assertEqual(res, 1) - - def test_v3_walk(self): -- print "\n" -- print "---v3 walk-------------------------------------\n" -+ print("\n") -+ print("---v3 walk-------------------------------------\n") - sess = setup_v3(); - varlist = netsnmp.VarList(netsnmp.Varbind('system')) - - vals = sess.walk(varlist) -- print "v3 sess.walk result: ", vals, "\n" -+ print("v3 sess.walk result: ", vals, "\n") - self.assertTrue(len(vals) > 0) - - for var in varlist: -- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - - - class SetTests(unittest.TestCase): - """SNMP set tests for the Net-SNMP Python interface""" - def testFuncs(self): - """Test code""" -- print "\n-------------- SET Test Start ----------------------------\n" -+ print("\n-------------- SET Test Start ----------------------------\n") - - var = netsnmp.Varbind('sysUpTime', '0') - res = netsnmp.snmpget(var, **snmp_dest()) -- print "uptime = ", res[0] -+ print("uptime = ", res[0]) - self.assertEqual(len(res), 1) - - -@@ -370,19 +370,19 @@ class SetTests(unittest.TestCase): - - var = netsnmp.Varbind('sysUpTime', '0') - res = netsnmp.snmpget(var, **snmp_dest()) -- print "uptime = ", res[0] -+ print("uptime = ", res[0]) - self.assertEqual(len(res), 1) - - var = netsnmp.Varbind('nsCacheEntry') - res = netsnmp.snmpgetnext(var, **snmp_dest()) -- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - self.assertEqual(len(res), 1) - - var.val = 65 - res = netsnmp.snmpset(var, **snmp_dest()) - self.assertEqual(res, 1) - res = netsnmp.snmpget(var, **snmp_dest()) -- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')' -+ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')') - self.assertEqual(len(res), 1) - self.assertEqual(res[0], '65'); - -@@ -394,7 +394,7 @@ class SetTests(unittest.TestCase): - netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 4)) - res = sess.set(varlist) - -- print "res = ", res -+ print("res = ", res) - self.assertEqual(res, 1) - - varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'), -@@ -414,15 +414,15 @@ class SetTests(unittest.TestCase): - self.assertEqual(varlist[2].val, '3') - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - - varlist = netsnmp.VarList( - netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 6)) - - res = sess.set(varlist) - -- print "res = ", res -+ print("res = ", res) - self.assertEqual(res, 1) - - varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'), -@@ -436,10 +436,10 @@ class SetTests(unittest.TestCase): - self.assertNotEqual(varlist[2].tag, 'snmpTargetAddrRowStatus') - - for var in varlist: -- print var.tag, var.iid, "=", var.val, '(', var.type, ')' -- print "\n" -+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') -+ print("\n") - -- print "\n-------------- SET Test End ----------------------------\n" -+ print("\n-------------- SET Test End ----------------------------\n") - - - if __name__ == '__main__': -diff -urNp a/python/setup.py b/python/setup.py ---- a/python/setup.py 2018-07-18 17:11:53.262147321 +0200 -+++ b/python/setup.py 2018-07-18 17:40:36.922751382 +0200 -@@ -9,9 +9,9 @@ intree=0 - - args = sys.argv[:] - for arg in args: -- if string.find(arg,'--basedir=') == 0: -- basedir = string.split(arg,'=')[1] -- sys.argv.remove(arg) -+ if arg.find('--basedir=') == 0: -+ basedir = arg.split('=')[1] -+ sys.argv.remove(arg) #tabs - intree=1 - - if intree: diff --git a/net-snmp-5.8-rpm-memory-leak.patch b/net-snmp-5.8-rpm-memory-leak.patch new file mode 100644 index 0000000000000000000000000000000000000000..33b8d299375d67bd5c04863537cdcb08ff708d9e --- /dev/null +++ b/net-snmp-5.8-rpm-memory-leak.patch @@ -0,0 +1,26 @@ +diff -urNp a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c +--- a/agent/mibgroup/host/data_access/swinst_rpm.c 2020-06-10 14:32:43.330486233 +0200 ++++ b/agent/mibgroup/host/data_access/swinst_rpm.c 2020-06-10 14:35:46.672298741 +0200 +@@ -75,6 +75,9 @@ netsnmp_swinst_arch_init(void) + snprintf( pkg_directory, SNMP_MAXPATH, "%s/Packages", dbpath ); + SNMP_FREE(rpmdbpath); + dbpath = NULL; ++#ifdef HAVE_RPMGETPATH ++ rpmFreeRpmrc(); ++#endif + if (-1 == stat( pkg_directory, &stat_buf )) { + snmp_log(LOG_ERR, "Can't find directory of RPM packages"); + pkg_directory[0] = '\0'; +diff -urNp a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c +--- a/agent/mibgroup/host/hr_swinst.c 2020-06-10 14:32:43.325486184 +0200 ++++ b/agent/mibgroup/host/hr_swinst.c 2020-06-10 14:36:44.423872418 +0200 +@@ -231,6 +231,9 @@ init_hr_swinst(void) + snprintf(path, sizeof(path), "%s/packages.rpm", swi->swi_dbpath); + path[ sizeof(path)-1 ] = 0; + swi->swi_directory = strdup(path); ++#ifdef HAVE_RPMGETPATH ++ rpmFreeRpmrc(); ++#endif + } + #else + # ifdef _PATH_HRSW_directory diff --git a/net-snmp-5.8-test-debug.patch b/net-snmp-5.8-test-debug.patch deleted file mode 100644 index 1ecd2abd10bc613b59f6c00fc8cb7c715a337bcd..0000000000000000000000000000000000000000 --- a/net-snmp-5.8-test-debug.patch +++ /dev/null @@ -1,30 +0,0 @@ -Don't check tests which depend on DNS - it's disabled in Koji - -diff -urNp a/testing/fulltests/default/T070com2sec_simple b/testing/fulltests/default/T070com2sec_simple ---- a/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:52:56.081185545 +0200 -+++ b/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:54:18.843968880 +0200 -@@ -134,6 +134,10 @@ SAVECHECKAGENT '<"c406a", 255.255.255.25 - SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies - SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies - -+FINISHED -+ -+# don't test the rest, it depends on DNS, which is not available in Koji -+ - CHECKAGENT '<"c408a"' - if [ "$snmp_last_test_result" -eq 0 ] ; then - CHECKAGENT 'line 32: Error:' -diff -urNp a/testing/fulltests/default/T071com2sec6_simple b/testing/fulltests/default/T071com2sec6_simple ---- a/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:52:56.080185548 +0200 -+++ b/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:55:17.779818732 +0200 -@@ -132,6 +132,10 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff - SAVECHECKAGENT 'line 27: Error:' - SAVECHECKAGENT 'line 28: Error:' - -+FINISHED -+ -+# don't test the rest, it depends on DNS, which is not available in Koji -+ - # 608 - CHECKAGENT '<"c608a"' - if [ "$snmp_last_test_result" -eq 0 ] ; then diff --git a/net-snmp-5.9-aes-config.patch b/net-snmp-5.9-aes-config.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac7014214700525c281d7fc721f021abbba6037f --- /dev/null +++ b/net-snmp-5.9-aes-config.patch @@ -0,0 +1,18 @@ +diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in +index afd6fa4..07c26fe 100644 +--- a/net-snmp-create-v3-user.in ++++ b/net-snmp-create-v3-user.in +@@ -58,11 +58,11 @@ case $1 in + exit 1 + fi + case $1 in +- DES|AES|AES128) ++ DES|AES|AES128|AES192|AES256) + Xalgorithm=$1 + shift + ;; +- des|aes|aes128) ++ des|aes|aes128|aes192|aes256) + Xalgorithm=`echo $1 | tr a-z A-Z` + shift + ;; diff --git a/net-snmp-5.9-autofs-skip.patch b/net-snmp-5.9-autofs-skip.patch new file mode 100644 index 0000000000000000000000000000000000000000..0d054b29c6c83c700b63d1cbd71cdae6d9db513b --- /dev/null +++ b/net-snmp-5.9-autofs-skip.patch @@ -0,0 +1,46 @@ +diff --git a/agent/mibgroup/host/hr_filesys.c b/agent/mibgroup/host/hr_filesys.c +index 4f78df3..fd25b3f 100644 +--- a/agent/mibgroup/host/hr_filesys.c ++++ b/agent/mibgroup/host/hr_filesys.c +@@ -704,6 +704,7 @@ static const char *HRFS_ignores[] = { + "shm", + "sockfs", + "sysfs", ++ "tmpfs", + "usbdevfs", + "usbfs", + #endif +diff --git a/agent/mibgroup/host/hr_storage.c b/agent/mibgroup/host/hr_storage.c +index 6b459ec..f7a376b 100644 +--- a/agent/mibgroup/host/hr_storage.c ++++ b/agent/mibgroup/host/hr_storage.c +@@ -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 (Check_HR_FileSys_AutoFs()) + return NULL; +diff --git a/agent/mibgroup/host/hrh_storage.c b/agent/mibgroup/host/hrh_storage.c +index 8967d35..9bf2659 100644 +--- a/agent/mibgroup/host/hrh_storage.c ++++ b/agent/mibgroup/host/hrh_storage.c +@@ -366,9 +366,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, + NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) && +- Check_HR_FileSys_NFS()) ++ Check_HR_FileSys_NFS()) || ++ Check_HR_FileSys_AutoFs())) + return NULL; + if (HRFS_entry && Check_HR_FileSys_AutoFs()) + return NULL; diff --git a/net-snmp-5.9-cflags.patch b/net-snmp-5.9-cflags.patch new file mode 100644 index 0000000000000000000000000000000000000000..5099cde95dbbc6b7f7b6ffd9db720e81f1d93c3e --- /dev/null +++ b/net-snmp-5.9-cflags.patch @@ -0,0 +1,36 @@ +diff -urNp a/net-snmp-config.in b/net-snmp-config.in +--- a/net-snmp-config.in 2018-07-18 13:43:12.264426052 +0200 ++++ b/net-snmp-config.in 2018-07-18 13:52:06.917089518 +0200 +@@ -140,10 +140,10 @@ else + ;; + #################################################### compile + --base-cflags) +- echo @CFLAGS@ @CPPFLAGS@ -I${NSC_INCLUDEDIR} ++ echo -I${NSC_INCLUDEDIR} + ;; + --cflags|--cf*) +- echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR} ++ echo @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR} + ;; + --srcdir) + echo $NSC_SRCDIR +diff -urNp a/perl/Makefile.PL b/perl/Makefile.PL +--- a/perl/Makefile.PL 2020-08-26 08:32:52.498909823 +0200 ++++ b/perl/Makefile.PL 2020-08-26 09:30:45.584951552 +0200 +@@ -1,3 +1,4 @@ ++use lib '.'; + use strict; + use warnings; + use ExtUtils::MakeMaker; +diff -urNp a/perl/MakefileSubs.pm b/perl/MakefileSubs.pm +--- a/perl/MakefileSubs.pm 2020-08-26 08:32:52.498909823 +0200 ++++ b/perl/MakefileSubs.pm 2020-08-26 08:36:44.097218448 +0200 +@@ -116,7 +116,7 @@ sub AddCommonParams { + append($Params->{'CCFLAGS'}, $cflags); + append($Params->{'CCFLAGS'}, $Config{'ccflags'}); + # Suppress known Perl header shortcomings. +- $Params->{'CCFLAGS'} =~ s/ -W(cast-qual|write-strings)//g; ++ $Params->{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; + append($Params->{'CCFLAGS'}, '-Wformat'); + } + } diff --git a/net-snmp-5.9-coverity.patch b/net-snmp-5.9-coverity.patch new file mode 100644 index 0000000000000000000000000000000000000000..fa3e0430d5a245c8c55a44e9786ee1e99eddf6c7 --- /dev/null +++ b/net-snmp-5.9-coverity.patch @@ -0,0 +1,22 @@ +diff --git a/agent/mibgroup/disman/event/mteTrigger.c b/agent/mibgroup/disman/event/mteTrigger.c +index e9a8831..5a1d8e7 100644 +--- a/agent/mibgroup/disman/event/mteTrigger.c ++++ b/agent/mibgroup/disman/event/mteTrigger.c +@@ -1012,7 +1012,7 @@ mteTrigger_run( unsigned int reg, void *clientarg) + * Similarly, if no fallEvent is configured, + * there's no point in trying to fire it either. + */ +- if (entry->mteTThRiseEvent[0] != '\0' ) { ++ if (entry->mteTThFallEvent[0] != '\0' ) { + entry->mteTriggerXOwner = entry->mteTThObjOwner; + entry->mteTriggerXObjects = entry->mteTThObjects; + entry->mteTriggerFired = vp1; +@@ -1105,7 +1105,7 @@ mteTrigger_run( unsigned int reg, void *clientarg) + * Similarly, if no fallEvent is configured, + * there's no point in trying to fire it either. + */ +- if (entry->mteTThDRiseEvent[0] != '\0' ) { ++ if (entry->mteTThDFallEvent[0] != '\0' ) { + entry->mteTriggerXOwner = entry->mteTThObjOwner; + entry->mteTriggerXObjects = entry->mteTThObjects; + entry->mteTriggerFired = vp1; diff --git a/net-snmp-5.9-dir-fix.patch b/net-snmp-5.9-dir-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..369626f7ed338c85b558935043253c71f10d1487 --- /dev/null +++ b/net-snmp-5.9-dir-fix.patch @@ -0,0 +1,24 @@ +diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in +index 452c269..afd6fa4 100644 +--- a/net-snmp-create-v3-user.in ++++ b/net-snmp-create-v3-user.in +@@ -16,6 +16,10 @@ Xalgorithm="DES" + token=rwuser + + while test "x$done" = "x" -a "x$1" != "x" -a "x$usage" != "xyes"; do ++case "$1" in ++ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; ++ *) optarg= ;; ++esac + + unset shifted + case $1 in +@@ -134,7 +138,7 @@ echo $line >> $outfile + prefix="@prefix@" + # Avoid that configure complains that this script ignores @datarootdir@ + echo "@datarootdir@" >/dev/null +-outfile="@datadir@/snmp/snmpd.conf" ++outfile="/etc/snmp/snmpd.conf" + line="$token $user" + echo "adding the following line to $outfile:" + echo " " $line diff --git a/net-snmp-5.9-dskTable-dynamic.patch b/net-snmp-5.9-dskTable-dynamic.patch new file mode 100644 index 0000000000000000000000000000000000000000..38227554ec50194ecf471ceccf4cb10d099161d4 --- /dev/null +++ b/net-snmp-5.9-dskTable-dynamic.patch @@ -0,0 +1,182 @@ +diff --git a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c +index 5206235..5e98476 100644 +--- a/agent/mibgroup/ucd-snmp/disk.c ++++ b/agent/mibgroup/ucd-snmp/disk.c +@@ -153,9 +153,10 @@ static void disk_free_config(void); + static void disk_parse_config(const char *, char *); + static void disk_parse_config_all(const char *, char *); + #if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS +-static void find_and_add_allDisks(int minpercent); ++static void refresh_disk_table(int addNewDisks, int minpercent); + static void add_device(char *path, char *device, +- int minspace, int minpercent, int override); ++ int minspace, int minpercent, int addNewDisks, ++ int override); + static void modify_disk_parameters(int index, int minspace, + int minpercent); + static int disk_exists(char *path); +@@ -167,6 +168,7 @@ struct diskpart { + char path[STRMAX]; + int minimumspace; + int minpercent; ++ int alive; + }; + + #define MAX_INT_32 0x7fffffff +@@ -174,6 +176,7 @@ struct diskpart { + + unsigned int numdisks; + int allDisksIncluded = 0; ++int allDisksMinPercent = 0; + unsigned int maxdisks = 0; + struct diskpart *disks; + +@@ -238,6 +241,7 @@ init_disk(void) + disk_free_config, + "minpercent%"); + allDisksIncluded = 0; ++ allDisksMinPercent = 0; + } + + static void +@@ -253,6 +257,7 @@ disk_free_config(void) + disks[i].minpercent = -1; + } + allDisksIncluded = 0; ++ allDisksMinPercent = 0; + } + + static void +@@ -313,7 +318,7 @@ disk_parse_config(const char *token, char *cptr) + * check if the disk already exists, if so then modify its + * parameters. if it does not exist then add it + */ +- add_device(path, find_device(path), minspace, minpercent, 1); ++ add_device(path, find_device(path), minspace, minpercent, 1, 1); + #endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */ + } + +@@ -372,7 +377,7 @@ disk_parse_config_all(const char *token, char *cptr) + + #if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS + static void +-add_device(char *path, char *device, int minspace, int minpercent, int override) ++add_device(char *path, char *device, int minspace, int minpercent, int addNewDisks, int override) + { + int index; + +@@ -402,10 +407,16 @@ add_device(char *path, char *device, int minspace, int minpercent, int override) + } + + index = disk_exists(path); +- if((index != -1) && (index < maxdisks) && (override==1)) { +- modify_disk_parameters(index, minspace, minpercent); ++ if((index != -1) && (index < maxdisks)) { ++ /* the path is already in the table */ ++ disks[index].alive = 1; ++ /* -> update its device */ ++ strlcpy(disks[index].device, device, sizeof(disks[index].device)); ++ if (override == 1) { ++ modify_disk_parameters(index, minspace, minpercent); ++ } + } +- else if(index == -1){ ++ else if(index == -1 && addNewDisks){ + /* add if and only if the device was found */ + if(device[0] != 0) { + /* The following buffers are cleared above, no need to add '\0' */ +@@ -413,6 +424,7 @@ add_device(char *path, char *device, int minspace, int minpercent, int override) + strlcpy(disks[numdisks].device, device, sizeof(disks[numdisks].device)); + disks[numdisks].minimumspace = minspace; + disks[numdisks].minpercent = minpercent; ++ disks[numdisks].alive = 1; + numdisks++; + } + else { +@@ -420,6 +432,7 @@ add_device(char *path, char *device, int minspace, int minpercent, int override) + disks[numdisks].minpercent = -1; + disks[numdisks].path[0] = 0; + disks[numdisks].device[0] = 0; ++ disks[numdisks].alive = 0; + } + } + } +@@ -444,7 +457,7 @@ int disk_exists(char *path) + } + + static void +-find_and_add_allDisks(int minpercent) ++refresh_disk_table(int addNewDisks, int minpercent) + { + #if HAVE_GETMNTENT + #if HAVE_SYS_MNTTAB_H +@@ -480,7 +493,7 @@ find_and_add_allDisks(int minpercent) + return; + } + while (mntfp && NULL != (mntent = getmntent(mntfp))) { +- add_device(mntent->mnt_dir, mntent->mnt_fsname, -1, minpercent, 0); ++ add_device(mntent->mnt_dir, mntent->mnt_fsname, -1, minpercent, addNewDisks, 0); + dummy = 1; + } + if (mntfp) +@@ -497,7 +510,7 @@ find_and_add_allDisks(int minpercent) + return; + } + while ((i = getmntent(mntfp, &mnttab)) == 0) { +- add_device(mnttab.mnt_mountp, mnttab.mnt_special, -1, minpercent, 0); ++ add_device(mnttab.mnt_mountp, mnttab.mnt_special, -1, minpercent, addNewDisks, 0); + dummy = 1; + } + fclose(mntfp); +@@ -510,7 +523,7 @@ find_and_add_allDisks(int minpercent) + #elif HAVE_FSTAB_H + setfsent(); /* open /etc/fstab */ + while((fstab1 = getfsent()) != NULL) { +- add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, 0); ++ add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, addNewDisks, 0); + dummy = 1; + } + endfsent(); /* close /etc/fstab */ +@@ -521,7 +534,7 @@ find_and_add_allDisks(int minpercent) + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntsize; i++) { + if (strncmp(mntbuf[i].f_fstypename, "zfs", 3) == 0) { +- add_device(mntbuf[i].f_mntonname, mntbuf[i].f_mntfromname, -1, minpercent, 0); ++ add_device(mntbuf[i].f_mntonname, mntbuf[i].f_mntfromname, -1, minpercent, addNewDisks, 0); + } + } + } +@@ -537,7 +550,7 @@ find_and_add_allDisks(int minpercent) + * statfs we default to the root partition "/" + */ + if (statfs("/", &statf) == 0) { +- add_device("/", statf.f_mntfromname, -1, minpercent, 0); ++ add_device("/", statf.f_mntfromname, -1, minpercent, addNewDisks, 0); + } + #endif + else { +@@ -696,6 +709,10 @@ fill_dsk_entry(int disknum, struct dsk_entry *entry) + #endif + #endif + ++ if (disks[disknum].alive == 0){ ++ return -1; ++ } ++ + entry->dskPercentInode = -1; + + #if defined(HAVE_STATVFS) || defined(HAVE_STATFS) +@@ -827,6 +844,13 @@ var_extensible_disk(struct variable *vp, + static char *errmsg; + static char empty_str[1]; + ++ int i; ++ for (i = 0; i < numdisks; i++){ ++ disks[i].alive = 0; ++ } ++ /* dynamically add new disks + update alive flag */ ++ refresh_disk_table(allDisksIncluded, allDisksMinPercent); ++ + tryAgain: + if (header_simple_table + (vp, name, length, exact, var_len, write_method, numdisks)) diff --git a/net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch b/net-snmp-5.9-libnetsnmptrapd-against-MYSQL_LIBS.patch similarity index 50% rename from net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch rename to net-snmp-5.9-libnetsnmptrapd-against-MYSQL_LIBS.patch index d835ee54a076d63afe82ef5d446206490360b10e..8f1f2ed8bb86ba0ea2e96b3621d821f0285efad6 100644 --- a/net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch +++ b/net-snmp-5.9-libnetsnmptrapd-against-MYSQL_LIBS.patch @@ -1,12 +1,13 @@ -diff -urNp a/apps/Makefile.in b/apps/Makefile.in ---- a/apps/Makefile.in 2018-07-18 15:39:28.069251000 +0200 -+++ b/apps/Makefile.in 2018-07-18 15:54:52.261943123 +0200 -@@ -230,7 +230,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX +diff --git a/apps/Makefile.in b/apps/Makefile.in +index d4529d3..175242b 100644 +--- a/apps/Makefile.in ++++ b/apps/Makefile.in +@@ -237,7 +237,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX) $(USELIBS) $(LINK) ${CFLAGS} -o $@ snmppcap.$(OSUFFIX) ${LDFLAGS} ${LIBS} -lpcap libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS) -- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) -+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIB) +- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LDFLAGS) ++ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS) $(RANLIB) $@ snmpinforminstall: diff --git a/net-snmp-5.9-memory-reporting.patch b/net-snmp-5.9-memory-reporting.patch new file mode 100644 index 0000000000000000000000000000000000000000..3db8d51f61d14483153eac1def8b37a251544bf1 --- /dev/null +++ b/net-snmp-5.9-memory-reporting.patch @@ -0,0 +1,28 @@ +diff --git a/agent/mibgroup/hardware/memory/memory_linux.c b/agent/mibgroup/hardware/memory/memory_linux.c +index 6d5e86c..68b55d2 100644 +--- a/agent/mibgroup/hardware/memory/memory_linux.c ++++ b/agent/mibgroup/hardware/memory/memory_linux.c +@@ -123,6 +123,13 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) { + if (first) + snmp_log(LOG_ERR, "No SwapTotal line in /proc/meminfo\n"); + } ++ b = strstr(buff, "SReclaimable: "); ++ if (b) ++ sscanf(b, "SReclaimable: %lu", &sreclaimable); ++ else { ++ if (first) ++ snmp_log(LOG_ERR, "No SReclaimable line in /proc/meminfo\n"); ++ } + b = strstr(buff, "SwapFree: "); + if (b) + sscanf(b, "SwapFree: %lu", &swapfree); +@@ -130,9 +137,6 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) { + if (first) + snmp_log(LOG_ERR, "No SwapFree line in /proc/meminfo\n"); + } +- b = strstr(buff, "SReclaimable: "); +- if (b) +- sscanf(b, "SReclaimable: %lu", &sreclaimable); + first = 0; + + diff --git a/net-snmp-5.8-multilib.patch b/net-snmp-5.9-multilib.patch similarity index 62% rename from net-snmp-5.8-multilib.patch rename to net-snmp-5.9-multilib.patch index b8f3feacbf10bc81fdf1ad60a6c860231fe9b39b..ffd8da83bda850dc6cbca94224f995df6b8927fd 100644 --- a/net-snmp-5.8-multilib.patch +++ b/net-snmp-5.9-multilib.patch @@ -1,6 +1,7 @@ -diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def ---- a/man/netsnmp_config_api.3.def 2018-07-18 11:18:06.196792766 +0200 -+++ b/man/netsnmp_config_api.3.def 2018-07-18 11:20:04.631679886 +0200 +diff --git a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def +index 90b20d9..bd5abe1 100644 +--- a/man/netsnmp_config_api.3.def ++++ b/man/netsnmp_config_api.3.def @@ -295,7 +295,7 @@ for one particular machine. .PP The default list of directories to search is \fC SYSCONFDIR/snmp\fP, @@ -10,7 +11,7 @@ diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def followed by \fC $HOME/.snmp\fP. This list can be changed by setting the environmental variable .I SNMPCONFPATH -@@ -367,7 +367,7 @@ A colon separated list of directories to +@@ -367,7 +367,7 @@ A colon separated list of directories to search for configuration files in. Default: .br @@ -19,10 +20,11 @@ diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def .SH "SEE ALSO" netsnmp_mib_api(3), snmp_api(3) .\" Local Variables: -diff -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def ---- a/man/snmp_config.5.def 2018-07-18 11:18:06.194792767 +0200 -+++ b/man/snmp_config.5.def 2018-07-18 11:20:56.423626117 +0200 -@@ -10,7 +10,7 @@ First off, there are numerous places tha +diff --git a/man/snmp_config.5.def b/man/snmp_config.5.def +index fd30873..c3437d6 100644 +--- a/man/snmp_config.5.def ++++ b/man/snmp_config.5.def +@@ -10,7 +10,7 @@ First off, there are numerous places that configuration files can be found and read from. By default, the applications look for configuration files in the following 4 directories, in order: SYSCONFDIR/snmp, @@ -31,10 +33,11 @@ diff -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def directories, it looks for files snmp.conf, snmpd.conf and/or snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf and/or snmptrapd.local.conf. *.local.conf are always -diff -urNp a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def ---- a/man/snmpd.conf.5.def 2018-07-18 11:18:06.196792766 +0200 -+++ b/man/snmpd.conf.5.def 2018-07-18 11:21:44.263574388 +0200 -@@ -1559,7 +1559,7 @@ filename), and call the initialisation r +diff --git a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def +index 7ce8a46..a4000f9 100644 +--- a/man/snmpd.conf.5.def ++++ b/man/snmpd.conf.5.def +@@ -1593,7 +1593,7 @@ filename), and call the initialisation routine \fIinit_NAME\fR. .RS .IP "Note:" If the specified PATH is not a fully qualified filename, it will diff --git a/net-snmp-5.7.2-pie.patch b/net-snmp-5.9-pie.patch similarity index 56% rename from net-snmp-5.7.2-pie.patch rename to net-snmp-5.9-pie.patch index ee02001b3585032ac8a53bb1648af6a96895aa94..cb2793d3f663589782ecd87769d35a5989b7f586 100644 --- a/net-snmp-5.7.2-pie.patch +++ b/net-snmp-5.9-pie.patch @@ -1,7 +1,8 @@ -diff -up net-snmp-5.7.2/agent/Makefile.in.pie net-snmp-5.7.2/agent/Makefile.in ---- net-snmp-5.7.2/agent/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200 -+++ net-snmp-5.7.2/agent/Makefile.in 2012-10-18 09:45:13.298613099 +0200 -@@ -294,7 +294,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c +diff --git a/agent/Makefile.in b/agent/Makefile.in +index b5d692d..1a30209 100644 +--- a/agent/Makefile.in ++++ b/agent/Makefile.in +@@ -297,7 +297,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c $(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $? snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG) @@ -9,11 +10,12 @@ diff -up net-snmp-5.7.2/agent/Makefile.in.pie net-snmp-5.7.2/agent/Makefile.in + $(LINK) $(CFLAGS) -o $@ -pie ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS} libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS} $(USELIBS) - $(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} @LD_NO_UNDEFINED@ $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) @AGENTLIBS@ -diff -up net-snmp-5.7.2/apps/Makefile.in.pie net-snmp-5.7.2/apps/Makefile.in ---- net-snmp-5.7.2/apps/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200 -+++ net-snmp-5.7.2/apps/Makefile.in 2012-10-18 09:44:27.827774580 +0200 -@@ -170,7 +170,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX + $(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} @LD_NO_UNDEFINED@ $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) @AGENTLIBS@ +diff --git a/apps/Makefile.in b/apps/Makefile.in +index 43f3b9c..d4529d3 100644 +--- a/apps/Makefile.in ++++ b/apps/Makefile.in +@@ -190,7 +190,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX) $(USELIBS) $(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) ${LDFLAGS} ${LIBS} snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS) diff --git a/net-snmp-5.9-proxy-getnext.patch b/net-snmp-5.9-proxy-getnext.patch new file mode 100644 index 0000000000000000000000000000000000000000..bfcbdbb94a01ccb655adf690e14b37df783c39a7 --- /dev/null +++ b/net-snmp-5.9-proxy-getnext.patch @@ -0,0 +1,13 @@ +diff --git a/agent/mibgroup/ucd-snmp/proxy.c b/agent/mibgroup/ucd-snmp/proxy.c +index e0ee96b..8abe7a3 100644 +--- a/agent/mibgroup/ucd-snmp/proxy.c ++++ b/agent/mibgroup/ucd-snmp/proxy.c +@@ -463,7 +463,7 @@ proxy_handler(netsnmp_mib_handler *handler, + if (sp->base_len && + reqinfo->mode == MODE_GETNEXT && + (snmp_oid_compare(ourname, ourlength, +- sp->base, sp->base_len) < 0)) { ++ sp->name, sp->name_len) < 0)) { + DEBUGMSGTL(( "proxy", "request is out of registered range\n")); + /* + * Create GETNEXT request with an OID so the diff --git a/net-snmp-5.9-python-ld-flags.patch b/net-snmp-5.9-python-ld-flags.patch new file mode 100644 index 0000000000000000000000000000000000000000..78fab3d3f06bb77594083998d286ffebed681f87 --- /dev/null +++ b/net-snmp-5.9-python-ld-flags.patch @@ -0,0 +1,21 @@ +diff --git a/python/setup.py b/python/setup.py +index 2547842..0c68cd8 100644 +--- a/python/setup.py ++++ b/python/setup.py +@@ -17,14 +17,14 @@ if intree: + netsnmp_libs = os.popen(basedir+'/net-snmp-config --libs').read() + libdir = os.popen(basedir+'/net-snmp-config --build-lib-dirs '+basedir).read() + incdir = os.popen(basedir+'/net-snmp-config --build-includes '+basedir).read() + " " + os.popen(basedir+'/net-snmp-config --base-cflags '+basedir).read() +- libs = re.findall(r"-l(\S+)", netsnmp_libs) ++ libs = re.findall(r"\s-l(\S+)", netsnmp_libs) + libdirs = re.findall(r"-L(\S+)", libdir) + incdirs = re.findall(r"-I(\S+)", incdir) + else: + netsnmp_libs = os.popen('net-snmp-config --libs').read() + libdirs = re.findall(r"-L(\S+)", netsnmp_libs) + incdirs = [] +- libs = re.findall(r"-l(\S+)", netsnmp_libs) ++ libs = re.findall(r"\s-l(\S+)", netsnmp_libs) + + setup( + name="netsnmp-python", version="1.0a1", diff --git a/net-snmp-5.9-python3.patch b/net-snmp-5.9-python3.patch new file mode 100644 index 0000000000000000000000000000000000000000..98de4ca96116c1c625ca1ab3ccc9a9bb25d148dd --- /dev/null +++ b/net-snmp-5.9-python3.patch @@ -0,0 +1,38 @@ +diff --git a/Makefile.in b/Makefile.in +index 912f6b2..862fb5f 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -227,7 +227,7 @@ perlcleanfeatures: + + # python specific build rules + # +-PYMAKE=$(PYTHON) setup.py $(PYTHONARGS) ++PYMAKE=/usr/bin/python3 setup.py $(PYTHONARGS) + pythonmodules: subdirs + @(dir=`pwd`; cd python; $(PYMAKE) build --basedir=$$dir) ; \ + if test $$? != 0 ; then \ +diff --git a/python/netsnmp/client.py b/python/netsnmp/client.py +index daf11a4..3a30a64 100644 +--- a/python/netsnmp/client.py ++++ b/python/netsnmp/client.py +@@ -56,7 +56,7 @@ class Varbind(object): + def __init__(self, tag=None, iid=None, val=None, type_arg=None): + self.tag = STR(tag) + self.iid = STR(iid) +- self.val = STR(val) ++ self.val = val + self.type = STR(type_arg) + # parse iid out of tag if needed + if iid is None and tag is not None: +@@ -66,7 +66,10 @@ class Varbind(object): + (self.tag, self.iid) = match.group(1, 2) + + def __setattr__(self, name, val): +- self.__dict__[name] = STR(val) ++ if name == 'val': ++ self.__dict__[name] = val ++ else: ++ self.__dict__[name] = STR(val) + + def __str__(self): + return obj_to_str(self) diff --git a/net-snmp-5.9-test-debug.patch b/net-snmp-5.9-test-debug.patch new file mode 100644 index 0000000000000000000000000000000000000000..85832a1985e8265cc3af838a684cb74fdfe81f16 --- /dev/null +++ b/net-snmp-5.9-test-debug.patch @@ -0,0 +1,110 @@ +diff --git a/testing/fulltests/default/T070com2sec_simple b/testing/fulltests/default/T070com2sec_simple +index 6c07f74..7df0b51 100644 +--- a/testing/fulltests/default/T070com2sec_simple ++++ b/testing/fulltests/default/T070com2sec_simple +@@ -134,34 +134,30 @@ SAVECHECKAGENT '<"c406a", 255.255.255.255/255.255.255.255> => "t406a"' + SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies + SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies + +-if false; then +- # The two tests below have been disabled because these rely on resolving a +- # domain name into a local IP address. Such DNS replies are filtered out by +- # many security devices because to avoid DNS rebinding attacks. See also +- # https://en.wikipedia.org/wiki/DNS_rebinding. +- +- CHECKAGENT '<"c408a"' +- if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 32: Error:' +- if [ "$snmp_last_test_result" -ne 1 ] ; then +- return_value=1 +- FINISHED +- fi +- elif [ "$snmp_last_test_result" -ne 1 ] ; then ++FINISHED ++ ++# don't test the rest, it depends on DNS, which is not available in Koji ++ ++CHECKAGENT '<"c408a"' ++if [ "$snmp_last_test_result" -eq 0 ] ; then ++ CHECKAGENT 'line 32: Error:' ++ if [ "$snmp_last_test_result" -ne 1 ] ; then + return_value=1 + FINISHED + fi ++elif [ "$snmp_last_test_result" -ne 1 ] ; then ++ return_value=1 ++ FINISHED ++fi + +- CHECKAGENT '<"c408b"' +- if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 33: Error:' +- if [ "$snmp_last_test_result" -ne 1 ] ; then +- return_value=1 +- fi +- elif [ "$snmp_last_test_result" -ne 1 ] ; then ++CHECKAGENT '<"c408b"' ++if [ "$snmp_last_test_result" -eq 0 ] ; then ++ CHECKAGENT 'line 33: Error:' ++ if [ "$snmp_last_test_result" -ne 1 ] ; then + return_value=1 + fi +- ++elif [ "$snmp_last_test_result" -ne 1 ] ; then ++ return_value=1 + fi + + FINISHED +diff --git a/testing/fulltests/default/T071com2sec6_simple b/testing/fulltests/default/T071com2sec6_simple +index 76da70b..bc2d432 100644 +--- a/testing/fulltests/default/T071com2sec6_simple ++++ b/testing/fulltests/default/T071com2sec6_simple +@@ -132,30 +132,27 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/ffff:ffff:ffff + SAVECHECKAGENT 'line 27: Error:' + SAVECHECKAGENT 'line 28: Error:' + +-if false; then +- # The two tests below have been disabled because these rely on resolving a +- # domain name into a local IP address. Such DNS replies are filtered out by +- # many security devices because to avoid DNS rebinding attacks. See also +- # https://en.wikipedia.org/wiki/DNS_rebinding. +- +- # 608 +- CHECKAGENT '<"c608a"' +- if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 29: Error:' +- errnum=`expr $errnum - 1` +- if [ "$snmp_last_test_result" -ne 1 ] ; then +- FINISHED +- fi +- elif [ "$snmp_last_test_result" -ne 1 ] ; then ++FINISHED ++ ++# don't test the rest, it depends on DNS, which is not available in Koji ++ ++# 608 ++CHECKAGENT '<"c608a"' ++if [ "$snmp_last_test_result" -eq 0 ] ; then ++ CHECKAGENT 'line 29: Error:' ++ errnum=`expr $errnum - 1` ++ if [ "$snmp_last_test_result" -ne 1 ] ; then + FINISHED + fi ++elif [ "$snmp_last_test_result" -ne 1 ] ; then ++ FINISHED ++fi + +- CHECKAGENTCOUNT atleastone '<"c608b"' +- if [ "$snmp_last_test_result" -eq 0 ] ; then +- CHECKAGENT 'line 30: Error:' +- if [ "$snmp_last_test_result" -eq 1 ] ; then +- errnum=`expr $errnum - 1` +- fi ++CHECKAGENTCOUNT atleastone '<"c608b"' ++if [ "$snmp_last_test_result" -eq 0 ] ; then ++ CHECKAGENT 'line 30: Error:' ++ if [ "$snmp_last_test_result" -eq 1 ] ; then ++ errnum=`expr $errnum - 1` + fi + fi + diff --git a/net-snmp-5.9-usage-exit.patch b/net-snmp-5.9-usage-exit.patch new file mode 100644 index 0000000000000000000000000000000000000000..c43c8462435a8acbfcddbca3c629ef256f729d31 --- /dev/null +++ b/net-snmp-5.9-usage-exit.patch @@ -0,0 +1,12 @@ +diff --git a/agent/snmpd.c b/agent/snmpd.c +index ae73eda..f01b890 100644 +--- a/agent/snmpd.c ++++ b/agent/snmpd.c +@@ -289,6 +289,7 @@ usage(char *prog) + " -S d|i|0-7\t\tuse -Ls instead\n" + "\n" + ); ++ exit(1); + } + + static void diff --git a/net-snmp-5.8.tar.gz b/net-snmp-5.9.tar.gz similarity index 46% rename from net-snmp-5.8.tar.gz rename to net-snmp-5.9.tar.gz index e8a439060d167eb8dd4bbe4ebfc925136950d98a..edf94360815afee24321281dfad1c90721a1eb05 100644 Binary files a/net-snmp-5.8.tar.gz and b/net-snmp-5.9.tar.gz differ diff --git a/net-snmp.spec b/net-snmp.spec index 986381294ccfe613243d6a866f960d182865a3c2..7649cb24b8c81567f4daf42fd02b965eda6080b4 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -2,8 +2,8 @@ %global multilib_arches x86_64 aarch64 Name: net-snmp -Version: 5.8 -Release: 7 +Version: 5.9 +Release: 1 Epoch: 1 Summary: SNMP Daemon License: BSD @@ -20,28 +20,37 @@ Source8: snmpd.service Source9: snmptrapd.service Source10: IETF-MIB-LICENSE.txt # These patches are from fedora29 -Patch1: net-snmp-5.7.2-pie.patch -Patch2: net-snmp-5.8-dir-fix.patch -Patch3: net-snmp-5.8-multilib.patch -Patch4: net-snmp-5.8-test-debug.patch -Patch5: net-snmp-5.7.2-autoreconf.patch -Patch6: net-snmp-5.8-agentx-disconnect-crash.patch -Patch7: net-snmp-5.7.2-cert-path.patch -Patch8: net-snmp-5.8-cflags.patch -Patch9: net-snmp-5.8-Remove-U64-typedef.patch -Patch10: net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch -Patch11: net-snmp-5.7.3-iterator-fix.patch -Patch12: net-snmp-5.8-autofs-skip.patch -Patch101: net-snmp-5.8-modern-rpm-api.patch -Patch102: net-snmp-5.8-python3.patch - -Patch6000: avoid-triggering-undefined-shift-left.patch +Patch1: net-snmp-5.9-pie.patch +Patch2: net-snmp-5.9-dir-fix.patch +Patch3: net-snmp-5.9-multilib.patch +Patch4: net-snmp-5.9-test-debug.patch +Patch5: net-snmp-5.7.2-cert-path.patch +Patch6: net-snmp-5.9-cflags.patch +Patch7: net-snmp-5.8-Remove-U64-typedef.patch +Patch8: net-snmp-5.9-libnetsnmptrapd-against-MYSQL_LIBS.patch +Patch9: net-snmp-5.7.3-iterator-fix.patch +Patch10: net-snmp-5.9-autofs-skip.patch +Patch11: net-snmp-5.9-python-ld-flags.patch +Patch12: net-snmp-5.9-usage-exit.patch +Patch13: net-snmp-5.9-coverity.patch +Patch14: net-snmp-5.9-proxy-getnext.patch +Patch15: net-snmp-5.9-dskTable-dynamic.patch +Patch16: net-snmp-5.8-expand-SNMPCONFPATH.patch +Patch17: net-snmp-5.8-duplicate-ipAddress.patch +Patch18: net-snmp-5.9-memory-reporting.patch +Patch19: net-snmp-5.8-man-page.patch +Patch20: net-snmp-5.8-ipAddress-faster-load.patch +Patch21: net-snmp-5.8-rpm-memory-leak.patch +Patch22: net-snmp-5.9-aes-config.patch +Patch23: net-snmp-5.8-modern-rpm-api.patch +Patch24: net-snmp-5.9-python3.patch %{?systemd_requires} BuildRequires: systemd gcc openssl-devel bzip2-devel elfutils-devel libselinux-devel -BuildRequires: elfutils-libelf-devel rpm-devel perl-devel perl(ExtUtils::Embed) procps +BuildRequires: elfutils-libelf-devel rpm-devel perl-devel perl(ExtUtils::Embed) procps pcre-devel BuildRequires: python3-devel python3-setuptools chrpath mariadb-connector-c-devel net-tools BuildRequires: perl(TAP::Harness) lm_sensors-devel autoconf automake +BuildRequires: net-snmp net-snmp-libs Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: %{name}-libs = %{epoch}:%{version}-%{release} @@ -195,14 +204,14 @@ for file in README COPYING; do mv $file.utf8 $file done chmod 644 local/passtest local/ipf-mod.pl -mkdir -p %{buildroot}/usr/include/net-snmp/agent/util_funcs -install -m 644 agent/mibgroup/util_funcs/*.h %{buildroot}/usr/include/net-snmp/agent/util_funcs mkdir -p %{buildroot}/%{_tmpfilesdir} install -m 644 %SOURCE7 %{buildroot}/%{_tmpfilesdir}/net-snmp.conf mkdir -p %{buildroot}/%{_unitdir} install -m 644 %SOURCE8 %SOURCE9 %{buildroot}/%{_unitdir}/ +cp -a %{_libdir}/libnetsnmp*.so* %{buildroot}%{_libdir} + %check %if %{netsnmp_check} cp -f libtool.orig libtool @@ -260,9 +269,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %files devel %attr(0644,root,root) %attr(0755,root,root) %{_bindir}/net-snmp-config* -%{_includedir}/net-snmp/* -%{_includedir}/ucd-snmp/*.h +%{_includedir}/* %{_libdir}/libnet*.so +%{_libdir}/pkgconfig/* %files perl %{_bindir}/mib2c* @@ -315,6 +324,21 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %{_mandir}/man1/fixproc* %changelog +* Tue Sep 01 2020 zhouyihang - 5.9-1 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: Upgrade version to 5.9 + +* Thu Jul 09 2020 zhouyihang - 5.8-10 +- Type:cves +- ID:CVE-2019-20892 +- SUG:NA +- DESC: Fix CVE-2019-20892 + +* Fri May 29 2020 Buildteam - 5.8-9 +- rebuild for lm_sensors version update + * Thu Mar 12 2020 Buildteam - 5.8-8 - Type:bugfix - ID:NA