aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2019-12-19 14:42:43 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2019-12-19 14:43:55 +0000
commit847f69d918bc30fa090135efc6c4923ac9b6ff65 (patch)
tree4d436e2a4d5d5f41dfe5a181a73095761d440368
parent9989e91d2578b9c96ce0beea69076d50752decfb (diff)
downloadaports-847f69d918bc30fa090135efc6c4923ac9b6ff65.tar.bz2
aports-847f69d918bc30fa090135efc6c4923ac9b6ff65.tar.xz
main/net-snmp: broken ErrorMsg at ucd-snmp
https://github.com/net-snmp/net-snmp/issues/26 fixes #11055 Add openrc subpkg
-rw-r--r--main/net-snmp/APKBUILD6
-rw-r--r--main/net-snmp/report-empty-strings-correctly.patch110
2 files changed, 114 insertions, 2 deletions
diff --git a/main/net-snmp/APKBUILD b/main/net-snmp/APKBUILD
index 53f3617ac6..d2151d9820 100644
--- a/main/net-snmp/APKBUILD
+++ b/main/net-snmp/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=net-snmp
pkgver=5.8
-pkgrel=2
+pkgrel=3
pkgdesc="Simple Network Management Protocol"
url="http://www.net-snmp.org/"
arch="all"
@@ -13,10 +13,11 @@ depends_dev="openssl-dev"
# net-snmp-gui subpackage has perl-net-snmp as depends
makedepends="file perl-dev openssl-dev perl-net-snmp linux-headers"
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
- $pkgname-perl:pl $pkgname-gui $pkgname-tools"
+ $pkgname-perl:pl $pkgname-gui $pkgname-tools $pkgname-openrc"
source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
netsnmp-swinst-crash.patch
fix-includes.patch
+ report-empty-strings-correctly.patch
snmpd.initd
snmpd.confd
@@ -144,6 +145,7 @@ tools() {
sha512sums="27895a583b23f3e14c48562bc32f3ba83513d81aa848e878be9a3650f0458d45950635c937ef627135f80b757b663e71fab9a3bde4fd91889153998ae3468fe7 net-snmp-5.8.tar.gz
4ad92f50b14d5e27ba86256cc532a2dd055502f4d5fbb1700434f9f01f881fd09bb1eadb94e727554e1470f036707558314c64a66d0376b54e71ab31d5e4baa3 netsnmp-swinst-crash.patch
87a552bd2e41684bba6e87fbcf6454a85ee912d7a339411fda24cebddf7661f0856729e076a917920a542cf84b687ffd90a091daa15f2c48f0ff64f3a53c0ddb fix-includes.patch
+633fbf574a76f63b0ae5340cd86439ca89ef2621b890917c35a884fe2d41052d4ec65c88f0d3f94f2bb3481b2bc1989647d3e697f7995b72abee47799300c26b report-empty-strings-correctly.patch
896ef65a6f420073746470cdbd0de8f356c5b936d35e131754905b3d4323c24dcd3a09e0cc8bd90b12e3402f01e478f927f0e4163cb85cb0cc03db3c2e0491f4 snmpd.initd
fb101aa758d741ed3ea88b11f1cd49cfd04bd03ce62435f3acb17724748131c57f00b71fd45cb7e7871d65a1aab576652cd6e158b6406aa6d0998582b8235ef5 snmpd.confd
073fd2b83eedd6eda1f7345350268ce7946ef6d67a8f26f7c232e46feb75babf68272ae12071a2f9ea76ede71393b3ae4672d3cd47cfd14ab77e3a6482f2e124 snmptrapd.confd"
diff --git a/main/net-snmp/report-empty-strings-correctly.patch b/main/net-snmp/report-empty-strings-correctly.patch
new file mode 100644
index 0000000000..b1520d9b64
--- /dev/null
+++ b/main/net-snmp/report-empty-strings-correctly.patch
@@ -0,0 +1,110 @@
+From d0787a2c86a80e31756965c436fac67b7d1c0f9b Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Fri, 11 Oct 2019 20:09:08 -0700
+Subject: [PATCH] HOST-RESOURCES-MIB, UCD-SNMP-MIB: Report empty strings
+ correctly
+
+See also https://github.com/net-snmp/net-snmp/issues/26.
+
+Fixes: 9b9c0e287b4d ("MIBs: Use asprintf() instead of snprintf() to prevent truncation")
+---
+ agent/mibgroup/host/hrh_filesys.c | 5 +++--
+ agent/mibgroup/ucd-snmp/disk.c | 3 ++-
+ agent/mibgroup/ucd-snmp/disk_hw.c | 3 ++-
+ agent/mibgroup/ucd-snmp/proc.c | 4 ++--
+ 4 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/agent/mibgroup/host/hrh_filesys.c b/agent/mibgroup/host/hrh_filesys.c
+index 354416157..073a37e98 100644
+--- a/agent/mibgroup/host/hrh_filesys.c
++++ b/agent/mibgroup/host/hrh_filesys.c
+@@ -219,6 +219,7 @@ var_hrhfilesys(struct variable *vp,
+ {
+ int fsys_idx;
+ static char *string;
++ static char empty_str[1];
+
+ fsys_idx =
+ header_hrhfilesys(vp, name, length, exact, var_len, write_method);
+@@ -235,7 +236,7 @@ var_hrhfilesys(struct variable *vp,
+ *var_len = 0;
+ if (asprintf(&string, "%s", HRFS_entry->path) >= 0)
+ *var_len = strlen(string);
+- return (u_char *) string;
++ return (u_char *)(string ? string : empty_str);
+ case HRFSYS_RMOUNT:
+ free(string);
+ if (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) {
+@@ -245,7 +246,7 @@ var_hrhfilesys(struct variable *vp,
+ string = strdup("");
+ }
+ *var_len = string ? strlen(string) : 0;
+- return (u_char *) string;
++ return (u_char *)(string ? string : empty_str);
+
+ case HRFSYS_TYPE:
+ fsys_type_id[fsys_type_len - 1] =
+diff --git a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
+index d827dcc18..52062352e 100644
+--- a/agent/mibgroup/ucd-snmp/disk.c
++++ b/agent/mibgroup/ucd-snmp/disk.c
+@@ -825,6 +825,7 @@ var_extensible_disk(struct variable *vp,
+ struct dsk_entry entry;
+ static long long_ret;
+ static char *errmsg;
++ static char empty_str[1];
+
+ tryAgain:
+ if (header_simple_table
+@@ -926,7 +927,7 @@ var_extensible_disk(struct variable *vp,
+ *var_len = strlen(errmsg);
+ }
+ }
+- return (u_char *) (errmsg);
++ return (u_char *)(errmsg ? errmsg : empty_str);
+ }
+ return NULL;
+ }
+diff --git a/agent/mibgroup/ucd-snmp/disk_hw.c b/agent/mibgroup/ucd-snmp/disk_hw.c
+index cc5da14de..e8b09a238 100644
+--- a/agent/mibgroup/ucd-snmp/disk_hw.c
++++ b/agent/mibgroup/ucd-snmp/disk_hw.c
+@@ -314,6 +314,7 @@ var_extensible_disk(struct variable *vp,
+ unsigned long long val;
+ static long long_ret;
+ static char *errmsg;
++ static char empty_str[1];
+ netsnmp_cache *cache;
+
+ /* Update the fsys H/W module */
+@@ -432,7 +433,7 @@ var_extensible_disk(struct variable *vp,
+ >= 0)) {
+ *var_len = strlen(errmsg);
+ }
+- return (u_char *) errmsg;
++ return (u_char *)(errmsg ? errmsg : empty_str);
+ }
+ return NULL;
+ }
+diff --git a/agent/mibgroup/ucd-snmp/proc.c b/agent/mibgroup/ucd-snmp/proc.c
+index 57aa2d58a..8eb5fa7ac 100644
+--- a/agent/mibgroup/ucd-snmp/proc.c
++++ b/agent/mibgroup/ucd-snmp/proc.c
+@@ -265,7 +265,7 @@ var_extensible_proc(struct variable *vp,
+ struct myproc *proc;
+ static long long_ret;
+ static char *errmsg;
+-
++ static char empty_str[1];
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, numprocs))
+@@ -328,7 +328,7 @@ var_extensible_proc(struct variable *vp,
+ }
+ }
+ *var_len = errmsg ? strlen(errmsg) : 0;
+- return ((u_char *) errmsg);
++ return (u_char *)(errmsg ? errmsg : empty_str);
+ case ERRORFIX:
+ *write_method = fixProcError;
+ long_return = fixproc.result;