From 9dd78b3406ba586f03972f984f07ee50a7f18494 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 9 Sep 2020 10:04:16 +0200 Subject: [PATCH 1/3] Test snmp on azure --- azure/apt.yml | 3 +++ azure/configure.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/azure/apt.yml b/azure/apt.yml index e8da9b001d3ee..703e5753d3c40 100644 --- a/azure/apt.yml +++ b/azure/apt.yml @@ -35,8 +35,11 @@ steps: libsodium-dev \ libargon2-0-dev \ libmm-dev \ + libsnmp-dev \ postgresql \ postgresql-contrib \ + snmpd \ + snmp-mibs-downloader \ llvm \ ${{ parameters.packages }} displayName: 'APT' diff --git a/azure/configure.yml b/azure/configure.yml index e9e49bf98acb6..fd0191528bef6 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -56,6 +56,7 @@ steps: --with-mhash \ --with-sodium \ --enable-dba \ + --with-snmp \ --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d From 87c593ddf4f8cb08790a7e90973fd6e2af75f65c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 9 Sep 2020 10:09:23 +0200 Subject: [PATCH 2/3] Use custom snmpd.conf --- azure/setup.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure/setup.yml b/azure/setup.yml index 523bb3b401436..825ca4d5f6c01 100644 --- a/azure/setup.yml +++ b/azure/setup.yml @@ -10,4 +10,10 @@ steps: displayName: 'Setup' - script: ./azure/setup-slapd.sh displayName: 'Configure slapd' + - script: | + set -e + sudo cp ext/snmp/tests/snmpd.conf /etc/snmp + sudo cp ext/snmp/tests/bigtest /etc/snmp + sudo service snmpd restart + displayName: 'Configure snmpd' From 952a11cc7b4898bf2b33f265ecafbd6e9dc0a0de Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 9 Sep 2020 10:23:06 +0200 Subject: [PATCH 3/3] Suppress uninitialized variable warning These are false positive warnings. --- ext/snmp/snmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 44c9c98e71a3c..3305565f79ea8 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1082,7 +1082,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) { zend_string *oid_str, *type_str = NULL, *value_str = NULL; HashTable *oid_ht, *type_ht = NULL, *value_ht = NULL; - char *a1, *a2, *a3, *a4, *a5, *a6, *a7; + char *a1 = NULL, *a2 = NULL, *a3 = NULL, *a4 = NULL, *a5 = NULL, *a6 = NULL, *a7 = NULL; size_t a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len; zend_bool use_orignames = 0, suffix_keys = 0; zend_long timeout = SNMP_DEFAULT_TIMEOUT;