New upstream release 5.9
This commit is contained in:
parent
f028a843ff
commit
03eed47b24
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ net-snmp-5.5.tar.gz
|
|||||||
/net-snmp-5.7.2.tar.gz
|
/net-snmp-5.7.2.tar.gz
|
||||||
/net-snmp-5.7.3.tar.gz
|
/net-snmp-5.7.3.tar.gz
|
||||||
/net-snmp-5.8.tar.gz
|
/net-snmp-5.8.tar.gz
|
||||||
|
/net-snmp-5.9.tar.gz
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
554747 - net-snmp-config should not contain perl options
|
|
||||||
|
|
||||||
Remove rpath from net-snmp-config --agent-libs output.
|
|
||||||
|
|
||||||
diff -up net-snmp-5.7/net-snmp-config.in.perl-linking net-snmp-5.7/net-snmp-config.in
|
|
||||||
--- net-snmp-5.7/net-snmp-config.in.perl-linking 2011-07-02 00:35:46.000000000 +0200
|
|
||||||
+++ net-snmp-5.7/net-snmp-config.in 2011-07-07 13:30:01.635798817 +0200
|
|
||||||
@@ -50,7 +50,7 @@ NSC_LDFLAGS="@LDFLAGS@"
|
|
||||||
|
|
||||||
NSC_LIBS="@LIBS@"
|
|
||||||
NSC_LNETSNMPLIBS="@LNETSNMPLIBS@"
|
|
||||||
-NSC_LAGENTLIBS="@LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@"
|
|
||||||
+NSC_LAGENTLIBS="@LAGENTLIBS@"
|
|
||||||
NSC_LMIBLIBS="@LMIBLIBS@"
|
|
||||||
|
|
||||||
NSC_INCLUDEDIR=${includedir}
|
|
@ -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
|
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
|||||||
diff -urNp old/apps/snmptrapd_sql.c new/apps/snmptrapd_sql.c
|
|
||||||
--- old/apps/snmptrapd_sql.c 2017-12-13 22:40:04.963569347 +0100
|
|
||||||
+++ new/apps/snmptrapd_sql.c 2017-12-13 22:44:38.640761652 +0100
|
|
||||||
@@ -50,8 +50,6 @@
|
|
||||||
#undef PACKAGE_STRING
|
|
||||||
#undef PACKAGE_TARNAME
|
|
||||||
#undef PACKAGE_VERSION
|
|
||||||
-#include <my_global.h>
|
|
||||||
-#include <my_sys.h>
|
|
||||||
#include <mysql.h>
|
|
||||||
#include <errmsg.h>
|
|
||||||
#include <mysql_version.h>
|
|
@ -1,38 +0,0 @@
|
|||||||
diff -urNp old/apps/snmptrapd_sql.c new/apps/snmptrapd_sql.c
|
|
||||||
--- old/apps/snmptrapd_sql.c 2017-07-18 09:44:00.655109694 +0200
|
|
||||||
+++ new/apps/snmptrapd_sql.c 2017-07-19 12:51:14.836148821 +0200
|
|
||||||
@@ -54,6 +54,7 @@
|
|
||||||
#include <my_sys.h>
|
|
||||||
#include <mysql.h>
|
|
||||||
#include <errmsg.h>
|
|
||||||
+#include <mysql_version.h>
|
|
||||||
|
|
||||||
netsnmp_feature_require(container_fifo)
|
|
||||||
|
|
||||||
@@ -437,6 +438,7 @@ netsnmp_mysql_init(void)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if MYSQL_VERSION_ID < 100000
|
|
||||||
#ifdef HAVE_BROKEN_LIBMYSQLCLIENT
|
|
||||||
my_init();
|
|
||||||
#else
|
|
||||||
@@ -445,6 +447,7 @@ netsnmp_mysql_init(void)
|
|
||||||
|
|
||||||
/** load .my.cnf values */
|
|
||||||
load_defaults ("my", _sql.groups, ¬_argc, ¬_argv);
|
|
||||||
+#endif
|
|
||||||
for(i=0; i < not_argc; ++i) {
|
|
||||||
if (NULL == not_argv[i])
|
|
||||||
continue;
|
|
||||||
@@ -542,6 +545,10 @@ netsnmp_mysql_init(void)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if MYSQL_VERSION_ID > 100000
|
|
||||||
+ mysql_options(_sql.conn, MYSQL_READ_DEFAULT_GROUP, "snmptrapd");
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
/** try to connect; we'll try again later if we fail */
|
|
||||||
(void) netsnmp_mysql_connect();
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
|||||||
diff -uNr net-snmp-5.7.3.orig/agent/mibgroup/host/data_access/swinst_rpm.c net-snmp-5.7.3/agent/mibgroup/host/data_access/swinst_rpm.c
|
|
||||||
--- net-snmp-5.7.3.orig/agent/mibgroup/host/data_access/swinst_rpm.c 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ net-snmp-5.7.3/agent/mibgroup/host/data_access/swinst_rpm.c 2017-08-11 00:16:35.232470439 +0200
|
|
||||||
@@ -96,8 +96,7 @@
|
|
||||||
|
|
||||||
rpmdbMatchIterator mi;
|
|
||||||
Header h;
|
|
||||||
- char *n, *v, *r, *g;
|
|
||||||
- int32_t *t;
|
|
||||||
+ const char *n, *v, *r, *g;
|
|
||||||
time_t install_time;
|
|
||||||
size_t date_len;
|
|
||||||
int i = 1;
|
|
||||||
@@ -119,11 +118,11 @@
|
|
||||||
CONTAINER_INSERT(container, entry);
|
|
||||||
|
|
||||||
h = headerLink( h );
|
|
||||||
- headerGetEntry( h, RPMTAG_NAME, NULL, (void**)&n, NULL);
|
|
||||||
- headerGetEntry( h, RPMTAG_VERSION, NULL, (void**)&v, NULL);
|
|
||||||
- headerGetEntry( h, RPMTAG_RELEASE, NULL, (void**)&r, NULL);
|
|
||||||
- headerGetEntry( h, RPMTAG_GROUP, NULL, (void**)&g, NULL);
|
|
||||||
- headerGetEntry( h, RPMTAG_INSTALLTIME, NULL, (void**)&t, NULL);
|
|
||||||
+ n = headerGetString( h, RPMTAG_NAME);
|
|
||||||
+ v = headerGetString( h, RPMTAG_VERSION);
|
|
||||||
+ r = headerGetString( h, RPMTAG_RELEASE);
|
|
||||||
+ g = headerGetString( h, RPMTAG_GROUP);
|
|
||||||
+ install_time = headerGetNumber( h, RPMTAG_INSTALLTIME);
|
|
||||||
|
|
||||||
entry->swName_len = snprintf( entry->swName, sizeof(entry->swName),
|
|
||||||
"%s-%s-%s", n, v, r);
|
|
||||||
@@ -133,7 +132,6 @@
|
|
||||||
? 2 /* operatingSystem */
|
|
||||||
: 4; /* application */
|
|
||||||
|
|
||||||
- install_time = *t;
|
|
||||||
dt = date_n_time( &install_time, &date_len );
|
|
||||||
if (date_len != 8 && date_len != 11) {
|
|
||||||
snmp_log(LOG_ERR, "Bogus length from date_n_time for %s", entry->swName);
|
|
||||||
diff -uNr net-snmp-5.7.3.orig/agent/mibgroup/host/hr_swinst.c net-snmp-5.7.3/agent/mibgroup/host/hr_swinst.c
|
|
||||||
--- net-snmp-5.7.3.orig/agent/mibgroup/host/hr_swinst.c 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ net-snmp-5.7.3/agent/mibgroup/host/hr_swinst.c 2017-08-11 00:17:07.488544492 +0200
|
|
||||||
@@ -484,9 +484,9 @@
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
# ifdef HAVE_LIBRPM
|
|
||||||
- char *rpm_groups;
|
|
||||||
- if ( headerGetEntry(swi->swi_h, RPMTAG_GROUP, NULL, (void **) &rpm_groups, NULL) ) {
|
|
||||||
- if ( strstr(rpm_groups, "System Environment") != NULL )
|
|
||||||
+ const char *rpm_group = headerGetString(swi->swi_h, RPMTAG_GROUP);
|
|
||||||
+ if ( NULL != rpm_group ) {
|
|
||||||
+ if ( strstr(rpm_group, "System Environment") != NULL )
|
|
||||||
long_return = 2; /* operatingSystem */
|
|
||||||
else
|
|
||||||
long_return = 4; /* applcation */
|
|
||||||
@@ -503,9 +503,8 @@
|
|
||||||
case HRSWINST_DATE:
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBRPM
|
|
||||||
- int32_t *rpm_data;
|
|
||||||
- if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
|
|
||||||
- time_t installTime = *rpm_data;
|
|
||||||
+ time_t installTime = headerGetNumber(swi->swi_h, RPMTAG_INSTALLTIME);
|
|
||||||
+ if ( 0 != installTime) {
|
|
||||||
ret = date_n_time(&installTime, var_len);
|
|
||||||
} else {
|
|
||||||
ret = date_n_time(NULL, var_len);
|
|
||||||
@@ -665,7 +664,7 @@
|
|
||||||
if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
|
|
||||||
int offset;
|
|
||||||
Header h;
|
|
||||||
- char *n, *v, *r;
|
|
||||||
+ const char *n, *v, *r;
|
|
||||||
|
|
||||||
offset = swi->swi_recs[ix - 1];
|
|
||||||
|
|
||||||
@@ -690,11 +689,9 @@
|
|
||||||
swi->swi_h = h;
|
|
||||||
swi->swi_prevx = ix;
|
|
||||||
|
|
||||||
- headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL);
|
|
||||||
- headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v,
|
|
||||||
- NULL);
|
|
||||||
- headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r,
|
|
||||||
- NULL);
|
|
||||||
+ n = headerGetString(swi->swi_h, RPMTAG_NAME);
|
|
||||||
+ v = headerGetString(swi->swi_h, RPMTAG_VERSION);
|
|
||||||
+ r = headerGetString(swi->swi_h, RPMTAG_RELEASE);
|
|
||||||
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
|
|
||||||
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
|
|
||||||
}
|
|
@ -1,303 +0,0 @@
|
|||||||
diff -urNp old/apps/snmpusm.c new/apps/snmpusm.c
|
|
||||||
--- old/apps/snmpusm.c 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ new/apps/snmpusm.c 2017-02-20 15:20:36.994022905 +0100
|
|
||||||
@@ -190,7 +190,7 @@ get_USM_DH_key(netsnmp_variable_list *va
|
|
||||||
oid *keyoid, size_t keyoid_len) {
|
|
||||||
u_char *dhkeychange;
|
|
||||||
DH *dh;
|
|
||||||
- BIGNUM *other_pub;
|
|
||||||
+ BIGNUM *p, *g, *pub_key, *other_pub;
|
|
||||||
u_char *key;
|
|
||||||
size_t key_len;
|
|
||||||
|
|
||||||
@@ -205,25 +205,29 @@ get_USM_DH_key(netsnmp_variable_list *va
|
|
||||||
dh = d2i_DHparams(NULL, &cp, dhvar->val_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!dh || !dh->g || !dh->p) {
|
|
||||||
+ if (dh)
|
|
||||||
+ DH_get0_pqg(dh, &p, NULL, &g);
|
|
||||||
+
|
|
||||||
+ if (!dh || !g || !p) {
|
|
||||||
SNMP_FREE(dhkeychange);
|
|
||||||
return SNMPERR_GENERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
- DH_generate_key(dh);
|
|
||||||
- if (!dh->pub_key) {
|
|
||||||
+ if (!DH_generate_key(dh)) {
|
|
||||||
SNMP_FREE(dhkeychange);
|
|
||||||
return SNMPERR_GENERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (vars->val_len != (unsigned int)BN_num_bytes(dh->pub_key)) {
|
|
||||||
+ DH_get0_key(dh, &pub_key, NULL);
|
|
||||||
+
|
|
||||||
+ if (vars->val_len != (unsigned int)BN_num_bytes(pub_key)) {
|
|
||||||
SNMP_FREE(dhkeychange);
|
|
||||||
fprintf(stderr,"incorrect diffie-helman lengths (%lu != %d)\n",
|
|
||||||
- (unsigned long)vars->val_len, BN_num_bytes(dh->pub_key));
|
|
||||||
+ (unsigned long)vars->val_len, BN_num_bytes(pub_key));
|
|
||||||
return SNMPERR_GENERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
- BN_bn2bin(dh->pub_key, dhkeychange + vars->val_len);
|
|
||||||
+ BN_bn2bin(pub_key, dhkeychange + vars->val_len);
|
|
||||||
|
|
||||||
key_len = DH_size(dh);
|
|
||||||
if (!key_len) {
|
|
||||||
diff -urNp old/configure new/configure
|
|
||||||
--- old/configure 2017-02-20 10:08:16.440396223 +0100
|
|
||||||
+++ new/configure 2017-02-20 10:57:15.749734281 +0100
|
|
||||||
@@ -23176,9 +23176,9 @@ $as_echo "#define HAVE_AES_CFB128_ENCRYP
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
- as_ac_Lib=`$as_echo "ac_cv_lib_${CRYPTO}''_EVP_MD_CTX_create" | $as_tr_sh`
|
|
||||||
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_MD_CTX_create in -l${CRYPTO}" >&5
|
|
||||||
-$as_echo_n "checking for EVP_MD_CTX_create in -l${CRYPTO}... " >&6; }
|
|
||||||
+ as_ac_Lib=`$as_echo "ac_cv_lib_${CRYPTO}''_EVP_MD_CTX_new" | $as_tr_sh`
|
|
||||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_MD_CTX_new in -l${CRYPTO}" >&5
|
|
||||||
+$as_echo_n "checking for EVP_MD_CTX_new in -l${CRYPTO}... " >&6; }
|
|
||||||
if eval \${$as_ac_Lib+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
@@ -23193,11 +23193,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
#endif
|
|
||||||
-char EVP_MD_CTX_create ();
|
|
||||||
+char EVP_MD_CTX_new ();
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
-return EVP_MD_CTX_create ();
|
|
||||||
+return EVP_MD_CTX_new ();
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -23216,10 +23216,10 @@ eval ac_res=\$$as_ac_Lib
|
|
||||||
$as_echo "$ac_res" >&6; }
|
|
||||||
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
|
|
||||||
|
|
||||||
-$as_echo "#define HAVE_EVP_MD_CTX_CREATE /**/" >>confdefs.h
|
|
||||||
+$as_echo "#define HAVE_EVP_MD_CTX_NEW /**/" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
-$as_echo "#define HAVE_EVP_MD_CTX_DESTROY /**/" >>confdefs.h
|
|
||||||
+$as_echo "#define HAVE_EVP_MD_CTX_FREE /**/" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -23293,7 +23293,7 @@ char SSL_library_init ();
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
-return SSL_library_init ();
|
|
||||||
+return OPENSSL_init_ssl(0, NULL);
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
diff -urNp old/configure.d/config_os_libs2 new/configure.d/config_os_libs2
|
|
||||||
--- old/configure.d/config_os_libs2 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ new/configure.d/config_os_libs2 2017-02-20 10:56:21.041616611 +0100
|
|
||||||
@@ -292,11 +292,11 @@ if test "x$tryopenssl" != "xno" -a "x$tr
|
|
||||||
AC_DEFINE(HAVE_AES_CFB128_ENCRYPT, 1,
|
|
||||||
[Define to 1 if you have the `AES_cfb128_encrypt' function.]))
|
|
||||||
|
|
||||||
- AC_CHECK_LIB(${CRYPTO}, EVP_MD_CTX_create,
|
|
||||||
- AC_DEFINE([HAVE_EVP_MD_CTX_CREATE], [],
|
|
||||||
- [Define to 1 if you have the `EVP_MD_CTX_create' function.])
|
|
||||||
- AC_DEFINE([HAVE_EVP_MD_CTX_DESTROY], [],
|
|
||||||
- [Define to 1 if you have the `EVP_MD_CTX_destroy' function.]))
|
|
||||||
+ AC_CHECK_LIB(${CRYPTO}, EVP_MD_CTX_new,
|
|
||||||
+ AC_DEFINE([HAVE_EVP_MD_CTX_NEW], [],
|
|
||||||
+ [Define to 1 if you have the `EVP_MD_CTX_new' function.])
|
|
||||||
+ AC_DEFINE([HAVE_EVP_MD_CTX_FREE], [],
|
|
||||||
+ [Define to 1 if you have the `EVP_MD_CTX_free' function.]))
|
|
||||||
fi
|
|
||||||
if echo " $transport_result_list " | $GREP "DTLS" > /dev/null; then
|
|
||||||
AC_CHECK_LIB(ssl, DTLSv1_method,
|
|
||||||
@@ -307,7 +307,7 @@ if test "x$tryopenssl" != "xno" -a "x$tr
|
|
||||||
TLSPROG=yes
|
|
||||||
fi
|
|
||||||
if echo " $transport_result_list " | $GREP "TLS" > /dev/null; then
|
|
||||||
- AC_CHECK_LIB(ssl, SSL_library_init,
|
|
||||||
+ AC_CHECK_LIB(ssl, OPENSSL_init_ssl,
|
|
||||||
AC_DEFINE(HAVE_LIBSSL, 1,
|
|
||||||
[Define to 1 if you have the `ssl' library (-lssl).])
|
|
||||||
LIBCRYPTO=" -lssl $LIBCRYPTO",
|
|
||||||
diff -urNp old/include/net-snmp/net-snmp-config.h.in new/include/net-snmp/net-snmp-config.h.in
|
|
||||||
--- old/include/net-snmp/net-snmp-config.h.in 2017-02-20 10:08:16.443522417 +0100
|
|
||||||
+++ new/include/net-snmp/net-snmp-config.h.in 2017-02-20 10:24:05.790584283 +0100
|
|
||||||
@@ -149,11 +149,11 @@
|
|
||||||
/* Define to 1 if you have the `eval_pv' function. */
|
|
||||||
#undef HAVE_EVAL_PV
|
|
||||||
|
|
||||||
-/* Define to 1 if you have the `EVP_MD_CTX_create' function. */
|
|
||||||
-#undef HAVE_EVP_MD_CTX_CREATE
|
|
||||||
+/* Define to 1 if you have the `EVP_MD_CTX_new' function. */
|
|
||||||
+#undef HAVE_EVP_MD_CTX_NEW
|
|
||||||
|
|
||||||
-/* Define to 1 if you have the `EVP_MD_CTX_destroy' function. */
|
|
||||||
-#undef HAVE_EVP_MD_CTX_DESTROY
|
|
||||||
+/* Define to 1 if you have the `EVP_MD_CTX_free' function. */
|
|
||||||
+#undef HAVE_EVP_MD_CTX_FREE
|
|
||||||
|
|
||||||
/* Define if you have EVP_sha224/256 in openssl */
|
|
||||||
#undef HAVE_EVP_SHA224
|
|
||||||
diff -urNp old/snmplib/keytools.c new/snmplib/keytools.c
|
|
||||||
--- old/snmplib/keytools.c 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ new/snmplib/keytools.c 2017-02-20 10:30:27.412068264 +0100
|
|
||||||
@@ -149,8 +149,8 @@ generate_Ku(const oid * hashtype, u_int
|
|
||||||
*/
|
|
||||||
#ifdef NETSNMP_USE_OPENSSL
|
|
||||||
|
|
||||||
-#ifdef HAVE_EVP_MD_CTX_CREATE
|
|
||||||
- ctx = EVP_MD_CTX_create();
|
|
||||||
+#ifdef HAVE_EVP_MD_CTX_NEW
|
|
||||||
+ ctx = EVP_MD_CTX_new();
|
|
||||||
#else
|
|
||||||
ctx = malloc(sizeof(*ctx));
|
|
||||||
if (!EVP_MD_CTX_init(ctx))
|
|
||||||
@@ -259,8 +259,8 @@ generate_Ku(const oid * hashtype, u_int
|
|
||||||
memset(buf, 0, sizeof(buf));
|
|
||||||
#ifdef NETSNMP_USE_OPENSSL
|
|
||||||
if (ctx) {
|
|
||||||
-#ifdef HAVE_EVP_MD_CTX_DESTROY
|
|
||||||
- EVP_MD_CTX_destroy(ctx);
|
|
||||||
+#ifdef HAVE_EVP_MD_CTX_FREE
|
|
||||||
+ EVP_MD_CTX_free(ctx);
|
|
||||||
#else
|
|
||||||
EVP_MD_CTX_cleanup(ctx);
|
|
||||||
free(ctx);
|
|
||||||
diff -urNp old/snmplib/scapi.c new/snmplib/scapi.c
|
|
||||||
--- old/snmplib/scapi.c 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ new/snmplib/scapi.c 2017-02-20 10:27:34.152379515 +0100
|
|
||||||
@@ -486,14 +486,14 @@ sc_hash(const oid * hashtype, size_t has
|
|
||||||
}
|
|
||||||
|
|
||||||
/** initialize the pointer */
|
|
||||||
-#ifdef HAVE_EVP_MD_CTX_CREATE
|
|
||||||
- cptr = EVP_MD_CTX_create();
|
|
||||||
+#ifdef HAVE_EVP_MD_CTX_NEW
|
|
||||||
+ cptr = EVP_MD_CTX_new();
|
|
||||||
#else
|
|
||||||
cptr = malloc(sizeof(*cptr));
|
|
||||||
#if defined(OLD_DES)
|
|
||||||
memset(cptr, 0, sizeof(*cptr));
|
|
||||||
#else
|
|
||||||
- EVP_MD_CTX_init(cptr);
|
|
||||||
+ EVP_MD_CTX_init(&cptr);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
if (!EVP_DigestInit(cptr, hashfn)) {
|
|
||||||
@@ -507,11 +507,11 @@ sc_hash(const oid * hashtype, size_t has
|
|
||||||
/** do the final pass */
|
|
||||||
EVP_DigestFinal(cptr, MAC, &tmp_len);
|
|
||||||
*MAC_len = tmp_len;
|
|
||||||
-#ifdef HAVE_EVP_MD_CTX_DESTROY
|
|
||||||
- EVP_MD_CTX_destroy(cptr);
|
|
||||||
+#ifdef HAVE_EVP_MD_CTX_FREE
|
|
||||||
+ EVP_MD_CTX_free(cptr);
|
|
||||||
#else
|
|
||||||
#if !defined(OLD_DES)
|
|
||||||
- EVP_MD_CTX_cleanup(cptr);
|
|
||||||
+ EVP_MD_CTX_cleanup(&cptr);
|
|
||||||
#endif
|
|
||||||
free(cptr);
|
|
||||||
#endif
|
|
||||||
diff -urNp old/snmplib/snmp_openssl.c new/snmplib/snmp_openssl.c
|
|
||||||
--- old/snmplib/snmp_openssl.c 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ new/snmplib/snmp_openssl.c 2017-02-20 12:46:00.059727928 +0100
|
|
||||||
@@ -47,7 +47,7 @@ void netsnmp_init_openssl(void) {
|
|
||||||
DEBUGMSGTL(("snmp_openssl", "initializing\n"));
|
|
||||||
|
|
||||||
/* Initializing OpenSSL */
|
|
||||||
- SSL_library_init();
|
|
||||||
+ OPENSSL_init_ssl(0, NULL);
|
|
||||||
SSL_load_error_strings();
|
|
||||||
ERR_load_BIO_strings();
|
|
||||||
OpenSSL_add_all_algorithms();
|
|
||||||
@@ -164,11 +164,11 @@ netsnmp_openssl_cert_dump_names(X509 *oc
|
|
||||||
oname_entry = X509_NAME_get_entry(osubj_name, i);
|
|
||||||
netsnmp_assert(NULL != oname_entry);
|
|
||||||
|
|
||||||
- if (oname_entry->value->type != V_ASN1_PRINTABLESTRING)
|
|
||||||
+ if (X509_NAME_ENTRY_get_data(oname_entry)->type != V_ASN1_PRINTABLESTRING)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/** get NID */
|
|
||||||
- onid = OBJ_obj2nid(oname_entry->object);
|
|
||||||
+ onid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(oname_entry));
|
|
||||||
if (onid == NID_undef) {
|
|
||||||
prefix_long = prefix_short = "UNKNOWN";
|
|
||||||
}
|
|
||||||
@@ -179,9 +179,9 @@ netsnmp_openssl_cert_dump_names(X509 *oc
|
|
||||||
|
|
||||||
DEBUGMSGT(("9:cert:dump:names",
|
|
||||||
"[%02d] NID type %d, ASN type %d\n", i, onid,
|
|
||||||
- oname_entry->value->type));
|
|
||||||
+ X509_NAME_ENTRY_get_data(oname_entry)->type));
|
|
||||||
DEBUGMSGT(("9:cert:dump:names", "%s/%s: '%s'\n", prefix_long,
|
|
||||||
- prefix_short, ASN1_STRING_data(oname_entry->value)));
|
|
||||||
+ prefix_short, ASN1_STRING_data(X509_NAME_ENTRY_get_data(oname_entry))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* NETSNMP_FEATURE_REMOVE_CERT_DUMP_NAMES */
|
|
||||||
@@ -470,7 +470,7 @@ netsnmp_openssl_cert_get_hash_type(X509
|
|
||||||
if (NULL == ocert)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
- return _nid2ht(OBJ_obj2nid(ocert->sig_alg->algorithm));
|
|
||||||
+ return _nid2ht(X509_get_signature_nid(ocert));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@@ -487,7 +487,7 @@ netsnmp_openssl_cert_get_fingerprint(X50
|
|
||||||
if (NULL == ocert)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
- nid = OBJ_obj2nid(ocert->sig_alg->algorithm);
|
|
||||||
+ nid = X509_get_signature_nid(ocert);
|
|
||||||
DEBUGMSGT(("9:openssl:fingerprint", "alg %d, cert nid %d (%d)\n", alg, nid,
|
|
||||||
_nid2ht(nid)));
|
|
||||||
|
|
||||||
diff -urNp old/win32/net-snmp/net-snmp-config.h new/win32/net-snmp/net-snmp-config.h
|
|
||||||
--- old/win32/net-snmp/net-snmp-config.h 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ new/win32/net-snmp/net-snmp-config.h 2017-02-20 10:23:20.796778512 +0100
|
|
||||||
@@ -1366,11 +1366,11 @@
|
|
||||||
/* Define to 1 if you have the <openssl/aes.h> header file. */
|
|
||||||
#define HAVE_OPENSSL_AES_H 1
|
|
||||||
|
|
||||||
-/* Define to 1 if you have the `EVP_MD_CTX_create' function. */
|
|
||||||
-#define HAVE_EVP_MD_CTX_CREATE 1
|
|
||||||
+/* Define to 1 if you have the `EVP_MD_CTX_new' function. */
|
|
||||||
+#define HAVE_EVP_MD_CTX_NEW 1
|
|
||||||
|
|
||||||
-/* Define to 1 if you have the `EVP_MD_CTX_destroy' function. */
|
|
||||||
-#define HAVE_EVP_MD_CTX_DESTROY 1
|
|
||||||
+/* Define to 1 if you have the `EVP_MD_CTX_free' function. */
|
|
||||||
+#define HAVE_EVP_MD_CTX_FREE 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `AES_cfb128_encrypt' function. */
|
|
||||||
#define HAVE_AES_CFB128_ENCRYPT 1
|
|
||||||
diff -urNp old/win32/net-snmp/net-snmp-config.h.in new/win32/net-snmp/net-snmp-config.h.in
|
|
||||||
--- old/win32/net-snmp/net-snmp-config.h.in 2014-12-08 21:23:22.000000000 +0100
|
|
||||||
+++ new/win32/net-snmp/net-snmp-config.h.in 2017-02-20 10:22:51.348367754 +0100
|
|
||||||
@@ -1366,11 +1366,11 @@
|
|
||||||
/* Define to 1 if you have the <openssl/aes.h> header file. */
|
|
||||||
#define HAVE_OPENSSL_AES_H 1
|
|
||||||
|
|
||||||
-/* Define to 1 if you have the `EVP_MD_CTX_create' function. */
|
|
||||||
-#define HAVE_EVP_MD_CTX_CREATE 1
|
|
||||||
+/* Define to 1 if you have the `EVP_MD_CTX_new' function. */
|
|
||||||
+#define HAVE_EVP_MD_CTX_NEW 1
|
|
||||||
|
|
||||||
-/* Define to 1 if you have the `EVP_MD_CTX_destroy' function. */
|
|
||||||
-#define HAVE_EVP_MD_CTX_DESTROY 1
|
|
||||||
+/* Define to 1 if you have the `EVP_MD_CTX_free' function. */
|
|
||||||
+#define HAVE_EVP_MD_CTX_FREE 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `AES_cfb128_encrypt' function. */
|
|
||||||
#define HAVE_AES_CFB128_ENCRYPT 1
|
|
@ -1,641 +0,0 @@
|
|||||||
diff -urNp old/configure new/configure
|
|
||||||
--- old/configure 2018-05-29 08:27:03.342448982 +0200
|
|
||||||
+++ new/configure 2018-05-29 08:27:15.317394863 +0200
|
|
||||||
@@ -6412,8 +6412,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="python3"
|
|
||||||
{ $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 old/configure.d/config_os_progs new/configure.d/config_os_progs
|
|
||||||
--- old/configure.d/config_os_progs 2018-05-29 08:27:03.368448865 +0200
|
|
||||||
+++ new/configure.d/config_os_progs 2018-05-29 08:27:15.341394754 +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 old/Makefile.in new/Makefile.in
|
|
||||||
--- old/Makefile.in 2018-05-29 08:27:03.340448991 +0200
|
|
||||||
+++ new/Makefile.in 2018-05-29 08:27:15.307394908 +0200
|
|
||||||
@@ -222,7 +222,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 old/python/netsnmp/client_intf.c new/python/netsnmp/client_intf.c
|
|
||||||
--- old/python/netsnmp/client_intf.c 2018-05-29 08:27:03.390448765 +0200
|
|
||||||
+++ new/python/netsnmp/client_intf.c 2018-05-31 10:28:43.202727021 +0200
|
|
||||||
@@ -1,11 +1,5 @@
|
|
||||||
#include <Python.h>
|
|
||||||
|
|
||||||
-#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 <net-snmp/net-snmp-config.h>
|
|
||||||
#include <net-snmp/net-snmp-includes.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
@@ -978,8 +972,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;
|
|
||||||
}
|
|
||||||
@@ -996,7 +1022,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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1079,11 +1105,11 @@ __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);
|
|
||||||
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);
|
|
||||||
PyObject_SetAttrString(session, "ErrorInd", tmp_for_conversion);
|
|
||||||
Py_DECREF(tmp_for_conversion);
|
|
||||||
}
|
|
||||||
@@ -1588,7 +1614,7 @@ netsnmp_get(PyObject *self, PyObject *ar
|
|
||||||
len = __snprint_value((char *) str_buf, sizeof(str_buf),
|
|
||||||
vars, tp, type, sprintval_flag);
|
|
||||||
str_buf[len] = '\0';
|
|
||||||
- py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf, len);
|
|
||||||
+ py_netsnmp_attr_set_bytes(varbind, "val", (char *) str_buf, len);
|
|
||||||
|
|
||||||
/* save in return tuple as well */
|
|
||||||
if ((type == SNMP_ENDOFMIBVIEW) ||
|
|
||||||
@@ -1808,7 +1834,7 @@ netsnmp_getnext(PyObject *self, PyObject
|
|
||||||
vars, tp, type, sprintval_flag);
|
|
||||||
str_buf[len] = '\0';
|
|
||||||
|
|
||||||
- py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf, len);
|
|
||||||
+ py_netsnmp_attr_set_bytes(varbind, "val", (char *) str_buf, len);
|
|
||||||
|
|
||||||
/* save in return tuple as well */
|
|
||||||
if ((type == SNMP_ENDOFMIBVIEW) ||
|
|
||||||
@@ -2138,7 +2164,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 */
|
|
||||||
@@ -2386,7 +2412,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, sizeof(str_buf),
|
|
||||||
@@ -2527,7 +2553,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;
|
|
||||||
}
|
|
||||||
@@ -2607,10 +2633,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 old/python/netsnmp/client.py new/python/netsnmp/client.py
|
|
||||||
--- old/python/netsnmp/client.py 2018-05-29 08:27:03.390448765 +0200
|
|
||||||
+++ new/python/netsnmp/client.py 2018-05-31 09:27:03.964289879 +0200
|
|
||||||
@@ -1,8 +1,8 @@
|
|
||||||
-import client_intf
|
|
||||||
import string
|
|
||||||
import re
|
|
||||||
import types
|
|
||||||
from sys import stderr
|
|
||||||
+from netsnmp import client_intf
|
|
||||||
|
|
||||||
# control verbosity of error output
|
|
||||||
verbose = 1
|
|
||||||
@@ -35,12 +35,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):
|
|
||||||
@@ -53,7 +53,7 @@ class Varbind(object):
|
|
||||||
def __init__(self, tag=None, iid=None, val=None, type=None):
|
|
||||||
self.tag = STR(tag)
|
|
||||||
self.iid = STR(iid)
|
|
||||||
- self.val = STR(val)
|
|
||||||
+ self.val = val
|
|
||||||
self.type = STR(type)
|
|
||||||
# parse iid out of tag if needed
|
|
||||||
if iid == None and tag != None:
|
|
||||||
@@ -63,7 +63,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 print_str(self):
|
|
||||||
return self.tag, self.iid, self.val, self.type
|
|
||||||
@@ -127,7 +130,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 old/python/netsnmp/__init__.py new/python/netsnmp/__init__.py
|
|
||||||
--- old/python/netsnmp/__init__.py 2018-05-29 08:27:03.390448765 +0200
|
|
||||||
+++ new/python/netsnmp/__init__.py 2018-05-29 08:27:15.362394659 +0200
|
|
||||||
@@ -1 +1 @@
|
|
||||||
-from client import *
|
|
||||||
+from .client import *
|
|
||||||
diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
|
||||||
--- old/python/netsnmp/tests/test.py 2018-05-29 08:27:03.390448765 +0200
|
|
||||||
+++ new/python/netsnmp/tests/test.py 2018-05-29 08:27:15.363394655 +0200
|
|
||||||
@@ -8,7 +8,7 @@ import time
|
|
||||||
|
|
||||||
class BasicTests(unittest.TestCase):
|
|
||||||
def testFuncs(self):
|
|
||||||
- print ""
|
|
||||||
+ print ("")
|
|
||||||
var = netsnmp.Varbind('sysDescr.0')
|
|
||||||
var = netsnmp.Varbind('sysDescr','0')
|
|
||||||
var = netsnmp.Varbind(
|
|
||||||
@@ -19,67 +19,67 @@ class BasicTests(unittest.TestCase):
|
|
||||||
|
|
||||||
var = netsnmp.Varbind('.1.3.6.1.2.1.1.1','0')
|
|
||||||
|
|
||||||
- print "---v1 GET tests -------------------------------------\n"
|
|
||||||
+ print ("---v1 GET tests -------------------------------------\n")
|
|
||||||
res = netsnmp.snmpget(var,
|
|
||||||
Version = 1,
|
|
||||||
DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
|
|
||||||
- print "v1 snmpget result: ", res, "\n"
|
|
||||||
+ print(("v1 snmpget result: ", res, "\n"))
|
|
||||||
|
|
||||||
- print "v1 get var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print(("v1 get var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
- print "---v1 GETNEXT tests-------------------------------------\n"
|
|
||||||
+ print ("---v1 GETNEXT tests-------------------------------------\n")
|
|
||||||
res = netsnmp.snmpgetnext(var,
|
|
||||||
Version = 1,
|
|
||||||
DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
|
|
||||||
- print "v1 snmpgetnext result: ", res, "\n"
|
|
||||||
+ print(("v1 snmpgetnext result: ", res, "\n"))
|
|
||||||
|
|
||||||
- print "v1 getnext var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print(("v1 getnext var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
- print "---v1 SET tests-------------------------------------\n"
|
|
||||||
+ print ("---v1 SET tests-------------------------------------\n")
|
|
||||||
var = netsnmp.Varbind('sysLocation','0', 'my new location')
|
|
||||||
res = netsnmp.snmpset(var,
|
|
||||||
Version = 1,
|
|
||||||
DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
|
|
||||||
- print "v1 snmpset result: ", res, "\n"
|
|
||||||
+ print(("v1 snmpset result: ", res, "\n"))
|
|
||||||
|
|
||||||
- print "v1 set var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print(("v1 set var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
- print "---v1 walk tests-------------------------------------\n"
|
|
||||||
+ print ("---v1 walk tests-------------------------------------\n")
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('system'))
|
|
||||||
|
|
||||||
- print "v1 varlist walk in: "
|
|
||||||
+ print ("v1 varlist walk in: ")
|
|
||||||
for var in vars:
|
|
||||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
res = netsnmp.snmpwalk(vars,
|
|
||||||
Version = 1,
|
|
||||||
DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
- print "v1 snmpwalk result: ", res, "\n"
|
|
||||||
+ print(("v1 snmpwalk result: ", res, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
|
|
||||||
- print "---v1 walk 2-------------------------------------\n"
|
|
||||||
+ print ("---v1 walk 2-------------------------------------\n")
|
|
||||||
|
|
||||||
- print "v1 varbind walk in: "
|
|
||||||
+ print ("v1 varbind walk in: ")
|
|
||||||
var = netsnmp.Varbind('system')
|
|
||||||
res = netsnmp.snmpwalk(var,
|
|
||||||
Version = 1,
|
|
||||||
DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
- print "v1 snmpwalk result (should be = orig): ", res, "\n"
|
|
||||||
+ print(("v1 snmpwalk result (should be = orig): ", res, "\n"))
|
|
||||||
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
- print "---v1 multi-varbind test-------------------------------------\n"
|
|
||||||
+ print ("---v1 multi-varbind test-------------------------------------\n")
|
|
||||||
sess = netsnmp.Session(Version=1,
|
|
||||||
DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
@@ -88,16 +88,16 @@ class BasicTests(unittest.TestCase):
|
|
||||||
netsnmp.Varbind('sysContact', 0),
|
|
||||||
netsnmp.Varbind('sysLocation', 0))
|
|
||||||
vals = sess.get(vars)
|
|
||||||
- print "v1 sess.get result: ", vals, "\n"
|
|
||||||
+ print(("v1 sess.get result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
vals = sess.getnext(vars)
|
|
||||||
- print "v1 sess.getnext result: ", vals, "\n"
|
|
||||||
+ print(("v1 sess.getnext result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
|
||||||
netsnmp.Varbind('sysORLastChange'),
|
|
||||||
@@ -106,28 +106,28 @@ class BasicTests(unittest.TestCase):
|
|
||||||
netsnmp.Varbind('sysORUpTime'))
|
|
||||||
|
|
||||||
vals = sess.getbulk(2, 8, vars)
|
|
||||||
- print "v1 sess.getbulk result: ", vals, "\n"
|
|
||||||
+ print(("v1 sess.getbulk result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
- print "---v1 set2-------------------------------------\n"
|
|
||||||
+ print ("---v1 set2-------------------------------------\n")
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(
|
|
||||||
netsnmp.Varbind('sysLocation', '0', 'my newer location'))
|
|
||||||
res = sess.set(vars)
|
|
||||||
- print "v1 sess.set result: ", res, "\n"
|
|
||||||
+ print(("v1 sess.set result: ", res, "\n"))
|
|
||||||
|
|
||||||
- print "---v1 walk3-------------------------------------\n"
|
|
||||||
+ print ("---v1 walk3-------------------------------------\n")
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('system'))
|
|
||||||
|
|
||||||
vals = sess.walk(vars)
|
|
||||||
- print "v1 sess.walk result: ", vals, "\n"
|
|
||||||
+ print(("v1 sess.walk result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
- print "---v2c get-------------------------------------\n"
|
|
||||||
+ print ("---v2c get-------------------------------------\n")
|
|
||||||
|
|
||||||
sess = netsnmp.Session(Version=2,
|
|
||||||
DestHost='localhost',
|
|
||||||
@@ -140,22 +140,22 @@ class BasicTests(unittest.TestCase):
|
|
||||||
netsnmp.Varbind('sysContact', 0),
|
|
||||||
netsnmp.Varbind('sysLocation', 0))
|
|
||||||
vals = sess.get(vars)
|
|
||||||
- print "v2 sess.get result: ", vals, "\n"
|
|
||||||
+ print(("v2 sess.get result: ", vals, "\n"))
|
|
||||||
|
|
||||||
- print "---v2c getnext-------------------------------------\n"
|
|
||||||
+ print ("---v2c getnext-------------------------------------\n")
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- 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(vars)
|
|
||||||
- print "v2 sess.getnext result: ", vals, "\n"
|
|
||||||
+ print(("v2 sess.getnext result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
- print "\n"
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
+ print ("\n")
|
|
||||||
|
|
||||||
- print "---v2c getbulk-------------------------------------\n"
|
|
||||||
+ print ("---v2c getbulk-------------------------------------\n")
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
|
||||||
netsnmp.Varbind('sysORLastChange'),
|
|
||||||
@@ -164,30 +164,30 @@ class BasicTests(unittest.TestCase):
|
|
||||||
netsnmp.Varbind('sysORUpTime'))
|
|
||||||
|
|
||||||
vals = sess.getbulk(2, 8, vars)
|
|
||||||
- print "v2 sess.getbulk result: ", vals, "\n"
|
|
||||||
+ print(("v2 sess.getbulk result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
- print "\n"
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
+ print ("\n")
|
|
||||||
|
|
||||||
- print "---v2c set-------------------------------------\n"
|
|
||||||
+ print ("---v2c set-------------------------------------\n")
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(
|
|
||||||
netsnmp.Varbind('sysLocation','0','my even newer location'))
|
|
||||||
|
|
||||||
res = sess.set(vars)
|
|
||||||
- print "v2 sess.set result: ", res, "\n"
|
|
||||||
+ print(("v2 sess.set result: ", res, "\n"))
|
|
||||||
|
|
||||||
- print "---v2c walk-------------------------------------\n"
|
|
||||||
+ print ("---v2c walk-------------------------------------\n")
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('system'))
|
|
||||||
|
|
||||||
vals = sess.walk(vars)
|
|
||||||
- print "v2 sess.walk result: ", vals, "\n"
|
|
||||||
+ print(("v2 sess.walk result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
- print "---v3 setup-------------------------------------\n"
|
|
||||||
+ print ("---v3 setup-------------------------------------\n")
|
|
||||||
sess = netsnmp.Session(Version=3,
|
|
||||||
DestHost='localhost',
|
|
||||||
SecLevel='authPriv',
|
|
||||||
@@ -200,22 +200,22 @@ class BasicTests(unittest.TestCase):
|
|
||||||
vars = 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(vars)
|
|
||||||
- print "v3 sess.get result: ", vals, "\n"
|
|
||||||
+ print(("v3 sess.get result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
- print "\n"
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
+ print ("\n")
|
|
||||||
|
|
||||||
- print "---v3 getnext-------------------------------------\n"
|
|
||||||
+ print ("---v3 getnext-------------------------------------\n")
|
|
||||||
|
|
||||||
vals = sess.getnext(vars)
|
|
||||||
- print "v3 sess.getnext result: ", vals, "\n"
|
|
||||||
+ print(("v3 sess.getnext result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
- print "\n"
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
+ print ("\n")
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
|
||||||
netsnmp.Varbind('sysORLastChange'),
|
|
||||||
@@ -224,37 +224,37 @@ class BasicTests(unittest.TestCase):
|
|
||||||
netsnmp.Varbind('sysORUpTime'))
|
|
||||||
|
|
||||||
vals = sess.getbulk(2, 8, vars)
|
|
||||||
- print "v3 sess.getbulk result: ", vals, "\n"
|
|
||||||
+ print(("v3 sess.getbulk result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
- print "\n"
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
+ print ("\n")
|
|
||||||
|
|
||||||
- print "---v3 set-------------------------------------\n"
|
|
||||||
+ print ("---v3 set-------------------------------------\n")
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(
|
|
||||||
netsnmp.Varbind('sysLocation','0', 'my final destination'))
|
|
||||||
res = sess.set(vars)
|
|
||||||
- print "v3 sess.set result: ", res, "\n"
|
|
||||||
+ print(("v3 sess.set result: ", res, "\n"))
|
|
||||||
|
|
||||||
- print "---v3 walk-------------------------------------\n"
|
|
||||||
+ print ("---v3 walk-------------------------------------\n")
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('system'))
|
|
||||||
|
|
||||||
vals = sess.walk(vars)
|
|
||||||
- print "v3 sess.walk result: ", vals, "\n"
|
|
||||||
+ print(("v3 sess.walk result: ", vals, "\n"))
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
|
|
||||||
class SetTests(unittest.TestCase):
|
|
||||||
def testFuncs(self):
|
|
||||||
- print "\n-------------- SET Test Start ----------------------------\n"
|
|
||||||
+ print ("\n-------------- SET Test Start ----------------------------\n")
|
|
||||||
|
|
||||||
var = netsnmp.Varbind('sysUpTime','0')
|
|
||||||
res = netsnmp.snmpget(var, Version = 1, DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
- print "uptime = ", res[0]
|
|
||||||
+ print(("uptime = ", res[0]))
|
|
||||||
|
|
||||||
|
|
||||||
var = netsnmp.Varbind('versionRestartAgent','0', 1)
|
|
||||||
@@ -264,19 +264,19 @@ class SetTests(unittest.TestCase):
|
|
||||||
var = netsnmp.Varbind('sysUpTime','0')
|
|
||||||
res = netsnmp.snmpget(var, Version = 1, DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
- print "uptime = ", res[0]
|
|
||||||
+ print(("uptime = ", res[0]))
|
|
||||||
|
|
||||||
var = netsnmp.Varbind('nsCacheEntry')
|
|
||||||
res = netsnmp.snmpgetnext(var, Version = 1, DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
- print "var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print(("var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
var.val = 65
|
|
||||||
res = netsnmp.snmpset(var, Version = 1, DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
res = netsnmp.snmpget(var, Version = 1, DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
- print "var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
+ print(("var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
|
|
||||||
sess = netsnmp.Session(Version = 1, DestHost='localhost',
|
|
||||||
Community='public')
|
|
||||||
@@ -286,7 +286,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(vars)
|
|
||||||
|
|
||||||
- print "res = ", res
|
|
||||||
+ print(("res = ", res))
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
|
||||||
netsnmp.Varbind('snmpTargetAddrTAddress'),
|
|
||||||
@@ -295,14 +295,14 @@ class SetTests(unittest.TestCase):
|
|
||||||
res = sess.getnext(vars)
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
|
||||||
- print "\n"
|
|
||||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
|
||||||
+ print ("\n")
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116','', 6))
|
|
||||||
|
|
||||||
res = sess.set(vars)
|
|
||||||
|
|
||||||
- print "res = ", res
|
|
||||||
+ print(("res = ", res))
|
|
||||||
|
|
||||||
vars = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
|
||||||
netsnmp.Varbind('snmpTargetAddrTAddress'),
|
|
||||||
@@ -311,10 +311,10 @@ class SetTests(unittest.TestCase):
|
|
||||||
res = sess.getnext(vars)
|
|
||||||
|
|
||||||
for var in vars:
|
|
||||||
- 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 old/python/setup.py new/python/setup.py
|
|
||||||
--- old/python/setup.py 2018-05-29 08:27:03.389448770 +0200
|
|
||||||
+++ new/python/setup.py 2018-05-29 08:27:15.362394659 +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)
|
|
||||||
intree=1
|
|
||||||
|
|
||||||
if intree:
|
|
@ -1,13 +0,0 @@
|
|||||||
diff -urNp old/agent/mibgroup/host/data_access/swinst_rpm.c new/agent/mibgroup/host/data_access/swinst_rpm.c
|
|
||||||
--- old/agent/mibgroup/host/data_access/swinst_rpm.c 2012-10-10 00:28:58.000000000 +0200
|
|
||||||
+++ new/agent/mibgroup/host/data_access/swinst_rpm.c 2017-03-23 13:39:44.695386498 +0100
|
|
||||||
@@ -129,7 +129,7 @@ netsnmp_swinst_arch_load( netsnmp_contai
|
|
||||||
"%s-%s-%s", n, v, r);
|
|
||||||
if (entry->swName_len > sizeof(entry->swName))
|
|
||||||
entry->swName_len = sizeof(entry->swName);
|
|
||||||
- entry->swType = (NULL != strstr( g, "System Environment"))
|
|
||||||
+ entry->swType = (g != NULL && NULL != strstr( g, "System Environment"))
|
|
||||||
? 2 /* operatingSystem */
|
|
||||||
: 4; /* application */
|
|
||||||
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
|||||||
From 0be093688013b90896f2db3204bb20e790d70149 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Bart Van Assche <bvanassche@acm.org>
|
|
||||||
Date: Mon, 27 Apr 2020 08:23:16 -0700
|
|
||||||
Subject: [PATCH] configure: Report supported authentication and encryption
|
|
||||||
modes correctly
|
|
||||||
|
|
||||||
Commit 9e49de2e03b1 ("NEWS: snmplib: AES-192/AES-256 compatibility with SNMP
|
|
||||||
Research / CISCO") removed SHA-128 and SHA-192 support and added support for
|
|
||||||
SHA-224, SHA-256, SHA-384 and SHA-512. Commit 329a9d3c9d63 ("revamp auth/priv
|
|
||||||
protocol constants handling") added support for several AES encryption modes.
|
|
||||||
Make the configure script report which modes are supported.
|
|
||||||
---
|
|
||||||
configure | 15 ++++++++++++++-
|
|
||||||
configure.d/config_os_misc2 | 15 ++++++++++++++-
|
|
||||||
2 files changed, 28 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
|
||||||
index 46402589f..7481ebd07 100755
|
|
||||||
--- a/configure
|
|
||||||
+++ b/configure
|
|
||||||
@@ -26453,7 +26453,13 @@ $as_echo "#define NETSNMP_USE_INTERNAL_CRYPTO 1" >>confdefs.h
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Internal Crypto Support" >&5
|
|
||||||
$as_echo "Internal Crypto Support" >&6; }
|
|
||||||
elif test "x$useopenssl" != "xno" ; then
|
|
||||||
- authmodes="MD5 SHA1 SHA512 SHA384 SHA256 SHA192"
|
|
||||||
+ authmodes="MD5 SHA1"
|
|
||||||
+ if test "x$ac_cv_func_EVP_sha224" = xyes; then
|
|
||||||
+ authmodes="$authmodes SHA224 SHA256"
|
|
||||||
+ fi
|
|
||||||
+ if test "x$ac_cv_func_EVP_sha384" = xyes; then
|
|
||||||
+ authmodes="$authmodes SHA384 SHA512"
|
|
||||||
+ fi
|
|
||||||
if test "x$enable_privacy" != "xno" ; then
|
|
||||||
if test "x$ac_cv_header_openssl_aes_h" = "xyes" ; then
|
|
||||||
encrmodes="DES AES"
|
|
||||||
@@ -26492,6 +26498,13 @@ fi
|
|
||||||
if test "x$enable_md5" = "xno"; then
|
|
||||||
authmodes=`echo $authmodes | $SED 's/MD5 *//;'`
|
|
||||||
fi
|
|
||||||
+if test "x$ac_cv_func_AES_cfb128_encrypt" = xyes ||
|
|
||||||
+ test "x$CRYPTO" = xinternal; then
|
|
||||||
+ encrmodes="$encrmodes AES128"
|
|
||||||
+ if test "x$aes_capable" = "xyes"; then
|
|
||||||
+ encrmodes="$encrmodes AES192 AES192C AES256 AES256C"
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/configure.d/config_os_misc2 b/configure.d/config_os_misc2
|
|
||||||
index 1df9bf0a2..be0bccec0 100644
|
|
||||||
--- a/configure.d/config_os_misc2
|
|
||||||
+++ b/configure.d/config_os_misc2
|
|
||||||
@@ -53,7 +53,13 @@ if test "x$CRYPTO" = "xinternal" ; then
|
|
||||||
AC_DEFINE(NETSNMP_USE_INTERNAL_CRYPTO, 1, "Define if internal cryptography code should be used")
|
|
||||||
AC_MSG_RESULT(Internal Crypto Support)
|
|
||||||
elif test "x$useopenssl" != "xno" ; then
|
|
||||||
- authmodes="MD5 SHA1 SHA512 SHA384 SHA256 SHA192"
|
|
||||||
+ authmodes="MD5 SHA1"
|
|
||||||
+ if test "x$ac_cv_func_EVP_sha224" = xyes; then
|
|
||||||
+ authmodes="$authmodes SHA224 SHA256"
|
|
||||||
+ fi
|
|
||||||
+ if test "x$ac_cv_func_EVP_sha384" = xyes; then
|
|
||||||
+ authmodes="$authmodes SHA384 SHA512"
|
|
||||||
+ fi
|
|
||||||
if test "x$enable_privacy" != "xno" ; then
|
|
||||||
if test "x$ac_cv_header_openssl_aes_h" = "xyes" ; then
|
|
||||||
encrmodes="DES AES"
|
|
||||||
@@ -86,6 +92,13 @@ fi
|
|
||||||
if test "x$enable_md5" = "xno"; then
|
|
||||||
authmodes=`echo $authmodes | $SED 's/MD5 *//;'`
|
|
||||||
fi
|
|
||||||
+if test "x$ac_cv_func_AES_cfb128_encrypt" = xyes ||
|
|
||||||
+ test "x$CRYPTO" = xinternal; then
|
|
||||||
+ encrmodes="$encrmodes AES128"
|
|
||||||
+ if test "x$aes_capable" = "xyes"; then
|
|
||||||
+ encrmodes="$encrmodes AES192 AES192C AES256 AES256C"
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
AC_SUBST(LNETSNMPLIBS)
|
|
||||||
AC_SUBST(LAGENTLIBS)
|
|
||||||
|
|
||||||
|
|
||||||
diff -urNp a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
|
||||||
--- a/net-snmp-create-v3-user.in 2020-06-15 12:59:05.117432700 +0200
|
|
||||||
+++ b/net-snmp-create-v3-user.in 2020-06-15 13:01:36.151905241 +0200
|
|
||||||
@@ -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
|
|
||||||
;;
|
|
@ -1,122 +0,0 @@
|
|||||||
diff -urNp a/agent/agent_trap.c b/agent/agent_trap.c
|
|
||||||
--- a/agent/agent_trap.c 2019-02-13 13:10:36.862269252 +0100
|
|
||||||
+++ b/agent/agent_trap.c 2019-02-13 15:02:11.396042356 +0100
|
|
||||||
@@ -174,6 +174,11 @@ _trap_version_incr(int version)
|
|
||||||
case SNMP_VERSION_3:
|
|
||||||
++_v2_sessions;
|
|
||||||
break;
|
|
||||||
+#ifdef USING_AGENTX_PROTOCOL_MODULE
|
|
||||||
+ case AGENTX_VERSION_1:
|
|
||||||
+ /* agentx registers in sinks, no need to count */
|
|
||||||
+ break;
|
|
||||||
+#endif
|
|
||||||
default:
|
|
||||||
snmp_log(LOG_ERR, "unknown snmp version %d\n", version);
|
|
||||||
}
|
|
||||||
@@ -201,6 +206,11 @@ _trap_version_decr(int version)
|
|
||||||
_v2_sessions = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
+#ifdef USING_AGENTX_PROTOCOL_MODULE
|
|
||||||
+ case AGENTX_VERSION_1:
|
|
||||||
+ /* agentx registers in sinks, no need to count */
|
|
||||||
+ break;
|
|
||||||
+#endif
|
|
||||||
default:
|
|
||||||
snmp_log(LOG_ERR, "unknown snmp version %d\n", version);
|
|
||||||
}
|
|
||||||
diff -urNp old/agent/mibgroup/agentx/master.c new/agent/mibgroup/agentx/master.c
|
|
||||||
--- old/agent/mibgroup/agentx/master.c 2019-04-03 12:13:55.115769783 +0200
|
|
||||||
+++ new/agent/mibgroup/agentx/master.c 2019-04-10 09:49:53.277168497 +0200
|
|
||||||
@@ -280,6 +280,11 @@ agentx_got_response(int operation,
|
|
||||||
netsnmp_free_delegated_cache(cache);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
+ case NETSNMP_CALLBACK_OP_RESEND:
|
|
||||||
+ DEBUGMSGTL(("agentx/master", "resend on session %8p req=0x%x\n",
|
|
||||||
+ session, (unsigned)reqid));
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
|
|
||||||
/*
|
|
||||||
* This session is alive
|
|
||||||
diff -urNp old/snmplib/snmp_api.c new/snmplib/snmp_api.c
|
|
||||||
--- old/snmplib/snmp_api.c 2019-04-24 00:28:34.904357292 +0200
|
|
||||||
+++ new/snmplib/snmp_api.c 2019-04-24 00:24:40.101830685 +0200
|
|
||||||
@@ -352,6 +352,7 @@ static int snmpv3_build(u_char ** p
|
|
||||||
netsnmp_pdu *pdu);
|
|
||||||
static int snmp_parse_version(u_char *, size_t);
|
|
||||||
static int snmp_resend_request(struct session_list *slp,
|
|
||||||
+ netsnmp_request_list *orp,
|
|
||||||
netsnmp_request_list *rp,
|
|
||||||
int incr_retries);
|
|
||||||
static void register_default_handlers(void);
|
|
||||||
@@ -5717,7 +5718,7 @@ _sess_process_packet_handle_pdu(void *se
|
|
||||||
* * inifinite resend
|
|
||||||
*/
|
|
||||||
if (rp->retries <= sp->retries) {
|
|
||||||
- snmp_resend_request(slp, rp, TRUE);
|
|
||||||
+ snmp_resend_request(slp, orp, rp, TRUE);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
/* We're done with retries, so no longer waiting for a response */
|
|
||||||
@@ -6662,9 +6663,22 @@ snmp_timeout(void)
|
|
||||||
snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
+static void
|
|
||||||
+remove_request(struct snmp_internal_session *isp,
|
|
||||||
+ netsnmp_request_list *orp, netsnmp_request_list *rp)
|
|
||||||
+{
|
|
||||||
+ if (orp)
|
|
||||||
+ orp->next_request = rp->next_request;
|
|
||||||
+ else
|
|
||||||
+ isp->requests = rp->next_request;
|
|
||||||
+ if (isp->requestsEnd == rp)
|
|
||||||
+ isp->requestsEnd = orp;
|
|
||||||
+ snmp_free_pdu(rp->pdu);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static int
|
|
||||||
-snmp_resend_request(struct session_list *slp, netsnmp_request_list *rp,
|
|
||||||
- int incr_retries)
|
|
||||||
+snmp_resend_request(struct session_list *slp, netsnmp_request_list *orp,
|
|
||||||
+ netsnmp_request_list *rp, int incr_retries)
|
|
||||||
{
|
|
||||||
struct snmp_internal_session *isp;
|
|
||||||
netsnmp_session *sp;
|
|
||||||
@@ -6731,9 +6745,11 @@ snmp_resend_request(struct session_list
|
|
||||||
sp->s_snmp_errno = SNMPERR_BAD_SENDTO;
|
|
||||||
sp->s_errno = errno;
|
|
||||||
snmp_set_detail(strerror(errno));
|
|
||||||
- if (rp->callback)
|
|
||||||
+ if (rp->callback) {
|
|
||||||
rp->callback(NETSNMP_CALLBACK_OP_SEND_FAILED, sp,
|
|
||||||
rp->pdu->reqid, rp->pdu, rp->cb_data);
|
|
||||||
+ remove_request(isp, orp, rp);
|
|
||||||
+ }
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
netsnmp_get_monotonic_clock(&now);
|
|
||||||
@@ -6813,19 +6829,12 @@ snmp_sess_timeout(void *sessp)
|
|
||||||
callback(NETSNMP_CALLBACK_OP_TIMED_OUT, sp,
|
|
||||||
rp->pdu->reqid, rp->pdu, magic);
|
|
||||||
}
|
|
||||||
- if (orp)
|
|
||||||
- orp->next_request = rp->next_request;
|
|
||||||
- else
|
|
||||||
- isp->requests = rp->next_request;
|
|
||||||
- if (isp->requestsEnd == rp)
|
|
||||||
- isp->requestsEnd = orp;
|
|
||||||
- snmp_free_pdu(rp->pdu);
|
|
||||||
+ remove_request(isp, orp, rp);
|
|
||||||
freeme = rp;
|
|
||||||
continue; /* don't update orp below */
|
|
||||||
} else {
|
|
||||||
- if (snmp_resend_request(slp, rp, TRUE)) {
|
|
||||||
+ if (snmp_resend_request(slp, orp, rp, TRUE))
|
|
||||||
break;
|
|
||||||
- }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
orp = rp;
|
|
@ -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;
|
|
||||||
|
|
@ -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
|
|
@ -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)";
|
|
@ -1,68 +0,0 @@
|
|||||||
diff -urNp a/agent/mibgroup/disman/event/mteTrigger.c b/agent/mibgroup/disman/event/mteTrigger.c
|
|
||||||
--- a/agent/mibgroup/disman/event/mteTrigger.c 2018-09-27 10:43:38.722444233 +0200
|
|
||||||
+++ b/agent/mibgroup/disman/event/mteTrigger.c 2018-09-27 11:01:46.503253963 +0200
|
|
||||||
@@ -1012,7 +1012,7 @@ mteTrigger_run( unsigned int reg, void *
|
|
||||||
* 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 *
|
|
||||||
* 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 -urNp a/agent/mibgroup/hardware/cpu/cpu_linux.c b/agent/mibgroup/hardware/cpu/cpu_linux.c
|
|
||||||
--- a/agent/mibgroup/hardware/cpu/cpu_linux.c 2018-09-27 10:43:38.697444449 +0200
|
|
||||||
+++ b/agent/mibgroup/hardware/cpu/cpu_linux.c 2018-09-27 11:12:07.109024625 +0200
|
|
||||||
@@ -122,6 +122,7 @@ int netsnmp_cpu_arch_load( netsnmp_cache
|
|
||||||
bsize = getpagesize()-1;
|
|
||||||
buff = (char*)malloc(bsize+1);
|
|
||||||
if (buff == NULL) {
|
|
||||||
+ close(statfd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff -urNp a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
|
|
||||||
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c 2018-09-27 10:43:38.711444328 +0200
|
|
||||||
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c 2018-09-27 11:16:45.532231535 +0200
|
|
||||||
@@ -543,15 +543,18 @@ netsnmp_access_ipaddress_extra_prefix_in
|
|
||||||
status = send (sd, &req, req.nlhdr.nlmsg_len, 0);
|
|
||||||
if (status < 0) {
|
|
||||||
snmp_log(LOG_ERR, "could not send netlink request\n");
|
|
||||||
+ close(sd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
status = recv (sd, buf, sizeof(buf), 0);
|
|
||||||
if (status < 0) {
|
|
||||||
snmp_log (LOG_ERR, "could not recieve netlink request\n");
|
|
||||||
+ close(sd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (status == 0) {
|
|
||||||
snmp_log (LOG_ERR, "nothing to read\n");
|
|
||||||
+ close(sd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
for (nlmp = (struct nlmsghdr *)buf; status > sizeof(*nlmp); ){
|
|
||||||
@@ -561,11 +564,13 @@ netsnmp_access_ipaddress_extra_prefix_in
|
|
||||||
|
|
||||||
if (req_len < 0 || len > status) {
|
|
||||||
snmp_log (LOG_ERR, "invalid netlink message\n");
|
|
||||||
+ close(sd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!NLMSG_OK (nlmp, status)) {
|
|
||||||
snmp_log (LOG_ERR, "invalid NLMSG message\n");
|
|
||||||
+ close(sd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
rtmp = (struct ifaddrmsg *)NLMSG_DATA(nlmp);
|
|
@ -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
|
|
@ -1,26 +0,0 @@
|
|||||||
From cd09fd82522861830aaf9d237b26eef5f9ba50d2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Bart Van Assche <bvanassche@acm.org>
|
|
||||||
Date: Wed, 21 Nov 2018 20:47:42 -0800
|
|
||||||
Subject: [PATCH] MIB-II: Only log once that opening /proc/net/if_inet6 failed
|
|
||||||
|
|
||||||
If IPv6 has been disabled (ipv6.disable=1) then opening /proc/net/if_inet6
|
|
||||||
fails. Only log this once instead of thousand of times a day.
|
|
||||||
|
|
||||||
Reported-by: Fif <lefif@users.sourceforge.net>
|
|
||||||
---
|
|
||||||
agent/mibgroup/ip-mib/data_access/ipaddress_linux.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
|
|
||||||
index 5ddead3e0..280575ce3 100644
|
|
||||||
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
|
|
||||||
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
|
|
||||||
@@ -234,7 +234,7 @@ _load_v6(netsnmp_container *container, int idx_offset)
|
|
||||||
|
|
||||||
#define PROCFILE "/proc/net/if_inet6"
|
|
||||||
if (!(in = fopen(PROCFILE, "r"))) {
|
|
||||||
- snmp_log_perror("ipaddress_linux: could not open " PROCFILE);
|
|
||||||
+ NETSNMP_LOGONCE((LOG_ERR, "ipaddress_linux: could not open " PROCFILE));
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
diff -urNp a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
|
|
||||||
--- a/snmplib/transports/snmpUDPIPv6Domain.c 2019-01-24 09:03:05.606441678 +0100
|
|
||||||
+++ b/snmplib/transports/snmpUDPIPv6Domain.c 2019-02-07 08:59:26.434587244 +0100
|
|
||||||
@@ -464,7 +464,7 @@ netsnmp_udp6_transport(const struct sock
|
|
||||||
NETSNMP_DS_LIB_CLIENT_ADDR);
|
|
||||||
if (client_socket) {
|
|
||||||
struct sockaddr_in6 client_addr;
|
|
||||||
- if(!netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL)) {
|
|
||||||
+ if(netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL)) {
|
|
||||||
return netsnmp_udp6_transport_with_source(addr, local,
|
|
||||||
&client_addr);
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
diff -urNp a/snmplib/keytools.c b/snmplib/keytools.c
|
|
||||||
--- a/snmplib/keytools.c 2018-11-27 15:04:59.931217024 +0100
|
|
||||||
+++ b/snmplib/keytools.c 2018-11-27 15:07:50.765672477 +0100
|
|
||||||
@@ -187,25 +187,25 @@ generate_Ku(const oid * hashtype, u_int
|
|
||||||
#else
|
|
||||||
ctx = malloc(sizeof(*ctx));
|
|
||||||
if (!EVP_MD_CTX_init(ctx))
|
|
||||||
- return SNMPERR_GENERR;
|
|
||||||
+ QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
|
|
||||||
#endif
|
|
||||||
if (!EVP_DigestInit(ctx, hashfn))
|
|
||||||
- return SNMPERR_GENERR;
|
|
||||||
+ QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
|
|
||||||
|
|
||||||
#elif NETSNMP_USE_INTERNAL_CRYPTO
|
|
||||||
#ifndef NETSNMP_DISABLE_MD5
|
|
||||||
if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
|
|
||||||
if (!MD5_Init(&cmd5))
|
|
||||||
- return SNMPERR_GENERR;
|
|
||||||
+ QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
|
|
||||||
cryptotype = TYPE_MD5;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
|
|
||||||
if (!SHA1_Init(&csha1))
|
|
||||||
- return SNMPERR_GENERR;
|
|
||||||
+ QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
|
|
||||||
cryptotype = TYPE_SHA1;
|
|
||||||
} else {
|
|
||||||
- return (SNMPERR_GENERR);
|
|
||||||
+ QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
MDbegin(&MD);
|
|
||||||
diff -urNp a/snmplib/scapi.c b/snmplib/scapi.c
|
|
||||||
--- a/snmplib/scapi.c 2018-11-27 15:04:59.931217024 +0100
|
|
||||||
+++ b/snmplib/scapi.c 2018-11-27 15:14:37.587393891 +0100
|
|
||||||
@@ -967,7 +967,8 @@ sc_hash_type(int auth_type, const u_char
|
|
||||||
#endif
|
|
||||||
if (!EVP_DigestInit(cptr, hashfn)) {
|
|
||||||
/* requested hash function is not available */
|
|
||||||
- return SNMPERR_SC_NOT_CONFIGURED;
|
|
||||||
+ rval = SNMPERR_SC_NOT_CONFIGURED;
|
|
||||||
+ goto sc_hash_type_quit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** pass the data */
|
|
||||||
@@ -976,6 +977,8 @@ sc_hash_type(int auth_type, const u_char
|
|
||||||
/** do the final pass */
|
|
||||||
EVP_DigestFinal(cptr, MAC, &tmp_len);
|
|
||||||
*MAC_len = tmp_len;
|
|
||||||
+
|
|
||||||
+sc_hash_type_quit:
|
|
||||||
#if defined(HAVE_EVP_MD_CTX_FREE)
|
|
||||||
EVP_MD_CTX_free(cptr);
|
|
||||||
#elif defined(HAVE_EVP_MD_CTX_DESTROY)
|
|
@ -1,404 +0,0 @@
|
|||||||
diff -urNp a/agent/mibgroup/host/data_access/swinst_darwin.c b/agent/mibgroup/host/data_access/swinst_darwin.c
|
|
||||||
--- a/agent/mibgroup/host/data_access/swinst_darwin.c 2019-03-21 09:39:04.745698692 +0100
|
|
||||||
+++ b/agent/mibgroup/host/data_access/swinst_darwin.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
@@ -1,400 +0,0 @@
|
|
||||||
-/*
|
|
||||||
- * swinst.c : hrSWInstalledTable data access
|
|
||||||
- */
|
|
||||||
-/*
|
|
||||||
- * Copyright (C) 2007 Apple, Inc. All rights reserved.
|
|
||||||
- * Use is subject to license terms specified in the COPYING file
|
|
||||||
- * distributed with the Net-SNMP package.
|
|
||||||
- */
|
|
||||||
-#include <net-snmp/net-snmp-config.h>
|
|
||||||
-#include <net-snmp/net-snmp-features.h>
|
|
||||||
-#include <net-snmp/net-snmp-includes.h>
|
|
||||||
-#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
||||||
-#include <net-snmp/library/container.h>
|
|
||||||
-#include <net-snmp/library/dir_utils.h>
|
|
||||||
-#include <net-snmp/library/snmp_debug.h>
|
|
||||||
-#include <net-snmp/data_access/swinst.h>
|
|
||||||
-#include "swinst_private.h"
|
|
||||||
-
|
|
||||||
-#include <stdlib.h>
|
|
||||||
-#include <unistd.h>
|
|
||||||
-#include <dirent.h>
|
|
||||||
-#include <sys/stat.h>
|
|
||||||
-
|
|
||||||
-#define __APPLE_API_EVOLVING 1
|
|
||||||
-#include <sys/acl.h> /* or else CoreFoundation.h barfs */
|
|
||||||
-#undef __APPLE_API_EVOLVING
|
|
||||||
-
|
|
||||||
-#include <CoreFoundation/CoreFoundation.h>
|
|
||||||
-#include <ApplicationServices/ApplicationServices.h>
|
|
||||||
-
|
|
||||||
-netsnmp_feature_require(container_directory)
|
|
||||||
-netsnmp_feature_require(date_n_time)
|
|
||||||
-
|
|
||||||
-/* ---------------------------------------------------------------------
|
|
||||||
- */
|
|
||||||
-static int _add_applications_in_dir(netsnmp_container *, const char* path);
|
|
||||||
-static int32_t _index;
|
|
||||||
-static int _check_bundled_app(CFURLRef currentURL, CFStringRef *name,
|
|
||||||
- CFStringRef *info, const char* path);
|
|
||||||
-static int _check_classic_app(CFURLRef currentURL, CFStringRef *name,
|
|
||||||
- CFStringRef *info, const char* path);
|
|
||||||
-static netsnmp_container *dirs = NULL;
|
|
||||||
-
|
|
||||||
-/* ---------------------------------------------------------------------
|
|
||||||
- */
|
|
||||||
-void
|
|
||||||
-netsnmp_swinst_arch_init( void )
|
|
||||||
-{
|
|
||||||
- struct stat stat_buf;
|
|
||||||
- const char *default_dirs[] = {
|
|
||||||
- "/Applications",
|
|
||||||
- "/Applications (Mac OS 9)",
|
|
||||||
- "/System/Library/CoreServices",
|
|
||||||
- "/System/Library/Extensions",
|
|
||||||
- "/System/Library/Services"
|
|
||||||
-#ifdef TEST
|
|
||||||
- , "/Developer/Applications"
|
|
||||||
- , "/Volumes/audX/Applications (Mac OS 9)"
|
|
||||||
-#endif
|
|
||||||
- };
|
|
||||||
- int i, count = sizeof(default_dirs)/sizeof(default_dirs[0]);
|
|
||||||
-
|
|
||||||
- /*
|
|
||||||
- * create the container, if needed
|
|
||||||
- */
|
|
||||||
- if (NULL == dirs) {
|
|
||||||
- dirs = netsnmp_container_find("directory_container:cstring");
|
|
||||||
- if (NULL == dirs) {
|
|
||||||
- snmp_log(LOG_ERR, "couldn't allocate container for dir list\n");
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
- dirs->container_name = strdup("directory search list");
|
|
||||||
- netsnmp_binary_array_options_set(dirs, 1, CONTAINER_KEY_UNSORTED);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- /*
|
|
||||||
- * add dirs
|
|
||||||
- */
|
|
||||||
- for(i = 0; i < count; ++i) {
|
|
||||||
- char * tmp;
|
|
||||||
- /** xxx: get/save the last mod date? */
|
|
||||||
- if(-1 == stat(default_dirs[i], &stat_buf)) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "skipping dir %s\n",
|
|
||||||
- default_dirs[i]));
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "adding dir %s\n",
|
|
||||||
- default_dirs[i]));
|
|
||||||
- tmp = strdup(default_dirs[i]);
|
|
||||||
- if (NULL == tmp) {
|
|
||||||
- snmp_log(LOG_ERR,"strdup failed\n");
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
- CONTAINER_INSERT(dirs, tmp);
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-void
|
|
||||||
-netsnmp_swinst_arch_shutdown( void )
|
|
||||||
-{
|
|
||||||
- netsnmp_directory_container_free(dirs);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* ---------------------------------------------------------------------
|
|
||||||
- */
|
|
||||||
-
|
|
||||||
-int
|
|
||||||
-netsnmp_swinst_arch_load( netsnmp_container *container, u_int flags )
|
|
||||||
-{
|
|
||||||
- netsnmp_iterator *it;
|
|
||||||
- const char *dir;
|
|
||||||
- int rc;
|
|
||||||
-
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "load\n"));
|
|
||||||
-
|
|
||||||
- if (NULL == dirs) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "no dirs to scan!\n"));
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- _index = 0;
|
|
||||||
-
|
|
||||||
- it = CONTAINER_ITERATOR(dirs);
|
|
||||||
- for (dir = ITERATOR_FIRST(it); dir; dir = ITERATOR_NEXT(it)) {
|
|
||||||
- rc = _add_applications_in_dir(container, dir);
|
|
||||||
- }
|
|
||||||
- ITERATOR_RELEASE(it);
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "loaded %d apps\n",_index));
|
|
||||||
-
|
|
||||||
- return 0;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-_dump_flags(u_long flags)
|
|
||||||
-{
|
|
||||||
- static struct {
|
|
||||||
- const char*name;
|
|
||||||
- u_long bits;
|
|
||||||
- } names[] = {
|
|
||||||
- { "kLSItemInfoIsPlainFile", 0x00000001 },
|
|
||||||
- { "kLSItemInfoIsPackage", 0x00000002 },
|
|
||||||
- { "kLSItemInfoIsApplication", 0x00000004 },
|
|
||||||
- { "kLSItemInfoIsContainer", 0x00000008 },
|
|
||||||
- { "kLSItemInfoIsAliasFile", 0x00000010 },
|
|
||||||
- { "kLSItemInfoIsSymlink", 0x00000020 },
|
|
||||||
- { "kLSItemInfoIsInvisible", 0x00000040 },
|
|
||||||
- { "kLSItemInfoIsNativeApp", 0x00000080 },
|
|
||||||
- { "kLSItemInfoIsClassicApp", 0x00000100 },
|
|
||||||
- { "kLSItemInfoAppPrefersNative", 0x00000200 },
|
|
||||||
- { "kLSItemInfoAppPrefersClassic", 0x00000400 },
|
|
||||||
- { "kLSItemInfoAppIsScriptable", 0x00000800 },
|
|
||||||
- { "kLSItemInfoIsVolume", 0x00001000 },
|
|
||||||
- { "kLSItemInfoExtensionIsHidden", 0x00100000 }
|
|
||||||
- };
|
|
||||||
- int i, count = sizeof(names)/sizeof(names[0]);
|
|
||||||
-
|
|
||||||
- for(i = 0; i < count; ++i) {
|
|
||||||
- if (flags & names[i].bits) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin:flags", "\t%s\n",
|
|
||||||
- names[i].name));
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static int
|
|
||||||
-_add_applications_in_dir(netsnmp_container *container, const char* path)
|
|
||||||
-{
|
|
||||||
- netsnmp_container *files;
|
|
||||||
- netsnmp_iterator *it;
|
|
||||||
- const char *file;
|
|
||||||
- netsnmp_swinst_entry *entry = NULL;
|
|
||||||
- struct stat stat_buf;
|
|
||||||
- size_t date_len;
|
|
||||||
- u_char *date_buf;
|
|
||||||
- int rc = 0;
|
|
||||||
-
|
|
||||||
- CFStringRef currentPath = NULL;
|
|
||||||
- CFURLRef currentURL = NULL;
|
|
||||||
- LSItemInfoRecord itemInfoRecord;
|
|
||||||
- CFStringRef prodName = NULL;
|
|
||||||
- CFStringRef version = NULL;
|
|
||||||
-
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", " adding files from %s\n", path));
|
|
||||||
- files = netsnmp_directory_container_read(NULL, path, 0);
|
|
||||||
- if (NULL == files) {
|
|
||||||
- snmp_log(LOG_ERR, "swinst: could not read directory %s\n", path);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- it = CONTAINER_ITERATOR(files);
|
|
||||||
- if (NULL == it) {
|
|
||||||
- snmp_log(LOG_ERR, "could not get iterator\n");
|
|
||||||
- netsnmp_directory_container_free(files);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- for (file = ITERATOR_FIRST(it);
|
|
||||||
- file;
|
|
||||||
- file = ITERATOR_NEXT(it),
|
|
||||||
- CFRelease(currentPath),
|
|
||||||
- CFRelease(currentURL)) {
|
|
||||||
-
|
|
||||||
- int rc2 = 0;
|
|
||||||
-
|
|
||||||
- currentPath =
|
|
||||||
- CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, file,
|
|
||||||
- kCFStringEncodingUTF8,
|
|
||||||
- kCFAllocatorNull);
|
|
||||||
- currentURL =
|
|
||||||
- CFURLCreateWithFileSystemPath(kCFAllocatorDefault, currentPath,
|
|
||||||
- kCFURLPOSIXPathStyle, true);
|
|
||||||
- LSCopyItemInfoForURL(currentURL,
|
|
||||||
- kLSRequestBasicFlagsOnly|kLSRequestAppTypeFlags,
|
|
||||||
- &itemInfoRecord);
|
|
||||||
- if((0 == itemInfoRecord.flags) ||
|
|
||||||
- (kLSItemInfoIsPlainFile == itemInfoRecord.flags) ||
|
|
||||||
- (itemInfoRecord.flags & kLSItemInfoIsInvisible) ||
|
|
||||||
- (itemInfoRecord.flags & kLSItemInfoIsAliasFile)) {
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
- /** recurse on non-application containers (i.e. directory) */
|
|
||||||
- if ((itemInfoRecord.flags & kLSItemInfoIsContainer) &&
|
|
||||||
- (!(itemInfoRecord.flags & kLSItemInfoIsApplication))) {
|
|
||||||
- netsnmp_directory_container_read(files, file, 0);
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- /** skip any other non-application files */
|
|
||||||
- if (!(itemInfoRecord.flags & kLSItemInfoIsApplication)) {
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if ((itemInfoRecord.flags & kLSItemInfoIsPackage) ||
|
|
||||||
- (itemInfoRecord.flags & kLSItemInfoIsContainer)) {
|
|
||||||
- rc2 = _check_bundled_app(currentURL, &prodName, &version, file);
|
|
||||||
- }
|
|
||||||
- else if ((itemInfoRecord.flags & kLSItemInfoIsClassicApp) ||
|
|
||||||
- (itemInfoRecord.flags & kLSItemInfoIsPlainFile)) {
|
|
||||||
- rc2 = _check_classic_app(currentURL, &prodName, &version, file);
|
|
||||||
- } else {
|
|
||||||
- snmp_log(LOG_ERR,"swinst shouldn't get here: %s\n", file);
|
|
||||||
- _dump_flags(itemInfoRecord.flags);
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
- if (rc2) { /* not an app. if directory, recurse; else continue */
|
|
||||||
- _dump_flags(itemInfoRecord.flags);
|
|
||||||
- if (1 == rc2)
|
|
||||||
- netsnmp_directory_container_read(files, file, 0);
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- /*
|
|
||||||
- * allocate entry
|
|
||||||
- */
|
|
||||||
- entry = netsnmp_swinst_entry_create(++_index);
|
|
||||||
- if (NULL == entry) {
|
|
||||||
- snmp_log(LOG_ERR, "error creating swinst entry\n");
|
|
||||||
- rc = -1;
|
|
||||||
- SNMP_CFRelease(prodName);
|
|
||||||
- SNMP_CFRelease(version);
|
|
||||||
- CFRelease(currentPath);
|
|
||||||
- CFRelease(currentURL);
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- entry->swName_len =
|
|
||||||
- snprintf(entry->swName, sizeof(entry->swName),
|
|
||||||
- "%s %s", CFStringGetCStringPtr(prodName,0),
|
|
||||||
- CFStringGetCStringPtr(version,0));
|
|
||||||
- if (entry->swName_len >= sizeof(entry->swName))
|
|
||||||
- entry->swName_len = sizeof(entry->swName)-1;
|
|
||||||
-
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "\t%s %s\n", file, entry->swName));
|
|
||||||
-
|
|
||||||
- /** get the last mod date */
|
|
||||||
- if(stat(file, &stat_buf) != -1) {
|
|
||||||
- date_buf = date_n_time(&stat_buf.st_mtime, &date_len);
|
|
||||||
- entry->swDate_len = date_len;
|
|
||||||
- memcpy(entry->swDate, date_buf, entry->swDate_len);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- CONTAINER_INSERT(container, entry);
|
|
||||||
- entry = NULL;
|
|
||||||
- SNMP_CFRelease(prodName);
|
|
||||||
- SNMP_CFRelease(version);
|
|
||||||
- }
|
|
||||||
- ITERATOR_RELEASE(it);
|
|
||||||
- netsnmp_directory_container_free(files);
|
|
||||||
-
|
|
||||||
- return rc;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static int
|
|
||||||
-_check_bundled_app(CFURLRef currentURL, CFStringRef *prodName,
|
|
||||||
- CFStringRef *version, const char* file)
|
|
||||||
-{
|
|
||||||
- CFBundleRef theBundle = NULL;
|
|
||||||
- CFDictionaryRef infoDict = NULL;
|
|
||||||
-
|
|
||||||
- if ((NULL == prodName) || (NULL == version))
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- theBundle = CFBundleCreate (kCFAllocatorDefault, currentURL);
|
|
||||||
- if(theBundle == NULL)
|
|
||||||
- return -1; /* not a bundle */
|
|
||||||
-
|
|
||||||
- infoDict = CFBundleGetInfoDictionary(theBundle);
|
|
||||||
- if(0 == CFDictionaryGetCount(infoDict)) {
|
|
||||||
- SNMP_CFRelease(theBundle);
|
|
||||||
- return 1; /* directory */
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- *prodName = (CFStringRef)
|
|
||||||
- CFDictionaryGetValue (infoDict, CFSTR("CFBundleName"));
|
|
||||||
- if (NULL == *prodName) {
|
|
||||||
- *prodName = (CFStringRef)
|
|
||||||
- CFDictionaryGetValue (infoDict, CFSTR("CFBundleDisplayName"));
|
|
||||||
- if (NULL == *prodName) {
|
|
||||||
- *prodName = (CFStringRef) CFDictionaryGetValue (infoDict,
|
|
||||||
- CFSTR("CFBundleExecutable"));
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- if(NULL == *prodName) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "\tmissing name: %s\n",file));
|
|
||||||
- /*CFShow(infoDict);*/
|
|
||||||
- SNMP_CFRelease(theBundle);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- *version = (CFStringRef)
|
|
||||||
- CFDictionaryGetValue (infoDict, CFSTR("CFBundleShortVersionString"));
|
|
||||||
- if(NULL == *version) {
|
|
||||||
- *version = (CFStringRef)
|
|
||||||
- CFDictionaryGetValue (infoDict, CFSTR("CFBundleVersion"));
|
|
||||||
- if (*version == NULL)
|
|
||||||
- *version = (CFStringRef) CFDictionaryGetValue (infoDict,
|
|
||||||
- CFSTR("CFBundleGetInfoString"));
|
|
||||||
- }
|
|
||||||
- if(NULL == *version) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "\tmissing version: %s\n",file));
|
|
||||||
- /*CFShow(infoDict);*/
|
|
||||||
- SNMP_CFRelease(theBundle);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if(theBundle != NULL) {
|
|
||||||
- CFRetain(*prodName);
|
|
||||||
- CFRetain(*version);
|
|
||||||
- SNMP_CFRelease(theBundle);
|
|
||||||
- }
|
|
||||||
- return 0;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static int
|
|
||||||
-_check_classic_app(CFURLRef currentURL, CFStringRef *prodName,
|
|
||||||
- CFStringRef *version, const char* file)
|
|
||||||
-{
|
|
||||||
- /*
|
|
||||||
- * get info for classic or single-file apps
|
|
||||||
- */
|
|
||||||
- FSRef theFSRef;
|
|
||||||
- int theResFile;
|
|
||||||
-
|
|
||||||
- if ((NULL == prodName) || (NULL == version))
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- *prodName = CFURLCopyLastPathComponent(currentURL);
|
|
||||||
- if (! CFURLGetFSRef(currentURL, &theFSRef)) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "GetFSRef failed: %s\n", file));
|
|
||||||
- SNMP_CFRelease(*prodName);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- theResFile = FSOpenResFile(&theFSRef, fsRdPerm);
|
|
||||||
- if (ResError() != noErr) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin", "FSOpenResFile failed: %s\n", file));
|
|
||||||
- SNMP_CFRelease(*prodName);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- VersRecHndl versHandle = (VersRecHndl)Get1IndResource('vers', 1);
|
|
||||||
- if (versHandle != NULL) {
|
|
||||||
- *version = CFStringCreateWithPascalString(kCFAllocatorDefault,
|
|
||||||
- (**versHandle).shortVersion, kCFStringEncodingMacRoman);
|
|
||||||
- if (*version == NULL) {
|
|
||||||
- StringPtr longVersionPtr = (**versHandle).shortVersion;
|
|
||||||
- longVersionPtr = (StringPtr)(((Ptr) longVersionPtr) +
|
|
||||||
- 1 + ((unsigned char) *longVersionPtr));
|
|
||||||
- *version = CFStringCreateWithPascalString(kCFAllocatorDefault,
|
|
||||||
- longVersionPtr, kCFStringEncodingMacRoman);
|
|
||||||
- }
|
|
||||||
- ReleaseResource((Handle)versHandle);
|
|
||||||
- }
|
|
||||||
- CloseResFile(theResFile);
|
|
||||||
- if(*version == NULL) {
|
|
||||||
- DEBUGMSGTL(("swinst:arch:darwin",
|
|
||||||
- "\tmissing classic/file version: %s\n", file));
|
|
||||||
- SNMP_CFRelease(*prodName);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- return 0;
|
|
||||||
-}
|
|
@ -1,35 +0,0 @@
|
|||||||
diff -urNp a/agent/mibgroup/hardware/memory/memory_linux.c b/agent/mibgroup/hardware/memory/memory_linux.c
|
|
||||||
--- a/agent/mibgroup/hardware/memory/memory_linux.c 2020-06-10 13:36:40.164588176 +0200
|
|
||||||
+++ b/agent/mibgroup/hardware/memory/memory_linux.c 2020-06-10 13:38:59.398944829 +0200
|
|
||||||
@@ -29,7 +29,7 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
|
||||||
ssize_t bytes_read;
|
|
||||||
char *b;
|
|
||||||
unsigned long memtotal = 0, memfree = 0, memshared = 0,
|
|
||||||
- buffers = 0, cached = 0,
|
|
||||||
+ buffers = 0, cached = 0, sreclaimable = 0,
|
|
||||||
swaptotal = 0, swapfree = 0;
|
|
||||||
|
|
||||||
netsnmp_memory_info *mem;
|
|
||||||
@@ -127,6 +127,13 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
|
||||||
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);
|
|
||||||
@@ -183,7 +190,7 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
|
||||||
if (!mem->descr)
|
|
||||||
mem->descr = strdup("Cached memory");
|
|
||||||
mem->units = 1024;
|
|
||||||
- mem->size = cached;
|
|
||||||
+ mem->size = cached+sreclaimable;
|
|
||||||
mem->free = 0; /* Report cached size/used as equal */
|
|
||||||
mem->other = -1;
|
|
||||||
}
|
|
@ -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 <Python.h>
|
|
||||||
|
|
||||||
-#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 <net-snmp/net-snmp-config.h>
|
|
||||||
#include <net-snmp/net-snmp-includes.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
@@ -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:
|
|
@ -1,146 +0,0 @@
|
|||||||
diff -urNp a/include/net-snmp/library/snmpusm.h b/include/net-snmp/library/snmpusm.h
|
|
||||||
--- a/include/net-snmp/library/snmpusm.h 2020-03-16 09:54:29.883655600 +0100
|
|
||||||
+++ b/include/net-snmp/library/snmpusm.h 2020-03-16 09:55:24.142944520 +0100
|
|
||||||
@@ -43,6 +43,7 @@ extern "C" {
|
|
||||||
* Structures.
|
|
||||||
*/
|
|
||||||
struct usmStateReference {
|
|
||||||
+ int refcnt;
|
|
||||||
char *usr_name;
|
|
||||||
size_t usr_name_length;
|
|
||||||
u_char *usr_engine_id;
|
|
||||||
diff -urNp a/snmplib/snmp_client.c b/snmplib/snmp_client.c
|
|
||||||
--- a/snmplib/snmp_client.c 2020-03-16 09:54:29.892655813 +0100
|
|
||||||
+++ b/snmplib/snmp_client.c 2020-03-16 09:58:13.214021890 +0100
|
|
||||||
@@ -402,27 +402,16 @@ _clone_pdu_header(netsnmp_pdu *pdu)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (pdu->securityStateRef &&
|
|
||||||
- pdu->command == SNMP_MSG_TRAP2) {
|
|
||||||
-
|
|
||||||
- ret = usm_clone_usmStateReference((struct usmStateReference *) pdu->securityStateRef,
|
|
||||||
- (struct usmStateReference **) &newpdu->securityStateRef );
|
|
||||||
-
|
|
||||||
- if (ret)
|
|
||||||
- {
|
|
||||||
+ sptr = find_sec_mod(newpdu->securityModel);
|
|
||||||
+ if (sptr && sptr->pdu_clone) {
|
|
||||||
+ /* call security model if it needs to know about this */
|
|
||||||
+ ret = sptr->pdu_clone(pdu, newpdu);
|
|
||||||
+ if (ret) {
|
|
||||||
snmp_free_pdu(newpdu);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if ((sptr = find_sec_mod(newpdu->securityModel)) != NULL &&
|
|
||||||
- sptr->pdu_clone != NULL) {
|
|
||||||
- /*
|
|
||||||
- * call security model if it needs to know about this
|
|
||||||
- */
|
|
||||||
- (*sptr->pdu_clone) (pdu, newpdu);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
return newpdu;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -urNp a/snmplib/snmpusm.c b/snmplib/snmpusm.c
|
|
||||||
--- a/snmplib/snmpusm.c 2020-03-16 09:54:29.894655860 +0100
|
|
||||||
+++ b/snmplib/snmpusm.c 2020-03-16 10:03:38.870027530 +0100
|
|
||||||
@@ -285,43 +285,64 @@ free_enginetime_on_shutdown(int majorid,
|
|
||||||
struct usmStateReference *
|
|
||||||
usm_malloc_usmStateReference(void)
|
|
||||||
{
|
|
||||||
- struct usmStateReference *retval = (struct usmStateReference *)
|
|
||||||
- calloc(1, sizeof(struct usmStateReference));
|
|
||||||
+ struct usmStateReference *retval;
|
|
||||||
+
|
|
||||||
+ retval = calloc(1, sizeof(struct usmStateReference));
|
|
||||||
+ if (retval)
|
|
||||||
+ retval->refcnt = 1;
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
} /* end usm_malloc_usmStateReference() */
|
|
||||||
|
|
||||||
+static int
|
|
||||||
+usm_clone(netsnmp_pdu *pdu, netsnmp_pdu *new_pdu)
|
|
||||||
+{
|
|
||||||
+ struct usmStateReference *ref = pdu->securityStateRef;
|
|
||||||
+ struct usmStateReference **new_ref =
|
|
||||||
+ (struct usmStateReference **)&new_pdu->securityStateRef;
|
|
||||||
+ int ret = 0;
|
|
||||||
+
|
|
||||||
+ if (!ref)
|
|
||||||
+ return ret;
|
|
||||||
+
|
|
||||||
+ if (pdu->command == SNMP_MSG_TRAP2) {
|
|
||||||
+ netsnmp_assert(pdu->securityModel == SNMP_DEFAULT_SECMODEL);
|
|
||||||
+ ret = usm_clone_usmStateReference(ref, new_ref);
|
|
||||||
+ } else {
|
|
||||||
+ netsnmp_assert(ref == *new_ref);
|
|
||||||
+ ref->refcnt++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
|
|
||||||
void
|
|
||||||
usm_free_usmStateReference(void *old)
|
|
||||||
{
|
|
||||||
- struct usmStateReference *old_ref = (struct usmStateReference *) old;
|
|
||||||
+ struct usmStateReference *ref = old;
|
|
||||||
|
|
||||||
- if (old_ref) {
|
|
||||||
+ if (!ref)
|
|
||||||
+ return;
|
|
||||||
|
|
||||||
- if (old_ref->usr_name_length)
|
|
||||||
- SNMP_FREE(old_ref->usr_name);
|
|
||||||
- if (old_ref->usr_engine_id_length)
|
|
||||||
- SNMP_FREE(old_ref->usr_engine_id);
|
|
||||||
- if (old_ref->usr_auth_protocol_length)
|
|
||||||
- SNMP_FREE(old_ref->usr_auth_protocol);
|
|
||||||
- if (old_ref->usr_priv_protocol_length)
|
|
||||||
- SNMP_FREE(old_ref->usr_priv_protocol);
|
|
||||||
-
|
|
||||||
- if (old_ref->usr_auth_key_length && old_ref->usr_auth_key) {
|
|
||||||
- SNMP_ZERO(old_ref->usr_auth_key, old_ref->usr_auth_key_length);
|
|
||||||
- SNMP_FREE(old_ref->usr_auth_key);
|
|
||||||
- }
|
|
||||||
- if (old_ref->usr_priv_key_length && old_ref->usr_priv_key) {
|
|
||||||
- SNMP_ZERO(old_ref->usr_priv_key, old_ref->usr_priv_key_length);
|
|
||||||
- SNMP_FREE(old_ref->usr_priv_key);
|
|
||||||
- }
|
|
||||||
+ if (--ref->refcnt > 0)
|
|
||||||
+ return;
|
|
||||||
|
|
||||||
- SNMP_ZERO(old_ref, sizeof(*old_ref));
|
|
||||||
- SNMP_FREE(old_ref);
|
|
||||||
+ SNMP_FREE(ref->usr_name);
|
|
||||||
+ SNMP_FREE(ref->usr_engine_id);
|
|
||||||
+ SNMP_FREE(ref->usr_auth_protocol);
|
|
||||||
+ SNMP_FREE(ref->usr_priv_protocol);
|
|
||||||
|
|
||||||
+ if (ref->usr_auth_key_length && ref->usr_auth_key) {
|
|
||||||
+ SNMP_ZERO(ref->usr_auth_key, ref->usr_auth_key_length);
|
|
||||||
+ SNMP_FREE(ref->usr_auth_key);
|
|
||||||
+ }
|
|
||||||
+ if (ref->usr_priv_key_length && ref->usr_priv_key) {
|
|
||||||
+ SNMP_ZERO(ref->usr_priv_key, ref->usr_priv_key_length);
|
|
||||||
+ SNMP_FREE(ref->usr_priv_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ SNMP_FREE(ref);
|
|
||||||
} /* end usm_free_usmStateReference() */
|
|
||||||
|
|
||||||
struct usmUser *
|
|
||||||
@@ -3316,6 +3337,7 @@ init_usm(void)
|
|
||||||
def->encode_reverse = usm_secmod_rgenerate_out_msg;
|
|
||||||
def->encode_forward = usm_secmod_generate_out_msg;
|
|
||||||
def->decode = usm_secmod_process_in_msg;
|
|
||||||
+ def->pdu_clone = usm_clone;
|
|
||||||
def->pdu_free_state_ref = usm_free_usmStateReference;
|
|
||||||
def->session_setup = usm_session_init;
|
|
||||||
def->handle_report = usm_handle_report;
|
|
@ -1,84 +0,0 @@
|
|||||||
diff -urNp a/agent/snmp_agent.c b/agent/snmp_agent.c
|
|
||||||
--- a/agent/snmp_agent.c 2020-06-11 10:20:31.646339191 +0200
|
|
||||||
+++ b/agent/snmp_agent.c 2020-06-11 10:23:41.178056889 +0200
|
|
||||||
@@ -1605,12 +1605,6 @@ free_agent_snmp_session(netsnmp_agent_se
|
|
||||||
DEBUGMSGTL(("verbose:asp", "asp %p reqinfo %p freed\n",
|
|
||||||
asp, asp->reqinfo));
|
|
||||||
|
|
||||||
- /* Clean up securityStateRef here to prevent a double free */
|
|
||||||
- if (asp->orig_pdu && asp->orig_pdu->securityStateRef)
|
|
||||||
- snmp_free_securityStateRef(asp->orig_pdu);
|
|
||||||
- if (asp->pdu && asp->pdu->securityStateRef)
|
|
||||||
- snmp_free_securityStateRef(asp->pdu);
|
|
||||||
-
|
|
||||||
if (asp->orig_pdu)
|
|
||||||
snmp_free_pdu(asp->orig_pdu);
|
|
||||||
if (asp->pdu)
|
|
||||||
diff -urNp a/include/net-snmp/pdu_api.h b/include/net-snmp/pdu_api.h
|
|
||||||
--- a/include/net-snmp/pdu_api.h 2020-06-11 10:20:31.631339058 +0200
|
|
||||||
+++ b/include/net-snmp/pdu_api.h 2020-06-11 10:24:17.261390028 +0200
|
|
||||||
@@ -19,8 +19,6 @@ NETSNMP_IMPORT
|
|
||||||
netsnmp_pdu *snmp_fix_pdu( netsnmp_pdu *pdu, int idx);
|
|
||||||
NETSNMP_IMPORT
|
|
||||||
void snmp_free_pdu( netsnmp_pdu *pdu);
|
|
||||||
-NETSNMP_IMPORT
|
|
||||||
-void snmp_free_securityStateRef( netsnmp_pdu *pdu);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
diff -urNp a/snmplib/snmp_api.c b/snmplib/snmp_api.c
|
|
||||||
--- a/snmplib/snmp_api.c 2020-06-11 10:20:31.695339627 +0200
|
|
||||||
+++ b/snmplib/snmp_api.c 2020-06-11 10:33:55.510891945 +0200
|
|
||||||
@@ -4034,17 +4034,6 @@ free_securityStateRef(netsnmp_pdu* pdu)
|
|
||||||
pdu->securityStateRef = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
-/*
|
|
||||||
- * This function is here to provide a separate call to
|
|
||||||
- * free the securityStateRef memory. This is needed to prevent
|
|
||||||
- * a double free if this memory is freed in snmp_free_pdu.
|
|
||||||
- */
|
|
||||||
-void
|
|
||||||
-snmp_free_securityStateRef(netsnmp_pdu* pdu)
|
|
||||||
-{
|
|
||||||
- free_securityStateRef(pdu);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
#define ERROR_STAT_LENGTH 11
|
|
||||||
|
|
||||||
int
|
|
||||||
@@ -5473,6 +5462,8 @@ snmp_free_pdu(netsnmp_pdu *pdu)
|
|
||||||
if (!pdu)
|
|
||||||
return;
|
|
||||||
|
|
||||||
+ free_securityStateRef(pdu);
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* If the command field is empty, that probably indicates
|
|
||||||
* that this PDU structure has already been freed.
|
|
||||||
@@ -5647,12 +5638,6 @@ _sess_process_packet_parse_pdu(void *ses
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret != SNMP_ERR_NOERROR) {
|
|
||||||
- /*
|
|
||||||
- * Call the security model to free any securityStateRef supplied w/ msg.
|
|
||||||
- */
|
|
||||||
- if (pdu->securityStateRef != NULL) {
|
|
||||||
- free_securityStateRef(pdu);
|
|
||||||
- }
|
|
||||||
snmp_free_pdu(pdu);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
@@ -5826,12 +5811,6 @@ _sess_process_packet_handle_pdu(void *se
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- /*
|
|
||||||
- * Call USM to free any securityStateRef supplied with the message.
|
|
||||||
- */
|
|
||||||
- if (pdu->securityStateRef && pdu->command == SNMP_MSG_TRAP2)
|
|
||||||
- free_securityStateRef(pdu);
|
|
||||||
-
|
|
||||||
if (!handled) {
|
|
||||||
if (sp->flags & SNMP_FLAGS_SHARED_SOCKET)
|
|
||||||
return -2;
|
|
@ -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
|
|
@ -1,21 +0,0 @@
|
|||||||
diff -urNp old/snmplib/transports/snmpUDPIPv4BaseDomain.c new/snmplib/transports/snmpUDPIPv4BaseDomain.c
|
|
||||||
--- old/snmplib/transports/snmpUDPIPv4BaseDomain.c 2019-06-27 08:40:48.663969034 +0200
|
|
||||||
+++ new/snmplib/transports/snmpUDPIPv4BaseDomain.c 2019-06-27 08:42:05.293723487 +0200
|
|
||||||
@@ -317,7 +317,7 @@ netsnmp_udpipv4base_tspec_transport(nets
|
|
||||||
if (NULL != tspec->source) {
|
|
||||||
struct sockaddr_in src_addr, *srcp = &src_addr;
|
|
||||||
/** get sockaddr from source */
|
|
||||||
- if (!netsnmp_sockaddr_in2(&src_addr, tspec->source, NULL))
|
|
||||||
+ if (!netsnmp_sockaddr_in2(&src_addr, tspec->source, ":0"))
|
|
||||||
return NULL;
|
|
||||||
return netsnmp_udpipv4base_transport_with_source(&addr, local, srcp);
|
|
||||||
} else {
|
|
||||||
@@ -364,7 +364,7 @@ netsnmp_udpipv4base_transport(const stru
|
|
||||||
strcat(client_address, ":0");
|
|
||||||
have_port = 1;
|
|
||||||
}
|
|
||||||
- rc = netsnmp_sockaddr_in2(&client_addr, client_socket, NULL);
|
|
||||||
+ rc = netsnmp_sockaddr_in2(&client_addr, client_socket, ":0");
|
|
||||||
if (client_address != client_socket)
|
|
||||||
free(client_address);
|
|
||||||
if(rc) {
|
|
@ -1,11 +0,0 @@
|
|||||||
diff -urNp a/agent/snmpd.c b/agent/snmpd.c
|
|
||||||
--- a/agent/snmpd.c 2018-10-04 10:34:10.939728847 +0200
|
|
||||||
+++ b/agent/snmpd.c 2018-10-04 10:34:43.910625603 +0200
|
|
||||||
@@ -325,6 +325,7 @@ usage(char *prog)
|
|
||||||
" -S d|i|0-7\t\tuse -Ls <facility> instead\n"
|
|
||||||
"\n"
|
|
||||||
);
|
|
||||||
+ exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
@ -1,357 +0,0 @@
|
|||||||
diff -urNp c/agent/snmp_agent.c d/agent/snmp_agent.c
|
|
||||||
--- c/agent/snmp_agent.c 2019-09-18 08:44:53.833601845 +0200
|
|
||||||
+++ d/agent/snmp_agent.c 2019-09-18 08:46:38.176595597 +0200
|
|
||||||
@@ -1604,6 +1604,13 @@ free_agent_snmp_session(netsnmp_agent_se
|
|
||||||
|
|
||||||
DEBUGMSGTL(("verbose:asp", "asp %p reqinfo %p freed\n",
|
|
||||||
asp, asp->reqinfo));
|
|
||||||
+
|
|
||||||
+ /* Clean up securityStateRef here to prevent a double free */
|
|
||||||
+ if (asp->orig_pdu && asp->orig_pdu->securityStateRef)
|
|
||||||
+ snmp_free_securityStateRef(asp->orig_pdu);
|
|
||||||
+ if (asp->pdu && asp->pdu->securityStateRef)
|
|
||||||
+ snmp_free_securityStateRef(asp->pdu);
|
|
||||||
+
|
|
||||||
if (asp->orig_pdu)
|
|
||||||
snmp_free_pdu(asp->orig_pdu);
|
|
||||||
if (asp->pdu)
|
|
||||||
diff -urNp c/include/net-snmp/pdu_api.h d/include/net-snmp/pdu_api.h
|
|
||||||
--- c/include/net-snmp/pdu_api.h 2019-09-18 08:44:53.822601740 +0200
|
|
||||||
+++ d/include/net-snmp/pdu_api.h 2019-09-18 08:47:03.620838212 +0200
|
|
||||||
@@ -19,6 +19,8 @@ NETSNMP_IMPORT
|
|
||||||
netsnmp_pdu *snmp_fix_pdu( netsnmp_pdu *pdu, int idx);
|
|
||||||
NETSNMP_IMPORT
|
|
||||||
void snmp_free_pdu( netsnmp_pdu *pdu);
|
|
||||||
+NETSNMP_IMPORT
|
|
||||||
+void snmp_free_securityStateRef( netsnmp_pdu *pdu);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
diff -urNp c/snmplib/snmp_api.c d/snmplib/snmp_api.c
|
|
||||||
--- c/snmplib/snmp_api.c 2019-09-18 08:44:53.807601597 +0200
|
|
||||||
+++ d/snmplib/snmp_api.c 2019-09-18 08:53:19.937435576 +0200
|
|
||||||
@@ -4012,7 +4012,12 @@ snmpv3_parse(netsnmp_pdu *pdu,
|
|
||||||
static void
|
|
||||||
free_securityStateRef(netsnmp_pdu* pdu)
|
|
||||||
{
|
|
||||||
- struct snmp_secmod_def *sptr = find_sec_mod(pdu->securityModel);
|
|
||||||
+ struct snmp_secmod_def *sptr;
|
|
||||||
+
|
|
||||||
+ if(!pdu->securityStateRef)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ sptr = find_sec_mod(pdu->securityModel);
|
|
||||||
if (sptr) {
|
|
||||||
if (sptr->pdu_free_state_ref) {
|
|
||||||
(*sptr->pdu_free_state_ref) (pdu->securityStateRef);
|
|
||||||
@@ -4029,6 +4034,17 @@ free_securityStateRef(netsnmp_pdu* pdu)
|
|
||||||
pdu->securityStateRef = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * This function is here to provide a separate call to
|
|
||||||
+ * free the securityStateRef memory. This is needed to prevent
|
|
||||||
+ * a double free if this memory is freed in snmp_free_pdu.
|
|
||||||
+ */
|
|
||||||
+void
|
|
||||||
+snmp_free_securityStateRef(netsnmp_pdu* pdu)
|
|
||||||
+{
|
|
||||||
+ free_securityStateRef(pdu);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#define ERROR_STAT_LENGTH 11
|
|
||||||
|
|
||||||
int
|
|
||||||
diff -urNp c/snmplib/snmpusm.c d/snmplib/snmpusm.c
|
|
||||||
--- c/snmplib/snmpusm.c 2019-09-18 08:44:53.802601550 +0200
|
|
||||||
+++ d/snmplib/snmpusm.c 2019-09-18 08:57:35.696872662 +0200
|
|
||||||
@@ -299,16 +299,20 @@ usm_free_usmStateReference(void *old)
|
|
||||||
|
|
||||||
if (old_ref) {
|
|
||||||
|
|
||||||
- SNMP_FREE(old_ref->usr_name);
|
|
||||||
- SNMP_FREE(old_ref->usr_engine_id);
|
|
||||||
- SNMP_FREE(old_ref->usr_auth_protocol);
|
|
||||||
- SNMP_FREE(old_ref->usr_priv_protocol);
|
|
||||||
+ if (old_ref->usr_name_length)
|
|
||||||
+ SNMP_FREE(old_ref->usr_name);
|
|
||||||
+ if (old_ref->usr_engine_id_length)
|
|
||||||
+ SNMP_FREE(old_ref->usr_engine_id);
|
|
||||||
+ if (old_ref->usr_auth_protocol_length)
|
|
||||||
+ SNMP_FREE(old_ref->usr_auth_protocol);
|
|
||||||
+ if (old_ref->usr_priv_protocol_length)
|
|
||||||
+ SNMP_FREE(old_ref->usr_priv_protocol);
|
|
||||||
|
|
||||||
- if (old_ref->usr_auth_key) {
|
|
||||||
+ if (old_ref->usr_auth_key_length && old_ref->usr_auth_key) {
|
|
||||||
SNMP_ZERO(old_ref->usr_auth_key, old_ref->usr_auth_key_length);
|
|
||||||
SNMP_FREE(old_ref->usr_auth_key);
|
|
||||||
}
|
|
||||||
- if (old_ref->usr_priv_key) {
|
|
||||||
+ if (old_ref->usr_priv_key_length && old_ref->usr_priv_key) {
|
|
||||||
SNMP_ZERO(old_ref->usr_priv_key, old_ref->usr_priv_key_length);
|
|
||||||
SNMP_FREE(old_ref->usr_priv_key);
|
|
||||||
}
|
|
||||||
@@ -1039,7 +1043,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
if ((user = usm_get_user(secEngineID, secEngineIDLen, secName))
|
|
||||||
== NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
|
|
||||||
DEBUGMSGTL(("usm", "Unknown User(%s)\n", secName));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_UNKNOWNSECURITYNAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1091,7 +1094,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
thePrivProtocolLength) == 1) {
|
|
||||||
DEBUGMSGTL(("usm", "Unsupported Security Level (%d)\n",
|
|
||||||
theSecLevel));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1121,7 +1123,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
&msgAuthParmLen, &msgPrivParmLen, &otstlen,
|
|
||||||
&seq_len, &msgSecParmLen) == -1) {
|
|
||||||
DEBUGMSGTL(("usm", "Failed calculating offsets.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1143,7 +1144,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
ptr = *wholeMsg = globalData;
|
|
||||||
if (theTotalLength > *wholeMsgLen) {
|
|
||||||
DEBUGMSGTL(("usm", "Message won't fit in buffer.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1169,7 +1169,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
htonl(boots_uint), htonl(time_uint),
|
|
||||||
&ptr[privParamsOffset]) == -1) {
|
|
||||||
DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1185,7 +1184,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
&ptr[privParamsOffset])
|
|
||||||
== -1)) {
|
|
||||||
DEBUGMSGTL(("usm", "Can't set DES-CBC salt.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1198,7 +1196,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
&ptr[dataOffset], &encrypted_length)
|
|
||||||
!= SNMP_ERR_NOERROR) {
|
|
||||||
DEBUGMSGTL(("usm", "encryption error.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_ENCRYPTIONERROR;
|
|
||||||
}
|
|
||||||
#ifdef NETSNMP_ENABLE_TESTING_CODE
|
|
||||||
@@ -1226,7 +1223,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
if ((encrypted_length != (theTotalLength - dataOffset))
|
|
||||||
|| (salt_length != msgPrivParmLen)) {
|
|
||||||
DEBUGMSGTL(("usm", "encryption length error.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_ENCRYPTIONERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1362,7 +1358,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
|
|
||||||
if (temp_sig == NULL) {
|
|
||||||
DEBUGMSGTL(("usm", "Out of memory.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1376,7 +1371,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
SNMP_ZERO(temp_sig, temp_sig_len);
|
|
||||||
SNMP_FREE(temp_sig);
|
|
||||||
DEBUGMSGTL(("usm", "Signing failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_AUTHENTICATIONFAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1384,7 +1378,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
SNMP_ZERO(temp_sig, temp_sig_len);
|
|
||||||
SNMP_FREE(temp_sig);
|
|
||||||
DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_AUTHENTICATIONFAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1398,7 +1391,6 @@ usm_generate_out_msg(int msgProcModel,
|
|
||||||
/*
|
|
||||||
* endif -- create keyed hash
|
|
||||||
*/
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
|
|
||||||
DEBUGMSGTL(("usm", "USM processing completed.\n"));
|
|
||||||
|
|
||||||
@@ -1548,7 +1540,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
if ((user = usm_get_user(secEngineID, secEngineIDLen, secName))
|
|
||||||
== NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
|
|
||||||
DEBUGMSGTL(("usm", "Unknown User\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_UNKNOWNSECURITYNAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1601,7 +1592,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
DEBUGMSGTL(("usm", "Unsupported Security Level or type (%d)\n",
|
|
||||||
theSecLevel));
|
|
||||||
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1636,7 +1626,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
DEBUGMSGTL(("usm",
|
|
||||||
"couldn't malloc %d bytes for encrypted PDU\n",
|
|
||||||
(int)ciphertextlen));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_MALLOC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1652,7 +1641,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
htonl(boots_uint), htonl(time_uint),
|
|
||||||
iv) == -1) {
|
|
||||||
DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
SNMP_FREE(ciphertext);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
@@ -1667,7 +1655,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
thePrivKeyLength - 8,
|
|
||||||
iv) == -1)) {
|
|
||||||
DEBUGMSGTL(("usm", "Can't set DES-CBC salt.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
SNMP_FREE(ciphertext);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
@@ -1686,7 +1673,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
scopedPdu, scopedPduLen,
|
|
||||||
ciphertext, &ciphertextlen) != SNMP_ERR_NOERROR) {
|
|
||||||
DEBUGMSGTL(("usm", "encryption error.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
SNMP_FREE(ciphertext);
|
|
||||||
return SNMPERR_USM_ENCRYPTIONERROR;
|
|
||||||
}
|
|
||||||
@@ -1703,7 +1689,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
ciphertext, ciphertextlen);
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "Encryption failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
SNMP_FREE(ciphertext);
|
|
||||||
return SNMPERR_USM_ENCRYPTIONERROR;
|
|
||||||
}
|
|
||||||
@@ -1743,7 +1728,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
DEBUGINDENTLESS();
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "building privParams failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1766,7 +1750,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
DEBUGINDENTLESS();
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "building authParams failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1789,7 +1772,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
DEBUGINDENTLESS();
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "building authParams failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1805,7 +1787,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm",
|
|
||||||
"building msgAuthoritativeEngineTime failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1821,7 +1802,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm",
|
|
||||||
"building msgAuthoritativeEngineBoots failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1833,7 +1813,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
DEBUGINDENTLESS();
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "building msgAuthoritativeEngineID failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1846,7 +1825,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
*offset - sp_offset);
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "building usm security parameters failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1860,7 +1838,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "building msgSecurityParameters failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1870,7 +1847,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
while ((*wholeMsgLen - *offset) < globalDataLen) {
|
|
||||||
if (!asn_realloc(wholeMsg, wholeMsgLen)) {
|
|
||||||
DEBUGMSGTL(("usm", "building global data failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1886,7 +1862,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
ASN_CONSTRUCTOR), *offset);
|
|
||||||
if (rc == 0) {
|
|
||||||
DEBUGMSGTL(("usm", "building master packet sequence failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_TOO_LONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1904,7 +1879,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
|
|
||||||
if (temp_sig == NULL) {
|
|
||||||
DEBUGMSGTL(("usm", "Out of memory.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_GENERICERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1915,14 +1889,12 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
!= SNMP_ERR_NOERROR) {
|
|
||||||
SNMP_FREE(temp_sig);
|
|
||||||
DEBUGMSGTL(("usm", "Signing failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_AUTHENTICATIONFAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (temp_sig_len != msgAuthParmLen) {
|
|
||||||
SNMP_FREE(temp_sig);
|
|
||||||
DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
return SNMPERR_USM_AUTHENTICATIONFAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1933,7 +1905,6 @@ usm_rgenerate_out_msg(int msgProcModel,
|
|
||||||
/*
|
|
||||||
* endif -- create keyed hash
|
|
||||||
*/
|
|
||||||
- usm_free_usmStateReference(secStateRef);
|
|
||||||
DEBUGMSGTL(("usm", "USM processing completed.\n"));
|
|
||||||
return SNMPERR_SUCCESS;
|
|
||||||
} /* end usm_rgenerate_out_msg() */
|
|
18
net-snmp-5.9-aes-config.patch
Normal file
18
net-snmp-5.9-aes-config.patch
Normal file
@ -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
|
||||||
|
;;
|
46
net-snmp-5.9-autofs-skip.patch
Normal file
46
net-snmp-5.9-autofs-skip.patch
Normal file
@ -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;
|
36
net-snmp-5.9-cflags.patch
Normal file
36
net-snmp-5.9-cflags.patch
Normal file
@ -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');
|
||||||
|
}
|
||||||
|
}
|
22
net-snmp-5.9-coverity.patch
Normal file
22
net-snmp-5.9-coverity.patch
Normal file
@ -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;
|
24
net-snmp-5.9-dir-fix.patch
Normal file
24
net-snmp-5.9-dir-fix.patch
Normal file
@ -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
|
@ -1,7 +1,8 @@
|
|||||||
diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
diff --git a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
||||||
--- a/agent/mibgroup/ucd-snmp/disk.c 2020-06-10 09:29:35.867328760 +0200
|
index 5206235..5e98476 100644
|
||||||
+++ b/agent/mibgroup/ucd-snmp/disk.c 2020-06-10 09:44:13.053535421 +0200
|
--- a/agent/mibgroup/ucd-snmp/disk.c
|
||||||
@@ -153,9 +153,10 @@ static void disk_free_config(void)
|
+++ 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(const char *, char *);
|
||||||
static void disk_parse_config_all(const char *, char *);
|
static void disk_parse_config_all(const char *, char *);
|
||||||
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
|
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
|
||||||
@ -46,7 +47,7 @@ diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -313,7 +318,7 @@ disk_parse_config(const char *token, cha
|
@@ -313,7 +318,7 @@ disk_parse_config(const char *token, char *cptr)
|
||||||
* check if the disk already exists, if so then modify its
|
* check if the disk already exists, if so then modify its
|
||||||
* parameters. if it does not exist then add it
|
* parameters. if it does not exist then add it
|
||||||
*/
|
*/
|
||||||
@ -55,7 +56,7 @@ diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
|||||||
#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
|
#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +377,7 @@ disk_parse_config_all(const char *token,
|
@@ -372,7 +377,7 @@ disk_parse_config_all(const char *token, char *cptr)
|
||||||
|
|
||||||
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
|
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
|
||||||
static void
|
static void
|
||||||
@ -64,7 +65,7 @@ diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
|||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
@@ -402,10 +407,16 @@ add_device(char *path, char *device, int
|
@@ -402,10 +407,16 @@ add_device(char *path, char *device, int minspace, int minpercent, int override)
|
||||||
}
|
}
|
||||||
|
|
||||||
index = disk_exists(path);
|
index = disk_exists(path);
|
||||||
@ -84,7 +85,7 @@ diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
|||||||
/* add if and only if the device was found */
|
/* add if and only if the device was found */
|
||||||
if(device[0] != 0) {
|
if(device[0] != 0) {
|
||||||
/* The following buffers are cleared above, no need to add '\0' */
|
/* The following buffers are cleared above, no need to add '\0' */
|
||||||
@@ -413,6 +424,7 @@ add_device(char *path, char *device, int
|
@@ -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));
|
strlcpy(disks[numdisks].device, device, sizeof(disks[numdisks].device));
|
||||||
disks[numdisks].minimumspace = minspace;
|
disks[numdisks].minimumspace = minspace;
|
||||||
disks[numdisks].minpercent = minpercent;
|
disks[numdisks].minpercent = minpercent;
|
||||||
@ -92,7 +93,7 @@ diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
|||||||
numdisks++;
|
numdisks++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -420,6 +432,7 @@ add_device(char *path, char *device, int
|
@@ -420,6 +432,7 @@ add_device(char *path, char *device, int minspace, int minpercent, int override)
|
||||||
disks[numdisks].minpercent = -1;
|
disks[numdisks].minpercent = -1;
|
||||||
disks[numdisks].path[0] = 0;
|
disks[numdisks].path[0] = 0;
|
||||||
disks[numdisks].device[0] = 0;
|
disks[numdisks].device[0] = 0;
|
||||||
@ -154,7 +155,7 @@ diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
@@ -696,6 +709,10 @@ fill_dsk_entry(int disknum, struct dsk_e
|
@@ -696,6 +709,10 @@ fill_dsk_entry(int disknum, struct dsk_entry *entry)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -165,9 +166,9 @@ diff -ruNp a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
|||||||
entry->dskPercentInode = -1;
|
entry->dskPercentInode = -1;
|
||||||
|
|
||||||
#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
|
#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
|
||||||
@@ -826,6 +843,13 @@ var_extensible_disk(struct variable *vp,
|
@@ -827,6 +844,13 @@ var_extensible_disk(struct variable *vp,
|
||||||
static long long_ret;
|
|
||||||
static char *errmsg;
|
static char *errmsg;
|
||||||
|
static char empty_str[1];
|
||||||
|
|
||||||
+ int i;
|
+ int i;
|
||||||
+ for (i = 0; i < numdisks; i++){
|
+ for (i = 0; i < numdisks; i++){
|
@ -1,11 +1,12 @@
|
|||||||
diff -urNp a/apps/Makefile.in b/apps/Makefile.in
|
diff --git a/apps/Makefile.in b/apps/Makefile.in
|
||||||
--- a/apps/Makefile.in 2018-07-18 15:39:28.069251000 +0200
|
index d4529d3..175242b 100644
|
||||||
+++ b/apps/Makefile.in 2018-07-18 15:54:52.261943123 +0200
|
--- a/apps/Makefile.in
|
||||||
@@ -230,7 +230,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX
|
+++ b/apps/Makefile.in
|
||||||
|
@@ -237,7 +237,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX) $(USELIBS)
|
||||||
$(LINK) ${CFLAGS} -o $@ snmppcap.$(OSUFFIX) ${LDFLAGS} ${LIBS} -lpcap
|
$(LINK) ${CFLAGS} -o $@ snmppcap.$(OSUFFIX) ${LDFLAGS} ${LIBS} -lpcap
|
||||||
|
|
||||||
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
|
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) $(LDFLAGS)
|
||||||
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS)
|
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
28
net-snmp-5.9-memory-reporting.patch
Normal file
28
net-snmp-5.9-memory-reporting.patch
Normal file
@ -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;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
|||||||
diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
diff --git 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
|
index 90b20d9..bd5abe1 100644
|
||||||
+++ b/man/netsnmp_config_api.3.def 2018-07-18 11:20:04.631679886 +0200
|
--- a/man/netsnmp_config_api.3.def
|
||||||
|
+++ b/man/netsnmp_config_api.3.def
|
||||||
@@ -295,7 +295,7 @@ for one particular machine.
|
@@ -295,7 +295,7 @@ for one particular machine.
|
||||||
.PP
|
.PP
|
||||||
The default list of directories to search is \fC SYSCONFDIR/snmp\fP,
|
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.
|
followed by \fC $HOME/.snmp\fP.
|
||||||
This list can be changed by setting the environmental variable
|
This list can be changed by setting the environmental variable
|
||||||
.I SNMPCONFPATH
|
.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.
|
files in.
|
||||||
Default:
|
Default:
|
||||||
.br
|
.br
|
||||||
@ -19,10 +20,11 @@ diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
|||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
netsnmp_mib_api(3), snmp_api(3)
|
netsnmp_mib_api(3), snmp_api(3)
|
||||||
.\" Local Variables:
|
.\" Local Variables:
|
||||||
diff -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def
|
diff --git 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
|
index fd30873..c3437d6 100644
|
||||||
+++ b/man/snmp_config.5.def 2018-07-18 11:20:56.423626117 +0200
|
--- a/man/snmp_config.5.def
|
||||||
@@ -10,7 +10,7 @@ First off, there are numerous places tha
|
+++ 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
|
found and read from. By default, the applications look for
|
||||||
configuration files in the following 4 directories, in order:
|
configuration files in the following 4 directories, in order:
|
||||||
SYSCONFDIR/snmp,
|
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
|
directories, it looks for files snmp.conf, snmpd.conf and/or
|
||||||
snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf
|
snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf
|
||||||
and/or snmptrapd.local.conf. *.local.conf are always
|
and/or snmptrapd.local.conf. *.local.conf are always
|
||||||
diff -urNp a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def
|
diff --git 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
|
index 7ce8a46..a4000f9 100644
|
||||||
+++ b/man/snmpd.conf.5.def 2018-07-18 11:21:44.263574388 +0200
|
--- a/man/snmpd.conf.5.def
|
||||||
@@ -1559,7 +1559,7 @@ filename), and call the initialisation r
|
+++ b/man/snmpd.conf.5.def
|
||||||
|
@@ -1593,7 +1593,7 @@ filename), and call the initialisation routine \fIinit_NAME\fR.
|
||||||
.RS
|
.RS
|
||||||
.IP "Note:"
|
.IP "Note:"
|
||||||
If the specified PATH is not a fully qualified filename, it will
|
If the specified PATH is not a fully qualified filename, it will
|
@ -1,7 +1,8 @@
|
|||||||
diff -up net-snmp-5.7.2/agent/Makefile.in.pie net-snmp-5.7.2/agent/Makefile.in
|
diff --git a/agent/Makefile.in b/agent/Makefile.in
|
||||||
--- net-snmp-5.7.2/agent/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200
|
index b5d692d..1a30209 100644
|
||||||
+++ net-snmp-5.7.2/agent/Makefile.in 2012-10-18 09:45:13.298613099 +0200
|
--- a/agent/Makefile.in
|
||||||
@@ -294,7 +294,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
|
+++ b/agent/Makefile.in
|
||||||
|
@@ -297,7 +297,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
|
||||||
$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $?
|
$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $?
|
||||||
|
|
||||||
snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG)
|
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}
|
+ $(LINK) $(CFLAGS) -o $@ -pie ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}
|
||||||
|
|
||||||
libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS} $(USELIBS)
|
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@
|
$(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} @LD_NO_UNDEFINED@ $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) @AGENTLIBS@
|
||||||
diff -up net-snmp-5.7.2/apps/Makefile.in.pie net-snmp-5.7.2/apps/Makefile.in
|
diff --git a/apps/Makefile.in b/apps/Makefile.in
|
||||||
--- net-snmp-5.7.2/apps/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200
|
index 43f3b9c..d4529d3 100644
|
||||||
+++ net-snmp-5.7.2/apps/Makefile.in 2012-10-18 09:44:27.827774580 +0200
|
--- a/apps/Makefile.in
|
||||||
@@ -170,7 +170,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX
|
+++ b/apps/Makefile.in
|
||||||
|
@@ -190,7 +190,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX) $(USELIBS)
|
||||||
$(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) ${LDFLAGS} ${LIBS}
|
$(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) ${LDFLAGS} ${LIBS}
|
||||||
|
|
||||||
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
|
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
|
@ -1,7 +1,8 @@
|
|||||||
diff -ruNp a/agent/mibgroup/ucd-snmp/proxy.c b/agent/mibgroup/ucd-snmp/proxy.c
|
diff --git a/agent/mibgroup/ucd-snmp/proxy.c b/agent/mibgroup/ucd-snmp/proxy.c
|
||||||
--- a/agent/mibgroup/ucd-snmp/proxy.c 2020-06-10 09:24:24.933347483 +0200
|
index e0ee96b..8abe7a3 100644
|
||||||
+++ b/agent/mibgroup/ucd-snmp/proxy.c 2020-06-10 09:25:49.007148474 +0200
|
--- a/agent/mibgroup/ucd-snmp/proxy.c
|
||||||
@@ -460,7 +460,7 @@ proxy_handler(netsnmp_mib_handler *handl
|
+++ b/agent/mibgroup/ucd-snmp/proxy.c
|
||||||
|
@@ -463,7 +463,7 @@ proxy_handler(netsnmp_mib_handler *handler,
|
||||||
if (sp->base_len &&
|
if (sp->base_len &&
|
||||||
reqinfo->mode == MODE_GETNEXT &&
|
reqinfo->mode == MODE_GETNEXT &&
|
||||||
(snmp_oid_compare(ourname, ourlength,
|
(snmp_oid_compare(ourname, ourlength,
|
@ -1,7 +1,8 @@
|
|||||||
diff -urNp a/python/setup.py b/python/setup.py
|
diff --git a/python/setup.py b/python/setup.py
|
||||||
--- a/python/setup.py 2018-11-29 16:39:33.959745228 +0100
|
index 2547842..0c68cd8 100644
|
||||||
+++ b/python/setup.py 2018-11-29 16:40:19.125513424 +0100
|
--- a/python/setup.py
|
||||||
@@ -18,14 +18,14 @@ if intree:
|
+++ b/python/setup.py
|
||||||
|
@@ -17,14 +17,14 @@ if intree:
|
||||||
netsnmp_libs = os.popen(basedir+'/net-snmp-config --libs').read()
|
netsnmp_libs = os.popen(basedir+'/net-snmp-config --libs').read()
|
||||||
libdir = os.popen(basedir+'/net-snmp-config --build-lib-dirs '+basedir).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()
|
incdir = os.popen(basedir+'/net-snmp-config --build-includes '+basedir).read() + " " + os.popen(basedir+'/net-snmp-config --base-cflags '+basedir).read()
|
38
net-snmp-5.9-python3.patch
Normal file
38
net-snmp-5.9-python3.patch
Normal file
@ -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)
|
110
net-snmp-5.9-test-debug.patch
Normal file
110
net-snmp-5.9-test-debug.patch
Normal file
@ -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
|
||||||
|
|
12
net-snmp-5.9-usage-exit.patch
Normal file
12
net-snmp-5.9-usage-exit.patch
Normal file
@ -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 <facility> instead\n"
|
||||||
|
"\n"
|
||||||
|
);
|
||||||
|
+ exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
139
net-snmp.spec
139
net-snmp.spec
@ -5,12 +5,12 @@
|
|||||||
%global multilib_arches %{ix86} ia64 ppc ppc64 s390 s390x x86_64 sparc sparcv9 sparc64 aarch64
|
%global multilib_arches %{ix86} ia64 ppc ppc64 s390 s390x x86_64 sparc sparcv9 sparc64 aarch64
|
||||||
|
|
||||||
# actual soname version
|
# actual soname version
|
||||||
%global soname 35
|
%global soname 40
|
||||||
|
|
||||||
Summary: A collection of SNMP protocol tools and libraries
|
Summary: A collection of SNMP protocol tools and libraries
|
||||||
Name: net-snmp
|
Name: net-snmp
|
||||||
Version: 5.8
|
Version: 5.9
|
||||||
Release: 25%{?dist}
|
Release: 1%{?dist}
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
|
|
||||||
License: BSD
|
License: BSD
|
||||||
@ -27,57 +27,46 @@ Source8: snmpd.service
|
|||||||
Source9: snmptrapd.service
|
Source9: snmptrapd.service
|
||||||
Source10: IETF-MIB-LICENSE.txt
|
Source10: IETF-MIB-LICENSE.txt
|
||||||
|
|
||||||
Patch1: net-snmp-5.7.2-pie.patch
|
Patch1: net-snmp-5.9-pie.patch
|
||||||
Patch2: net-snmp-5.8-dir-fix.patch
|
Patch2: net-snmp-5.9-dir-fix.patch
|
||||||
Patch3: net-snmp-5.8-multilib.patch
|
Patch3: net-snmp-5.9-multilib.patch
|
||||||
Patch4: net-snmp-5.8-test-debug.patch
|
Patch4: net-snmp-5.9-test-debug.patch
|
||||||
Patch5: net-snmp-5.7.2-autoreconf.patch
|
Patch5: net-snmp-5.7.2-cert-path.patch
|
||||||
Patch6: net-snmp-5.8-agentx-disconnect-crash.patch
|
Patch6: net-snmp-5.9-cflags.patch
|
||||||
Patch7: net-snmp-5.7.2-cert-path.patch
|
Patch7: net-snmp-5.8-Remove-U64-typedef.patch
|
||||||
Patch8: net-snmp-5.8-cflags.patch
|
Patch8: net-snmp-5.9-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
||||||
Patch9: net-snmp-5.8-Remove-U64-typedef.patch
|
Patch9: net-snmp-5.7.3-iterator-fix.patch
|
||||||
Patch10: net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
Patch10: net-snmp-5.9-autofs-skip.patch
|
||||||
Patch11: net-snmp-5.7.3-iterator-fix.patch
|
Patch11: net-snmp-5.9-python-ld-flags.patch
|
||||||
Patch12: net-snmp-5.8-autofs-skip.patch
|
Patch12: net-snmp-5.9-usage-exit.patch
|
||||||
Patch13: net-snmp-5.8-key-leak-backport.patch
|
Patch13: net-snmp-5.9-coverity.patch
|
||||||
Patch14: net-snmp-5.8-python-ld-flags.patch
|
Patch14: net-snmp-5.9-proxy-getnext.patch
|
||||||
Patch15: net-snmp-5.8-ipv6-clientaddr.patch
|
Patch15: net-snmp-5.9-dskTable-dynamic.patch
|
||||||
Patch16: net-snmp-5.8-licensing.patch
|
Patch16: net-snmp-5.8-expand-SNMPCONFPATH.patch
|
||||||
Patch17: net-snmp-5.8-agent-of-death.patch
|
Patch17: net-snmp-5.8-duplicate-ipAddress.patch
|
||||||
Patch18: net-snmp-5.8-trapsink.patch
|
Patch18: net-snmp-5.9-memory-reporting.patch
|
||||||
Patch19: net-snmp-5.8-v3-forward.patch
|
Patch19: net-snmp-5.8-man-page.patch
|
||||||
Patch20: net-snmp-5.8-usage-exit.patch
|
Patch20: net-snmp-5.8-ipAddress-faster-load.patch
|
||||||
Patch21: net-snmp-5.8-coverity.patch
|
Patch21: net-snmp-5.8-rpm-memory-leak.patch
|
||||||
Patch22: net-snmp-5.8-flood-messages.patch
|
Patch22: net-snmp-5.9-aes-config.patch
|
||||||
Patch23: net-snmp-5.8-sec-counter.patch
|
|
||||||
Patch24: net-snmp-5.8-proxy-getnext.patch
|
|
||||||
Patch25: net-snmp-5.8-dskTable-dynamic.patch
|
|
||||||
Patch26: net-snmp-5.8-expand-SNMPCONFPATH.patch
|
|
||||||
Patch27: net-snmp-5.8-duplicate-ipAddress.patch
|
|
||||||
Patch28: net-snmp-5.8-memory-reporting.patch
|
|
||||||
Patch29: net-snmp-5.8-man-page.patch
|
|
||||||
Patch30: net-snmp-5.8-ipAddress-faster-load.patch
|
|
||||||
Patch31: net-snmp-5.8-rpm-memory-leak.patch
|
|
||||||
Patch32: net-snmp-5.8-sec-memory-leak.patch
|
|
||||||
Patch33: net-snmp-5.8-aes-config.patch
|
|
||||||
|
|
||||||
# Modern RPM API means at least EL6
|
# Modern RPM API means at least EL6
|
||||||
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
||||||
|
|
||||||
#disable this patch due compatibility issues
|
#disable this patch due compatibility issues
|
||||||
Patch102: net-snmp-5.8-python3.patch
|
Patch102: net-snmp-5.9-python3.patch
|
||||||
|
|
||||||
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||||
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||||
# This is actually needed for the %%triggerun script but Requires(triggerun)
|
# This is actually needed for the %%triggerun script but Requires(triggerun)
|
||||||
# is not valid. We can use %%post because this particular %triggerun script
|
# is not valid. We can use %%post because this particular %%triggerun script
|
||||||
# should fire just after this package is installed.
|
# should fire just after this package is installed.
|
||||||
%{?systemd_requires}
|
%{?systemd_requires}
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
|
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
|
||||||
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
|
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
|
||||||
BuildRequires: perl-devel, perl(ExtUtils::Embed), procps
|
BuildRequires: perl-devel, perl(ExtUtils::Embed), procps, pcre-devel
|
||||||
BuildRequires: python3-devel, python3-setuptools
|
BuildRequires: python3-devel, python3-setuptools
|
||||||
BuildRequires: chrpath
|
BuildRequires: chrpath
|
||||||
BuildRequires: mariadb-connector-c-devel
|
BuildRequires: mariadb-connector-c-devel
|
||||||
@ -189,21 +178,6 @@ Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
|||||||
The net-snmp-agent-libs package contains the runtime agent libraries for shared
|
The net-snmp-agent-libs package contains the runtime agent libraries for shared
|
||||||
binaries and applications.
|
binaries and applications.
|
||||||
|
|
||||||
#%package -n python2-net-snmp
|
|
||||||
#%%{?python_provide:%%python_provide python2-net-snmp}
|
|
||||||
#%%{?python_obsolete:%%python_obsolete python3-net-snmp}
|
|
||||||
# Remove before F30
|
|
||||||
#Provides: %%{name}-python = %%{version}-%%{release}
|
|
||||||
#Provides: %%{name}-python%%{?_isa} = %%{version}-%%{release}
|
|
||||||
#Obsoletes: %%{name}-python < %%{version}-%%{release}
|
|
||||||
#Summary: The Python 'netsnmp' module for the Net-SNMP
|
|
||||||
#Requires: %%{name}-libs%%{?_isa} = %%{epoch}:%%{version}-%%{release}
|
|
||||||
#
|
|
||||||
#%%description -n python2-net-snmp
|
|
||||||
#The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
|
|
||||||
#SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
|
|
||||||
#Net-SNMP toolkit library.
|
|
||||||
|
|
||||||
%package -n python3-net-snmp
|
%package -n python3-net-snmp
|
||||||
%{?python_provide:%python_provide python3-net-snmp}
|
%{?python_provide:%python_provide python3-net-snmp}
|
||||||
# Remove before F30
|
# Remove before F30
|
||||||
@ -229,35 +203,24 @@ cp %{SOURCE10} .
|
|||||||
%patch2 -p1 -b .dir-fix
|
%patch2 -p1 -b .dir-fix
|
||||||
%patch3 -p1 -b .multilib
|
%patch3 -p1 -b .multilib
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch5 -p1 -b .autoreconf
|
%patch5 -p1 -b .cert-path
|
||||||
%patch6 -p1 -b .agentx-disconnect-crash
|
%patch6 -p1 -b .cflags
|
||||||
%patch7 -p1 -b .cert-path
|
%patch7 -p1 -b .u64-remove
|
||||||
%patch8 -p1 -b .cflags
|
%patch8 -p1 -b .perlfix
|
||||||
%patch9 -p1 -b .u64-remove
|
%patch9 -p1 -b .iterator-fix
|
||||||
%patch10 -p1 -b .perlfix
|
%patch10 -p1 -b .autofs-skip
|
||||||
%patch11 -p1 -b .iterator-fix
|
%patch11 -p1 -b .python-ld-flags
|
||||||
%patch12 -p1 -b .autofs-skip
|
%patch12 -p1 -b .usage-fix
|
||||||
%patch13 -p1 -b .leak-backport
|
%patch13 -p1 -b .coverity
|
||||||
%patch14 -p1 -b .python-ld-flags
|
%patch14 -p1 -b .proxy-getnext
|
||||||
%patch15 -p1 -b .ipv6-clientaddr
|
%patch15 -p1 -b .dskTable-dynamic
|
||||||
%patch16 -p1
|
%patch16 -p1 -b .expand-SNMPCONFPATH
|
||||||
%patch17 -p1 -b .agent-of-death
|
%patch17 -p1 -b .duplicate-ipAddress
|
||||||
%patch18 -p1 -b .trapsink
|
%patch18 -p1 -b .memory-reporting
|
||||||
%patch19 -p1 -b .v3-forward
|
%patch19 -p1 -b .man-page
|
||||||
%patch20 -p1 -b .usage-fix
|
%patch20 -p1 -b .ipAddress-faster-load
|
||||||
%patch21 -p1 -b .coverity
|
%patch21 -p1 -b .rpm-memory-leak
|
||||||
%patch22 -p1 -b .flood-messages
|
%patch22 -p1 -b .aes-config
|
||||||
%patch23 -p1 -b .sec-counter
|
|
||||||
%patch24 -p1 -b .proxy-getnext
|
|
||||||
%patch25 -p1 -b .dskTable-dynamic
|
|
||||||
%patch26 -p1 -b .expand-SNMPCONFPATH
|
|
||||||
%patch27 -p1 -b .duplicate-ipAddress
|
|
||||||
%patch28 -p1 -b .memory-reporting
|
|
||||||
%patch29 -p1 -b .man-page
|
|
||||||
%patch30 -p1 -b .ipAddress-faster-load
|
|
||||||
%patch31 -p1 -b .rpm-memory-leak
|
|
||||||
%patch32 -p1 -b .sec-memory-leak
|
|
||||||
%patch33 -p1 -b .aes-config
|
|
||||||
|
|
||||||
%patch101 -p1 -b .modern-rpm-api
|
%patch101 -p1 -b .modern-rpm-api
|
||||||
%patch102 -p1
|
%patch102 -p1
|
||||||
@ -402,10 +365,6 @@ done
|
|||||||
# remove executable bit from documentation samples
|
# remove executable bit from documentation samples
|
||||||
chmod 644 local/passtest local/ipf-mod.pl
|
chmod 644 local/passtest local/ipf-mod.pl
|
||||||
|
|
||||||
# dirty hack for #603243, until it's fixed properly upstream
|
|
||||||
install -m 755 -d %{buildroot}/usr/include/net-snmp/agent/util_funcs
|
|
||||||
install -m 644 agent/mibgroup/util_funcs/*.h %{buildroot}/usr/include/net-snmp/agent/util_funcs
|
|
||||||
|
|
||||||
# systemd stuff
|
# systemd stuff
|
||||||
install -m 755 -d %{buildroot}/%{_tmpfilesdir}
|
install -m 755 -d %{buildroot}/%{_tmpfilesdir}
|
||||||
install -m 644 %SOURCE7 %{buildroot}/%{_tmpfilesdir}/net-snmp.conf
|
install -m 644 %SOURCE7 %{buildroot}/%{_tmpfilesdir}/net-snmp.conf
|
||||||
@ -477,7 +436,8 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
|||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%{_libdir}/lib*.so
|
%{_libdir}/lib*.so
|
||||||
/usr/include/*
|
%{_libdir}/pkgconfig/*
|
||||||
|
%{_includedir}/*
|
||||||
%attr(0644,root,root) %{_mandir}/man3/*.3.*
|
%attr(0644,root,root) %{_mandir}/man3/*.3.*
|
||||||
%attr(0755,root,root) %{_bindir}/net-snmp-config*
|
%attr(0755,root,root) %{_bindir}/net-snmp-config*
|
||||||
%attr(0644,root,root) %{_mandir}/man1/net-snmp-config*.1.*
|
%attr(0644,root,root) %{_mandir}/man1/net-snmp-config*.1.*
|
||||||
@ -527,6 +487,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
|||||||
%{_libdir}/libnetsnmptrapd*.so.%{soname}*
|
%{_libdir}/libnetsnmptrapd*.so.%{soname}*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Aug 17 2020 Josef Řídký <jridky@redhat.com> - 1:5.9-1
|
||||||
|
- New upstream release 5.9
|
||||||
|
|
||||||
* Tue Aug 04 2020 Josef Ridky <jridky@redhat.com> - 1:5.8-25
|
* Tue Aug 04 2020 Josef Ridky <jridky@redhat.com> - 1:5.8-25
|
||||||
- link math library to fix FTBFS for hplip (#1863855)
|
- link math library to fix FTBFS for hplip (#1863855)
|
||||||
|
|
||||||
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
SHA512 (net-snmp-5.8.tar.gz) = 27895a583b23f3e14c48562bc32f3ba83513d81aa848e878be9a3650f0458d45950635c937ef627135f80b757b663e71fab9a3bde4fd91889153998ae3468fe7
|
SHA512 (net-snmp-5.9.tar.gz) = 045a54be69a318ee8ed7ec8fd044bdb32821c189703cc7b1700b20f17a18af17a631588b3815f07ffa1f146f2e5be7f199a2929c6ab1f796d02fe6a2f3e8b3e5
|
||||||
|
Loading…
Reference in New Issue
Block a user