Compare commits
73 Commits
Author | SHA1 | Date |
---|---|---|
Josef Řídký | f9c2f25179 | |
Fedora Release Engineering | 5567bd7e3e | |
Python Maint | 689c725c34 | |
Jitka Plesnikova | 8718f62cb2 | |
Zbigniew Jędrzejewski-Szmek | a55907366f | |
Fedora Release Engineering | 71fd62d403 | |
Josef Řídký | d622fc4df5 | |
Sahana Prasad | 309b687c1e | |
Josef Řídký | fc25bbe4da | |
Sahana Prasad | 8c84e94b7d | |
Josef Řídký | c7a2182909 | |
Josef Řídký | 888f62f4d4 | |
Josef Řídký | 94800d9ce0 | |
Fedora Release Engineering | 0da701e098 | |
Josef Řídký | e7210d3f0a | |
Josef Řídký | 31a7f8be0f | |
Python Maint | 0e8b4706fe | |
Josef Řídký | 3b0b966b01 | |
Josef Řídký | 2f2718771d | |
Josef Řídký | 5ca895838f | |
Jitka Plesnikova | ea2a4871cc | |
Josef Řídký | 25af5a1169 | |
Zbigniew Jędrzejewski-Szmek | 1e1e50aae2 | |
Josef Řídký | 4643516582 | |
Josef Řídký | e80342ac5a | |
Josef Řídký | b47ab87730 | |
Josef Řídký | 14b4835cfb | |
Josef Řídký | 0dba34c092 | |
Josef Řídký | 47adcde62f | |
Josef Řídký | 4efbf707c2 | |
Josef Řídký | 9fa55abb4b | |
Fedora Release Engineering | f532a181bf | |
Josef Řídký | 8c24d14eac | |
Josef Řídký | 07d64d3ffe | |
Josef Řídký | 91a48da872 | |
Josef Řídký | b6b01ca16f | |
Josef Řídký | 4d7a6a1463 | |
Tom Stellard | 5573ec507b | |
Josef Řídký | 911fab38f4 | |
Josef Řídký | be26e76db3 | |
Josef Řídký | d9dc99b36b | |
Josef Řídký | 03eed47b24 | |
Josef Řídký | f028a843ff | |
Fedora Release Engineering | c829d67c13 | |
Josef Řídký | c384b83a3c | |
Josef Řídký | c664a21037 | |
Josef Řídký | 172d7325f8 | |
Jitka Plesnikova | 001fdfb203 | |
Miro Hrončok | 1dbc8dd231 | |
Josef Řídký | 69b13ec687 | |
Josef Řídký | b2ce63191d | |
Petr Písař | b0ffa68e22 | |
Josef Řídký | 55bd9e1c49 | |
Josef Řídký | 72112e3c24 | |
Fedora Release Engineering | d0ef14dd43 | |
Miro Hrončok | 975f13d14c | |
Josef Řídký | 81c40c1ab4 | |
Josef Řídký | 7dc11217ec | |
Miro Hrončok | e2746cbe5d | |
Fedora Release Engineering | 4dc72487ac | |
Josef Řídký | f5c7c112d1 | |
Josef Řídký | 0e8117956a | |
Josef Řídký | 1c3bbf5bde | |
Josef Řídký | 2bee86eba7 | |
Josef Řídký | 1382878e8a | |
Josef Řídký | a20598cfce | |
Igor Gnatenko | a6f4811b0c | |
Igor Gnatenko | 9c5bf4babd | |
Jitka Plesnikova | 5ca3ab167a | |
Josef Ridky | aff1706e3d | |
Josef Ridky | cbcf8637b1 | |
Fedora Release Engineering | ec72bd7624 | |
Björn Esser | 70f4aab30e |
|
@ -6,3 +6,6 @@ net-snmp-5.5.tar.gz
|
|||
/net-snmp-5.7.2.tar.gz
|
||||
/net-snmp-5.7.3.tar.gz
|
||||
/net-snmp-5.8.tar.gz
|
||||
/net-snmp-5.9.tar.gz
|
||||
/net-snmp-5.9.1.tar.gz
|
||||
/net-snmp-5.9.3.tar.gz
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
From 9432f629e66e4f9500f6335eab3ad427f84523b2 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Thu, 20 Jul 2017 10:31:47 -0700
|
||||
Subject: [PATCH] Link libnetsnmptrapd against MYSQL_LIBS
|
||||
|
||||
When building with MySQL (MariaDB) support, this library must
|
||||
be linked against the MySQL client library, or else it will
|
||||
have unresolved symbols.
|
||||
---
|
||||
apps/Makefile.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/apps/Makefile.in b/apps/Makefile.in
|
||||
index 77404dd89..7da434522 100644
|
||||
--- a/apps/Makefile.in
|
||||
+++ b/apps/Makefile.in
|
||||
@@ -204,7 +204,7 @@ snmpdf$(EXEEXT): snmpdf.$(OSUFFIX) $(USELIBS)
|
||||
$(LINK) ${CFLAGS} -o $@ snmpdf.$(OSUFFIX) ${LDFLAGS} ${LIBS}
|
||||
|
||||
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
|
||||
- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS)
|
||||
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS)
|
||||
$(RANLIB) $@
|
||||
|
||||
snmpinforminstall:
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -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,14 +1,14 @@
|
|||
diff -urNp old/agent/mibgroup/host/data_access/swrun.c new/agent/mibgroup/host/data_access/swrun.c
|
||||
--- old/agent/mibgroup/host/data_access/swrun.c 2018-03-26 09:00:39.932335587 +0200
|
||||
+++ new/agent/mibgroup/host/data_access/swrun.c 2018-03-26 09:03:00.845876681 +0200
|
||||
@@ -102,7 +102,9 @@ swrun_count_processes_by_name( char *nam
|
||||
--- old/agent/mibgroup/host/data_access/swrun.c 2017-07-18 09:44:00.626109526 +0200
|
||||
+++ new/agent/mibgroup/host/data_access/swrun.c 2017-07-19 15:27:50.452255836 +0200
|
||||
@@ -102,6 +102,10 @@ swrun_count_processes_by_name( char *nam
|
||||
return 0; /* or -1 */
|
||||
|
||||
it = CONTAINER_ITERATOR( swrun_container );
|
||||
- while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) {
|
||||
+ for (entry = (netsnmp_swrun_entry*)ITERATOR_FIRST( it );
|
||||
+ entry;
|
||||
+ entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) {
|
||||
+ if((entry = (netsnmp_swrun_entry*)ITERATOR_FIRST( it )) != NULL) {
|
||||
+ if (0 == strcmp( entry->hrSWRunName, name ))
|
||||
+ i++;
|
||||
+ }
|
||||
while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) {
|
||||
if (0 == strcmp( entry->hrSWRunName, name ))
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -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,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)";
|
|
@ -0,0 +1,35 @@
|
|||
diff -urNp a/snmplib/snmp_api.c b/snmplib/snmp_api.c
|
||||
--- a/snmplib/snmp_api.c 2020-11-26 11:05:51.084788775 +0100
|
||||
+++ b/snmplib/snmp_api.c 2020-11-26 11:08:27.850751397 +0100
|
||||
@@ -235,7 +235,7 @@ static const char *api_errors[-SNMPERR_M
|
||||
"No error", /* SNMPERR_SUCCESS */
|
||||
"Generic error", /* SNMPERR_GENERR */
|
||||
"Invalid local port", /* SNMPERR_BAD_LOCPORT */
|
||||
- "Unknown host", /* SNMPERR_BAD_ADDRESS */
|
||||
+ "Invalid address", /* SNMPERR_BAD_ADDRESS */
|
||||
"Unknown session", /* SNMPERR_BAD_SESSION */
|
||||
"Too long", /* SNMPERR_TOO_LONG */
|
||||
"No socket", /* SNMPERR_NO_SOCKET */
|
||||
@@ -1662,7 +1662,9 @@ _sess_open(netsnmp_session * in_session)
|
||||
DEBUGMSGTL(("_sess_open", "couldn't interpret peername\n"));
|
||||
in_session->s_snmp_errno = SNMPERR_BAD_ADDRESS;
|
||||
in_session->s_errno = errno;
|
||||
- snmp_set_detail(in_session->peername);
|
||||
+ if (!netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
|
||||
+ NETSNMP_DS_LIB_CLIENT_ADDR))
|
||||
+ snmp_set_detail(in_session->peername);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
diff -ruNp a/snmplib/transports/snmpUDPIPv4BaseDomain.c b/snmplib/transports/snmpUDPIPv4BaseDomain.c
|
||||
--- a/snmplib/transports/snmpUDPIPv4BaseDomain.c 2021-01-06 12:51:51.948106797 +0100
|
||||
+++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c 2021-01-06 14:17:31.029745744 +0100
|
||||
@@ -209,6 +209,8 @@ netsnmp_udpipv4base_transport_bind(netsn
|
||||
DEBUGMSGTL(("netsnmp_udpbase",
|
||||
"failed to bind for clientaddr: %d %s\n",
|
||||
errno, strerror(errno)));
|
||||
+ NETSNMP_LOGONCE((LOG_ERR, "Cannot bind for clientaddr: %s\n",
|
||||
+ strerror(errno)));
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -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
|
|
@ -0,0 +1,11 @@
|
|||
diff -urNp a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c
|
||||
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2020-06-10 13:27:03.213904398 +0200
|
||||
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2020-06-10 13:28:41.025863050 +0200
|
||||
@@ -121,6 +121,7 @@ _remove_duplicates(netsnmp_container *co
|
||||
for (entry = ITERATOR_FIRST(it); entry; entry = ITERATOR_NEXT(it)) {
|
||||
if (prev_entry && _access_ipaddress_entry_compare_addr(prev_entry, entry) == 0) {
|
||||
/* 'entry' is duplicate of the previous one -> delete it */
|
||||
+ NETSNMP_LOGONCE((LOG_ERR, "Duplicate IPv4 address detected, some interfaces may not be visible in IP-MIB\n"));
|
||||
netsnmp_access_ipaddress_entry_free(entry);
|
||||
} else {
|
||||
CONTAINER_INSERT(ret, entry);
|
|
@ -0,0 +1,12 @@
|
|||
diff -ruNp a/snmplib/read_config.c b/snmplib/read_config.c
|
||||
--- a/snmplib/read_config.c 2020-06-10 09:51:57.184786510 +0200
|
||||
+++ b/snmplib/read_config.c 2020-06-10 09:53:13.257507112 +0200
|
||||
@@ -1642,7 +1642,7 @@ snmp_save_persistent(const char *type)
|
||||
* save a warning header to the top of the new file
|
||||
*/
|
||||
snprintf(fileold, sizeof(fileold),
|
||||
- "%s%s# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s",
|
||||
+ "%s%s# Please save normal configuration tokens for %s in /etc/snmp/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s",
|
||||
"#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n",
|
||||
"#\n# **** DO NOT EDIT THIS FILE ****\n#\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n############################################################################\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n",
|
||||
type, type, type,
|
|
@ -0,0 +1,82 @@
|
|||
diff -urNp a/agent/mibgroup/mibII/ipAddr.c b/agent/mibgroup/mibII/ipAddr.c
|
||||
--- a/agent/mibgroup/mibII/ipAddr.c 2020-06-10 14:14:30.113696471 +0200
|
||||
+++ b/agent/mibgroup/mibII/ipAddr.c 2020-06-10 14:27:15.345354018 +0200
|
||||
@@ -495,14 +495,16 @@ Address_Scan_Next(Index, Retin_ifaddr)
|
||||
}
|
||||
|
||||
#elif defined(linux)
|
||||
+#include <errno.h>
|
||||
static struct ifreq *ifr;
|
||||
static int ifr_counter;
|
||||
|
||||
static void
|
||||
Address_Scan_Init(void)
|
||||
{
|
||||
- int num_interfaces = 0;
|
||||
+ int i;
|
||||
int fd;
|
||||
+ int lastlen = 0;
|
||||
|
||||
/* get info about all interfaces */
|
||||
|
||||
@@ -510,28 +512,45 @@ Address_Scan_Init(void)
|
||||
SNMP_FREE(ifc.ifc_buf);
|
||||
ifr_counter = 0;
|
||||
|
||||
- do
|
||||
- {
|
||||
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||
{
|
||||
DEBUGMSGTL(("snmpd", "socket open failure in Address_Scan_Init\n"));
|
||||
return;
|
||||
}
|
||||
- num_interfaces += 16;
|
||||
|
||||
- ifc.ifc_len = sizeof(struct ifreq) * num_interfaces;
|
||||
- ifc.ifc_buf = (char*) realloc(ifc.ifc_buf, ifc.ifc_len);
|
||||
-
|
||||
- if (ioctl(fd, SIOCGIFCONF, &ifc) < 0)
|
||||
- {
|
||||
- ifr=NULL;
|
||||
- close(fd);
|
||||
- return;
|
||||
- }
|
||||
- close(fd);
|
||||
+ /*
|
||||
+ * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF
|
||||
+ * on some platforms; see W. R. Stevens, ``Unix Network Programming
|
||||
+ * Volume I'', p.435...
|
||||
+ */
|
||||
+
|
||||
+ for (i = 8;; i *= 2) {
|
||||
+ ifc.ifc_len = sizeof(struct ifreq) * i;
|
||||
+ ifc.ifc_req = calloc(i, sizeof(struct ifreq));
|
||||
+
|
||||
+ if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
|
||||
+ if (errno != EINVAL || lastlen != 0) {
|
||||
+ /*
|
||||
+ * Something has gone genuinely wrong...
|
||||
+ */
|
||||
+ snmp_log(LOG_ERR, "bad rc from ioctl, errno %d", errno);
|
||||
+ SNMP_FREE(ifc.ifc_buf);
|
||||
+ close(fd);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (ifc.ifc_len == lastlen) {
|
||||
+ /*
|
||||
+ * The length is the same as the last time; we're done...
|
||||
+ */
|
||||
+ break;
|
||||
+ }
|
||||
+ lastlen = ifc.ifc_len;
|
||||
+ }
|
||||
+ free(ifc.ifc_buf); /* no SNMP_FREE, getting ready to reassign */
|
||||
}
|
||||
- while (ifc.ifc_len >= (sizeof(struct ifreq) * num_interfaces));
|
||||
-
|
||||
+
|
||||
+ close(fd);
|
||||
ifr = ifc.ifc_req;
|
||||
}
|
||||
|
|
@ -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,12 +0,0 @@
|
|||
diff -urNp a/apps/Makefile.in b/apps/Makefile.in
|
||||
--- a/apps/Makefile.in 2018-07-18 15:39:28.069251000 +0200
|
||||
+++ b/apps/Makefile.in 2018-07-18 15:54:52.261943123 +0200
|
||||
@@ -230,7 +230,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX
|
||||
$(LINK) ${CFLAGS} -o $@ snmppcap.$(OSUFFIX) ${LDFLAGS} ${LIBS} -lpcap
|
||||
|
||||
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
|
||||
- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS)
|
||||
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS)
|
||||
$(RANLIB) $@
|
||||
|
||||
snmpinforminstall:
|
|
@ -0,0 +1,36 @@
|
|||
diff -urNp a/man/net-snmp-create-v3-user.1.def b/man/net-snmp-create-v3-user.1.def
|
||||
--- a/man/net-snmp-create-v3-user.1.def 2020-06-10 13:43:18.443070961 +0200
|
||||
+++ b/man/net-snmp-create-v3-user.1.def 2020-06-10 13:49:25.975363441 +0200
|
||||
@@ -3,7 +3,7 @@
|
||||
net-snmp-create-v3-user \- create a SNMPv3 user in net-snmp configuration file
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
-.B net-snmp-create-v3-user [-ro] [-a authpass] [-x privpass] [-X DES|AES]
|
||||
+.B net-snmp-create-v3-user [-ro] [-A authpass] [-a MD5|SHA] [-X privpass] [-x DES|AES]
|
||||
.B [username]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
@@ -16,13 +16,16 @@ new user in net-snmp configuration file
|
||||
displays the net-snmp version number
|
||||
.TP
|
||||
\fB\-ro\fR
|
||||
-create an user with read-only permissions
|
||||
+creates a user with read-only permissions
|
||||
.TP
|
||||
-\fB\-a authpass\fR
|
||||
-specify authentication password
|
||||
+\fB\-A authpass\fR
|
||||
+specifies the authentication password
|
||||
.TP
|
||||
-\fB\-x privpass\fR
|
||||
-specify encryption password
|
||||
+\fB\-a MD5|SHA\fR
|
||||
+specifies the authentication password hashing algorithm
|
||||
.TP
|
||||
-\fB\-X DES|AES\fR
|
||||
-specify encryption algorithm
|
||||
+\fB\-X privpass\fR
|
||||
+specifies the encryption password
|
||||
+.TP
|
||||
+\fB\-x DES|AES\fR
|
||||
+specifies the encryption algorithm
|
|
@ -1,20 +0,0 @@
|
|||
diff -urNp a/python/setup.py b/python/setup.py
|
||||
--- a/python/setup.py 2018-11-29 16:39:33.959745228 +0100
|
||||
+++ b/python/setup.py 2018-11-29 16:40:19.125513424 +0100
|
||||
@@ -18,14 +18,14 @@ if intree:
|
||||
netsnmp_libs = os.popen(basedir+'/net-snmp-config --libs').read()
|
||||
libdir = os.popen(basedir+'/net-snmp-config --build-lib-dirs '+basedir).read()
|
||||
incdir = os.popen(basedir+'/net-snmp-config --build-includes '+basedir).read() + " " + os.popen(basedir+'/net-snmp-config --base-cflags '+basedir).read()
|
||||
- libs = re.findall(r"-l(\S+)", netsnmp_libs)
|
||||
+ libs = re.findall(r"\s-l(\S+)", netsnmp_libs)
|
||||
libdirs = re.findall(r"-L(\S+)", libdir)
|
||||
incdirs = re.findall(r"-I(\S+)", incdir)
|
||||
else:
|
||||
netsnmp_libs = os.popen('net-snmp-config --libs').read()
|
||||
libdirs = re.findall(r"-L(\S+)", netsnmp_libs)
|
||||
incdirs = []
|
||||
- libs = re.findall(r"-l(\S+)", netsnmp_libs)
|
||||
+ libs = re.findall(r"\s-l(\S+)", netsnmp_libs)
|
||||
|
||||
setup(
|
||||
name="netsnmp-python", version="1.0a1",
|
|
@ -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:
|
|
@ -0,0 +1,28 @@
|
|||
diff --git a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c
|
||||
index 695c469..dd0e487 100644
|
||||
--- a/agent/mibgroup/host/data_access/swinst_rpm.c
|
||||
+++ b/agent/mibgroup/host/data_access/swinst_rpm.c
|
||||
@@ -75,6 +75,9 @@ netsnmp_swinst_arch_init(void)
|
||||
snprintf( pkg_directory, SNMP_MAXPATH, "%s/Packages", dbpath );
|
||||
SNMP_FREE(rpmdbpath);
|
||||
dbpath = NULL;
|
||||
+#ifdef HAVE_RPMGETPATH
|
||||
+ rpmFreeRpmrc();
|
||||
+#endif
|
||||
if (-1 == stat( pkg_directory, &stat_buf )) {
|
||||
snmp_log(LOG_ERR, "Can't find directory of RPM packages\n");
|
||||
pkg_directory[0] = '\0';
|
||||
diff --git a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c
|
||||
index 1f52733..ccf1cab 100644
|
||||
--- a/agent/mibgroup/host/hr_swinst.c
|
||||
+++ b/agent/mibgroup/host/hr_swinst.c
|
||||
@@ -231,6 +231,9 @@ init_hr_swinst(void)
|
||||
snprintf(path, sizeof(path), "%s/packages.rpm", swi->swi_dbpath);
|
||||
path[ sizeof(path)-1 ] = 0;
|
||||
swi->swi_directory = strdup(path);
|
||||
+#ifdef HAVE_RPMGETPATH
|
||||
+ rpmFreeRpmrc();
|
||||
+#endif
|
||||
}
|
||||
#else
|
||||
# ifdef _PATH_HRSW_directory
|
|
@ -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
|
|
@ -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
|
||||
;;
|
|
@ -0,0 +1,12 @@
|
|||
diff --git a/agent/mibgroup/host/hr_filesys.c b/agent/mibgroup/host/hr_filesys.c
|
||||
index e7ca92f..80b3e0d 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
|
|
@ -0,0 +1,20 @@
|
|||
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');
|
||||
}
|
||||
}
|
|
@ -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;
|
|
@ -0,0 +1,30 @@
|
|||
diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
||||
index 19895a1..ac3c60f 100644
|
||||
--- a/net-snmp-create-v3-user.in
|
||||
+++ b/net-snmp-create-v3-user.in
|
||||
@@ -14,6 +14,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,11 +138,9 @@ if test ! -d "$outfile"; then
|
||||
touch "$outfile"
|
||||
fi
|
||||
echo "$line" >> "$outfile"
|
||||
-prefix=@prefix@
|
||||
-datarootdir=@datarootdir@
|
||||
-# To suppress shellcheck complaints about $prefix and $datarootdir.
|
||||
-: "$prefix" "$datarootdir"
|
||||
-outfile="@datadir@/snmp/snmpd.conf"
|
||||
+# Avoid that configure complains that this script ignores @datarootdir@
|
||||
+echo "@datarootdir@" >/dev/null
|
||||
+outfile="/etc/snmp/snmpd.conf"
|
||||
line="$token $user"
|
||||
echo "adding the following line to $outfile:"
|
||||
echo " $line"
|
|
@ -0,0 +1,855 @@
|
|||
diff --git a/include/net-snmp/library/cert_util.h b/include/net-snmp/library/cert_util.h
|
||||
index 80e2a19..143adbb 100644
|
||||
--- a/include/net-snmp/library/cert_util.h
|
||||
+++ b/include/net-snmp/library/cert_util.h
|
||||
@@ -55,7 +55,8 @@ extern "C" {
|
||||
char *common_name;
|
||||
|
||||
u_char hash_type;
|
||||
- u_char _pad[3]; /* for future use */
|
||||
+ u_char _pad[1]; /* for future use */
|
||||
+ u_short offset;
|
||||
} netsnmp_cert;
|
||||
|
||||
/** types */
|
||||
@@ -100,6 +101,7 @@ extern "C" {
|
||||
|
||||
NETSNMP_IMPORT
|
||||
netsnmp_cert *netsnmp_cert_find(int what, int where, void *hint);
|
||||
+ netsnmp_void_array *netsnmp_certs_find(int what, int where, void *hint);
|
||||
|
||||
int netsnmp_cert_check_vb_fingerprint(const netsnmp_variable_list *var);
|
||||
|
||||
diff --git a/include/net-snmp/library/dir_utils.h b/include/net-snmp/library/dir_utils.h
|
||||
index 471bb0b..ac7f69a 100644
|
||||
--- a/include/net-snmp/library/dir_utils.h
|
||||
+++ b/include/net-snmp/library/dir_utils.h
|
||||
@@ -53,7 +53,8 @@ extern "C" {
|
||||
#define NETSNMP_DIR_NSFILE 0x0010
|
||||
/** load stats in netsnmp_file */
|
||||
#define NETSNMP_DIR_NSFILE_STATS 0x0020
|
||||
-
|
||||
+/** allow files to be indexed more than once */
|
||||
+#define NETSNMP_DIR_ALLOW_DUPLICATES 0x0040
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
diff --git a/snmplib/cert_util.c b/snmplib/cert_util.c
|
||||
index 210ad8b..b1f8144 100644
|
||||
--- a/snmplib/cert_util.c
|
||||
+++ b/snmplib/cert_util.c
|
||||
@@ -100,7 +100,7 @@ netsnmp_feature_child_of(tls_fingerprint_build, cert_util_all);
|
||||
* bump this value whenever cert index format changes, so indexes
|
||||
* will be regenerated with new format.
|
||||
*/
|
||||
-#define CERT_INDEX_FORMAT 1
|
||||
+#define CERT_INDEX_FORMAT 2
|
||||
|
||||
static netsnmp_container *_certs = NULL;
|
||||
static netsnmp_container *_keys = NULL;
|
||||
@@ -126,6 +126,8 @@ static int _cert_fn_ncompare(netsnmp_cert_common *lhs,
|
||||
netsnmp_cert_common *rhs);
|
||||
static void _find_partner(netsnmp_cert *cert, netsnmp_key *key);
|
||||
static netsnmp_cert *_find_issuer(netsnmp_cert *cert);
|
||||
+static netsnmp_void_array *_cert_reduce_subset_first(netsnmp_void_array *matching);
|
||||
+static netsnmp_void_array *_cert_reduce_subset_what(netsnmp_void_array *matching, int what);
|
||||
static netsnmp_void_array *_cert_find_subset_fn(const char *filename,
|
||||
const char *directory);
|
||||
static netsnmp_void_array *_cert_find_subset_sn(const char *subject);
|
||||
@@ -345,6 +347,8 @@ _get_cert_container(const char *use)
|
||||
{
|
||||
netsnmp_container *c;
|
||||
|
||||
+ int rc;
|
||||
+
|
||||
c = netsnmp_container_find("certs:binary_array");
|
||||
if (NULL == c) {
|
||||
snmp_log(LOG_ERR, "could not create container for %s\n", use);
|
||||
@@ -354,6 +358,8 @@ _get_cert_container(const char *use)
|
||||
c->free_item = (netsnmp_container_obj_func*)_cert_free;
|
||||
c->compare = (netsnmp_container_compare*)_cert_compare;
|
||||
|
||||
+ CONTAINER_SET_OPTIONS(c, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
|
||||
+
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -362,6 +368,8 @@ _setup_containers(void)
|
||||
{
|
||||
netsnmp_container *additional_keys;
|
||||
|
||||
+ int rc;
|
||||
+
|
||||
_certs = _get_cert_container("netsnmp certificates");
|
||||
if (NULL == _certs)
|
||||
return;
|
||||
@@ -376,6 +384,7 @@ _setup_containers(void)
|
||||
additional_keys->container_name = strdup("certs_cn");
|
||||
additional_keys->free_item = NULL;
|
||||
additional_keys->compare = (netsnmp_container_compare*)_cert_cn_compare;
|
||||
+ CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
|
||||
netsnmp_container_add_index(_certs, additional_keys);
|
||||
|
||||
/** additional keys: subject name */
|
||||
@@ -389,6 +398,7 @@ _setup_containers(void)
|
||||
additional_keys->free_item = NULL;
|
||||
additional_keys->compare = (netsnmp_container_compare*)_cert_sn_compare;
|
||||
additional_keys->ncompare = (netsnmp_container_compare*)_cert_sn_ncompare;
|
||||
+ CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
|
||||
netsnmp_container_add_index(_certs, additional_keys);
|
||||
|
||||
/** additional keys: file name */
|
||||
@@ -402,6 +412,7 @@ _setup_containers(void)
|
||||
additional_keys->free_item = NULL;
|
||||
additional_keys->compare = (netsnmp_container_compare*)_cert_fn_compare;
|
||||
additional_keys->ncompare = (netsnmp_container_compare*)_cert_fn_ncompare;
|
||||
+ CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
|
||||
netsnmp_container_add_index(_certs, additional_keys);
|
||||
|
||||
_keys = netsnmp_container_find("cert_keys:binary_array");
|
||||
@@ -424,7 +435,7 @@ netsnmp_cert_map_container(void)
|
||||
}
|
||||
|
||||
static netsnmp_cert *
|
||||
-_new_cert(const char *dirname, const char *filename, int certType,
|
||||
+_new_cert(const char *dirname, const char *filename, int certType, int offset,
|
||||
int hashType, const char *fingerprint, const char *common_name,
|
||||
const char *subject)
|
||||
{
|
||||
@@ -446,8 +457,10 @@ _new_cert(const char *dirname, const char *filename, int certType,
|
||||
|
||||
cert->info.dir = strdup(dirname);
|
||||
cert->info.filename = strdup(filename);
|
||||
- cert->info.allowed_uses = NS_CERT_REMOTE_PEER;
|
||||
+ /* only the first certificate is allowed to be a remote peer */
|
||||
+ cert->info.allowed_uses = offset ? 0 : NS_CERT_REMOTE_PEER;
|
||||
cert->info.type = certType;
|
||||
+ cert->offset = offset;
|
||||
if (fingerprint) {
|
||||
cert->hash_type = hashType;
|
||||
cert->fingerprint = strdup(fingerprint);
|
||||
@@ -884,14 +897,86 @@ _certindex_new( const char *dirname )
|
||||
* certificate utility functions
|
||||
*
|
||||
*/
|
||||
+static BIO *
|
||||
+netsnmp_open_bio(const char *dir, const char *filename)
|
||||
+{
|
||||
+ BIO *certbio;
|
||||
+ char file[SNMP_MAXPATH];
|
||||
+
|
||||
+ DEBUGMSGT(("9:cert:read", "Checking file %s\n", filename));
|
||||
+
|
||||
+ certbio = BIO_new(BIO_s_file());
|
||||
+ if (NULL == certbio) {
|
||||
+ snmp_log(LOG_ERR, "error creating BIO\n");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ snprintf(file, sizeof(file),"%s/%s", dir, filename);
|
||||
+ if (BIO_read_filename(certbio, file) <=0) {
|
||||
+ snmp_log(LOG_ERR, "error reading certificate/key %s into BIO\n", file);
|
||||
+ BIO_vfree(certbio);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return certbio;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+netsnmp_ocert_parse(netsnmp_cert *cert, X509 *ocert)
|
||||
+{
|
||||
+ int is_ca;
|
||||
+
|
||||
+ cert->ocert = ocert;
|
||||
+
|
||||
+ /*
|
||||
+ * X509_check_ca return codes:
|
||||
+ * 0 not a CA
|
||||
+ * 1 is a CA
|
||||
+ * 2 basicConstraints absent so "maybe" a CA
|
||||
+ * 3 basicConstraints absent but self signed V1.
|
||||
+ * 4 basicConstraints absent but keyUsage present and keyCertSign asserted.
|
||||
+ * 5 outdated Netscape Certificate Type CA extension.
|
||||
+ */
|
||||
+ is_ca = X509_check_ca(ocert);
|
||||
+ if (1 == is_ca)
|
||||
+ cert->info.allowed_uses |= NS_CERT_CA;
|
||||
+
|
||||
+ if (NULL == cert->subject) {
|
||||
+ cert->subject = X509_NAME_oneline(X509_get_subject_name(ocert), NULL,
|
||||
+ 0);
|
||||
+ DEBUGMSGT(("9:cert:add:subject", "subject name: %s\n", cert->subject));
|
||||
+ }
|
||||
+
|
||||
+ if (NULL == cert->issuer) {
|
||||
+ cert->issuer = X509_NAME_oneline(X509_get_issuer_name(ocert), NULL, 0);
|
||||
+ if (strcmp(cert->subject, cert->issuer) == 0) {
|
||||
+ free(cert->issuer);
|
||||
+ cert->issuer = strdup("self-signed");
|
||||
+ }
|
||||
+ DEBUGMSGT(("9:cert:add:issuer", "CA issuer: %s\n", cert->issuer));
|
||||
+ }
|
||||
+
|
||||
+ if (NULL == cert->fingerprint) {
|
||||
+ cert->hash_type = netsnmp_openssl_cert_get_hash_type(ocert);
|
||||
+ cert->fingerprint =
|
||||
+ netsnmp_openssl_cert_get_fingerprint(ocert, cert->hash_type);
|
||||
+ }
|
||||
+
|
||||
+ if (NULL == cert->common_name) {
|
||||
+ cert->common_name =netsnmp_openssl_cert_get_commonName(ocert, NULL,
|
||||
+ NULL);
|
||||
+ DEBUGMSGT(("9:cert:add:name","%s\n", cert->common_name));
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
static X509 *
|
||||
netsnmp_ocert_get(netsnmp_cert *cert)
|
||||
{
|
||||
BIO *certbio;
|
||||
X509 *ocert = NULL;
|
||||
+ X509 *ncert = NULL;
|
||||
EVP_PKEY *okey = NULL;
|
||||
- char file[SNMP_MAXPATH];
|
||||
- int is_ca;
|
||||
|
||||
if (NULL == cert)
|
||||
return NULL;
|
||||
@@ -908,51 +993,33 @@ netsnmp_ocert_get(netsnmp_cert *cert)
|
||||
}
|
||||
}
|
||||
|
||||
- DEBUGMSGT(("9:cert:read", "Checking file %s\n", cert->info.filename));
|
||||
-
|
||||
- certbio = BIO_new(BIO_s_file());
|
||||
- if (NULL == certbio) {
|
||||
- snmp_log(LOG_ERR, "error creating BIO\n");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- snprintf(file, sizeof(file),"%s/%s", cert->info.dir, cert->info.filename);
|
||||
- if (BIO_read_filename(certbio, file) <=0) {
|
||||
- snmp_log(LOG_ERR, "error reading certificate %s into BIO\n", file);
|
||||
- BIO_vfree(certbio);
|
||||
+ certbio = netsnmp_open_bio(cert->info.dir, cert->info.filename);
|
||||
+ if (!certbio) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (NS_CERT_TYPE_UNKNOWN == cert->info.type) {
|
||||
- char *pos = strrchr(cert->info.filename, '.');
|
||||
- if (NULL == pos)
|
||||
- return NULL;
|
||||
- cert->info.type = _cert_ext_type(++pos);
|
||||
- netsnmp_assert(cert->info.type != NS_CERT_TYPE_UNKNOWN);
|
||||
- }
|
||||
-
|
||||
switch (cert->info.type) {
|
||||
|
||||
case NS_CERT_TYPE_DER:
|
||||
+ (void)BIO_seek(certbio, cert->offset);
|
||||
ocert = d2i_X509_bio(certbio,NULL); /* DER/ASN1 */
|
||||
if (NULL != ocert)
|
||||
break;
|
||||
- (void)BIO_reset(certbio);
|
||||
/* Check for PEM if DER didn't work */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case NS_CERT_TYPE_PEM:
|
||||
- ocert = PEM_read_bio_X509_AUX(certbio, NULL, NULL, NULL);
|
||||
+ (void)BIO_seek(certbio, cert->offset);
|
||||
+ ocert = ncert = PEM_read_bio_X509_AUX(certbio, NULL, NULL, NULL);
|
||||
if (NULL == ocert)
|
||||
break;
|
||||
if (NS_CERT_TYPE_DER == cert->info.type) {
|
||||
DEBUGMSGT(("9:cert:read", "Changing type from DER to PEM\n"));
|
||||
cert->info.type = NS_CERT_TYPE_PEM;
|
||||
}
|
||||
- /** check for private key too */
|
||||
- if (NULL == cert->key) {
|
||||
- (void)BIO_reset(certbio);
|
||||
- okey = PEM_read_bio_PrivateKey(certbio, NULL, NULL, NULL);
|
||||
+ /** check for private key too, but only if we're the first certificate */
|
||||
+ if (0 == cert->offset && NULL == cert->key) {
|
||||
+ okey = PEM_read_bio_PrivateKey(certbio, NULL, NULL, NULL);
|
||||
if (NULL != okey) {
|
||||
netsnmp_key *key;
|
||||
DEBUGMSGT(("cert:read:key", "found key with cert in %s\n",
|
||||
@@ -979,7 +1046,7 @@ netsnmp_ocert_get(netsnmp_cert *cert)
|
||||
break;
|
||||
#ifdef CERT_PKCS12_SUPPORT_MAYBE_LATER
|
||||
case NS_CERT_TYPE_PKCS12:
|
||||
- (void)BIO_reset(certbio);
|
||||
+ (void)BIO_seek(certbio, cert->offset);
|
||||
PKCS12 *p12 = d2i_PKCS12_bio(certbio, NULL);
|
||||
if ( (NULL != p12) && (PKCS12_verify_mac(p12, "", 0) ||
|
||||
PKCS12_verify_mac(p12, NULL, 0)))
|
||||
@@ -999,46 +1066,7 @@ netsnmp_ocert_get(netsnmp_cert *cert)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- cert->ocert = ocert;
|
||||
- /*
|
||||
- * X509_check_ca return codes:
|
||||
- * 0 not a CA
|
||||
- * 1 is a CA
|
||||
- * 2 basicConstraints absent so "maybe" a CA
|
||||
- * 3 basicConstraints absent but self signed V1.
|
||||
- * 4 basicConstraints absent but keyUsage present and keyCertSign asserted.
|
||||
- * 5 outdated Netscape Certificate Type CA extension.
|
||||
- */
|
||||
- is_ca = X509_check_ca(ocert);
|
||||
- if (1 == is_ca)
|
||||
- cert->info.allowed_uses |= NS_CERT_CA;
|
||||
-
|
||||
- if (NULL == cert->subject) {
|
||||
- cert->subject = X509_NAME_oneline(X509_get_subject_name(ocert), NULL,
|
||||
- 0);
|
||||
- DEBUGMSGT(("9:cert:add:subject", "subject name: %s\n", cert->subject));
|
||||
- }
|
||||
-
|
||||
- if (NULL == cert->issuer) {
|
||||
- cert->issuer = X509_NAME_oneline(X509_get_issuer_name(ocert), NULL, 0);
|
||||
- if (strcmp(cert->subject, cert->issuer) == 0) {
|
||||
- free(cert->issuer);
|
||||
- cert->issuer = strdup("self-signed");
|
||||
- }
|
||||
- DEBUGMSGT(("9:cert:add:issuer", "CA issuer: %s\n", cert->issuer));
|
||||
- }
|
||||
-
|
||||
- if (NULL == cert->fingerprint) {
|
||||
- cert->hash_type = netsnmp_openssl_cert_get_hash_type(ocert);
|
||||
- cert->fingerprint =
|
||||
- netsnmp_openssl_cert_get_fingerprint(ocert, cert->hash_type);
|
||||
- }
|
||||
-
|
||||
- if (NULL == cert->common_name) {
|
||||
- cert->common_name =netsnmp_openssl_cert_get_commonName(ocert, NULL,
|
||||
- NULL);
|
||||
- DEBUGMSGT(("9:cert:add:name","%s\n", cert->common_name));
|
||||
- }
|
||||
+ netsnmp_ocert_parse(cert, ocert);
|
||||
|
||||
return ocert;
|
||||
}
|
||||
@@ -1048,7 +1076,6 @@ netsnmp_okey_get(netsnmp_key *key)
|
||||
{
|
||||
BIO *keybio;
|
||||
EVP_PKEY *okey;
|
||||
- char file[SNMP_MAXPATH];
|
||||
|
||||
if (NULL == key)
|
||||
return NULL;
|
||||
@@ -1056,19 +1083,8 @@ netsnmp_okey_get(netsnmp_key *key)
|
||||
if (key->okey)
|
||||
return key->okey;
|
||||
|
||||
- snprintf(file, sizeof(file),"%s/%s", key->info.dir, key->info.filename);
|
||||
- DEBUGMSGT(("cert:key:read", "Checking file %s\n", key->info.filename));
|
||||
-
|
||||
- keybio = BIO_new(BIO_s_file());
|
||||
- if (NULL == keybio) {
|
||||
- snmp_log(LOG_ERR, "error creating BIO\n");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (BIO_read_filename(keybio, file) <=0) {
|
||||
- snmp_log(LOG_ERR, "error reading certificate %s into BIO\n",
|
||||
- key->info.filename);
|
||||
- BIO_vfree(keybio);
|
||||
+ keybio = netsnmp_open_bio(key->info.dir, key->info.filename);
|
||||
+ if (!keybio) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1154,7 +1170,7 @@ netsnmp_cert_load_x509(netsnmp_cert *cert)
|
||||
cert->issuer_cert = _find_issuer(cert);
|
||||
if (NULL == cert->issuer_cert) {
|
||||
DEBUGMSGT(("cert:load:warn",
|
||||
- "couldn't load CA chain for cert %s\n",
|
||||
+ "couldn't load full CA chain for cert %s\n",
|
||||
cert->info.filename));
|
||||
rc = CERT_LOAD_PARTIAL;
|
||||
break;
|
||||
@@ -1163,7 +1179,7 @@ netsnmp_cert_load_x509(netsnmp_cert *cert)
|
||||
/** get issuer ocert */
|
||||
if ((NULL == cert->issuer_cert->ocert) &&
|
||||
(netsnmp_ocert_get(cert->issuer_cert) == NULL)) {
|
||||
- DEBUGMSGT(("cert:load:warn", "couldn't load cert chain for %s\n",
|
||||
+ DEBUGMSGT(("cert:load:warn", "couldn't load full cert chain for %s\n",
|
||||
cert->info.filename));
|
||||
rc = CERT_LOAD_PARTIAL;
|
||||
break;
|
||||
@@ -1184,7 +1200,7 @@ _find_partner(netsnmp_cert *cert, netsnmp_key *key)
|
||||
return;
|
||||
}
|
||||
|
||||
- if(key) {
|
||||
+ if (key) {
|
||||
if (key->cert) {
|
||||
DEBUGMSGT(("cert:partner", "key already has partner\n"));
|
||||
return;
|
||||
@@ -1197,7 +1213,8 @@ _find_partner(netsnmp_cert *cert, netsnmp_key *key)
|
||||
return;
|
||||
*pos = 0;
|
||||
|
||||
- matching = _cert_find_subset_fn( filename, key->info.dir );
|
||||
+ matching = _cert_reduce_subset_first(_cert_find_subset_fn( filename,
|
||||
+ key->info.dir ));
|
||||
if (!matching)
|
||||
return;
|
||||
if (1 == matching->size) {
|
||||
@@ -1217,7 +1234,7 @@ _find_partner(netsnmp_cert *cert, netsnmp_key *key)
|
||||
DEBUGMSGT(("cert:partner", "%s matches multiple certs\n",
|
||||
key->info.filename));
|
||||
}
|
||||
- else if(cert) {
|
||||
+ else if (cert) {
|
||||
if (cert->key) {
|
||||
DEBUGMSGT(("cert:partner", "cert already has partner\n"));
|
||||
return;
|
||||
@@ -1255,76 +1272,182 @@ _find_partner(netsnmp_cert *cert, netsnmp_key *key)
|
||||
}
|
||||
}
|
||||
|
||||
+static netsnmp_key *
|
||||
+_add_key(EVP_PKEY *okey, const char* dirname, const char* filename, FILE *index)
|
||||
+{
|
||||
+ netsnmp_key *key;
|
||||
+
|
||||
+ key = _new_key(dirname, filename);
|
||||
+ if (NULL == key) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ key->okey = okey;
|
||||
+
|
||||
+ if (-1 == CONTAINER_INSERT(_keys, key)) {
|
||||
+ DEBUGMSGT(("cert:key:file:add:err",
|
||||
+ "error inserting key into container\n"));
|
||||
+ netsnmp_key_free(key);
|
||||
+ key = NULL;
|
||||
+ }
|
||||
+ if (index) {
|
||||
+ fprintf(index, "k:%s\n", filename);
|
||||
+ }
|
||||
+
|
||||
+ return key;
|
||||
+}
|
||||
+
|
||||
+static netsnmp_cert *
|
||||
+_add_cert(X509 *ocert, const char* dirname, const char* filename, int type, int offset, FILE *index)
|
||||
+{
|
||||
+ netsnmp_cert *cert;
|
||||
+
|
||||
+ cert = _new_cert(dirname, filename, type, offset, -1, NULL, NULL, NULL);
|
||||
+ if (NULL == cert)
|
||||
+ return NULL;
|
||||
+
|
||||
+ netsnmp_ocert_parse(cert, ocert);
|
||||
+
|
||||
+ if (-1 == CONTAINER_INSERT(_certs, cert)) {
|
||||
+ DEBUGMSGT(("cert:file:add:err",
|
||||
+ "error inserting cert into container\n"));
|
||||
+ netsnmp_cert_free(cert);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (index) {
|
||||
+ /** filename = NAME_MAX = 255 */
|
||||
+ /** fingerprint max = 64*3=192 for sha512 */
|
||||
+ /** common name / CN = 64 */
|
||||
+ if (cert)
|
||||
+ fprintf(index, "c:%s %d %d %d %s '%s' '%s'\n", filename,
|
||||
+ cert->info.type, cert->offset, cert->hash_type, cert->fingerprint,
|
||||
+ cert->common_name, cert->subject);
|
||||
+ }
|
||||
+
|
||||
+ return cert;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
_add_certfile(const char* dirname, const char* filename, FILE *index)
|
||||
{
|
||||
- X509 *ocert;
|
||||
- EVP_PKEY *okey;
|
||||
+ BIO *certbio;
|
||||
+ X509 *ocert = NULL;
|
||||
+ X509 *ncert;
|
||||
+ EVP_PKEY *okey = NULL;
|
||||
netsnmp_cert *cert = NULL;
|
||||
netsnmp_key *key = NULL;
|
||||
char certfile[SNMP_MAXPATH];
|
||||
int type;
|
||||
+ int offset = 0;
|
||||
|
||||
if (((const void*)NULL == dirname) || (NULL == filename))
|
||||
return -1;
|
||||
|
||||
type = _type_from_filename(filename);
|
||||
- netsnmp_assert(type != NS_CERT_TYPE_UNKNOWN);
|
||||
+ if (type == NS_CERT_TYPE_UNKNOWN) {
|
||||
+ snmp_log(LOG_ERR, "certificate file '%s' type not recognised, ignoring\n", filename);
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- snprintf(certfile, sizeof(certfile),"%s/%s", dirname, filename);
|
||||
+ certbio = netsnmp_open_bio(dirname, filename);
|
||||
+ if (!certbio) {
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- DEBUGMSGT(("9:cert:file:add", "Checking file: %s (type %d)\n", filename,
|
||||
- type));
|
||||
+ switch (type) {
|
||||
|
||||
- if (NS_CERT_TYPE_KEY == type) {
|
||||
- key = _new_key(dirname, filename);
|
||||
- if (NULL == key)
|
||||
- return -1;
|
||||
- okey = netsnmp_okey_get(key);
|
||||
- if (NULL == okey) {
|
||||
- netsnmp_key_free(key);
|
||||
- return -1;
|
||||
- }
|
||||
- key->okey = okey;
|
||||
- if (-1 == CONTAINER_INSERT(_keys, key)) {
|
||||
- DEBUGMSGT(("cert:key:file:add:err",
|
||||
- "error inserting key into container\n"));
|
||||
- netsnmp_key_free(key);
|
||||
- key = NULL;
|
||||
- }
|
||||
- }
|
||||
- else {
|
||||
- cert = _new_cert(dirname, filename, type, -1, NULL, NULL, NULL);
|
||||
- if (NULL == cert)
|
||||
- return -1;
|
||||
- ocert = netsnmp_ocert_get(cert);
|
||||
- if (NULL == ocert) {
|
||||
- netsnmp_cert_free(cert);
|
||||
- return -1;
|
||||
- }
|
||||
- cert->ocert = ocert;
|
||||
- if (-1 == CONTAINER_INSERT(_certs, cert)) {
|
||||
- DEBUGMSGT(("cert:file:add:err",
|
||||
- "error inserting cert into container\n"));
|
||||
- netsnmp_cert_free(cert);
|
||||
- cert = NULL;
|
||||
- }
|
||||
- }
|
||||
- if ((NULL == cert) && (NULL == key)) {
|
||||
- DEBUGMSGT(("cert:file:add:failure", "for %s\n", certfile));
|
||||
- return -1;
|
||||
+ case NS_CERT_TYPE_KEY:
|
||||
+
|
||||
+ okey = PEM_read_bio_PrivateKey(certbio, NULL, NULL, NULL);
|
||||
+ if (NULL == okey)
|
||||
+ snmp_log(LOG_ERR, "error parsing key file %s\n",
|
||||
+ key->info.filename);
|
||||
+ else {
|
||||
+ key = _add_key(okey, dirname, filename, index);
|
||||
+ if (NULL == key) {
|
||||
+ EVP_PKEY_free(okey);
|
||||
+ okey = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case NS_CERT_TYPE_DER:
|
||||
+
|
||||
+ ocert = d2i_X509_bio(certbio, NULL); /* DER/ASN1 */
|
||||
+ if (NULL != ocert) {
|
||||
+ if (!_add_cert(ocert, dirname, filename, type, 0, index)) {
|
||||
+ X509_free(ocert);
|
||||
+ ocert = NULL;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ (void)BIO_reset(certbio);
|
||||
+ /* Check for PEM if DER didn't work */
|
||||
+ /* FALLTHROUGH */
|
||||
+
|
||||
+ case NS_CERT_TYPE_PEM:
|
||||
+
|
||||
+ if (NS_CERT_TYPE_DER == type) {
|
||||
+ DEBUGMSGT(("9:cert:read", "Changing type from DER to PEM\n"));
|
||||
+ type = NS_CERT_TYPE_PEM;
|
||||
+ }
|
||||
+ ocert = ncert = PEM_read_bio_X509_AUX(certbio, NULL, NULL, NULL);
|
||||
+ if (NULL != ocert) {
|
||||
+ cert = _add_cert(ncert, dirname, filename, type, offset, index);
|
||||
+ if (NULL == cert) {
|
||||
+ X509_free(ocert);
|
||||
+ ocert = ncert = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ while (NULL != ncert) {
|
||||
+ offset = BIO_tell(certbio);
|
||||
+ ncert = PEM_read_bio_X509_AUX(certbio, NULL, NULL, NULL);
|
||||
+ if (ncert) {
|
||||
+ if (NULL == _add_cert(ncert, dirname, filename, type, offset, index)) {
|
||||
+ X509_free(ncert);
|
||||
+ ncert = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ BIO_seek(certbio, offset);
|
||||
+
|
||||
+ /** check for private key too */
|
||||
+ okey = PEM_read_bio_PrivateKey(certbio, NULL, NULL, NULL);
|
||||
+
|
||||
+ if (NULL != okey) {
|
||||
+ DEBUGMSGT(("cert:read:key", "found key with cert in %s\n",
|
||||
+ cert->info.filename));
|
||||
+ key = _add_key(okey, dirname, filename, NULL);
|
||||
+ if (NULL != key) {
|
||||
+ DEBUGMSGT(("cert:read:partner", "%s match found!\n",
|
||||
+ cert->info.filename));
|
||||
+ key->cert = cert;
|
||||
+ cert->key = key;
|
||||
+ cert->info.allowed_uses |= NS_CERT_IDENTITY;
|
||||
+ }
|
||||
+ else {
|
||||
+ EVP_PKEY_free(okey);
|
||||
+ okey = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ break;
|
||||
+
|
||||
+#ifdef CERT_PKCS12_SUPPORT_MAYBE_LATER
|
||||
+ case NS_CERT_TYPE_PKCS12:
|
||||
+#endif
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
}
|
||||
|
||||
- if (index) {
|
||||
- /** filename = NAME_MAX = 255 */
|
||||
- /** fingerprint max = 64*3=192 for sha512 */
|
||||
- /** common name / CN = 64 */
|
||||
- if (cert)
|
||||
- fprintf(index, "c:%s %d %d %s '%s' '%s'\n", filename,
|
||||
- cert->info.type, cert->hash_type, cert->fingerprint,
|
||||
- cert->common_name, cert->subject);
|
||||
- else if (key)
|
||||
- fprintf(index, "k:%s\n", filename);
|
||||
+ BIO_vfree(certbio);
|
||||
+
|
||||
+ if ((NULL == ocert) && (NULL == okey)) {
|
||||
+ snmp_log(LOG_ERR, "certificate file '%s' contained neither certificate nor key, ignoring\n", certfile);
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1338,7 +1461,8 @@ _cert_read_index(const char *dirname, struct stat *dirstat)
|
||||
struct stat idx_stat;
|
||||
char tmpstr[SNMP_MAXPATH + 5], filename[NAME_MAX];
|
||||
char fingerprint[EVP_MAX_MD_SIZE*3], common_name[64+1], type_str[15];
|
||||
- char subject[SNMP_MAXBUF_SMALL], hash_str[15];
|
||||
+ char subject[SNMP_MAXBUF_SMALL], hash_str[15], offset_str[15];
|
||||
+ ssize_t offset;
|
||||
int count = 0, type, hash, version;
|
||||
netsnmp_cert *cert;
|
||||
netsnmp_key *key;
|
||||
@@ -1381,7 +1505,8 @@ _cert_read_index(const char *dirname, struct stat *dirstat)
|
||||
netsnmp_directory_container_read_some(NULL, dirname,
|
||||
_time_filter, &idx_stat,
|
||||
NETSNMP_DIR_NSFILE |
|
||||
- NETSNMP_DIR_NSFILE_STATS);
|
||||
+ NETSNMP_DIR_NSFILE_STATS |
|
||||
+ NETSNMP_DIR_ALLOW_DUPLICATES);
|
||||
if (newer) {
|
||||
DEBUGMSGT(("cert:index:parse", "Index outdated; files modified\n"));
|
||||
CONTAINER_FREE_ALL(newer, NULL);
|
||||
@@ -1426,6 +1551,7 @@ _cert_read_index(const char *dirname, struct stat *dirstat)
|
||||
pos = &tmpstr[2];
|
||||
if ((NULL == (pos=copy_nword(pos, filename, sizeof(filename)))) ||
|
||||
(NULL == (pos=copy_nword(pos, type_str, sizeof(type_str)))) ||
|
||||
+ (NULL == (pos=copy_nword(pos, offset_str, sizeof(offset_str)))) ||
|
||||
(NULL == (pos=copy_nword(pos, hash_str, sizeof(hash_str)))) ||
|
||||
(NULL == (pos=copy_nword(pos, fingerprint,
|
||||
sizeof(fingerprint)))) ||
|
||||
@@ -1438,8 +1564,9 @@ _cert_read_index(const char *dirname, struct stat *dirstat)
|
||||
break;
|
||||
}
|
||||
type = atoi(type_str);
|
||||
+ offset = atoi(offset_str);
|
||||
hash = atoi(hash_str);
|
||||
- cert = _new_cert(dirname, filename, type, hash, fingerprint,
|
||||
+ cert = _new_cert(dirname, filename, type, offset, hash, fingerprint,
|
||||
common_name, subject);
|
||||
if (cert && 0 == CONTAINER_INSERT(found, cert))
|
||||
++count;
|
||||
@@ -1546,7 +1673,8 @@ _add_certdir(const char *dirname)
|
||||
netsnmp_directory_container_read_some(NULL, dirname,
|
||||
_cert_cert_filter, NULL,
|
||||
NETSNMP_DIR_RELATIVE_PATH |
|
||||
- NETSNMP_DIR_EMPTY_OK );
|
||||
+ NETSNMP_DIR_EMPTY_OK |
|
||||
+ NETSNMP_DIR_ALLOW_DUPLICATES);
|
||||
if (NULL == cert_container) {
|
||||
DEBUGMSGT(("cert:index:dir",
|
||||
"error creating container for cert files\n"));
|
||||
@@ -1634,7 +1762,7 @@ _cert_print(netsnmp_cert *c, void *context)
|
||||
if (NULL == c)
|
||||
return;
|
||||
|
||||
- DEBUGMSGT(("cert:dump", "cert %s in %s\n", c->info.filename, c->info.dir));
|
||||
+ DEBUGMSGT(("cert:dump", "cert %s in %s at offset %d\n", c->info.filename, c->info.dir, c->offset));
|
||||
DEBUGMSGT(("cert:dump", " type %d flags 0x%x (%s)\n",
|
||||
c->info.type, c->info.allowed_uses,
|
||||
_mode_str(c->info.allowed_uses)));
|
||||
@@ -1838,7 +1966,8 @@ netsnmp_cert_find(int what, int where, void *hint)
|
||||
netsnmp_void_array *matching;
|
||||
|
||||
DEBUGMSGT(("cert:find:params", " hint = %s\n", (char *)hint));
|
||||
- matching = _cert_find_subset_fn( filename, NULL );
|
||||
+ matching = _cert_reduce_subset_what(_cert_find_subset_fn(
|
||||
+ filename, NULL ), what);
|
||||
if (!matching)
|
||||
return NULL;
|
||||
if (1 == matching->size)
|
||||
@@ -2281,6 +2410,124 @@ _reduce_subset_dir(netsnmp_void_array *matching, const char *directory)
|
||||
}
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * reduce subset by eliminating any certificates that are not the
|
||||
+ * first certficate in a file. This allows us to ignore certificate
|
||||
+ * chains when testing for specific certificates, and to match keys
|
||||
+ * to the first certificate only.
|
||||
+ */
|
||||
+static netsnmp_void_array *
|
||||
+_cert_reduce_subset_first(netsnmp_void_array *matching)
|
||||
+{
|
||||
+ netsnmp_cert *cc;
|
||||
+ int i = 0, j, newsize;
|
||||
+
|
||||
+ if ((NULL == matching))
|
||||
+ return matching;
|
||||
+
|
||||
+ newsize = matching->size;
|
||||
+
|
||||
+ for( ; i < matching->size; ) {
|
||||
+ /*
|
||||
+ * if we've shifted matches down we'll hit a NULL entry before
|
||||
+ * we hit the end of the array.
|
||||
+ */
|
||||
+ if (NULL == matching->array[i])
|
||||
+ break;
|
||||
+ /*
|
||||
+ * skip over valid matches. The first entry has an offset of zero.
|
||||
+ */
|
||||
+ cc = (netsnmp_cert*)matching->array[i];
|
||||
+ if (0 == cc->offset) {
|
||||
+ ++i;
|
||||
+ continue;
|
||||
+ }
|
||||
+ /*
|
||||
+ * shrink array by shifting everything down a spot. Might not be
|
||||
+ * the most efficient soloution, but this is just happening at
|
||||
+ * startup and hopefully most certs won't have common prefixes.
|
||||
+ */
|
||||
+ --newsize;
|
||||
+ for ( j=i; j < newsize; ++j )
|
||||
+ matching->array[j] = matching->array[j+1];
|
||||
+ matching->array[j] = NULL;
|
||||
+ /** no ++i; just shifted down, need to look at same position again */
|
||||
+ }
|
||||
+ /*
|
||||
+ * if we shifted, set the new size
|
||||
+ */
|
||||
+ if (newsize != matching->size) {
|
||||
+ DEBUGMSGT(("9:cert:subset:first", "shrank from %" NETSNMP_PRIz "d to %d\n",
|
||||
+ matching->size, newsize));
|
||||
+ matching->size = newsize;
|
||||
+ }
|
||||
+
|
||||
+ if (0 == matching->size) {
|
||||
+ free(matching->array);
|
||||
+ SNMP_FREE(matching);
|
||||
+ }
|
||||
+
|
||||
+ return matching;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * reduce subset by eliminating any certificates that do not match
|
||||
+ * purpose specified.
|
||||
+ */
|
||||
+static netsnmp_void_array *
|
||||
+_cert_reduce_subset_what(netsnmp_void_array *matching, int what)
|
||||
+{
|
||||
+ netsnmp_cert_common *cc;
|
||||
+ int i = 0, j, newsize;
|
||||
+
|
||||
+ if ((NULL == matching))
|
||||
+ return matching;
|
||||
+
|
||||
+ newsize = matching->size;
|
||||
+
|
||||
+ for( ; i < matching->size; ) {
|
||||
+ /*
|
||||
+ * if we've shifted matches down we'll hit a NULL entry before
|
||||
+ * we hit the end of the array.
|
||||
+ */
|
||||
+ if (NULL == matching->array[i])
|
||||
+ break;
|
||||
+ /*
|
||||
+ * skip over valid matches. The first entry has an offset of zero.
|
||||
+ */
|
||||
+ cc = (netsnmp_cert_common *)matching->array[i];
|
||||
+ if ((cc->allowed_uses & what)) {
|
||||
+ ++i;
|
||||
+ continue;
|
||||
+ }
|
||||
+ /*
|
||||
+ * shrink array by shifting everything down a spot. Might not be
|
||||
+ * the most efficient soloution, but this is just happening at
|
||||
+ * startup and hopefully most certs won't have common prefixes.
|
||||
+ */
|
||||
+ --newsize;
|
||||
+ for ( j=i; j < newsize; ++j )
|
||||
+ matching->array[j] = matching->array[j+1];
|
||||
+ matching->array[j] = NULL;
|
||||
+ /** no ++i; just shifted down, need to look at same position again */
|
||||
+ }
|
||||
+ /*
|
||||
+ * if we shifted, set the new size
|
||||
+ */
|
||||
+ if (newsize != matching->size) {
|
||||
+ DEBUGMSGT(("9:cert:subset:what", "shrank from %" NETSNMP_PRIz "d to %d\n",
|
||||
+ matching->size, newsize));
|
||||
+ matching->size = newsize;
|
||||
+ }
|
||||
+
|
||||
+ if (0 == matching->size) {
|
||||
+ free(matching->array);
|
||||
+ SNMP_FREE(matching);
|
||||
+ }
|
||||
+
|
||||
+ return matching;
|
||||
+}
|
||||
+
|
||||
static netsnmp_void_array *
|
||||
_cert_find_subset_common(const char *filename, netsnmp_container *container)
|
||||
{
|
||||
diff --git a/snmplib/dir_utils.c b/snmplib/dir_utils.c
|
||||
index c2dd989..e7145e4 100644
|
||||
--- a/snmplib/dir_utils.c
|
||||
+++ b/snmplib/dir_utils.c
|
||||
@@ -107,6 +107,9 @@ netsnmp_directory_container_read_some(netsnmp_container *user_container,
|
||||
/** default to unsorted */
|
||||
if (! (flags & NETSNMP_DIR_SORTED))
|
||||
CONTAINER_SET_OPTIONS(container, CONTAINER_KEY_UNSORTED, rc);
|
||||
+ /** default to duplicates not allowed */
|
||||
+ if (! (flags & NETSNMP_DIR_ALLOW_DUPLICATES))
|
||||
+ CONTAINER_SET_OPTIONS(container, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
|
||||
}
|
||||
|
||||
dir = opendir(dirname);
|
|
@ -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
|
||||
--- a/man/netsnmp_config_api.3.def 2018-07-18 11:18:06.196792766 +0200
|
||||
+++ b/man/netsnmp_config_api.3.def 2018-07-18 11:20:04.631679886 +0200
|
||||
diff --git a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
||||
index 90b20d9..bd5abe1 100644
|
||||
--- a/man/netsnmp_config_api.3.def
|
||||
+++ b/man/netsnmp_config_api.3.def
|
||||
@@ -295,7 +295,7 @@ for one particular machine.
|
||||
.PP
|
||||
The default list of directories to search is \fC SYSCONFDIR/snmp\fP,
|
||||
|
@ -10,7 +11,7 @@ diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
|||
followed by \fC $HOME/.snmp\fP.
|
||||
This list can be changed by setting the environmental variable
|
||||
.I SNMPCONFPATH
|
||||
@@ -367,7 +367,7 @@ A colon separated list of directories to
|
||||
@@ -367,7 +367,7 @@ A colon separated list of directories to search for configuration
|
||||
files in.
|
||||
Default:
|
||||
.br
|
||||
|
@ -19,10 +20,11 @@ diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
|||
.SH "SEE ALSO"
|
||||
netsnmp_mib_api(3), snmp_api(3)
|
||||
.\" Local Variables:
|
||||
diff -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def
|
||||
--- a/man/snmp_config.5.def 2018-07-18 11:18:06.194792767 +0200
|
||||
+++ b/man/snmp_config.5.def 2018-07-18 11:20:56.423626117 +0200
|
||||
@@ -10,7 +10,7 @@ First off, there are numerous places tha
|
||||
diff --git a/man/snmp_config.5.def b/man/snmp_config.5.def
|
||||
index fd30873..c3437d6 100644
|
||||
--- a/man/snmp_config.5.def
|
||||
+++ b/man/snmp_config.5.def
|
||||
@@ -10,7 +10,7 @@ First off, there are numerous places that configuration files can be
|
||||
found and read from. By default, the applications look for
|
||||
configuration files in the following 4 directories, in order:
|
||||
SYSCONFDIR/snmp,
|
||||
|
@ -31,10 +33,11 @@ diff -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def
|
|||
directories, it looks for files snmp.conf, snmpd.conf and/or
|
||||
snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf
|
||||
and/or snmptrapd.local.conf. *.local.conf are always
|
||||
diff -urNp a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def
|
||||
--- a/man/snmpd.conf.5.def 2018-07-18 11:18:06.196792766 +0200
|
||||
+++ b/man/snmpd.conf.5.def 2018-07-18 11:21:44.263574388 +0200
|
||||
@@ -1559,7 +1559,7 @@ filename), and call the initialisation r
|
||||
diff --git a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def
|
||||
index 7ce8a46..a4000f9 100644
|
||||
--- a/man/snmpd.conf.5.def
|
||||
+++ b/man/snmpd.conf.5.def
|
||||
@@ -1593,7 +1593,7 @@ filename), and call the initialisation routine \fIinit_NAME\fR.
|
||||
.RS
|
||||
.IP "Note:"
|
||||
If the specified PATH is not a fully qualified filename, it will
|
|
@ -1,7 +1,8 @@
|
|||
diff -up net-snmp-5.7.2/agent/Makefile.in.pie net-snmp-5.7.2/agent/Makefile.in
|
||||
--- net-snmp-5.7.2/agent/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ net-snmp-5.7.2/agent/Makefile.in 2012-10-18 09:45:13.298613099 +0200
|
||||
@@ -294,7 +294,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
|
||||
diff --git a/agent/Makefile.in b/agent/Makefile.in
|
||||
index 047d880..38d40aa 100644
|
||||
--- a/agent/Makefile.in
|
||||
+++ b/agent/Makefile.in
|
||||
@@ -300,7 +300,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
|
||||
$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $?
|
||||
|
||||
snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG)
|
||||
|
@ -9,11 +10,12 @@ diff -up net-snmp-5.7.2/agent/Makefile.in.pie net-snmp-5.7.2/agent/Makefile.in
|
|||
+ $(LINK) $(CFLAGS) -o $@ -pie ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}
|
||||
|
||||
libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS} $(USELIBS)
|
||||
$(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} @LD_NO_UNDEFINED@ $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) @AGENTLIBS@
|
||||
diff -up net-snmp-5.7.2/apps/Makefile.in.pie net-snmp-5.7.2/apps/Makefile.in
|
||||
--- net-snmp-5.7.2/apps/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ net-snmp-5.7.2/apps/Makefile.in 2012-10-18 09:44:27.827774580 +0200
|
||||
@@ -170,7 +170,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX
|
||||
$(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) @AGENTLIBS@
|
||||
diff --git a/apps/Makefile.in b/apps/Makefile.in
|
||||
index 3dbb1d1..48ed23a 100644
|
||||
--- a/apps/Makefile.in
|
||||
+++ b/apps/Makefile.in
|
||||
@@ -190,7 +190,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX) $(USELIBS)
|
||||
$(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) ${LDFLAGS} ${LIBS}
|
||||
|
||||
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
|
|
@ -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)
|
|
@ -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
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
diff -urNp a/dist/autoconf-version b/dist/autoconf-version
|
||||
--- a/dist/autoconf-version 2021-09-01 11:18:14.582110773 +0200
|
||||
+++ b/dist/autoconf-version 2021-09-01 11:20:16.804369533 +0200
|
||||
@@ -1 +1 @@
|
||||
-2.69
|
||||
+2.71
|
|
@ -0,0 +1,175 @@
|
|||
diff -urNp a/man/net-snmp-config.1.def b/man/net-snmp-config.1.def
|
||||
--- a/man/net-snmp-config.1.def 2021-05-26 09:30:07.430790003 +0200
|
||||
+++ b/man/net-snmp-config.1.def 2021-05-26 09:35:36.703673542 +0200
|
||||
@@ -30,7 +30,7 @@ code for a list of available debug token
|
||||
SNMP Setup commands:
|
||||
.TP
|
||||
\fB\-\-create\-snmpv3\-user\fR [\-ro] [\-a authpass] [\-x privpass]
|
||||
-[\-X DES|AES] [\-A MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224] [username]
|
||||
+[\-X AES] [\-A MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224] [username]
|
||||
.PP
|
||||
These options produce the various compilation flags needed when
|
||||
building external SNMP applications:
|
||||
diff -urNp a/man/net-snmp-create-v3-user.1.def b/man/net-snmp-create-v3-user.1.def
|
||||
--- a/man/net-snmp-create-v3-user.1.def 2021-05-26 09:30:07.430790003 +0200
|
||||
+++ b/man/net-snmp-create-v3-user.1.def 2021-05-26 09:34:23.702034230 +0200
|
||||
@@ -3,7 +3,7 @@
|
||||
net-snmp-create-v3-user \- create a SNMPv3 user in net-snmp configuration file
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
-.B net-snmp-create-v3-user [-ro] [-A authpass] [-a MD5|SHA] [-X privpass] [-x DES|AES]
|
||||
+.B net-snmp-create-v3-user [-ro] [-A authpass] [-a MD5|SHA] [-X privpass] [-x AES]
|
||||
.B [username]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
@@ -27,5 +27,5 @@ specifies the authentication password ha
|
||||
\fB\-X privpass\fR
|
||||
specifies the encryption password
|
||||
.TP
|
||||
-\fB\-x DES|AES\fR
|
||||
+\fB\-x AES\fR
|
||||
specifies the encryption algorithm
|
||||
diff -urNp a/man/snmpcmd.1.def b/man/snmpcmd.1.def
|
||||
--- a/man/snmpcmd.1.def 2021-05-26 09:30:07.429789994 +0200
|
||||
+++ b/man/snmpcmd.1.def 2021-05-26 09:37:51.104850500 +0200
|
||||
@@ -311,7 +311,7 @@ Overrides the \fIdefSecurityName\fR toke
|
||||
file.
|
||||
.TP
|
||||
.BI \-x " privProtocol"
|
||||
-Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages.
|
||||
+Set the privacy protocol (AES) used for encrypted SNMPv3 messages.
|
||||
Overrides the \fIdefPrivType\fR token in the
|
||||
.I snmp.conf
|
||||
file. This option is only valid if the Net-SNMP software was build
|
||||
diff -urNp a/man/snmp.conf.5.def b/man/snmp.conf.5.def
|
||||
--- a/man/snmp.conf.5.def 2021-05-26 09:30:07.429789994 +0200
|
||||
+++ b/man/snmp.conf.5.def 2021-05-26 09:40:03.730011937 +0200
|
||||
@@ -221,13 +221,13 @@ The
|
||||
value will be used for the authentication and/or privacy pass phrases
|
||||
if either of the other directives are not specified.
|
||||
.IP "defAuthType MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224"
|
||||
-.IP "defPrivType DES|AES"
|
||||
+.IP "defPrivType AES"
|
||||
define the default authentication and privacy protocols to use for
|
||||
SNMPv3 requests.
|
||||
These can be overridden using the \fB\-a\fR and \fB\-x\fR options respectively.
|
||||
.IP
|
||||
If not specified, SNMPv3 requests will default to MD5 authentication
|
||||
-and DES encryption.
|
||||
+and AES encryption.
|
||||
.RS
|
||||
.IP "Note:
|
||||
If the software has not been compiled to use the OpenSSL libraries,
|
||||
@@ -262,8 +262,7 @@ master keys which have been converted to
|
||||
suitable for on particular SNMP engine (agent). The length of the key
|
||||
needs to be appropriate for the authentication or encryption type
|
||||
being used (auth keys: MD5=16 bytes, SHA1=20 bytes;
|
||||
-priv keys: DES=16 bytes (8
|
||||
-bytes of which is used as an IV and not a key), and AES=16 bytes).
|
||||
+priv keys: AES=16 bytes).
|
||||
.IP "sshtosnmpsocket PATH"
|
||||
Sets the path of the \fBsshtosnmp\fR socket created by an application
|
||||
(e.g. snmpd) listening for incoming ssh connections through the
|
||||
diff -urNp a/man/snmpd.examples.5.def b/man/snmpd.examples.5.def
|
||||
--- a/man/snmpd.examples.5.def 2021-05-26 09:30:07.429789994 +0200
|
||||
+++ b/man/snmpd.examples.5.def 2021-05-26 09:41:29.170761436 +0200
|
||||
@@ -87,8 +87,8 @@ the same authentication and encryption s
|
||||
.RS
|
||||
.nf
|
||||
createUser me MD5 "single pass phrase"
|
||||
-createUser myself MD5 "single pass phrase" DES
|
||||
-createUser andI MD5 "single pass phrase" DES "single pass phrase"
|
||||
+createUser myself MD5 "single pass phrase" AES
|
||||
+createUser andI MD5 "single pass phrase" AES "single pass phrase"
|
||||
.fi
|
||||
.RE
|
||||
Note that this defines three \fIdistinct\fR users, who could be granted
|
||||
diff -urNp a/man/snmptrapd.conf.5.def b/man/snmptrapd.conf.5.def
|
||||
--- a/man/snmptrapd.conf.5.def 2021-05-26 09:30:07.428789985 +0200
|
||||
+++ b/man/snmptrapd.conf.5.def 2021-05-26 09:42:02.963064029 +0200
|
||||
@@ -117,7 +117,7 @@ to trigger the types of processing liste
|
||||
See
|
||||
.IR snmpd.conf (5)
|
||||
for more details.
|
||||
-.IP "createUser [-e ENGINEID] username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES]"
|
||||
+.IP "createUser [-e ENGINEID] username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [AES]"
|
||||
See the
|
||||
.IR snmpd.conf (5)
|
||||
manual page for a description of how to create SNMPv3 users. This
|
||||
diff -urNp a/man/snmpusm.1.def b/man/snmpusm.1.def
|
||||
--- a/man/snmpusm.1.def 2021-05-26 09:30:07.430790003 +0200
|
||||
+++ b/man/snmpusm.1.def 2021-05-26 09:42:24.178253990 +0200
|
||||
@@ -216,7 +216,7 @@ rwuser initial
|
||||
# lets add the new user we'll create too:
|
||||
rwuser wes
|
||||
# USM configuration entries
|
||||
-createUser initial MD5 setup_passphrase DES
|
||||
+createUser initial MD5 setup_passphrase AES
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
diff -urNp a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
||||
--- a/net-snmp-create-v3-user.in 2021-05-26 09:30:07.369789468 +0200
|
||||
+++ b/net-snmp-create-v3-user.in 2021-05-26 09:33:23.966511123 +0200
|
||||
@@ -10,7 +10,7 @@ if @PSCMD@ | egrep ' snmpd *$' > /dev/nu
|
||||
fi
|
||||
|
||||
Aalgorithm="MD5"
|
||||
-Xalgorithm="DES"
|
||||
+Xalgorithm="AES"
|
||||
token=rwuser
|
||||
|
||||
while test "x$done" = "x" -a "x$1" != "x" -a "x$usage" != "xyes"; do
|
||||
@@ -57,11 +57,11 @@ case $1 in
|
||||
exit 1
|
||||
fi
|
||||
case $1 in
|
||||
- DES|AES|AES128|AES192|AES256)
|
||||
+ AES|AES128|AES192|AES256)
|
||||
Xalgorithm=$1
|
||||
shift
|
||||
;;
|
||||
- des|aes|aes128|aes192|aes256)
|
||||
+ aes|aes128|aes192|aes256)
|
||||
Xalgorithm=$(echo "$1" | tr a-z A-Z)
|
||||
shift
|
||||
;;
|
||||
@@ -90,7 +90,7 @@ if test "x$usage" = "xyes"; then
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " net-snmp-create-v3-user [-ro] [-A authpass] [-X privpass]"
|
||||
- echo " [-a MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224] [-x DES|AES] [username]"
|
||||
+ echo " [-a MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224] [-x AES] [username]"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
diff -urNp a/README.snmpv3 b/README.snmpv3
|
||||
--- a/README.snmpv3 2021-05-26 09:30:07.352789320 +0200
|
||||
+++ b/README.snmpv3 2021-05-26 09:44:49.109551728 +0200
|
||||
@@ -4,7 +4,7 @@ How to setup SNMPv3, a very brief docume
|
||||
do a better job on since I suck at writing documentation and he
|
||||
doesn't ;-) --Wes:
|
||||
|
||||
-Note: SHA authentication and DES/AES encryption support is only available
|
||||
+Note: SHA authentication and AES encryption support is only available
|
||||
if you have OpenSSL installed or if you've compiled using
|
||||
--with-openssl=internal. If you use --with-openssl=internal please
|
||||
read the documentation in snmplib/openssl/README for important details.
|
||||
@@ -27,7 +27,7 @@ CREATING THE FIRST USER:
|
||||
WARNING: SNMPv3 pass phrases must be at least 8 characters long!
|
||||
|
||||
The above line creates the user "myuser" with a password of
|
||||
- "my_password" (and uses MD5 and DES for protection). (Note that
|
||||
+ "my_password" (and uses MD5 and AES for protection). (Note that
|
||||
encryption support isn't enabled in the binary releases downloadable
|
||||
from the net-snmp web site.) net-snmp-config will also add a line
|
||||
to your snmpd.conf file to let that user have read/write access to
|
||||
@@ -44,7 +44,7 @@ CREATING THE FIRST USER:
|
||||
[ this should return information about how long your agent has been up]
|
||||
|
||||
snmpget -v 3 -u myuser -l authPriv -a MD5 -A my_password
|
||||
- -x DES -X my_password localhost sysUpTime.0
|
||||
+ -x AES -X my_password localhost sysUpTime.0
|
||||
[ this should return similar information, but encrypts the transmission ]
|
||||
|
||||
CREATING A SECOND USER:
|
|
@ -16,47 +16,47 @@
|
|||
arch=`arch`
|
||||
echo $arch | grep -q i.86
|
||||
if [ $? -eq 0 ] ; then
|
||||
net-snmp-config-i386 $*
|
||||
net-snmp-config-i386 "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "ia64" ] ; then
|
||||
net-snmp-config-ia64 $*
|
||||
net-snmp-config-ia64 "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "ppc" ] ; then
|
||||
net-snmp-config-ppc $*
|
||||
net-snmp-config-ppc "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "ppc64" ] ; then
|
||||
net-snmp-config-ppc64 $*
|
||||
net-snmp-config-ppc64 "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "s390" ] ; then
|
||||
net-snmp-config-s390 $*
|
||||
net-snmp-config-s390 "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "s390x" ] ; then
|
||||
net-snmp-config-s390x $*
|
||||
net-snmp-config-s390x "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "x86_64" ] ; then
|
||||
net-snmp-config-x86_64 $*
|
||||
net-snmp-config-x86_64 "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "alpha" ] ; then
|
||||
net-snmp-config-alpha $*
|
||||
net-snmp-config-alpha "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "sparc" ] ; then
|
||||
net-snmp-config-sparc $*
|
||||
net-snmp-config-sparc "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "sparc64" ] ; then
|
||||
net-snmp-config-sparc64 $*
|
||||
net-snmp-config-sparc64 "$@"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$arch" = "aarch64" ] ; then
|
||||
net-snmp-config-aarch64 $*
|
||||
net-snmp-config-aarch64 "$@"
|
||||
exit 0
|
||||
fi
|
||||
echo "Cannot determine architecture"
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
Libs.private should contain a list of libraries the library that the package
|
||||
exposes is linked too. So let's filter out unrelated link flags.
|
||||
|
||||
diff --git net-snmp-5.9.1/netsnmp.pc.in~ net-snmp-5.9.1/netsnmp.pc.in
|
||||
index 0a1f5785a4..524ca91d82 100644
|
||||
--- net-snmp-5.9.1/netsnmp.pc.in~
|
||||
+++ net-snmp-5.9.1/netsnmp.pc.in
|
||||
@@ -9,4 +9,4 @@ URL: http://www.net-snmp.org
|
||||
Version: @PACKAGE_VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lnetsnmp
|
||||
-Libs.private: @LDFLAGS@ @LNETSNMPLIBS@ @LIBS@ @PERLLDOPTS_FOR_APPS@
|
||||
+Libs.private: @LNETSNMPLIBS@ @LIBS@
|
||||
diff --git net-snmp-5.9.1/netsnmp-agent.pc.in~ net-snmp-5.9.1/netsnmp-agent.pc.in
|
||||
index 3a1c77bbf8..3d3b308d21 100644
|
||||
--- net-snmp-5.9.1/netsnmp-agent.pc.in~
|
||||
+++ net-snmp-5.9.1/netsnmp-agent.pc.in
|
||||
@@ -9,4 +9,4 @@ URL: http://www.net-snmp.org
|
||||
Version: @PACKAGE_VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lnetsnmpmibs -lnetsnmpagent -lnetsnmp
|
||||
-Libs.private: @LDFLAGS@ @LMIBLIBS@ @LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@ @LNETSNMPLIBS@ @LIBS@
|
||||
+Libs.private: @LMIBLIBS@ @LAGENTLIBS@ @LNETSNMPLIBS@ @LIBS@
|
||||
diff --git net-snmp-5.9.1/net-snmp-config.in~ net-snmp-5.9.1/net-snmp-config.in
|
||||
index 6b5abf8f83..ee81ce98fa 100644
|
||||
--- net-snmp-5.9.1/net-snmp-config.in~
|
||||
+++ net-snmp-5.9.1/net-snmp-config.in
|
||||
@@ -193,13 +193,13 @@ else
|
||||
#################################################### client lib
|
||||
--libs)
|
||||
# use this one == --netsnmp-libs + --external-libs
|
||||
- echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS
|
||||
+ echo $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS
|
||||
;;
|
||||
--netsnmp-libs)
|
||||
echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS
|
||||
;;
|
||||
--external-libs)
|
||||
- echo $NSC_LDFLAGS $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@
|
||||
+ echo $NSC_LNETSNMPLIBS $NSC_LIBS
|
||||
;;
|
||||
#################################################### agent lib
|
||||
--base-agent-libs)
|
||||
@@ -210,13 +210,13 @@ else
|
||||
;;
|
||||
--agent-libs)
|
||||
# use this one == --netsnmp-agent-libs + --external-libs
|
||||
- echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS
|
||||
+ echo $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS
|
||||
;;
|
||||
--netsnmp-agent-libs)
|
||||
echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS
|
||||
;;
|
||||
--external-agent-libs)
|
||||
- echo $NSC_LDFLAGS $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS
|
||||
+ echo $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS
|
||||
;;
|
||||
####################################################
|
||||
--version|--ver*)
|
|
@ -1 +1 @@
|
|||
d /var/run/net-snmp 0755 root root
|
||||
d /run/net-snmp 0755 root root
|
||||
|
|
301
net-snmp.spec
301
net-snmp.spec
|
@ -5,12 +5,12 @@
|
|||
%global multilib_arches %{ix86} ia64 ppc ppc64 s390 s390x x86_64 sparc sparcv9 sparc64 aarch64
|
||||
|
||||
# actual soname version
|
||||
%global soname 35
|
||||
%global soname 40
|
||||
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: 5.8
|
||||
Release: 3%{?dist}
|
||||
Version: 5.9.3
|
||||
Release: 1%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD
|
||||
|
@ -27,33 +27,42 @@ Source8: snmpd.service
|
|||
Source9: snmptrapd.service
|
||||
Source10: IETF-MIB-LICENSE.txt
|
||||
|
||||
Patch1: net-snmp-5.7.2-pie.patch
|
||||
Patch2: net-snmp-5.8-dir-fix.patch
|
||||
Patch3: net-snmp-5.8-multilib.patch
|
||||
Patch4: net-snmp-5.8-test-debug.patch
|
||||
Patch5: net-snmp-5.7.2-autoreconf.patch
|
||||
Patch6: net-snmp-5.8-agentx-disconnect-crash.patch
|
||||
Patch7: net-snmp-5.7.2-cert-path.patch
|
||||
Patch8: net-snmp-5.8-cflags.patch
|
||||
Patch9: net-snmp-5.8-Remove-U64-typedef.patch
|
||||
Patch10: net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
||||
Patch11: net-snmp-5.7.3-iterator-fix.patch
|
||||
Patch12: net-snmp-5.8-autofs-skip.patch
|
||||
Patch13: net-snmp-5.8-key-leak-backport.patch
|
||||
Patch14: net-snmp-5.8-python-ld-flags.patch
|
||||
Patch1: net-snmp-5.9-pie.patch
|
||||
Patch2: net-snmp-5.9-dir-fix.patch
|
||||
Patch3: net-snmp-5.9-multilib.patch
|
||||
Patch4: net-snmp-5.9-test-debug.patch
|
||||
Patch5: net-snmp-5.7.2-cert-path.patch
|
||||
Patch6: net-snmp-5.9-cflags.patch
|
||||
Patch7: net-snmp-5.8-Remove-U64-typedef.patch
|
||||
Patch8: net-snmp-5.7.3-iterator-fix.patch
|
||||
Patch9: net-snmp-5.9-autofs-skip.patch
|
||||
Patch10: net-snmp-5.9-coverity.patch
|
||||
Patch11: net-snmp-5.8-expand-SNMPCONFPATH.patch
|
||||
Patch12: net-snmp-5.8-duplicate-ipAddress.patch
|
||||
Patch13: net-snmp-5.9-memory-reporting.patch
|
||||
Patch14: net-snmp-5.8-man-page.patch
|
||||
Patch15: net-snmp-5.8-ipAddress-faster-load.patch
|
||||
Patch16: net-snmp-5.8-rpm-memory-leak.patch
|
||||
Patch17: net-snmp-5.9-aes-config.patch
|
||||
Patch18: net-snmp-5.8-clientaddr-error-message.patch
|
||||
Patch19: net-snmp-5.9-intermediate-certs.patch
|
||||
Patch20: net-snmp-5.9.1-remove-des.patch
|
||||
Patch21: net-snmp-5.9.1-autoconf.patch
|
||||
Patch22: net-snmp-libs-misunderstanding.patch
|
||||
|
||||
# Modern RPM API means at least EL6
|
||||
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
||||
|
||||
#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}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
# 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.
|
||||
%{?systemd_requires}
|
||||
BuildRequires: make
|
||||
BuildRequires: systemd
|
||||
BuildRequires: gcc
|
||||
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
|
||||
|
@ -65,7 +74,17 @@ BuildRequires: mariadb-connector-c-devel
|
|||
# for netstat, needed by 'make test'
|
||||
BuildRequires: net-tools
|
||||
# for make test
|
||||
BuildRequires: perl(:VERSION) >= 5.6
|
||||
BuildRequires: perl(AutoLoader)
|
||||
BuildRequires: perl(blib)
|
||||
BuildRequires: perl(Carp)
|
||||
BuildRequires: perl(DynaLoader)
|
||||
BuildRequires: perl(Exporter)
|
||||
BuildRequires: perl(overload)
|
||||
BuildRequires: perl(strict)
|
||||
BuildRequires: perl(TAP::Harness)
|
||||
BuildRequires: perl(vars)
|
||||
BuildRequires: perl(warnings)
|
||||
%ifnarch s390 s390x ppc64le
|
||||
BuildRequires: lm_sensors-devel >= 3
|
||||
%endif
|
||||
|
@ -100,6 +119,7 @@ Summary: The development environment for the NET-SNMP project
|
|||
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
Requires: elfutils-devel, rpm-devel, elfutils-libelf-devel, openssl-devel
|
||||
Requires: redhat-rpm-config
|
||||
%ifnarch s390 s390x ppc64le
|
||||
Requires: lm_sensors-devel
|
||||
%endif
|
||||
|
@ -120,6 +140,7 @@ packages installed.
|
|||
Summary: The perl NET-SNMP module and the mib2c tool
|
||||
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}, perl-interpreter
|
||||
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
BuildRequires: perl-interpreter
|
||||
BuildRequires: perl-generators
|
||||
|
||||
|
@ -159,21 +180,6 @@ Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
|||
The net-snmp-agent-libs package contains the runtime agent libraries for shared
|
||||
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
|
||||
%{?python_provide:%python_provide python3-net-snmp}
|
||||
# Remove before F30
|
||||
|
@ -199,24 +205,30 @@ cp %{SOURCE10} .
|
|||
%patch2 -p1 -b .dir-fix
|
||||
%patch3 -p1 -b .multilib
|
||||
%patch4 -p1
|
||||
%patch5 -p1 -b .autoreconf
|
||||
%patch6 -p1 -b .agentx-disconnect-crash
|
||||
%patch7 -p1 -b .cert-path
|
||||
%patch8 -p1 -b .cflags
|
||||
%patch9 -p1 -b .u64-remove
|
||||
%patch10 -p1 -b .perlfix
|
||||
%patch11 -p1 -b .iterator-fix
|
||||
%patch12 -p1 -b .autofs-skip
|
||||
%patch13 -p1 -b .leak-backport
|
||||
%patch14 -p1 -b .python-ld-flags
|
||||
%patch5 -p1 -b .cert-path
|
||||
%patch6 -p1 -b .cflags
|
||||
%patch7 -p1 -b .u64-remove
|
||||
%patch8 -p1 -b .iterator-fix
|
||||
%patch9 -p1 -b .autofs-skip
|
||||
%patch10 -p1 -b .coverity
|
||||
%patch11 -p1 -b .expand-SNMPCONFPATH
|
||||
%patch12 -p1 -b .duplicate-ipAddress
|
||||
%patch13 -p1 -b .memory-reporting
|
||||
%patch14 -p1 -b .man-page
|
||||
%patch15 -p1 -b .ipAddress-faster-load
|
||||
%patch16 -p1 -b .rpm-memory-leak
|
||||
%patch17 -p1 -b .aes-config
|
||||
%patch18 -p1 -b .clientaddr-error-message
|
||||
%patch19 -p1 -b .intermediate-certs
|
||||
%patch20 -p1 -b .remove-des
|
||||
%patch21 -p1 -b .autoconf
|
||||
%patch22 -p1
|
||||
|
||||
%patch101 -p1 -b .modern-rpm-api
|
||||
%patch102 -p1
|
||||
|
||||
%ifarch sparc64 s390 s390x
|
||||
# disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697
|
||||
rm testing/fulltests/default/T200*
|
||||
%endif
|
||||
|
||||
%build
|
||||
|
||||
|
@ -239,14 +251,16 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
|
|||
%configure \
|
||||
--disable-static --enable-shared \
|
||||
--enable-as-needed \
|
||||
--enable-blumenthal-aes \
|
||||
--enable-embedded-perl \
|
||||
--enable-ipv6 \
|
||||
--enable-local-smux \
|
||||
--enable-mfd-rewrites \
|
||||
--enable-ucd-snmp-compatibility \
|
||||
--disable-des \
|
||||
--sysconfdir=%{_sysconfdir} \
|
||||
--with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT -fPIE" \
|
||||
--with-ldflags="$RPM_LD_FLAGS" \
|
||||
--with-cflags="$RPM_OPT_FLAGS -fPIE" \
|
||||
--with-ldflags="$RPM_LD_FLAGS -lm" \
|
||||
--with-logfile="/var/log/snmpd.log" \
|
||||
--with-mib-modules="$MIBS" \
|
||||
--with-mysql \
|
||||
|
@ -257,9 +271,10 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
|
|||
--with-security-modules=tsm \
|
||||
--with-sys-location="Unknown" \
|
||||
--with-systemd \
|
||||
--with-temp-file-pattern=/var/run/net-snmp/snmp-tmp-XXXXXX \
|
||||
--with-temp-file-pattern=/run/net-snmp/snmp-tmp-XXXXXX \
|
||||
--with-transports="DTLSUDP TLSTCP" \
|
||||
--with-sys-contact="root@localhost" <<EOF
|
||||
--with-sys-contact="root@localhost" \
|
||||
--without-pcre <<EOF
|
||||
EOF
|
||||
|
||||
# store original libtool file, we will need it later
|
||||
|
@ -269,7 +284,7 @@ sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
|
|||
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
|
||||
|
||||
# the package is not %%_smp_mflags safe
|
||||
make
|
||||
%{__make}
|
||||
|
||||
# remove rpath from compiled perl libs
|
||||
find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
|
||||
|
@ -354,10 +369,6 @@ done
|
|||
# remove executable bit from documentation samples
|
||||
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
|
||||
install -m 755 -d %{buildroot}/%{_tmpfilesdir}
|
||||
install -m 644 %SOURCE7 %{buildroot}/%{_tmpfilesdir}/net-snmp.conf
|
||||
|
@ -429,7 +440,8 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
|||
|
||||
%files devel
|
||||
%{_libdir}/lib*.so
|
||||
/usr/include/*
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_includedir}/*
|
||||
%attr(0644,root,root) %{_mandir}/man3/*.3.*
|
||||
%attr(0755,root,root) %{_bindir}/net-snmp-config*
|
||||
%attr(0644,root,root) %{_mandir}/man1/net-snmp-config*.1.*
|
||||
|
@ -479,6 +491,183 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
|||
%{_libdir}/libnetsnmptrapd*.so.%{soname}*
|
||||
|
||||
%changelog
|
||||
* Thu Aug 04 2022 Josef Ridky <jridky@redhat.com> - 1:5.9.3-1
|
||||
- New upstream release 5.9.3 (#2072230)
|
||||
|
||||
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.9.1-17
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1:5.9.1-16
|
||||
- Rebuilt for Python 3.11
|
||||
|
||||
* Mon May 30 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1:5.9.1-15
|
||||
- Perl 5.36 rebuild
|
||||
|
||||
* Sat Jan 29 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1:5.9.1-14
|
||||
- Remove linker flags from Libs.private (#2043092)
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.9.1-13
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Mon Oct 04 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-12
|
||||
- fix FTBFS of ERR_get_error (#2008781)
|
||||
|
||||
* Wed Sep 15 2021 Sahana Prasad <sahana@redhat.com> - 1:5.9.1-11
|
||||
- Rebuilt with OpenSSL 3.0.0
|
||||
|
||||
* Wed Sep 15 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-10
|
||||
- Remove ERR_GET_FUNC from code (#2004351)
|
||||
|
||||
* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> - 1:5.9.1-9
|
||||
- Rebuilt with OpenSSL 3.0.0
|
||||
|
||||
* Wed Sep 01 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-8
|
||||
- fix FTBFS (#1999475)
|
||||
|
||||
* Thu Jul 29 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-7
|
||||
- revert cflags modification in net-snmp-config as was reverted in upstream
|
||||
and add proper dependency to net-snmp-devel sub-package (#1544527)
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.9.1-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Mon Jul 19 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-5
|
||||
- fix UseNumeric in Python library (#1970937)
|
||||
|
||||
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1:5.9.1-4
|
||||
- Rebuilt for Python 3.10
|
||||
|
||||
* Tue Jun 01 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-3
|
||||
- disable DES for F35+
|
||||
|
||||
* Tue Jun 01 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-2
|
||||
- restore DES for F34 and F33
|
||||
|
||||
* Wed May 26 2021 Josef Ridky <jridky@redhat.com> - 1:5.9.1-1
|
||||
- New upstream release 5.9.1 (#1946399)
|
||||
- remove DES support
|
||||
|
||||
* Fri May 21 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1:5.9-10
|
||||
- Perl 5.34 rebuild
|
||||
|
||||
* Mon Mar 15 2021 Josef Ridky <jridky@redhat.com> - 1:5.9-9
|
||||
- fix issue with parsing IPv4 address twice
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1:5.9-8
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
||||
* Thu Feb 04 2021 Josef Ridky <jridky@redhat.com> - 1:5.9-7
|
||||
- remove file with unsupported license
|
||||
- use make and make install macros
|
||||
|
||||
* Thu Jan 28 2021 Josef Ridky <jridky@redhat.com> - 1:5.9-6
|
||||
- add support for digests detected from ECC certificates
|
||||
- add support for intermediate certificates
|
||||
- fix crash caused by small buffer size
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.9-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Mon Jan 18 2021 Josef Ridky <jridky@redhat.com> - 1:5.9-4
|
||||
- fix issue with parsing long trap headers (#1912725)
|
||||
- fix error message when the address specified by clientaddr option
|
||||
is wrong or cannot be bound
|
||||
- fix issue with quoting empty passphrase
|
||||
|
||||
* Wed Nov 18 2020 Josef Ridky <jridky@redhat.com> - 1:5.9-3
|
||||
- update net-snmp-tmpfs.conf for /var/run to /run (#1893471)
|
||||
|
||||
* Tue Sep 01 2020 Josef Ridky <jridky@redhat.com> - 1:5.9-2
|
||||
- Disable pcre binding
|
||||
- Add support for available memory report
|
||||
|
||||
* Mon Aug 17 2020 Josef Ridky <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
|
||||
- link math library to fix FTBFS for hplip (#1863855)
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.8-24
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Jul 07 2020 Josef Ridky <jridky@redhat.com> - 1:5.8-23
|
||||
- change /var/run/net-snmp to /run/net-snmp (#1737631)
|
||||
|
||||
* Tue Jul 07 2020 Josef Ridky <jridky@redhat.com> - 1:5.8-22
|
||||
- proxied OIDs unspecified in proxy statement in snmpd.conf
|
||||
- UCD-SNMP-MIB::dskTable doesn't update dynamically
|
||||
- expand SNMPCONFPATH variable
|
||||
- log meningful message on duplicate IP address
|
||||
- memory reporting adjustment
|
||||
- fix typos in man page
|
||||
- speedup ipAddressTable loading
|
||||
- fix memory leak when shut down librpm
|
||||
- services starts after network-online.target
|
||||
- add missing part of memory leak patch
|
||||
- add support for AES192 and AES256
|
||||
- fix net-snmp-config wrapper script (#1815984)
|
||||
|
||||
* Mon Jun 22 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1:5.8-21
|
||||
- Perl 5.32 rebuild
|
||||
|
||||
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1:5.8-20
|
||||
- Rebuilt for Python 3.9
|
||||
|
||||
* Thu Apr 09 2020 Josef Ridky <jridky@redhat.com> -1:5.8-19
|
||||
- update skip_autofs patch (#1810104)
|
||||
- exit snmpd after snmpd -h command
|
||||
- fix issues found by coverity scan
|
||||
- fix issue with flood messages
|
||||
- fix double free or corruption error when freeing security context
|
||||
|
||||
* Tue Mar 24 2020 Petr Pisar <ppisar@redhat.com> - 1:5.8-18
|
||||
- Build-require Perl dependencies for running the tests
|
||||
|
||||
* Wed Feb 26 2020 Josef Ridky <jridky@redhat.com> - 1:5.8-17
|
||||
- fix config error with RPM library (#1807274)
|
||||
|
||||
* Mon Feb 17 2020 Josef Ridky <jridky@redhat.com> - 1:5.8-16
|
||||
- set net-snmp-devel as requirement for net-snmp-perl
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.8-15
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1:5.8-14
|
||||
- Rebuilt for Python 3.8.0rc1 (#1748018)
|
||||
|
||||
* Thu Sep 19 2019 Josef Ridky <jridky@redhat.com> - 1:5.8-13
|
||||
- Fix snmpv3 trap forwarding (#1753506)
|
||||
|
||||
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1:5.8-12
|
||||
- Rebuilt for Python 3.8
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.8-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Jun 28 2019 Josef Ridky <jridky@redhat.com> - 1:5.8-10
|
||||
- remove file with unsupported license
|
||||
- fix daemon crash on resend request (#1663027)
|
||||
- fix issue with trapsink default port
|
||||
|
||||
* Mon Jun 10 22:13:21 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1:5.8-9
|
||||
- Rebuild for RPM 4.15
|
||||
|
||||
* Mon Jun 10 15:42:03 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1:5.8-8
|
||||
- Rebuild for RPM 4.15
|
||||
|
||||
* Thu May 30 2019 Jitka Plesnikova <jplesnik@redhat.com> - 1:5.8-7
|
||||
- Perl 5.30 rebuild
|
||||
|
||||
* Thu Feb 07 2019 Josef Ridky <jridky@redhat.com> - 1:5.8-6
|
||||
- fix IPv6 address assignment for clientaddr option (#1673272)
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.8-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 1:5.8-4
|
||||
- Rebuilt for libcrypt.so.2 (#1666033)
|
||||
|
||||
* Tue Nov 27 2018 Josef Ridky <jridky@redhat.com> - 1:5.8-3
|
||||
- backport memory leak fixes from upstream
|
||||
- add fPIE to CFLAGS (#1543853)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[Unit]
|
||||
Description=Simple Network Management Protocol (SNMP) Daemon.
|
||||
After=syslog.target network.target
|
||||
After=syslog.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[Unit]
|
||||
Description=Simple Network Management Protocol (SNMP) Trap Daemon.
|
||||
After=syslog.target network.target
|
||||
After=syslog.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
|
|
2
sources
2
sources
|
@ -1 +1 @@
|
|||
SHA512 (net-snmp-5.8.tar.gz) = 27895a583b23f3e14c48562bc32f3ba83513d81aa848e878be9a3650f0458d45950635c937ef627135f80b757b663e71fab9a3bde4fd91889153998ae3468fe7
|
||||
SHA512 (net-snmp-5.9.3.tar.gz) = a476df4967029a2eb03d27b0e250170785d0a8c143d49b900ee958c3cbdfaccd415b70af40f6fbed9cb8819d522c35a6073a431091d908ccc7c018fa0aaa2abc
|
||||
|
|
Loading…
Reference in New Issue