diff --git a/.gitignore b/.gitignore index b1f9fb5..96662cf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ net-snmp-5.5.tar.gz /net-snmp-5.7.1.tar.gz /net-snmp-5.7.2.tar.gz /net-snmp-5.7.3.tar.gz +/net-snmp-5.8.tar.gz diff --git a/net-snmp-5.5-agentx-disconnect-crash.patch b/net-snmp-5.5-agentx-disconnect-crash.patch deleted file mode 100644 index b3b47be..0000000 --- a/net-snmp-5.5-agentx-disconnect-crash.patch +++ /dev/null @@ -1,270 +0,0 @@ -955511 - net-snmpd crash on time out -969061 - net-snmpd crash on time out -1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out - -Based on usptream commit 793d596838ff7cb48a73b675d62897c56c9e62df, -heavily backported to net-snmp-5.5 - -diff -up net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c.disconnect-crash net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c ---- net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c.disconnect-crash 2013-07-03 15:26:35.884813210 +0200 -+++ net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c 2013-07-03 15:26:35.908813135 +0200 -@@ -158,6 +158,7 @@ close_agentx_session(netsnmp_session * s - for (sp = session->subsession; sp != NULL; sp = sp->next) { - - if (sp->sessid == sessid) { -+ netsnmp_remove_delegated_requests_for_session(sp); - unregister_mibs_by_session(sp); - unregister_index_by_session(sp); - unregister_sysORTable_by_session(sp); -diff -up net-snmp-5.7.2/agent/mibgroup/agentx/master.c.disconnect-crash net-snmp-5.7.2/agent/mibgroup/agentx/master.c ---- net-snmp-5.7.2/agent/mibgroup/agentx/master.c.disconnect-crash 2013-07-03 15:26:35.000000000 +0200 -+++ net-snmp-5.7.2/agent/mibgroup/agentx/master.c 2013-07-03 15:29:00.644362208 +0200 -@@ -222,7 +222,7 @@ agentx_got_response(int operation, - /* response is too late, free the cache */ - if (magic) - netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic); -- return 0; -+ return 1; - } - requests = cache->requests; - -diff -up net-snmp-5.7.2/agent/snmp_agent.c.disconnect-crash net-snmp-5.7.2/agent/snmp_agent.c ---- net-snmp-5.7.2/agent/snmp_agent.c.disconnect-crash 2013-07-03 15:26:35.893813182 +0200 -+++ net-snmp-5.7.2/agent/snmp_agent.c 2013-07-03 15:28:28.979460861 +0200 -@@ -1446,6 +1446,7 @@ free_agent_snmp_session(netsnmp_agent_se - netsnmp_free_cachemap(asp->cache_store); - asp->cache_store = NULL; - } -+ agent_snmp_session_release_cancelled(asp); - SNMP_FREE(asp); - } - -@@ -1457,6 +1458,11 @@ netsnmp_check_for_delegated(netsnmp_agen - - if (NULL == asp->treecache) - return 0; -+ -+ if (agent_snmp_session_is_cancelled(asp)) { -+ printf("request %p cancelled\n", asp); -+ return 0; -+ } - - for (i = 0; i <= asp->treecache_num; i++) { - for (request = asp->treecache[i].requests_begin; request; -@@ -1535,39 +1541,48 @@ int - netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess) - { - netsnmp_agent_session *asp; -- int count = 0; -+ int total_count = 0; - - for (asp = agent_delegated_list; asp; asp = asp->next) { - /* - * check each request - */ -+ int i; -+ int count = 0; - netsnmp_request_info *request; -- for(request = asp->requests; request; request = request->next) { -- /* -- * check session -- */ -- netsnmp_assert(NULL!=request->subtree); -- if(request->subtree->session != sess) -- continue; -+ for (i = 0; i <= asp->treecache_num; i++) { -+ for (request = asp->treecache[i].requests_begin; request; -+ request = request->next) { -+ /* -+ * check session -+ */ -+ netsnmp_assert(NULL!=request->subtree); -+ if(request->subtree->session != sess) -+ continue; - -- /* -- * matched! mark request as done -- */ -- netsnmp_request_set_error(request, SNMP_ERR_GENERR); -- ++count; -+ /* -+ * matched! mark request as done -+ */ -+ netsnmp_request_set_error(request, SNMP_ERR_GENERR); -+ ++count; -+ } -+ } -+ if (count) { -+ agent_snmp_session_mark_cancelled(asp); -+ total_count += count; - } - } - - /* - * if we found any, that request may be finished now - */ -- if(count) { -+ if(total_count) { - DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session " -- "%8p\n", count, sess)); -- netsnmp_check_outstanding_agent_requests(); -+ "%8p\n", total_count, sess)); -+ netsnmp_check_delegated_requests(); - } - -- return count; -+ return total_count; - } - - int -@@ -2739,19 +2754,11 @@ handle_var_requests(netsnmp_agent_sessio - return final_status; - } - --/* -- * loop through our sessions known delegated sessions and check to see -- * if they've completed yet. If there are no more delegated sessions, -- * check for and process any queued requests -- */ - void --netsnmp_check_outstanding_agent_requests(void) -+netsnmp_check_delegated_requests(void) - { - netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL; - -- /* -- * deal with delegated requests -- */ - for (asp = agent_delegated_list; asp; asp = next_asp) { - next_asp = asp->next; /* save in case we clean up asp */ - if (!netsnmp_check_for_delegated(asp)) { -@@ -2790,6 +2797,22 @@ netsnmp_check_outstanding_agent_requests - prev_asp = asp; - } - } -+} -+ -+/* -+ * loop through our sessions known delegated sessions and check to see -+ * if they've completed yet. If there are no more delegated sessions, -+ * check for and process any queued requests -+ */ -+void -+netsnmp_check_outstanding_agent_requests(void) -+{ -+ netsnmp_agent_session *asp; -+ -+ /* -+ * deal with delegated requests -+ */ -+ netsnmp_check_delegated_requests(); - - /* - * if we are processing a set and there are more delegated -@@ -2819,7 +2842,8 @@ netsnmp_check_outstanding_agent_requests - - netsnmp_processing_set = netsnmp_agent_queued_list; - DEBUGMSGTL(("snmp_agent", "SET request remains queued while " -- "delegated requests finish, asp = %8p\n", asp)); -+ "delegated requests finish, asp = %8p\n", -+ agent_delegated_list)); - break; - } - #endif /* NETSNMP_NO_WRITE_SUPPORT */ -@@ -2880,6 +2904,11 @@ check_delayed_request(netsnmp_agent_sess - case SNMP_MSG_GETBULK: - case SNMP_MSG_GETNEXT: - netsnmp_check_all_requests_status(asp, 0); -+ if (agent_snmp_session_is_cancelled(asp)) { -+ printf("request %p is cancelled\n", asp); -+ DEBUGMSGTL(("snmp_agent","canceling next walk for asp %p\n", asp)); -+ break; -+ } - handle_getnext_loop(asp); - if (netsnmp_check_for_delegated(asp) && - netsnmp_check_transaction_id(asp->pdu->transid) != -@@ -3838,4 +3867,73 @@ netsnmp_set_all_requests_error(netsnmp_a - return error_value; - } - #endif /* NETSNMP_FEATURE_REMOVE_SET_ALL_REQUESTS_ERROR */ -+ -+/* -+ * Ugly hack to fix bug #950602 and preserve ABI -+ * (the official patch adds netsnmp_agent_session->flags). -+ * We must create parallel database of netsnmp_agent_sessions -+ * and put cancelled requests there instead of marking -+ * netsnmp_agent_session->flags. -+ */ -+static netsnmp_agent_session **cancelled_agent_snmp_sessions; -+static int cancelled_agent_snmp_sessions_count; -+static int cancelled_agent_snmp_sessions_max; -+ -+int -+agent_snmp_session_mark_cancelled(netsnmp_agent_session *session) -+{ -+ DEBUGMSGTL(("agent:cancelled", "Cancelling session %p\n", session)); -+ if (!session) -+ return 0; -+ if (cancelled_agent_snmp_sessions_count + 1 > cancelled_agent_snmp_sessions_max) { -+ netsnmp_agent_session **aux; -+ int max = cancelled_agent_snmp_sessions_max + 10; -+ aux = realloc(cancelled_agent_snmp_sessions, sizeof(netsnmp_agent_session*) * max); -+ if (!aux) -+ return SNMP_ERR_GENERR; -+ cancelled_agent_snmp_sessions = aux; -+ cancelled_agent_snmp_sessions_max = max; -+ } -+ cancelled_agent_snmp_sessions[cancelled_agent_snmp_sessions_count] = session; -+ cancelled_agent_snmp_sessions_count++; -+ return 0; -+} -+ -+int -+agent_snmp_session_is_cancelled(netsnmp_agent_session *session) -+{ -+ int i; -+ for (i=0; i> $outfile --outfile="@datadir@/snmp/snmpd.conf" -+outfile="/etc/snmp/snmpd.conf" - line="$token $user" - echo "adding the following line to $outfile:" - echo " " $line diff --git a/net-snmp-5.6-test-debug.patch b/net-snmp-5.6-test-debug.patch deleted file mode 100644 index 4ae97fb..0000000 --- a/net-snmp-5.6-test-debug.patch +++ /dev/null @@ -1,29 +0,0 @@ -Don't check tests which depend on DNS - it's disabled in Koji - -diff -up net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple.debug net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple ---- net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple.debug 2012-10-10 00:28:58.000000000 +0200 -+++ net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple 2012-10-18 10:16:39.276416510 +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 later, 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 -up net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple.debug net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple ---- net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple.debug 2012-10-10 00:28:58.000000000 +0200 -+++ net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple 2012-10-18 10:16:39.276416510 +0200 -@@ -132,6 +132,9 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff - SAVECHECKAGENT 'line 27: Error:' - SAVECHECKAGENT 'line 28: Error:' - -+FINISHED -+ -+# don't test the later, it depends on DNS, which is not available in Koji - # 608 - CHECKAGENT '<"c608a"' - if [ "$snmp_last_test_result" -eq 0 ] ; then diff --git a/net-snmp-5.7-agentx-crash.patch b/net-snmp-5.7-agentx-crash.patch deleted file mode 100644 index d25ace5..0000000 --- a/net-snmp-5.7-agentx-crash.patch +++ /dev/null @@ -1,57 +0,0 @@ -729738 - net-snmp dumps core in netsnmp_oid_find_prefix -1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out - -commit f9304c83f76202db0e684269ca1af32e43cd9db4 -Author: Jan Safranek -Date: Tue Feb 7 14:53:44 2012 +0100 - - CHANGES: PATCH 1633670: fixed snmpd crashing when an AgentX subagent disconnect in the middle of processing of a request. - - I fixed also the memory leak reported in the tracker comments. - -diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c -index c42a42a..baeebaf 100644 ---- a/agent/mibgroup/agentx/master.c -+++ b/agent/mibgroup/agentx/master.c -@@ -219,6 +219,9 @@ agentx_got_response(int operation, - if (!cache) { - DEBUGMSGTL(("agentx/master", "response too late on session %8p\n", - session)); -+ /* response is too late, free the cache */ -+ if (magic) -+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic); - return 0; - } - requests = cache->requests; -@@ -606,6 +609,8 @@ agentx_master_handler(netsnmp_mib_handler *handler, - result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data); - if (result == 0) { - snmp_free_pdu(pdu); -+ if (cb_data) -+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) cb_data); - } - - return SNMP_ERR_NOERROR; -diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c -index f16f392..b84b85e 100644 ---- a/agent/mibgroup/agentx/master_admin.c -+++ b/agent/mibgroup/agentx/master_admin.c -@@ -133,11 +133,16 @@ close_agentx_session(netsnmp_session * session, int sessid) - * requests, so that the delegated request will be completed and - * further requests can be processed - */ -- netsnmp_remove_delegated_requests_for_session(session); -+ while (netsnmp_remove_delegated_requests_for_session(session)) { -+ DEBUGMSGTL(("agentx/master", "Continue removing delegated reqests\n")); -+ } -+ - if (session->subsession != NULL) { - netsnmp_session *subsession = session->subsession; - for(; subsession; subsession = subsession->next) { -- netsnmp_remove_delegated_requests_for_session(subsession); -+ while (netsnmp_remove_delegated_requests_for_session(subsession)) { -+ DEBUGMSGTL(("agentx/master", "Continue removing delegated subsession reqests\n")); -+ } - } - } - diff --git a/net-snmp-5.7.2-create-user-multilib.patch b/net-snmp-5.7.2-create-user-multilib.patch deleted file mode 100644 index ffc6c26..0000000 --- a/net-snmp-5.7.2-create-user-multilib.patch +++ /dev/null @@ -1,40 +0,0 @@ -Make net-snmp-create-v3-user multilib-clean - -The file had different NSC_AGENTLIBS on different architectures. - -Source: upstream - -commit 68300a9fb43568c5d833c48a2fef3ff16c2923c3 -Author: Jan Safranek -Date: Thu Feb 7 10:14:33 2013 +0100 - - Remove unused variables. - -diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in -index 5288f3b..efa19c3 100644 ---- a/net-snmp-create-v3-user.in -+++ b/net-snmp-create-v3-user.in -@@ -10,23 +10,6 @@ exec_prefix=@exec_prefix@ - includedir=@includedir@ - libdir=@libdir@ - datarootdir=@datarootdir@ --NSC_LDFLAGS="@LDFLAGS@" --NSC_INCLUDEDIR=${includedir} --NSC_LIBDIR=-L${libdir} --NSC_LIBS="@LIBS@" --NSC_AGENTLIBS="@AGENTLIBS@ @PERLLDOPTS_FOR_APPS@" --NSC_PREFIX=$prefix --NSC_EXEC_PREFIX=$exec_prefix --NSC_SRCDIR=@srcdir@ --NSC_INCDIR=${NSC_PREFIX}/include --NSC_BASE_SUBAGENT_LIBS="-lnetsnmpagent -lnetsnmp" --NSC_BASE_AGENT_LIBS="-lnetsnmpagent -lnetsnmpmibs -lnetsnmp" --NSC_SRC_LIBDIRS="agent/.libs snmplib/.libs" --NSC_SRC_LIBDEPS="agent/.libs/libnetsnmpmibs.a agent/.libs/libnetsnmpagent.a snmplib/.libs/libnetsnmp.a" -- --if test "x$NSC_SRCDIR" = "x." ; then -- NSC_SRCDIR="NET-SNMP-SOURCE-DIR" --fi - - if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then - echo "Apparently at least one snmpd demon is already running." diff --git a/net-snmp-5.7.2-systemd.patch b/net-snmp-5.7.2-systemd.patch deleted file mode 100644 index 74d0463..0000000 --- a/net-snmp-5.7.2-systemd.patch +++ /dev/null @@ -1,1650 +0,0 @@ -718183 - Provide native systemd unit file - -Gathered from following upstream git commits and backported to 5.7. - -commit 19499c3c90bf9d7b2b9e5d08baa26cc6bba28a11 -Author: Jan Safranek -Date: Mon Aug 8 15:48:54 2011 +0200 - - CHANGES: snmpd: integrated with systemd, see README.systemd for details. - - It brings sd-daemon.c and .h directly downloaded from systemd. I've made very - few changes to it to match our NETSNMP_NO_SYSTEMD and include paths. - -commit fef6cddfdb94da1a6b1fb768af62918b80f11fd3 -Author: Jan Safranek -Date: Mon Aug 8 15:48:54 2011 +0200 - - CHANGES: snmptrapd: integrate systemd notification support. - -commit 0641e43c694c485cbbffef0556efc4641bd3ff50 -Author: Jan Safranek -Date: Mon Aug 8 15:48:54 2011 +0200 - - Add sd_find_inet_socket() and sd_find_inet_unisx() helpers into - system-specific code. This will help us to find various sockets - created by systemd much easier. - -commit 76530a89f1c8bbd0b63acce63e10d5d4812a1a16 -Author: Jan Safranek -Date: Mon Aug 8 15:48:54 2011 +0200 - - Check sockets created by systemd when opening new server sockets. - - systemd can pass sockets to our daemons during startup using LISTEN_FDS - environment variable. So check this variable when opening new listening - socket - maybe system has already opened the socket for us. - -commit bf108d7f1354f6276fc43c129963f2c49b9fc242 -Author: Jan Safranek -Date: Mon Aug 8 15:48:54 2011 +0200 - - Added sample systemd service files. - -commit 884ec488a6596380ba283d707827dd926a52e0b2 -Author: Jan Safranek -Date: Mon Aug 8 15:48:55 2011 +0200 - - Run autoheader+autoconf. - -commit 86132e3f1e6ef7b4e0b96d8fa24e37c81b71b0e0 -Author: Jan Safranek -Date: Tue Aug 9 10:53:43 2011 +0200 - - Update systemd documentation and samples. - - - add socket unit for snmpd to paralelize boot - - update WantedBy in socket units as recommended by http://0pointer.de/blog/projects/socket-activation.html - - rephrase README.systemd - -diff -up net-snmp-5.7.3/agent/snmpd.c.MPGqYh net-snmp-5.7.3/agent/snmpd.c ---- net-snmp-5.7.3/agent/snmpd.c.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/agent/snmpd.c 2015-02-17 13:34:05.736221851 +0100 -@@ -164,6 +164,10 @@ typedef long fd_mask; - - #endif - -+#ifndef NETSNMP_NO_SYSTEMD -+#include -+#endif -+ - netsnmp_feature_want(logging_file) - netsnmp_feature_want(logging_stdio) - netsnmp_feature_want(logging_syslog) -@@ -443,18 +447,26 @@ main(int argc, char *argv[]) - int agent_mode = -1; - char *pid_file = NULL; - char option_compatability[] = "-Le"; -+ int prepared_sockets = 0; - #if HAVE_GETPID - int fd; - FILE *PID; - #endif - - #ifndef WIN32 -+#ifndef NETSNMP_NO_SYSTEMD -+ /* check if systemd has sockets for us and don't close them */ -+ prepared_sockets = netsnmp_sd_listen_fds(0); -+#endif /* NETSNMP_NO_SYSTEMD */ -+ - /* - * close all non-standard file descriptors we may have - * inherited from the shell. - */ -- for (i = getdtablesize() - 1; i > 2; --i) { -- (void) close(i); -+ if (!prepared_sockets) { -+ for (i = getdtablesize() - 1; i > 2; --i) { -+ (void) close(i); -+ } - } - #endif /* #WIN32 */ - -@@ -1107,6 +1119,19 @@ main(int argc, char *argv[]) - netsnmp_addrcache_initialise(); - - /* -+ * Let systemd know we're up. -+ */ -+#ifndef NETSNMP_NO_SYSTEMD -+ netsnmp_sd_notify(1, "READY=1\n"); -+ if (prepared_sockets) -+ /* -+ * Clear the environment variable, we already processed all the sockets -+ * by now. -+ */ -+ netsnmp_sd_listen_fds(1); -+#endif -+ -+ /* - * Forever monitor the dest_port for incoming PDUs. - */ - DEBUGMSGTL(("snmpd/main", "We're up. Starting to process data.\n")); -diff -up net-snmp-5.7.3/apps/snmptrapd.c.MPGqYh net-snmp-5.7.3/apps/snmptrapd.c ---- net-snmp-5.7.3/apps/snmptrapd.c.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/apps/snmptrapd.c 2015-02-17 13:34:05.736221851 +0100 -@@ -125,6 +125,10 @@ SOFTWARE. - - #include - -+#ifndef NETSNMP_NO_SYSTEMD -+#include -+#endif -+ - #ifndef BSD4_3 - #define BSD4_2 - #endif -@@ -657,15 +661,22 @@ main(int argc, char *argv[]) - int agentx_subagent = 1; - #endif - netsnmp_trapd_handler *traph; -+ int prepared_sockets = 0; - - - #ifndef WIN32 -+#ifndef NETSNMP_NO_SYSTEMD -+ /* check if systemd has sockets for us and don't close them */ -+ prepared_sockets = netsnmp_sd_listen_fds(0); -+#endif - /* - * close all non-standard file descriptors we may have - * inherited from the shell. - */ -- for (i = getdtablesize() - 1; i > 2; --i) { -- (void) close(i); -+ if (!prepared_sockets) { -+ for (i = getdtablesize() - 1; i > 2; --i) { -+ (void) close(i); -+ } - } - #endif /* #WIN32 */ - -@@ -1318,6 +1329,19 @@ main(int argc, char *argv[]) - #endif - #endif - -+ /* -+ * Let systemd know we're up. -+ */ -+#ifndef NETSNMP_NO_SYSTEMD -+ netsnmp_sd_notify(1, "READY=1\n"); -+ if (prepared_sockets) -+ /* -+ * Clear the environment variable, we already processed all the sockets -+ * by now. -+ */ -+ netsnmp_sd_listen_fds(1); -+#endif -+ - #ifdef WIN32SERVICE - trapd_status = SNMPTRAPD_RUNNING; - #endif -diff -up net-snmp-5.7.3/configure.d/config_modules_lib.MPGqYh net-snmp-5.7.3/configure.d/config_modules_lib ---- net-snmp-5.7.3/configure.d/config_modules_lib.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/configure.d/config_modules_lib 2015-02-17 13:34:05.737221850 +0100 -@@ -53,6 +53,14 @@ if test "x$PARTIALTARGETOS" = "xmingw32" - other_ftobjs_list="$other_ftobjs_list winpipe.ft" - fi - -+# Linux systemd -+if test "x$with_systemd" == "xyes"; then -+ other_src_list="$other_src_list sd-daemon.c" -+ other_objs_list="$other_objs_list sd-daemon.o" -+ other_lobjs_list="$other_lobjs_list sd-daemon.lo" -+ other_ftobjs_list="$other_ftobjs_list sd-daemon.ft" -+fi -+ - AC_SUBST(other_src_list) - AC_SUBST(other_objs_list) - AC_SUBST(other_lobjs_list) -diff -up net-snmp-5.7.3/configure.d/config_project_with_enable.MPGqYh net-snmp-5.7.3/configure.d/config_project_with_enable ---- net-snmp-5.7.3/configure.d/config_project_with_enable.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/configure.d/config_project_with_enable 2015-02-17 13:34:05.737221850 +0100 -@@ -690,6 +690,15 @@ if test "x$with_dummy_values" != "xyes"; - data for]) - fi - -+NETSNMP_ARG_WITH(systemd, -+[ --with-systemd Provide systemd support. See README.systemd -+ for details.]) -+# Define unless specifically suppressed (i.e., option defaults to false). -+if test "x$with_systemd" != "xyes"; then -+ AC_DEFINE(NETSNMP_NO_SYSTEMD, 1, -+ [If you don't want to integrate with systemd.]) -+fi -+ - NETSNMP_ARG_ENABLE(set-support, - [ --disable-set-support Do not allow SNMP set requests.]) - if test "x$enable_set_support" = "xno"; then -diff -up net-snmp-5.7.3/configure.MPGqYh net-snmp-5.7.3/configure ---- net-snmp-5.7.3/configure.MPGqYh 2014-12-08 21:23:37.000000000 +0100 -+++ net-snmp-5.7.3/configure 2015-02-17 13:34:05.744221845 +0100 -@@ -951,6 +951,8 @@ with_kmem_usage - enable_kmem_usage - with_dummy_values - enable_dummy_values -+with_systemd -+enable_systemd - enable_set_support - with_set_support - with_sys_contact -@@ -1867,6 +1869,8 @@ Configuring the agent: - This is technically not compliant with the - SNMP specifications, but was how the agent - operated for versions < 4.0. -+ --with-systemd Provide systemd support. See README.systemd -+ for details. - --with-sys-contact="who@where" Default system contact. - (Default: LOGIN@DOMAINNAME) - --with-sys-location="location" Default system location. -@@ -4398,6 +4402,24 @@ $as_echo "#define NETSNMP_NO_DUMMY_VALUE - - fi - -+ -+# Check whether --with-systemd was given. -+if test "${with_systemd+set}" = set; then : -+ withval=$with_systemd; -+fi -+ -+ # Check whether --enable-systemd was given. -+if test "${enable_systemd+set}" = set; then : -+ enableval=$enable_systemd; as_fn_error $? "Invalid option. Use --with-systemd/--without-systemd instead" "$LINENO" 5 -+fi -+ -+# Define unless specifically suppressed (i.e., option defaults to false). -+if test "x$with_systemd" != "xyes"; then -+ -+$as_echo "#define NETSNMP_NO_SYSTEMD 1" >>confdefs.h -+ -+fi -+ - # Check whether --enable-set-support was given. - if test "${enable_set_support+set}" = set; then : - enableval=$enable_set_support; -@@ -18639,6 +18661,14 @@ if test "x$PARTIALTARGETOS" = "xmingw32" - other_ftobjs_list="$other_ftobjs_list winpipe.ft" - fi - -+# Linux systemd -+if test "x$with_systemd" == "xyes"; then -+ other_src_list="$other_src_list sd-daemon.c" -+ other_objs_list="$other_objs_list sd-daemon.o" -+ other_lobjs_list="$other_lobjs_list sd-daemon.lo" -+ other_ftobjs_list="$other_ftobjs_list sd-daemon.ft" -+fi -+ - - - -diff -up net-snmp-5.7.3/dist/snmpd.service.MPGqYh net-snmp-5.7.3/dist/snmpd.service ---- net-snmp-5.7.3/dist/snmpd.service.MPGqYh 2015-02-17 13:34:05.745221844 +0100 -+++ net-snmp-5.7.3/dist/snmpd.service 2015-02-17 13:34:05.745221844 +0100 -@@ -0,0 +1,18 @@ -+# -+# SNMP agent service file for systemd -+# -+# -+# The service should be enabled, i.e. snmpd should start during machine boot. -+# Socket activation shall not be used. See README.systemd for details. -+ -+[Unit] -+Description=Simple Network Management Protocol (SNMP) daemon. -+After=syslog.target network.target -+ -+[Service] -+# Type=notify is also supported. It should be set when snmpd.socket is not used. -+Type=simple -+ExecStart=/usr/sbin/snmpd -f -+ -+[Install] -+WantedBy=multi-user.target -diff -up net-snmp-5.7.3/dist/snmpd.socket.MPGqYh net-snmp-5.7.3/dist/snmpd.socket ---- net-snmp-5.7.3/dist/snmpd.socket.MPGqYh 2015-02-17 13:34:05.745221844 +0100 -+++ net-snmp-5.7.3/dist/snmpd.socket 2015-02-17 13:34:05.745221844 +0100 -@@ -0,0 +1,17 @@ -+[Unit] -+Description=Socket listening for SNMP and AgentX messages -+ -+[Socket] -+ListenDatagram=0.0.0.0:161 -+# Uncomment other listening addresses as needed - TCP, UDP6, TCP6. -+# It must match listening addresses/ports defined in snmpd.service -+# or snmpd.conf. -+# ListenStream=0.0.0.0:161 -+# ListenDatagram=[::]:161 -+# ListenStream=[::]:161 -+# -+# Uncomment AgentX socket if snmpd.conf enables AgentX protocol. -+# ListenStream=/var/agentx/master -+ -+[Install] -+WantedBy=sockets.target -diff -up net-snmp-5.7.3/dist/snmptrapd.service.MPGqYh net-snmp-5.7.3/dist/snmptrapd.service ---- net-snmp-5.7.3/dist/snmptrapd.service.MPGqYh 2015-02-17 13:34:05.745221844 +0100 -+++ net-snmp-5.7.3/dist/snmptrapd.service 2015-02-17 13:34:05.745221844 +0100 -@@ -0,0 +1,16 @@ -+# -+# SNMP trap-processing service file for systemd -+# -+ -+[Unit] -+Description=Simple Network Management Protocol (SNMP) Trap daemon. -+After=syslog.target network.target -+ -+[Service] -+# Type=notify is also supported. It should be set when snmptrapd.socket is not -+# used. -+Type=simple -+ExecStart=/usr/sbin/snmptrapd -f -+ -+[Install] -+WantedBy=multi-user.target -diff -up net-snmp-5.7.3/dist/snmptrapd.socket.MPGqYh net-snmp-5.7.3/dist/snmptrapd.socket ---- net-snmp-5.7.3/dist/snmptrapd.socket.MPGqYh 2015-02-17 13:34:05.745221844 +0100 -+++ net-snmp-5.7.3/dist/snmptrapd.socket 2015-02-17 13:34:05.745221844 +0100 -@@ -0,0 +1,14 @@ -+[Unit] -+Description=Socket listening for SNMP trap messages -+ -+[Socket] -+ListenDatagram=0.0.0.0:162 -+# Uncomment other listening addresses as needed - TCP, UDP6, TCP6. -+# It must match listening addresses/ports defined in snmptrapd.service -+# or snmptrapd.conf. -+# ListenStream=0.0.0.0:162 -+# ListenDatagram=[::]:162 -+# ListenStream=[::]:162 -+ -+[Install] -+WantedBy=sockets.target -diff -up net-snmp-5.7.3/include/net-snmp/library/sd-daemon.h.MPGqYh net-snmp-5.7.3/include/net-snmp/library/sd-daemon.h ---- net-snmp-5.7.3/include/net-snmp/library/sd-daemon.h.MPGqYh 2015-02-17 13:34:05.746221843 +0100 -+++ net-snmp-5.7.3/include/net-snmp/library/sd-daemon.h 2015-02-17 13:34:05.746221843 +0100 -@@ -0,0 +1,286 @@ -+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -+ -+#ifndef SNMPD_SD_DAEMON_H -+#define SNMPD_SD_DAEMON_H -+ -+/*** -+ Copyright 2010 Lennart Poettering -+ -+ Permission is hereby granted, free of charge, to any person -+ obtaining a copy of this software and associated documentation files -+ (the "Software"), to deal in the Software without restriction, -+ including without limitation the rights to use, copy, modify, merge, -+ publish, distribute, sublicense, and/or sell copies of the Software, -+ and to permit persons to whom the Software is furnished to do so, -+ subject to the following conditions: -+ -+ The above copyright notice and this permission notice shall be -+ included in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ SOFTWARE. -+***/ -+ -+#include -+#include -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* -+ Reference implementation of a few systemd related interfaces for -+ writing daemons. These interfaces are trivial to implement. To -+ simplify porting we provide this reference implementation. -+ Applications are welcome to reimplement the algorithms described -+ here if they do not want to include these two source files. -+ -+ The following functionality is provided: -+ -+ - Support for logging with log levels on stderr -+ - File descriptor passing for socket-based activation -+ - Daemon startup and status notification -+ - Detection of systemd boots -+ -+ You may compile this with -DDISABLE_SYSTEMD to disable systemd -+ support. This makes all those calls NOPs that are directly related to -+ systemd (i.e. only sd_is_xxx() will stay useful). -+ -+ Since this is drop-in code we don't want any of our symbols to be -+ exported in any case. Hence we declare hidden visibility for all of -+ them. -+ -+ You may find an up-to-date version of these source files online: -+ -+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h -+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c -+ -+ This should compile on non-Linux systems, too, but with the -+ exception of the sd_is_xxx() calls all functions will become NOPs. -+ -+ See sd-daemon(7) for more information. -+*/ -+ -+#ifndef _sd_printf_attr_ -+#if __GNUC__ >= 4 -+#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) -+#else -+#define _sd_printf_attr_(a,b) -+#endif -+#endif -+ -+/* -+ Log levels for usage on stderr: -+ -+ fprintf(stderr, SD_NOTICE "Hello World!\n"); -+ -+ This is similar to printk() usage in the kernel. -+*/ -+#define SD_EMERG "<0>" /* system is unusable */ -+#define SD_ALERT "<1>" /* action must be taken immediately */ -+#define SD_CRIT "<2>" /* critical conditions */ -+#define SD_ERR "<3>" /* error conditions */ -+#define SD_WARNING "<4>" /* warning conditions */ -+#define SD_NOTICE "<5>" /* normal but significant condition */ -+#define SD_INFO "<6>" /* informational */ -+#define SD_DEBUG "<7>" /* debug-level messages */ -+ -+/* The first passed file descriptor is fd 3 */ -+#define SD_LISTEN_FDS_START 3 -+ -+/* -+ Returns how many file descriptors have been passed, or a negative -+ errno code on failure. Optionally, removes the $LISTEN_FDS and -+ $LISTEN_PID file descriptors from the environment (recommended, but -+ problematic in threaded environments). If r is the return value of -+ this function you'll find the file descriptors passed as fds -+ SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative -+ errno style error code on failure. This function call ensures that -+ the FD_CLOEXEC flag is set for the passed file descriptors, to make -+ sure they are not passed on to child processes. If FD_CLOEXEC shall -+ not be set, the caller needs to unset it after this call for all file -+ descriptors that are used. -+ -+ See sd_listen_fds(3) for more information. -+*/ -+int netsnmp_sd_listen_fds(int unset_environment); -+ -+/* -+ Helper call for identifying a passed file descriptor. Returns 1 if -+ the file descriptor is a FIFO in the file system stored under the -+ specified path, 0 otherwise. If path is NULL a path name check will -+ not be done and the call only verifies if the file descriptor -+ refers to a FIFO. Returns a negative errno style error code on -+ failure. -+ -+ See sd_is_fifo(3) for more information. -+*/ -+int netsnmp_sd_is_fifo(int fd, const char *path); -+ -+/* -+ Helper call for identifying a passed file descriptor. Returns 1 if -+ the file descriptor is a special character device on the file -+ system stored under the specified path, 0 otherwise. -+ If path is NULL a path name check will not be done and the call -+ only verifies if the file descriptor refers to a special character. -+ Returns a negative errno style error code on failure. -+ -+ See sd_is_special(3) for more information. -+*/ -+int netsnmp_sd_is_special(int fd, const char *path); -+ -+/* -+ Helper call for identifying a passed file descriptor. Returns 1 if -+ the file descriptor is a socket of the specified family (AF_INET, -+ ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If -+ family is 0 a socket family check will not be done. If type is 0 a -+ socket type check will not be done and the call only verifies if -+ the file descriptor refers to a socket. If listening is > 0 it is -+ verified that the socket is in listening mode. (i.e. listen() has -+ been called) If listening is == 0 it is verified that the socket is -+ not in listening mode. If listening is < 0 no listening mode check -+ is done. Returns a negative errno style error code on failure. -+ -+ See sd_is_socket(3) for more information. -+*/ -+int netsnmp_sd_is_socket(int fd, int family, int type, int listening); -+ -+/* -+ Helper call for identifying a passed file descriptor. Returns 1 if -+ the file descriptor is an Internet socket, of the specified family -+ (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM, -+ SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version -+ check is not done. If type is 0 a socket type check will not be -+ done. If port is 0 a socket port check will not be done. The -+ listening flag is used the same way as in sd_is_socket(). Returns a -+ negative errno style error code on failure. -+ -+ See sd_is_socket_inet(3) for more information. -+*/ -+int netsnmp_sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port); -+ -+/* -+ Helper call for identifying a passed file descriptor. Returns 1 if -+ the file descriptor is an AF_UNIX socket of the specified type -+ (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0 -+ a socket type check will not be done. If path is NULL a socket path -+ check will not be done. For normal AF_UNIX sockets set length to -+ 0. For abstract namespace sockets set length to the length of the -+ socket name (including the initial 0 byte), and pass the full -+ socket path in path (including the initial 0 byte). The listening -+ flag is used the same way as in sd_is_socket(). Returns a negative -+ errno style error code on failure. -+ -+ See sd_is_socket_unix(3) for more information. -+*/ -+int netsnmp_sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length); -+ -+/* -+ Informs systemd about changed daemon state. This takes a number of -+ newline separated environment-style variable assignments in a -+ string. The following variables are known: -+ -+ READY=1 Tells systemd that daemon startup is finished (only -+ relevant for services of Type=notify). The passed -+ argument is a boolean "1" or "0". Since there is -+ little value in signaling non-readiness the only -+ value daemons should send is "READY=1". -+ -+ STATUS=... Passes a single-line status string back to systemd -+ that describes the daemon state. This is free-from -+ and can be used for various purposes: general state -+ feedback, fsck-like programs could pass completion -+ percentages and failing programs could pass a human -+ readable error message. Example: "STATUS=Completed -+ 66% of file system check..." -+ -+ ERRNO=... If a daemon fails, the errno-style error code, -+ formatted as string. Example: "ERRNO=2" for ENOENT. -+ -+ BUSERROR=... If a daemon fails, the D-Bus error-style error -+ code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut" -+ -+ MAINPID=... The main pid of a daemon, in case systemd did not -+ fork off the process itself. Example: "MAINPID=4711" -+ -+ Daemons can choose to send additional variables. However, it is -+ recommended to prefix variable names not listed above with X_. -+ -+ Returns a negative errno-style error code on failure. Returns > 0 -+ if systemd could be notified, 0 if it couldn't possibly because -+ systemd is not running. -+ -+ Example: When a daemon finished starting up, it could issue this -+ call to notify systemd about it: -+ -+ sd_notify(0, "READY=1"); -+ -+ See sd_notifyf() for more complete examples. -+ -+ See sd_notify(3) for more information. -+*/ -+int netsnmp_sd_notify(int unset_environment, const char *state); -+ -+/* -+ Similar to sd_notify() but takes a format string. -+ -+ Example 1: A daemon could send the following after initialization: -+ -+ sd_notifyf(0, "READY=1\n" -+ "STATUS=Processing requests...\n" -+ "MAINPID=%lu", -+ (unsigned long) getpid()); -+ -+ Example 2: A daemon could send the following shortly before -+ exiting, on failure: -+ -+ sd_notifyf(0, "STATUS=Failed to start up: %s\n" -+ "ERRNO=%i", -+ strerror(errno), -+ errno); -+ -+ See sd_notifyf(3) for more information. -+*/ -+int netsnmp_sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3); -+ -+/* -+ Returns > 0 if the system was booted with systemd. Returns < 0 on -+ error. Returns 0 if the system was not booted with systemd. Note -+ that all of the functions above handle non-systemd boots just -+ fine. You should NOT protect them with a call to this function. Also -+ note that this function checks whether the system, not the user -+ session is controlled by systemd. However the functions above work -+ for both user and system services. -+ -+ See sd_booted(3) for more information. -+*/ -+int netsnmp_sd_booted(void); -+ -+/** -+ * Find an socket with given parameters. See man sd_is_socket_inet for -+ * description of the arguments. -+ * -+ * Returns the file descriptor if it is found, 0 otherwise. -+ */ -+int netsnmp_sd_find_inet_socket(int family, int type, int listening, int port); -+ -+/** -+ * Find an unix socket with given parameters. See man sd_is_socket_unix for -+ * description of the arguments. -+ * -+ * Returns the file descriptor if it is found, 0 otherwise. -+ */ -+int -+netsnmp_sd_find_unix_socket(int type, int listening, const char *path); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* SNMPD_SD_DAEMON_H */ -diff -up net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in.MPGqYh net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in ---- net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in 2015-02-17 13:34:05.746221843 +0100 -@@ -1410,6 +1410,9 @@ - /* If you don't have root access don't exit upon kmem errors */ - #undef NETSNMP_NO_ROOT_ACCESS - -+/* If you don't want to integrate with systemd. */ -+#undef NETSNMP_NO_SYSTEMD -+ - /* Define if you want to remove all SET/write access from the code */ - #undef NETSNMP_NO_WRITE_SUPPORT - -diff -up net-snmp-5.7.3/README.systemd.MPGqYh net-snmp-5.7.3/README.systemd ---- net-snmp-5.7.3/README.systemd.MPGqYh 2015-02-17 13:34:05.747221843 +0100 -+++ net-snmp-5.7.3/README.systemd 2015-02-17 13:34:05.747221843 +0100 -@@ -0,0 +1,41 @@ -+README.systemd -+-------------- -+Net-SNMP provides two daemons, which support systemd system manager. -+See http://www.freedesktop.org/wiki/Software/systemd to learn how -+systemd works. Both socket activation and notification is supported by these -+daemons. -+ -+To enable systemd support, the sources must be compiled with -+--with-systemd configure option. -+ -+snmpd - The SNMP agent -+---------------------- -+Socket activation od snmpd daemon is implemented, but it's discouraged. -+The reason is simple - snmpd not only listens and processes SNMP requests -+from network, but also gathers system statistics counters, sends traps and -+communicates with subagents. It even opens few netlink sockets. -+ -+In other words, snmpd should run from system start to properly work. -+This can be done in two ways: -+1) either as snmpd service unit with 'Type=notification' and without a socket -+ unit -+2) or as snmpd service unit with 'Type=simple', appropriate socket socket unit -+ and the snmpd service enabled. This way systemd creates the snmpd listening -+ socket early during boot and passes the sockets to snmpd slightly later -+ (but still during machine boot). This way systemd can paralelize start of -+ services, which depend on snmpd. Admins must adjust the socket file manually, -+ depending if the snmpd support AgentX, IPv6, SMUX etc. -+ -+snmpd should be started with '-f' command line parameter to disable forking - -+systemd does that for us automatically. -+ -+ -+snmptrapd - The trap processing daemon -+-------------------------------------- -+snmptrapd supports full socket activation and also notification (if needed). -+Both 'Type=simple' (with appropriate socket unit) and 'Type=notify' services -+will work. Again, '-f' parameter should be provided on snmptrapd command line. -+ -+If integration with SNMP agent using AgentX protocol is enabled, snmptrapd should -+start during boot and not after first SNMP trap arrives. Same rules as for snmpd -+applies then. -\ No newline at end of file -diff -up net-snmp-5.7.3/snmplib/sd-daemon.c.MPGqYh net-snmp-5.7.3/snmplib/sd-daemon.c ---- net-snmp-5.7.3/snmplib/sd-daemon.c.MPGqYh 2015-02-17 13:34:05.747221843 +0100 -+++ net-snmp-5.7.3/snmplib/sd-daemon.c 2015-02-17 13:34:05.747221843 +0100 -@@ -0,0 +1,532 @@ -+/* -+ * Systemd integration parts. -+ * -+ * Most of this file is directly copied from systemd sources. -+ * Changes: -+ * - all functions were renamed to have netsnmp_ prefix -+ * - includes were changed to match Net-SNMP style. -+ * - removed gcc export macros -+ * - removed POSIX message queues -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#ifndef NETSNMP_NO_SYSTEMD -+ -+/*** -+ Copyright 2010 Lennart Poettering -+ -+ Permission is hereby granted, free of charge, to any person -+ obtaining a copy of this software and associated documentation files -+ (the "Software"), to deal in the Software without restriction, -+ including without limitation the rights to use, copy, modify, merge, -+ publish, distribute, sublicense, and/or sell copies of the Software, -+ and to permit persons to whom the Software is furnished to do so, -+ subject to the following conditions: -+ -+ The above copyright notice and this permission notice shall be -+ included in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ SOFTWARE. -+***/ -+ -+#ifndef _GNU_SOURCE -+#define _GNU_SOURCE -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+int netsnmp_sd_listen_fds(int unset_environment) { -+ -+ int r, fd; -+ const char *e; -+ char *p = NULL; -+ unsigned long l; -+ -+ if (!(e = getenv("LISTEN_PID"))) { -+ r = 0; -+ goto finish; -+ } -+ -+ errno = 0; -+ l = strtoul(e, &p, 10); -+ -+ if (errno != 0) { -+ r = -errno; -+ goto finish; -+ } -+ -+ if (!p || *p || l <= 0) { -+ r = -EINVAL; -+ goto finish; -+ } -+ -+ /* Is this for us? */ -+ if (getpid() != (pid_t) l) { -+ r = 0; -+ goto finish; -+ } -+ -+ if (!(e = getenv("LISTEN_FDS"))) { -+ r = 0; -+ goto finish; -+ } -+ -+ errno = 0; -+ l = strtoul(e, &p, 10); -+ -+ if (errno != 0) { -+ r = -errno; -+ goto finish; -+ } -+ -+ if (!p || *p) { -+ r = -EINVAL; -+ goto finish; -+ } -+ -+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) { -+ int flags; -+ -+ if ((flags = fcntl(fd, F_GETFD)) < 0) { -+ r = -errno; -+ goto finish; -+ } -+ -+ if (flags & FD_CLOEXEC) -+ continue; -+ -+ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) { -+ r = -errno; -+ goto finish; -+ } -+ } -+ -+ r = (int) l; -+ -+finish: -+ if (unset_environment) { -+ unsetenv("LISTEN_PID"); -+ unsetenv("LISTEN_FDS"); -+ } -+ -+ return r; -+} -+ -+int netsnmp_sd_is_fifo(int fd, const char *path) { -+ struct stat st_fd; -+ -+ if (fd < 0) -+ return -EINVAL; -+ -+ memset(&st_fd, 0, sizeof(st_fd)); -+ if (fstat(fd, &st_fd) < 0) -+ return -errno; -+ -+ if (!S_ISFIFO(st_fd.st_mode)) -+ return 0; -+ -+ if (path) { -+ struct stat st_path; -+ -+ memset(&st_path, 0, sizeof(st_path)); -+ if (stat(path, &st_path) < 0) { -+ -+ if (errno == ENOENT || errno == ENOTDIR) -+ return 0; -+ -+ return -errno; -+ } -+ -+ return -+ st_path.st_dev == st_fd.st_dev && -+ st_path.st_ino == st_fd.st_ino; -+ } -+ -+ return 1; -+} -+ -+int netsnmp_sd_is_special(int fd, const char *path) { -+ struct stat st_fd; -+ -+ if (fd < 0) -+ return -EINVAL; -+ -+ if (fstat(fd, &st_fd) < 0) -+ return -errno; -+ -+ if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode)) -+ return 0; -+ -+ if (path) { -+ struct stat st_path; -+ -+ if (stat(path, &st_path) < 0) { -+ -+ if (errno == ENOENT || errno == ENOTDIR) -+ return 0; -+ -+ return -errno; -+ } -+ -+ if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode)) -+ return -+ st_path.st_dev == st_fd.st_dev && -+ st_path.st_ino == st_fd.st_ino; -+ else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode)) -+ return st_path.st_rdev == st_fd.st_rdev; -+ else -+ return 0; -+ } -+ -+ return 1; -+} -+ -+static int sd_is_socket_internal(int fd, int type, int listening) { -+ struct stat st_fd; -+ -+ if (fd < 0 || type < 0) -+ return -EINVAL; -+ -+ if (fstat(fd, &st_fd) < 0) -+ return -errno; -+ -+ if (!S_ISSOCK(st_fd.st_mode)) -+ return 0; -+ -+ if (type != 0) { -+ int other_type = 0; -+ socklen_t l = sizeof(other_type); -+ -+ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0) -+ return -errno; -+ -+ if (l != sizeof(other_type)) -+ return -EINVAL; -+ -+ if (other_type != type) -+ return 0; -+ } -+ -+ if (listening >= 0) { -+ int accepting = 0; -+ socklen_t l = sizeof(accepting); -+ -+ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0) -+ return -errno; -+ -+ if (l != sizeof(accepting)) -+ return -EINVAL; -+ -+ if (!accepting != !listening) -+ return 0; -+ } -+ -+ return 1; -+} -+ -+union sockaddr_union { -+ struct sockaddr sa; -+ struct sockaddr_in in4; -+ struct sockaddr_in6 in6; -+ struct sockaddr_un un; -+ struct sockaddr_storage storage; -+}; -+ -+int netsnmp_sd_is_socket(int fd, int family, int type, int listening) { -+ int r; -+ -+ if (family < 0) -+ return -EINVAL; -+ -+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) -+ return r; -+ -+ if (family > 0) { -+ union sockaddr_union sockaddr; -+ socklen_t l; -+ -+ memset(&sockaddr, 0, sizeof(sockaddr)); -+ l = sizeof(sockaddr); -+ -+ if (getsockname(fd, &sockaddr.sa, &l) < 0) -+ return -errno; -+ -+ if (l < sizeof(sa_family_t)) -+ return -EINVAL; -+ -+ return sockaddr.sa.sa_family == family; -+ } -+ -+ return 1; -+} -+ -+int netsnmp_sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { -+ union sockaddr_union sockaddr; -+ socklen_t l; -+ int r; -+ -+ if (family != 0 && family != AF_INET && family != AF_INET6) -+ return -EINVAL; -+ -+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) -+ return r; -+ -+ memset(&sockaddr, 0, sizeof(sockaddr)); -+ l = sizeof(sockaddr); -+ -+ if (getsockname(fd, &sockaddr.sa, &l) < 0) -+ return -errno; -+ -+ if (l < sizeof(sa_family_t)) -+ return -EINVAL; -+ -+ if (sockaddr.sa.sa_family != AF_INET && -+ sockaddr.sa.sa_family != AF_INET6) -+ return 0; -+ -+ if (family > 0) -+ if (sockaddr.sa.sa_family != family) -+ return 0; -+ -+ if (port > 0) { -+ if (sockaddr.sa.sa_family == AF_INET) { -+ if (l < sizeof(struct sockaddr_in)) -+ return -EINVAL; -+ -+ return htons(port) == sockaddr.in4.sin_port; -+ } else { -+ if (l < sizeof(struct sockaddr_in6)) -+ return -EINVAL; -+ -+ return htons(port) == sockaddr.in6.sin6_port; -+ } -+ } -+ -+ return 1; -+} -+ -+int netsnmp_sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { -+ union sockaddr_union sockaddr; -+ socklen_t l; -+ int r; -+ -+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) -+ return r; -+ -+ memset(&sockaddr, 0, sizeof(sockaddr)); -+ l = sizeof(sockaddr); -+ -+ if (getsockname(fd, &sockaddr.sa, &l) < 0) -+ return -errno; -+ -+ if (l < sizeof(sa_family_t)) -+ return -EINVAL; -+ -+ if (sockaddr.sa.sa_family != AF_UNIX) -+ return 0; -+ -+ if (path) { -+ if (length <= 0) -+ length = strlen(path); -+ -+ if (length <= 0) -+ /* Unnamed socket */ -+ return l == offsetof(struct sockaddr_un, sun_path); -+ -+ if (path[0]) -+ /* Normal path socket */ -+ return -+ (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) && -+ memcmp(path, sockaddr.un.sun_path, length+1) == 0; -+ else -+ /* Abstract namespace socket */ -+ return -+ (l == offsetof(struct sockaddr_un, sun_path) + length) && -+ memcmp(path, sockaddr.un.sun_path, length) == 0; -+ } -+ -+ return 1; -+} -+ -+int netsnmp_sd_notify(int unset_environment, const char *state) { -+ int fd = -1, r; -+ struct msghdr msghdr; -+ struct iovec iovec; -+ union sockaddr_union sockaddr; -+ const char *e; -+ -+ if (!state) { -+ r = -EINVAL; -+ goto finish; -+ } -+ -+ if (!(e = getenv("NOTIFY_SOCKET"))) -+ return 0; -+ -+ /* Must be an abstract socket, or an absolute path */ -+ if ((e[0] != '@' && e[0] != '/') || e[1] == 0) { -+ r = -EINVAL; -+ goto finish; -+ } -+ -+ if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) { -+ r = -errno; -+ goto finish; -+ } -+ -+ memset(&sockaddr, 0, sizeof(sockaddr)); -+ sockaddr.sa.sa_family = AF_UNIX; -+ strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); -+ -+ if (sockaddr.un.sun_path[0] == '@') -+ sockaddr.un.sun_path[0] = 0; -+ -+ memset(&iovec, 0, sizeof(iovec)); -+ iovec.iov_base = (char *)state; -+ iovec.iov_len = strlen(state); -+ -+ memset(&msghdr, 0, sizeof(msghdr)); -+ msghdr.msg_name = &sockaddr; -+ msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e); -+ -+ if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) -+ msghdr.msg_namelen = sizeof(struct sockaddr_un); -+ -+ msghdr.msg_iov = &iovec; -+ msghdr.msg_iovlen = 1; -+ -+ if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { -+ r = -errno; -+ goto finish; -+ } -+ -+ r = 1; -+ -+finish: -+ if (unset_environment) -+ unsetenv("NOTIFY_SOCKET"); -+ -+ if (fd >= 0) -+ close(fd); -+ -+ return r; -+} -+ -+int netsnmp_sd_notifyf(int unset_environment, const char *format, ...) { -+ va_list ap; -+ char *p = NULL; -+ int r; -+ -+ va_start(ap, format); -+ r = vasprintf(&p, format, ap); -+ va_end(ap); -+ -+ if (r < 0 || !p) -+ return -ENOMEM; -+ -+ r = netsnmp_sd_notify(unset_environment, p); -+ free(p); -+ -+ return r; -+} -+ -+int netsnmp_sd_booted(void) { -+ struct stat a, b; -+ -+ /* We simply test whether the systemd cgroup hierarchy is -+ * mounted */ -+ -+ if (lstat("/sys/fs/cgroup", &a) < 0) -+ return 0; -+ -+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0) -+ return 0; -+ -+ return a.st_dev != b.st_dev; -+} -+ -+/* End of original sd-daemon.c from systemd sources */ -+ -+int -+netsnmp_sd_find_inet_socket(int family, int type, int listening, int port) -+{ -+ int count, fd; -+ -+ count = netsnmp_sd_listen_fds(0); -+ if (count <= 0) { -+ DEBUGMSGTL(("systemd:find_inet_socket", "No LISTEN_FDS found.\n")); -+ return 0; -+ } -+ DEBUGMSGTL(("systemd:find_inet_socket", "LISTEN_FDS reports %d sockets.\n", -+ count)); -+ -+ for (fd = 3; fd < 3+count; fd++) { -+ int rc = netsnmp_sd_is_socket_inet(fd, family, type, listening, port); -+ if (rc < 0) -+ DEBUGMSGTL(("systemd:find_inet_socket", -+ "sd_is_socket_inet error: %d\n", rc)); -+ if (rc > 0) { -+ DEBUGMSGTL(("systemd:find_inet_socket", -+ "Found the socket in LISTEN_FDS\n")); -+ return fd; -+ } -+ } -+ DEBUGMSGTL(("systemd:find_inet_socket", "Socket not found in LISTEN_FDS\n")); -+ return 0; -+} -+ -+int -+netsnmp_sd_find_unix_socket(int type, int listening, const char *path) -+{ -+ int count, fd; -+ -+ count = netsnmp_sd_listen_fds(0); -+ if (count <= 0) { -+ DEBUGMSGTL(("systemd:find_unix_socket", "No LISTEN_FDS found.\n")); -+ return 0; -+ } -+ DEBUGMSGTL(("systemd:find_unix_socket", "LISTEN_FDS reports %d sockets.\n", -+ count)); -+ -+ for (fd = 3; fd < 3+count; fd++) { -+ int rc = netsnmp_sd_is_socket_unix(fd, type, listening, path, 0); -+ if (rc < 0) -+ DEBUGMSGTL(("systemd:find_unix_socket", -+ "netsnmp_sd_is_socket_unix error: %d\n", rc)); -+ if (rc > 0) { -+ DEBUGMSGTL(("systemd:find_unix_socket", -+ "Found the socket in LISTEN_FDS\n")); -+ return fd; -+ } -+ } -+ DEBUGMSGTL(("systemd:find_unix_socket", "Socket not found in LISTEN_FDS\n")); -+ return 0; -+} -+ -+#endif /* ! NETSNMP_NO_SYSTEMD */ -diff -up net-snmp-5.7.3/snmplib/transports/snmpTCPDomain.c.MPGqYh net-snmp-5.7.3/snmplib/transports/snmpTCPDomain.c ---- net-snmp-5.7.3/snmplib/transports/snmpTCPDomain.c.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/snmplib/transports/snmpTCPDomain.c 2015-02-17 13:34:05.748221842 +0100 -@@ -43,6 +43,10 @@ - #include - #include - -+#ifndef NETSNMP_NO_SYSTEMD -+#include -+#endif -+ - /* - * needs to be in sync with the definitions in snmplib/snmpUDPDomain.c - * and perl/agent/agent.xs -@@ -149,6 +153,7 @@ netsnmp_tcp_transport(struct sockaddr_in - netsnmp_transport *t = NULL; - netsnmp_udp_addr_pair *addr_pair = NULL; - int rc = 0; -+ int socket_initialized = 0; - - #ifdef NETSNMP_NO_LISTEN_SUPPORT - if (local) -@@ -178,7 +183,19 @@ netsnmp_tcp_transport(struct sockaddr_in - t->domain_length = - sizeof(netsnmp_snmpTCPDomain) / sizeof(netsnmp_snmpTCPDomain[0]); - -- t->sock = socket(PF_INET, SOCK_STREAM, 0); -+#ifndef NETSNMP_NO_SYSTEMD -+ /* -+ * Maybe the socket was already provided by systemd... -+ */ -+ if (local) { -+ t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_STREAM, 1, -+ ntohs(addr->sin_port)); -+ if (t->sock) -+ socket_initialized = 1; -+ } -+#endif -+ if (!socket_initialized) -+ t->sock = socket(PF_INET, SOCK_STREAM, 0); - if (t->sock < 0) { - netsnmp_transport_free(t); - return NULL; -@@ -215,11 +232,13 @@ netsnmp_tcp_transport(struct sockaddr_in - setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, - sizeof(opt)); - -- rc = bind(t->sock, (struct sockaddr *)addr, sizeof(struct sockaddr)); -- if (rc != 0) { -- netsnmp_socketbase_close(t); -- netsnmp_transport_free(t); -- return NULL; -+ if (!socket_initialized) { -+ rc = bind(t->sock, (struct sockaddr *)addr, sizeof(struct sockaddr)); -+ if (rc != 0) { -+ netsnmp_socketbase_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } - } - - /* -@@ -235,12 +254,13 @@ netsnmp_tcp_transport(struct sockaddr_in - /* - * Now sit here and wait for connections to arrive. - */ -- -- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); -- if (rc != 0) { -- netsnmp_socketbase_close(t); -- netsnmp_transport_free(t); -- return NULL; -+ if (!socket_initialized) { -+ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); -+ if (rc != 0) { -+ netsnmp_socketbase_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } - } - - /* -diff -up net-snmp-5.7.3/snmplib/transports/snmpTCPIPv6Domain.c.MPGqYh net-snmp-5.7.3/snmplib/transports/snmpTCPIPv6Domain.c ---- net-snmp-5.7.3/snmplib/transports/snmpTCPIPv6Domain.c.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/snmplib/transports/snmpTCPIPv6Domain.c 2015-02-17 13:34:05.748221842 +0100 -@@ -49,6 +49,10 @@ - #include - #include - -+#ifndef NETSNMP_NO_SYSTEMD -+#include -+#endif -+ - #include "inet_ntop.h" - - oid netsnmp_TCPIPv6Domain[] = { TRANSPORT_DOMAIN_TCP_IPV6 }; -@@ -140,6 +144,7 @@ netsnmp_tcp6_transport(struct sockaddr_i - { - netsnmp_transport *t = NULL; - int rc = 0; -+ int socket_initialized = 0; - - #ifdef NETSNMP_NO_LISTEN_SUPPORT - if (local) -@@ -174,7 +179,19 @@ netsnmp_tcp6_transport(struct sockaddr_i - t->domain = netsnmp_TCPIPv6Domain; - t->domain_length = sizeof(netsnmp_TCPIPv6Domain) / sizeof(oid); - -- t->sock = socket(PF_INET6, SOCK_STREAM, 0); -+#ifndef NETSNMP_NO_SYSTEMD -+ /* -+ * Maybe the socket was already provided by systemd... -+ */ -+ if (local) { -+ t->sock = netsnmp_sd_find_inet_socket(PF_INET6, SOCK_STREAM, 1, -+ ntohs(addr->sin6_port)); -+ if (t->sock) -+ socket_initialized = 1; -+ } -+#endif -+ if (!socket_initialized) -+ t->sock = socket(PF_INET6, SOCK_STREAM, 0); - if (t->sock < 0) { - netsnmp_transport_free(t); - return NULL; -@@ -220,12 +237,14 @@ netsnmp_tcp6_transport(struct sockaddr_i - - setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)); - -- rc = bind(t->sock, (struct sockaddr *) addr, -- sizeof(struct sockaddr_in6)); -- if (rc != 0) { -- netsnmp_socketbase_close(t); -- netsnmp_transport_free(t); -- return NULL; -+ if (!socket_initialized) { -+ rc = bind(t->sock, (struct sockaddr *) addr, -+ sizeof(struct sockaddr_in6)); -+ if (rc != 0) { -+ netsnmp_socketbase_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } - } - - /* -@@ -242,11 +261,13 @@ netsnmp_tcp6_transport(struct sockaddr_i - * Now sit here and wait for connections to arrive. - */ - -- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); -- if (rc != 0) { -- netsnmp_socketbase_close(t); -- netsnmp_transport_free(t); -- return NULL; -+ if (!socket_initialized) { -+ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); -+ if (rc != 0) { -+ netsnmp_socketbase_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } - } - - /* -diff -up net-snmp-5.7.3/snmplib/transports/snmpUDPIPv4BaseDomain.c.MPGqYh net-snmp-5.7.3/snmplib/transports/snmpUDPIPv4BaseDomain.c ---- net-snmp-5.7.3/snmplib/transports/snmpUDPIPv4BaseDomain.c.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/snmplib/transports/snmpUDPIPv4BaseDomain.c 2015-02-17 13:36:22.744123462 +0100 -@@ -40,6 +40,10 @@ - - #include - -+#ifndef NETSNMP_NO_SYSTEMD -+#include -+#endif -+ - #if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR) - int netsnmp_udpipv4_recvfrom(int s, void *buf, int len, struct sockaddr *from, - socklen_t *fromlen, struct sockaddr *dstip, -@@ -64,6 +68,7 @@ netsnmp_udpipv4base_transport(struct soc - char *client_socket = NULL; - netsnmp_indexed_addr_pair addr_pair; - socklen_t local_addr_len; -+ int socket_initialized = 0; - - #ifdef NETSNMP_NO_LISTEN_SUPPORT - if (local) -@@ -88,7 +93,20 @@ netsnmp_udpipv4base_transport(struct soc - free(str); - } - -- t->sock = socket(PF_INET, SOCK_DGRAM, 0); -+#ifndef NETSNMP_NO_SYSTEMD -+ /* -+ * Maybe the socket was already provided by systemd... -+ */ -+ if (local) { -+ t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_DGRAM, -1, -+ ntohs(addr->sin_port)); -+ if (t->sock) -+ socket_initialized = 1; -+ } -+#endif -+ if (!socket_initialized) -+ t->sock = socket(PF_INET, SOCK_DGRAM, 0); -+ - DEBUGMSGTL(("UDPBase", "openned socket %d as local=%d\n", t->sock, local)); - if (t->sock < 0) { - netsnmp_transport_free(t); -@@ -151,12 +169,14 @@ netsnmp_udpipv4base_transport(struct soc - } - } - #endif /* !defined(WIN32) */ -- rc = bind(t->sock, (struct sockaddr *) addr, -- sizeof(struct sockaddr)); -- if (rc != 0) { -- netsnmp_socketbase_close(t); -- netsnmp_transport_free(t); -- return NULL; -+ if (!socket_initialized) { -+ rc = bind(t->sock, (struct sockaddr *) addr, -+ sizeof(struct sockaddr)); -+ if (rc != 0) { -+ netsnmp_socketbase_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } - } - t->data = NULL; - t->data_length = 0; -diff -up net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c.MPGqYh net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c ---- net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c 2015-02-17 13:37:16.256087147 +0100 -@@ -67,6 +67,10 @@ static const struct in6_addr in6addr_any - #include - #include - -+#ifndef NETSNMP_NO_SYSTEMD -+#include -+#endif -+ - #include "inet_ntop.h" - #include "inet_pton.h" - -@@ -190,6 +194,7 @@ netsnmp_udp6_transport(struct sockaddr_i - { - netsnmp_transport *t = NULL; - int rc = 0; -+ int socket_initialized = 0; - - #ifdef NETSNMP_NO_LISTEN_SUPPORT - if (local) -@@ -217,7 +222,19 @@ netsnmp_udp6_transport(struct sockaddr_i - t->domain_length = - sizeof(netsnmp_UDPIPv6Domain) / sizeof(netsnmp_UDPIPv6Domain[0]); - -- t->sock = socket(PF_INET6, SOCK_DGRAM, 0); -+#ifndef NETSNMP_NO_SYSTEMD -+ /* -+ * Maybe the socket was already provided by systemd... -+ */ -+ if (local) { -+ t->sock = netsnmp_sd_find_inet_socket(PF_INET6, SOCK_DGRAM, -1, -+ ntohs(addr->sin6_port)); -+ if (t->sock) -+ socket_initialized = 1; -+ } -+#endif -+ if (!socket_initialized) -+ t->sock = socket(PF_INET6, SOCK_DGRAM, 0); - if (t->sock < 0) { - netsnmp_transport_free(t); - return NULL; -@@ -242,13 +259,14 @@ netsnmp_udp6_transport(struct sockaddr_i - } - } - #endif -- -- rc = bind(t->sock, (struct sockaddr *) addr, -- sizeof(struct sockaddr_in6)); -- if (rc != 0) { -- netsnmp_socketbase_close(t); -- netsnmp_transport_free(t); -- return NULL; -+ if (!socket_initialized) { -+ rc = bind(t->sock, (struct sockaddr *) addr, -+ sizeof(struct sockaddr_in6)); -+ if (rc != 0) { -+ netsnmp_socketbase_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } - } - t->local = (unsigned char*)malloc(18); - if (t->local == NULL) { -diff -up net-snmp-5.7.3/snmplib/transports/snmpUnixDomain.c.MPGqYh net-snmp-5.7.3/snmplib/transports/snmpUnixDomain.c ---- net-snmp-5.7.3/snmplib/transports/snmpUnixDomain.c.MPGqYh 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/snmplib/transports/snmpUnixDomain.c 2015-02-17 13:34:05.749221841 +0100 -@@ -37,6 +37,10 @@ - #include /* mkdirhier */ - #include - -+#ifndef NETSNMP_NO_SYSTEMD -+#include -+#endif -+ - netsnmp_feature_child_of(transport_unix_socket_all, transport_all) - netsnmp_feature_child_of(unix_socket_paths, transport_unix_socket_all) - -@@ -295,6 +299,7 @@ netsnmp_unix_transport(struct sockaddr_u - netsnmp_transport *t = NULL; - sockaddr_un_pair *sup = NULL; - int rc = 0; -+ int socket_initialized = 0; - - #ifdef NETSNMP_NO_LISTEN_SUPPORT - /* SPECIAL CIRCUMSTANCE: We still want AgentX to be able to operate, -@@ -333,7 +338,18 @@ netsnmp_unix_transport(struct sockaddr_u - t->data_length = sizeof(sockaddr_un_pair); - sup = (sockaddr_un_pair *) t->data; - -- t->sock = socket(PF_UNIX, SOCK_STREAM, 0); -+#ifndef NETSNMP_NO_SYSTEMD -+ /* -+ * Maybe the socket was already provided by systemd... -+ */ -+ if (local) { -+ t->sock = netsnmp_sd_find_unix_socket(SOCK_STREAM, 1, addr->sun_path); -+ if (t->sock) -+ socket_initialized = 1; -+ } -+#endif -+ if (!socket_initialized) -+ t->sock = socket(PF_UNIX, SOCK_STREAM, 0); - if (t->sock < 0) { - netsnmp_transport_free(t); - return NULL; -@@ -357,25 +373,26 @@ netsnmp_unix_transport(struct sockaddr_u - - t->flags |= NETSNMP_TRANSPORT_FLAG_LISTEN; - -- unlink(addr->sun_path); -- rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr)); -- -- if (rc != 0 && errno == ENOENT && create_path) { -- rc = mkdirhier(addr->sun_path, create_mode, 1); -+ if (!socket_initialized) { -+ unlink(addr->sun_path); -+ rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr)); -+ if (rc != 0 && errno == ENOENT && create_path) { -+ rc = mkdirhier(addr->sun_path, create_mode, 1); -+ if (rc != 0) { -+ netsnmp_unix_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } -+ rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr)); -+ } - if (rc != 0) { -+ DEBUGMSGTL(("netsnmp_unix_transport", -+ "couldn't bind \"%s\", errno %d (%s)\n", -+ addr->sun_path, errno, strerror(errno))); - netsnmp_unix_close(t); - netsnmp_transport_free(t); - return NULL; - } -- rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr)); -- } -- if (rc != 0) { -- DEBUGMSGTL(("netsnmp_unix_transport", -- "couldn't bind \"%s\", errno %d (%s)\n", -- addr->sun_path, errno, strerror(errno))); -- netsnmp_unix_close(t); -- netsnmp_transport_free(t); -- return NULL; - } - - /* -@@ -391,16 +408,17 @@ netsnmp_unix_transport(struct sockaddr_u - * Now sit here and listen for connections to arrive. - */ - -- rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); -- if (rc != 0) { -- DEBUGMSGTL(("netsnmp_unix_transport", -- "couldn't listen to \"%s\", errno %d (%s)\n", -- addr->sun_path, errno, strerror(errno))); -- netsnmp_unix_close(t); -- netsnmp_transport_free(t); -- return NULL; -+ if (!socket_initialized) { -+ rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN); -+ if (rc != 0) { -+ DEBUGMSGTL(("netsnmp_unix_transport", -+ "couldn't listen to \"%s\", errno %d (%s)\n", -+ addr->sun_path, errno, strerror(errno))); -+ netsnmp_unix_close(t); -+ netsnmp_transport_free(t); -+ return NULL; -+ } - } -- - } else { - t->remote = (u_char *)malloc(strlen(addr->sun_path)); - if (t->remote == NULL) { diff --git a/net-snmp-5.7.3-CVE-2018-1000116.patch b/net-snmp-5.7.3-CVE-2018-1000116.patch deleted file mode 100644 index e7adffd..0000000 --- a/net-snmp-5.7.3-CVE-2018-1000116.patch +++ /dev/null @@ -1,200 +0,0 @@ -diff -urNp old/snmplib/snmp_api.c new/snmplib/snmp_api.c ---- old/snmplib/snmp_api.c 2018-03-08 09:08:50.675762351 +0100 -+++ new/snmplib/snmp_api.c 2018-03-08 09:27:13.289076553 +0100 -@@ -4350,12 +4350,10 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char - u_char type; - u_char msg_type; - u_char *var_val; -- int badtype = 0; - size_t len; - size_t four; -- netsnmp_variable_list *vp = NULL; -+ netsnmp_variable_list *vp = NULL, *vplast = NULL; - oid objid[MAX_OID_LEN]; -- u_char *p; - - /* - * Get the PDU type -@@ -4493,38 +4491,24 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char - (ASN_SEQUENCE | ASN_CONSTRUCTOR), - "varbinds"); - if (data == NULL) -- return -1; -+ goto fail; - - /* - * get each varBind sequence - */ - while ((int) *length > 0) { -- netsnmp_variable_list *vptemp; -- vptemp = (netsnmp_variable_list *) malloc(sizeof(*vptemp)); -- if (NULL == vptemp) { -- return -1; -- } -- if (NULL == vp) { -- pdu->variables = vptemp; -- } else { -- vp->next_variable = vptemp; -- } -- vp = vptemp; -+ vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list); -+ if (NULL == vp) -+ goto fail; - -- vp->next_variable = NULL; -- vp->val.string = NULL; - vp->name_length = MAX_OID_LEN; -- vp->name = NULL; -- vp->index = 0; -- vp->data = NULL; -- vp->dataFreeHook = NULL; - DEBUGDUMPSECTION("recv", "VarBind"); - data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type, - &vp->val_len, &var_val, length); - if (data == NULL) -- return -1; -+ goto fail; - if (snmp_set_var_objid(vp, objid, vp->name_length)) -- return -1; -+ goto fail; - - len = MAX_PACKET_LENGTH; - DEBUGDUMPHEADER("recv", "Value"); -@@ -4532,11 +4516,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char - case ASN_INTEGER: - vp->val.integer = (long *) vp->buf; - vp->val_len = sizeof(long); -- p = asn_parse_int(var_val, &len, &vp->type, -+ asn_parse_int(var_val, &len, &vp->type, - (long *) vp->val.integer, - sizeof(*vp->val.integer)); -- if (!p) -- return -1; - break; - case ASN_COUNTER: - case ASN_GAUGE: -@@ -4544,11 +4526,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char - case ASN_UINTEGER: - vp->val.integer = (long *) vp->buf; - vp->val_len = sizeof(u_long); -- p = asn_parse_unsigned_int(var_val, &len, &vp->type, -+ asn_parse_unsigned_int(var_val, &len, &vp->type, - (u_long *) vp->val.integer, - vp->val_len); -- if (!p) -- return -1; - break; - #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES - case ASN_OPAQUE_COUNTER64: -@@ -4557,38 +4537,30 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char - case ASN_COUNTER64: - vp->val.counter64 = (struct counter64 *) vp->buf; - vp->val_len = sizeof(struct counter64); -- p = asn_parse_unsigned_int64(var_val, &len, &vp->type, -+ asn_parse_unsigned_int64(var_val, &len, &vp->type, - (struct counter64 *) vp->val. - counter64, vp->val_len); -- if (!p) -- return -1; - break; - #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES - case ASN_OPAQUE_FLOAT: - vp->val.floatVal = (float *) vp->buf; - vp->val_len = sizeof(float); -- p = asn_parse_float(var_val, &len, &vp->type, -+ asn_parse_float(var_val, &len, &vp->type, - vp->val.floatVal, vp->val_len); -- if (!p) -- return -1; - break; - case ASN_OPAQUE_DOUBLE: - vp->val.doubleVal = (double *) vp->buf; - vp->val_len = sizeof(double); -- p = asn_parse_double(var_val, &len, &vp->type, -+ asn_parse_double(var_val, &len, &vp->type, - vp->val.doubleVal, vp->val_len); -- if (!p) -- return -1; - break; - case ASN_OPAQUE_I64: - vp->val.counter64 = (struct counter64 *) vp->buf; - vp->val_len = sizeof(struct counter64); -- p = asn_parse_signed_int64(var_val, &len, &vp->type, -+ asn_parse_signed_int64(var_val, &len, &vp->type, - (struct counter64 *) vp->val.counter64, - sizeof(*vp->val.counter64)); - -- if (!p) -- return -1; - break; - #endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */ - case ASN_IPADDRESS: -@@ -4604,22 +4576,18 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char - vp->val.string = (u_char *) malloc(vp->val_len); - } - if (vp->val.string == NULL) { -- return -1; -+ goto fail; - } -- p = asn_parse_string(var_val, &len, &vp->type, vp->val.string, -+ asn_parse_string(var_val, &len, &vp->type, vp->val.string, - &vp->val_len); -- if (!p) -- return -1; - break; - case ASN_OBJECT_ID: - vp->val_len = MAX_OID_LEN; -- p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len); -- if (!p) -- return -1; -+ asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len); - vp->val_len *= sizeof(oid); - vp->val.objid = (oid *) malloc(vp->val_len); - if (vp->val.objid == NULL) { -- return -1; -+ goto fail; - } - memmove(vp->val.objid, objid, vp->val_len); - break; -@@ -4631,21 +4599,34 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char - case ASN_BIT_STR: - vp->val.bitstring = (u_char *) malloc(vp->val_len); - if (vp->val.bitstring == NULL) { -- return -1; -+ goto fail; - } -- p = asn_parse_bitstring(var_val, &len, &vp->type, -+ asn_parse_bitstring(var_val, &len, &vp->type, - vp->val.bitstring, &vp->val_len); -- if (!p) -- return -1; - break; - default: - snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type); -- badtype = -1; -+ goto fail; - break; - } - DEBUGINDENTADD(-4); -- } -- return badtype; -+ if (NULL == vplast) { -+ pdu->variables = vp; -+ } else { -+ vplast->next_variable = vp; -+ } -+ vplast = vp; -+ vp = NULL; -+ } -+ return 0; -+ -+ fail: -+ DEBUGMSGTL(("recv", "error while parsing VarBindList\n")); -+ /** if we were parsing a var, remove it from the pdu and free it */ -+ if (vp) -+ snmp_free_var(vp); -+ -+ return -1; - } - - /* diff --git a/net-snmp-5.7.3-Fix-Makefile-PL.patch b/net-snmp-5.7.3-Fix-Makefile-PL.patch deleted file mode 100644 index 735f014..0000000 --- a/net-snmp-5.7.3-Fix-Makefile-PL.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -up net-snmp-5.7.3/perl/ASN/Makefile.PL.orig net-snmp-5.7.3/perl/ASN/Makefile.PL ---- net-snmp-5.7.3/perl/ASN/Makefile.PL.orig 2016-05-06 10:35:30.005905040 +0200 -+++ net-snmp-5.7.3/perl/ASN/Makefile.PL 2016-05-06 10:35:57.518776400 +0200 -@@ -3,6 +3,7 @@ require 5; - use Config; - use Getopt::Long; - my $lib_version; -+my %MakeParams = (); - - # See lib/ExtUtils/MakeMaker.pm for details of how to influence - # the contents of the Makefile that is written. -diff -up net-snmp-5.7.3/perl/Makefile.PL.orig net-snmp-5.7.3/perl/Makefile.PL ---- net-snmp-5.7.3/perl/Makefile.PL.orig 2016-05-06 10:34:38.975143641 +0200 -+++ net-snmp-5.7.3/perl/Makefile.PL 2016-05-06 10:35:13.326983024 +0200 -@@ -2,6 +2,7 @@ use ExtUtils::MakeMaker; - use Config; - use Getopt::Long; - require 5; -+my %MakeParams = (); - - %MakeParams = InitMakeParams(); - diff --git a/net-snmp-5.7.3-snmpstatus-null.patch b/net-snmp-5.7.3-snmpstatus-null.patch deleted file mode 100644 index 7f5de20..0000000 --- a/net-snmp-5.7.3-snmpstatus-null.patch +++ /dev/null @@ -1,69 +0,0 @@ -commit bec6243394ed78897c14e3fa46f934e0ea3d453e -Author: Jan Safranek -Date: Fri Jun 26 13:30:07 2015 +0200 - - snmpstatus: CHANGES: Fixed crash when receiving non-standard compliant responses. - - Some HW sends ifOperStatus as NULL instead of INTEGER type. We should not try to dereference this NULL. - -diff --git a/apps/snmpstatus.c b/apps/snmpstatus.c -index ae08369..6f31c42 100644 ---- a/apps/snmpstatus.c -+++ b/apps/snmpstatus.c -@@ -310,30 +310,38 @@ main(int argc, char *argv[]) - continue; - } - if (vars->name_length >= length_ifOperStatus -- && !memcmp(objid_ifOperStatus, vars->name, -- sizeof(objid_ifOperStatus))) { -+ && !memcmp(objid_ifOperStatus, vars->name, -+ sizeof(objid_ifOperStatus)) -+ && vars->type == ASN_INTEGER -+ && vars->val.integer) { - if (*vars->val.integer != MIB_IFSTATUS_UP) - down_interfaces++; - snmp_add_null_var(pdu, vars->name, - vars->name_length); - good_var++; -- } else if (vars->name_length >= length_ifInUCastPkts && -- !memcmp(objid_ifInUCastPkts, vars->name, -- sizeof(objid_ifInUCastPkts))) { -+ } else if (vars->name_length >= length_ifInUCastPkts -+ &&!memcmp(objid_ifInUCastPkts, vars->name, -+ sizeof(objid_ifInUCastPkts)) -+ && vars->type == ASN_COUNTER -+ && vars->val.integer) { - ipackets += *vars->val.integer; - snmp_add_null_var(pdu, vars->name, - vars->name_length); - good_var++; - } else if (vars->name_length >= length_ifInNUCastPkts - && !memcmp(objid_ifInNUCastPkts, vars->name, -- sizeof(objid_ifInNUCastPkts))) { -+ sizeof(objid_ifInNUCastPkts)) -+ && vars->type == ASN_COUNTER -+ && vars->val.integer) { - ipackets += *vars->val.integer; - snmp_add_null_var(pdu, vars->name, - vars->name_length); - good_var++; - } else if (vars->name_length >= length_ifOutUCastPkts - && !memcmp(objid_ifOutUCastPkts, vars->name, -- sizeof(objid_ifOutUCastPkts))) { -+ sizeof(objid_ifOutUCastPkts)) -+ && vars->type == ASN_COUNTER -+ && vars->val.integer) { - opackets += *vars->val.integer; - snmp_add_null_var(pdu, vars->name, - vars->name_length); -@@ -341,7 +349,9 @@ main(int argc, char *argv[]) - } else if (vars->name_length >= length_ifOutNUCastPkts - && !memcmp(objid_ifOutNUCastPkts, - vars->name, -- sizeof(objid_ifOutNUCastPkts))) { -+ sizeof(objid_ifOutNUCastPkts)) -+ && vars->type == ASN_COUNTER -+ && vars->val.integer) { - opackets += *vars->val.integer; - snmp_add_null_var(pdu, vars->name, - vars->name_length); diff --git a/net-snmp-5.7.3-strtok-r.patch b/net-snmp-5.7.3-strtok-r.patch deleted file mode 100644 index 0d4006a..0000000 --- a/net-snmp-5.7.3-strtok-r.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -urNp net-snmp-5.7.3/snmplib/snmp_transport.c net-snmp-5.7.3.new/snmplib/snmp_transport.c ---- net-snmp-5.7.3/snmplib/snmp_transport.c 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3.new/snmplib/snmp_transport.c 2016-08-12 13:04:35.438583586 +0200 -@@ -594,12 +594,13 @@ netsnmp_tdomain_transport_full(const cha - int commas = 0; - const char *cp = default_domain; - char *dup = strdup(default_domain); -+ char *ptr = NULL; - - while (*++cp) if (*cp == ',') commas++; - lspec = calloc(commas+2, sizeof(char *)); - commas = 1; -- lspec[0] = strtok(dup, ","); -- while ((lspec[commas++] = strtok(NULL, ","))) -+ lspec[0] = strtok_r(dup, ",", &ptr); -+ while ((lspec[commas++] = strtok_r(NULL, ",", &ptr))) - ; - spec = (const char * const *)lspec; - } diff --git a/net-snmp-5.8-Remove-U64-typedef.patch b/net-snmp-5.8-Remove-U64-typedef.patch new file mode 100644 index 0000000..75a2c6d --- /dev/null +++ b/net-snmp-5.8-Remove-U64-typedef.patch @@ -0,0 +1,12 @@ +diff -urNp a/include/net-snmp/library/int64.h b/include/net-snmp/library/int64.h +--- a/include/net-snmp/library/int64.h 2018-07-18 14:37:16.543348832 +0200 ++++ b/include/net-snmp/library/int64.h 2018-07-18 15:31:31.516999288 +0200 +@@ -10,7 +10,7 @@ extern "C" { + * Note: using the U64 typedef is deprecated because this typedef conflicts + * with a typedef with the same name defined in the Perl header files. + */ +- typedef struct counter64 U64; ++// typedef struct counter64 U64; + #endif + + #define I64CHARSZ 21 diff --git a/net-snmp-5.8-agentx-disconnect-crash.patch b/net-snmp-5.8-agentx-disconnect-crash.patch new file mode 100644 index 0000000..da84313 --- /dev/null +++ b/net-snmp-5.8-agentx-disconnect-crash.patch @@ -0,0 +1,12 @@ +diff -urNp a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c +--- a/agent/mibgroup/agentx/master.c 2018-07-18 12:13:49.953014652 +0200 ++++ b/agent/mibgroup/agentx/master.c 2018-07-18 12:20:23.537626773 +0200 +@@ -221,7 +221,7 @@ agentx_got_response(int operation, + /* response is too late, free the cache */ + if (magic) + netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic); +- return 0; ++ return 1; + } + requests = cache->requests; + diff --git a/net-snmp-5.7.3-autofs.patch b/net-snmp-5.8-autofs-skip.patch similarity index 60% rename from net-snmp-5.7.3-autofs.patch rename to net-snmp-5.8-autofs-skip.patch index 266de77..e6de4f3 100644 --- a/net-snmp-5.7.3-autofs.patch +++ b/net-snmp-5.8-autofs-skip.patch @@ -1,6 +1,6 @@ -diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c ---- oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2012-10-10 00:28:58.000000000 +0200 -+++ nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2017-10-31 10:21:53.433280099 +0100 +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: @@ -12,7 +12,7 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/h /* * The following code covers selected filesystems -@@ -153,10 +154,12 @@ netsnmp_fsys_arch_load( void ) +@@ -156,10 +157,12 @@ netsnmp_fsys_arch_load( void ) /* * Optionally skip retrieving statistics for remote mounts @@ -27,10 +27,10 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/h continue; if ( statfs( entry->path, &stat_buf ) < 0 ) { -diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntent.c nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c ---- oold/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-30 14:50:41.784743150 +0100 -+++ nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-31 08:59:08.953114110 +0100 -@@ -145,6 +145,13 @@ _fsys_type( char *typename ) +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; @@ -55,10 +55,10 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntent.c nnew/agent/mibgroup/h #ifdef irix6 if ( NSFS_STATFS( entry->path, &stat_buf, sizeof(struct statfs), 0) < 0 ) #else -diff -urNp oold/agent/mibgroup/hardware/fsys/mnttypes.h nnew/agent/mibgroup/hardware/fsys/mnttypes.h ---- oold/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-30 14:50:41.741743139 +0100 -+++ nnew/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-31 09:01:40.462427047 +0100 -@@ -159,6 +159,9 @@ +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 @@ -68,10 +68,10 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/mnttypes.h nnew/agent/mibgroup/hard #ifndef MNTTYPE_DEVPTS #define MNTTYPE_DEVPTS "devpts" #endif -diff -urNp oold/agent/mibgroup/host/hr_filesys.c nnew/agent/mibgroup/host/hr_filesys.c ---- oold/agent/mibgroup/host/hr_filesys.c 2012-10-10 00:28:58.000000000 +0200 -+++ nnew/agent/mibgroup/host/hr_filesys.c 2017-10-31 09:28:46.926093897 +0100 -@@ -839,6 +839,27 @@ Check_HR_FileSys_NFS (void) +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 */ } @@ -99,9 +99,9 @@ diff -urNp oold/agent/mibgroup/host/hr_filesys.c nnew/agent/mibgroup/host/hr_fil void End_HR_FileSys(void) { -diff -urNp oold/agent/mibgroup/host/hr_filesys.h nnew/agent/mibgroup/host/hr_filesys.h ---- oold/agent/mibgroup/host/hr_filesys.h 2012-10-10 00:28:58.000000000 +0200 -+++ nnew/agent/mibgroup/host/hr_filesys.h 2017-10-31 09:29:44.541837515 +0100 +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); @@ -110,10 +110,10 @@ diff -urNp oold/agent/mibgroup/host/hr_filesys.h nnew/agent/mibgroup/host/hr_fil extern int Get_FSIndex(char *); extern long Get_FSSize(char *); /* Temporary */ -diff -urNp oold/agent/mibgroup/host/hrh_filesys.c nnew/agent/mibgroup/host/hrh_filesys.c ---- oold/agent/mibgroup/host/hrh_filesys.c 2012-10-10 00:28:58.000000000 +0200 -+++ nnew/agent/mibgroup/host/hrh_filesys.c 2017-10-31 09:37:36.787634605 +0100 -@@ -427,3 +427,9 @@ Check_HR_FileSys_NFS (void) +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; } @@ -123,9 +123,9 @@ diff -urNp oold/agent/mibgroup/host/hrh_filesys.c nnew/agent/mibgroup/host/hrh_f +{ + return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0; +} -diff -urNp oold/agent/mibgroup/host/hrh_filesys.h nnew/agent/mibgroup/host/hrh_filesys.h ---- oold/agent/mibgroup/host/hrh_filesys.h 2012-10-10 00:28:58.000000000 +0200 -+++ nnew/agent/mibgroup/host/hrh_filesys.h 2017-10-31 09:38:00.644616572 +0100 +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); @@ -134,10 +134,10 @@ diff -urNp oold/agent/mibgroup/host/hrh_filesys.h nnew/agent/mibgroup/host/hrh_f extern int Get_FSIndex(char *); extern long Get_FSSize(char *); /* Temporary */ -diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_storage.c ---- oold/agent/mibgroup/host/hrh_storage.c 2017-10-30 14:50:41.766743146 +0100 -+++ nnew/agent/mibgroup/host/hrh_storage.c 2017-10-31 10:08:25.482217951 +0100 -@@ -368,9 +368,10 @@ really_try_next: +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 && @@ -150,7 +150,7 @@ diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_s return NULL; if (store_idx <= NETSNMP_MEM_TYPE_MAX ) { mem = (netsnmp_memory_info*)ptr; -@@ -509,7 +510,8 @@ Get_Next_HR_Store(void) +@@ -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) && @@ -160,10 +160,10 @@ diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_s return HRS_index + NETSNMP_MEM_TYPE_MAX; } } else { -diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_storage.c ---- oold/agent/mibgroup/host/hr_storage.c 2012-10-10 00:28:58.000000000 +0200 -+++ nnew/agent/mibgroup/host/hr_storage.c 2017-10-31 10:11:41.161064352 +0100 -@@ -545,9 +545,10 @@ really_try_next: +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 ) { @@ -176,7 +176,7 @@ diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_sto return NULL; /* or goto try_next; */ if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) { snmp_log_perror(HRFS_entry->HRFS_mount); -@@ -688,7 +689,8 @@ Get_Next_HR_Store(void) +@@ -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) && @@ -186,14 +186,14 @@ diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_sto return HRS_index + NETSNMP_MEM_TYPE_MAX; } } else { -diff -urNp oold/include/net-snmp/agent/hardware/fsys.h nnew/include/net-snmp/agent/hardware/fsys.h ---- oold/include/net-snmp/agent/hardware/fsys.h 2012-10-10 00:28:58.000000000 +0200 -+++ nnew/include/net-snmp/agent/hardware/fsys.h 2017-10-31 10:14:59.560581680 +0100 +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_TYPE_SYSFS (4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT) + #define NETSNMP_FS_TYPE_TMPFS (5 | _NETSNMP_FS_TYPE_LOCAL) + #define NETSNMP_FS_TYPE_USBFS (6 | _NETSNMP_FS_TYPE_LOCAL) ++#define NETSNMP_FS_TYPE_AUTOFS (7 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT) #define NETSNMP_FS_FLAG_ACTIVE 0x01 #define NETSNMP_FS_FLAG_REMOTE 0x02 diff --git a/net-snmp-5.7.3-cflags.patch b/net-snmp-5.8-cflags.patch similarity index 53% rename from net-snmp-5.7.3-cflags.patch rename to net-snmp-5.8-cflags.patch index 943ff10..1809726 100644 --- a/net-snmp-5.7.3-cflags.patch +++ b/net-snmp-5.8-cflags.patch @@ -1,123 +1,7 @@ -1309080 - net-snmp-config specifies redhat-hardened-cc1 in cflags and causes gcc failure without redhat-rpm-config - -Don't remove -Wall in perl Makefiles - it would remove -Wformat and gcc would fail with -error: -Wformat-security ignored without -Wformat - -+ there is one upstream patch below (to be removed on rebase) - -diff -up net-snmp-5.7.3/perl/agent/default_store/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/default_store/Makefile.PL ---- net-snmp-5.7.3/perl/agent/default_store/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/perl/agent/default_store/Makefile.PL 2016-02-24 12:17:05.154209526 +0100 -@@ -79,7 +79,7 @@ sub InitMakeParams { - $Params{'LIBS'} = "-L../../../snmplib/.libs -L../../../snmplib/ " . $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 - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; - } -diff -up net-snmp-5.7.3/perl/agent/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/Makefile.PL ---- net-snmp-5.7.3/perl/agent/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/perl/agent/Makefile.PL 2016-02-24 12:17:05.154209526 +0100 -@@ -92,7 +92,7 @@ sub InitMakeParams { - $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 - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; - } -diff -up net-snmp-5.7.3/perl/agent/Support/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/Support/Makefile.PL ---- net-snmp-5.7.3/perl/agent/Support/Makefile.PL.cflags 2016-02-24 12:17:16.291271579 +0100 -+++ net-snmp-5.7.3/perl/agent/Support/Makefile.PL 2016-02-24 12:17:22.413305687 +0100 -@@ -86,7 +86,7 @@ sub InitMakeParams { - $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $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 - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; - } -diff -up net-snmp-5.7.3/perl/ASN/Makefile.PL.cflags net-snmp-5.7.3/perl/ASN/Makefile.PL ---- net-snmp-5.7.3/perl/ASN/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/perl/ASN/Makefile.PL 2016-02-24 12:17:05.155209532 +0100 -@@ -86,7 +86,7 @@ sub InitMakeParams { - $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $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 - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; - } -diff -up net-snmp-5.7.3/perl/default_store/Makefile.PL.cflags net-snmp-5.7.3/perl/default_store/Makefile.PL ---- net-snmp-5.7.3/perl/default_store/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/perl/default_store/Makefile.PL 2016-02-24 12:17:05.155209532 +0100 -@@ -79,7 +79,7 @@ sub InitMakeParams { - $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $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 - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; - } -diff -up net-snmp-5.7.3/perl/OID/Makefile.PL.cflags net-snmp-5.7.3/perl/OID/Makefile.PL ---- net-snmp-5.7.3/perl/OID/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/perl/OID/Makefile.PL 2016-02-24 12:17:05.155209532 +0100 -@@ -86,7 +86,7 @@ sub InitMakeParams { - # } 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 - if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; - } -diff -up net-snmp-5.7.3/perl/SNMP/Makefile.PL.cflags net-snmp-5.7.3/perl/SNMP/Makefile.PL ---- net-snmp-5.7.3/perl/SNMP/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/perl/SNMP/Makefile.PL 2016-02-24 12:17:05.155209532 +0100 -@@ -98,7 +98,7 @@ sub InitMakeParams { - # } 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 - if (!$ENV{'NETSNMP_PREFIX'}) { - $prefix = `$opts->{'nsconfig'} --prefix`; - chomp($prefix); -diff -up net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL.cflags net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL ---- net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL 2016-02-24 12:17:05.155209532 +0100 -@@ -124,7 +124,7 @@ sub InitMakeParams { - $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 - if ($Params{'CCFLAGS'} eq "") { - die "You need to install net-snmp first (I can't find net-snmp-config)"; - } - -commit 127274f8f27fba264a4c0f91190fd6f8037cdf21 -Author: Jan Safranek -Date: Wed Feb 24 10:14:21 2016 +0100 - - Trim output of net-snmp-config --cflags. - - We should report CFLAGS needed to import and use Net-SNMP headers, not - CFLAGS used to compile actual Net-SNMP. - - E.g. we should not report various distro fortify-source options. - -diff --git a/net-snmp-config.in b/net-snmp-config.in -index 7e34944..f3bffe9 100644 ---- a/net-snmp-config.in -+++ b/net-snmp-config.in -@@ -138,10 +138,10 @@ else +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) @@ -130,5 +14,99 @@ index 7e34944..f3bffe9 100644 ;; --srcdir) echo $NSC_SRCDIR - - +diff -urNp a/perl/agent/default_store/Makefile.PL b/perl/agent/default_store/Makefile.PL +--- a/perl/agent/default_store/Makefile.PL 2018-07-18 13:43:12.170426290 +0200 ++++ b/perl/agent/default_store/Makefile.PL 2018-07-18 13:51:31.812176486 +0200 +@@ -83,7 +83,7 @@ sub AgentDefaultStoreInitMakeParams { + " " . $Params{'LIBS'}; + $Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'}; + } +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; +diff -urNp a/perl/agent/Makefile.PL b/perl/agent/Makefile.PL +--- a/perl/agent/Makefile.PL 2018-07-18 13:43:12.169426292 +0200 ++++ b/perl/agent/Makefile.PL 2018-07-18 13:52:53.884973275 +0200 +@@ -98,7 +98,7 @@ sub AgentInitMakeParams { + $Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'}; + # $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'}; + } +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; +diff -urNp a/perl/agent/Support/Makefile.PL b/perl/agent/Support/Makefile.PL +--- a/perl/agent/Support/Makefile.PL 2018-07-18 13:43:12.169426292 +0200 ++++ b/perl/agent/Support/Makefile.PL 2018-07-18 13:53:11.414929921 +0200 +@@ -90,7 +90,7 @@ sub SupportInitMakeParams { + " " . $Params{'LIBS'}; + $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'}; + } +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; +diff -urNp a/perl/ASN/Makefile.PL b/perl/ASN/Makefile.PL +--- a/perl/ASN/Makefile.PL 2018-07-18 13:43:12.171426287 +0200 ++++ b/perl/ASN/Makefile.PL 2018-07-18 13:53:46.652842822 +0200 +@@ -93,7 +93,7 @@ sub AsnInitMakeParams { + " " . $Params{'LIBS'}; + $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'}; + } +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; +diff -urNp a/perl/default_store/Makefile.PL b/perl/default_store/Makefile.PL +--- a/perl/default_store/Makefile.PL 2018-07-18 13:43:12.175426277 +0200 ++++ b/perl/default_store/Makefile.PL 2018-07-18 13:54:20.814758441 +0200 +@@ -83,7 +83,7 @@ sub DefaultStoreInitMakeParams { + " " . $Params{'LIBS'}; + $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'}; + } +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; +diff -urNp a/perl/OID/Makefile.PL b/perl/OID/Makefile.PL +--- a/perl/OID/Makefile.PL 2018-07-18 13:43:12.175426277 +0200 ++++ b/perl/OID/Makefile.PL 2018-07-18 13:54:43.348702811 +0200 +@@ -90,7 +90,7 @@ sub OidInitMakeParams { + # } else { + # $Params{'PREREQ_PM'} = {'SNMP' => '5.0'}; + } +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; +diff -urNp a/perl/SNMP/Makefile.PL b/perl/SNMP/Makefile.PL +--- a/perl/SNMP/Makefile.PL 2018-07-18 13:43:12.173426282 +0200 ++++ b/perl/SNMP/Makefile.PL 2018-07-18 13:55:07.220643903 +0200 +@@ -103,7 +103,7 @@ sub SnmpInitMakeParams { + # } else { + # $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 }; + } +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if (!$ENV{'NETSNMP_PREFIX'}) { + $prefix = `$opts->{'nsconfig'} --prefix`; +diff -urNp a/perl/TrapReceiver/Makefile.PL b/perl/TrapReceiver/Makefile.PL +--- a/perl/TrapReceiver/Makefile.PL 2018-07-18 13:43:12.172426285 +0200 ++++ b/perl/TrapReceiver/Makefile.PL 2018-07-18 13:55:43.100647233 +0200 +@@ -132,7 +132,7 @@ sub TrapReceiverInitMakeParams { + $Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . " $Params{'LIBS'}"; + } + +- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings ++ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings + $Params{'CCFLAGS'} .= ' -Wformat'; + if ($Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; diff --git a/net-snmp-5.8-dir-fix.patch b/net-snmp-5.8-dir-fix.patch new file mode 100644 index 0000000..2c47d52 --- /dev/null +++ b/net-snmp-5.8-dir-fix.patch @@ -0,0 +1,12 @@ +diff -urNp a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in +--- a/net-snmp-create-v3-user.in 2018-07-18 11:11:53.227015237 +0200 ++++ b/net-snmp-create-v3-user.in 2018-07-18 11:12:13.375010176 +0200 +@@ -137,7 +137,7 @@ fi + echo $line >> $outfile + prefix="@prefix@" + datarootdir="@datarootdir@" +-outfile="@datadir@/snmp/snmpd.conf" ++outfile="/etc/snmp/snmpd.conf" + line="$token $user" + echo "adding the following line to $outfile:" + echo " " $line diff --git a/net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch b/net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch new file mode 100644 index 0000000..d835ee5 --- /dev/null +++ b/net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch @@ -0,0 +1,12 @@ +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_LIB) + $(RANLIB) $@ + + snmpinforminstall: diff --git a/net-snmp-5.8-modern-rpm-api.patch b/net-snmp-5.8-modern-rpm-api.patch new file mode 100644 index 0000000..93fcc63 --- /dev/null +++ b/net-snmp-5.8-modern-rpm-api.patch @@ -0,0 +1,83 @@ +diff -urNp a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c +--- a/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:12:19.583503903 +0200 ++++ b/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:50:38.599703588 +0200 +@@ -102,7 +102,6 @@ netsnmp_swinst_arch_load( netsnmp_contai + rpmtd td_name, td_version, td_release, td_group, td_time; + #else + char *n, *v, *r, *g; +- int32_t *t; + #endif + time_t install_time; + size_t date_len; +@@ -146,14 +145,13 @@ netsnmp_swinst_arch_load( netsnmp_contai + install_time = rpmtdGetNumber(td_time); + g = rpmtdGetString(td_group); + #else +- 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); +- install_time = *t; + #endif + entry->swType = (g && NULL != strstr( g, "System Environment")) + ? 2 /* operatingSystem */ +diff -urNp a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c +--- a/agent/mibgroup/host/hr_swinst.c 2018-07-18 16:12:19.582503907 +0200 ++++ b/agent/mibgroup/host/hr_swinst.c 2018-07-18 17:09:29.716564197 +0200 +@@ -479,9 +479,9 @@ var_hrswinst(struct variable * vp, + } + #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 */ +@@ -498,9 +498,8 @@ var_hrswinst(struct variable * vp, + 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); +@@ -660,7 +659,7 @@ Save_HR_SW_info(int ix) + 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]; + +@@ -685,11 +684,9 @@ Save_HR_SW_info(int ix) + 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; + } diff --git a/net-snmp-5.6-multilib.patch b/net-snmp-5.8-multilib.patch similarity index 51% rename from net-snmp-5.6-multilib.patch rename to net-snmp-5.8-multilib.patch index 9c12385..b8f3fea 100644 --- a/net-snmp-5.6-multilib.patch +++ b/net-snmp-5.8-multilib.patch @@ -1,6 +1,6 @@ -diff -up net-snmp-5.7.3/man/netsnmp_config_api.3.def.oSBcEB net-snmp-5.7.3/man/netsnmp_config_api.3.def ---- net-snmp-5.7.3/man/netsnmp_config_api.3.def.oSBcEB 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/man/netsnmp_config_api.3.def 2015-02-17 13:32:38.903284207 +0100 +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 @@ -295,7 +295,7 @@ for one particular machine. .PP The default list of directories to search is \fC SYSCONFDIR/snmp\fP, @@ -10,18 +10,18 @@ diff -up net-snmp-5.7.3/man/netsnmp_config_api.3.def.oSBcEB net-snmp-5.7.3/man/n followed by \fC $HOME/.snmp\fP. This list can be changed by setting the environmental variable .I SNMPCONFPATH -@@ -365,7 +365,7 @@ function that it should abort the operat - SNMPCONFPATH - A colon separated list of directories to search for configuration +@@ -367,7 +367,7 @@ A colon separated list of directories to files in. --Default: SYSCONFDIR/snmp:DATADIR/snmp:LIBDIR/snmp:$HOME/.snmp -+Default: SYSCONFDIR/snmp:DATADIR/snmp:/usr/lib(64)/snmp:$HOME/.snmp + Default: + .br +-SYSCONFDIR/snmp:\:DATADIR/snmp:\:LIBDIR/snmp:\:$HOME/.snmp ++SYSCONFDIR/snmp:\:DATADIR/snmp:\:/usr/lib(64)/snmp:\:$HOME/.snmp .SH "SEE ALSO" netsnmp_mib_api(3), snmp_api(3) .\" Local Variables: -diff -up net-snmp-5.7.3/man/snmp_config.5.def.oSBcEB net-snmp-5.7.3/man/snmp_config.5.def ---- net-snmp-5.7.3/man/snmp_config.5.def.oSBcEB 2015-02-17 13:32:04.251309092 +0100 -+++ net-snmp-5.7.3/man/snmp_config.5.def 2015-02-17 13:33:09.217262438 +0100 +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 found and read from. By default, the applications look for configuration files in the following 4 directories, in order: @@ -31,10 +31,10 @@ diff -up net-snmp-5.7.3/man/snmp_config.5.def.oSBcEB net-snmp-5.7.3/man/snmp_con 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 -up net-snmp-5.7.3/man/snmpd.conf.5.def.oSBcEB net-snmp-5.7.3/man/snmpd.conf.5.def ---- net-snmp-5.7.3/man/snmpd.conf.5.def.oSBcEB 2014-12-08 21:23:22.000000000 +0100 -+++ net-snmp-5.7.3/man/snmpd.conf.5.def 2015-02-17 13:32:04.251309092 +0100 -@@ -1502,7 +1502,7 @@ filename), and call the initialisation r +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 .RS .IP "Note:" If the specified PATH is not a fully qualified filename, it will diff --git a/net-snmp-5.8-python3.patch b/net-snmp-5.8-python3.patch new file mode 100644 index 0000000..8edab40 --- /dev/null +++ b/net-snmp-5.8-python3.patch @@ -0,0 +1,720 @@ +diff -urNp a/configure b/configure +--- a/configure 2018-07-18 17:11:53.178147565 +0200 ++++ b/configure 2018-07-18 17:14:01.254774416 +0200 +@@ -7742,8 +7742,8 @@ $as_echo "no" >&6; } + fi + + +-# Extract the first word of "python", so it can be a program name with args. +-set dummy python; ac_word=$2 ++# Extract the first word of "python3", so it can be a program name with args. ++set dummy python3; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 + $as_echo_n "checking for $ac_word... " >&6; } + if ${ac_cv_path_PYTHONPROG+:} false; then : +diff -urNp a/configure.d/config_os_progs b/configure.d/config_os_progs +--- a/configure.d/config_os_progs 2018-07-18 17:11:53.197147510 +0200 ++++ b/configure.d/config_os_progs 2018-07-18 17:14:29.963690646 +0200 +@@ -57,7 +57,7 @@ AC_PATH_PROG(AUTOCONF, autoconf, [: + AC_PATH_PROG(AUTOHEADER, autoheader, [:]) + AC_PATH_PROG([PERLPROG], perl) + AC_PATH_PROG([PSPROG], ps) +-AC_PATH_PROG([PYTHONPROG],python) ++AC_PATH_PROG([PYTHONPROG],python3) + + AC_PATH_PROG([UNAMEPROG], uname) + AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG", [Where is the uname command]) +diff -urNp a/Makefile.in b/Makefile.in +--- a/Makefile.in 2018-07-18 17:11:53.175147574 +0200 ++++ b/Makefile.in 2018-07-18 17:16:21.331365317 +0200 +@@ -226,7 +226,7 @@ perlcleanfeatures: + + # python specific build rules + # +-PYMAKE=$(PYTHON) setup.py $(PYTHONARGS) ++PYMAKE=/usr/bin/python3 setup.py $(PYTHONARGS) + pythonmodules: subdirs + @(dir=`pwd`; cd python; $(PYMAKE) build --basedir=$$dir) ; \ + if test $$? != 0 ; then \ +diff -urNp a/python/netsnmp/client_intf.c b/python/netsnmp/client_intf.c +--- a/python/netsnmp/client_intf.c 2018-07-18 17:11:53.262147321 +0200 ++++ b/python/netsnmp/client_intf.c 2018-07-18 17:33:16.495712833 +0200 +@@ -1,11 +1,5 @@ + #include + +-#if PY_VERSION_HEX < 0x02050000 +-typedef int Py_ssize_t; +-#define PY_SSIZE_T_MAX INT_MAX +-#define PY_SSIZE_T_MIN INT_MIN +-#endif +- + #include + #include + #include +@@ -852,8 +846,40 @@ py_netsnmp_attr_string(PyObject *obj, ch + if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) { + PyObject *attr = PyObject_GetAttrString(obj, attr_name); + if (attr) { ++ *val = PyUnicode_AsUTF8AndSize(attr, len); ++ Py_DECREF(attr); ++ return 0; ++ } ++ } ++ ++ return -1; ++} ++ ++static int ++py_netsnmp_attr_set_bytes(PyObject *obj, char *attr_name, ++ char *val, size_t len) ++{ ++ int ret = -1; ++ if (obj && attr_name) { ++ PyObject* val_obj = (val ? ++ PyBytes_FromStringAndSize(val, len) : ++ Py_BuildValue("")); ++ ret = PyObject_SetAttrString(obj, attr_name, val_obj); ++ Py_DECREF(val_obj); ++ } ++ return ret; ++} ++ ++static int ++py_netsnmp_attr_bytes(PyObject *obj, char * attr_name, char **val, ++ Py_ssize_t *len) ++{ ++ *val = NULL; ++ if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) { ++ PyObject *attr = PyObject_GetAttrString(obj, attr_name); ++ if (attr) { + int retval; +- retval = PyString_AsStringAndSize(attr, val, len); ++ retval = PyBytes_AsStringAndSize(attr, val, len); + Py_DECREF(attr); + return retval; + } +@@ -870,7 +896,7 @@ py_netsnmp_attr_long(PyObject *obj, char + if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) { + PyObject *attr = PyObject_GetAttrString(obj, attr_name); + if (attr) { +- val = PyInt_AsLong(attr); ++ val = PyLong_AsLong(attr); + Py_DECREF(attr); + } + } +@@ -955,13 +981,13 @@ __py_netsnmp_update_session_errors(PyObj + + py_netsnmp_attr_set_string(session, "ErrorStr", err_str, STRLEN(err_str)); + +- tmp_for_conversion = PyInt_FromLong(err_num); ++ tmp_for_conversion = PyLong_FromLong(err_num); + if (!tmp_for_conversion) + return; /* nothing better to do? */ + PyObject_SetAttrString(session, "ErrorNum", tmp_for_conversion); + Py_DECREF(tmp_for_conversion); + +- tmp_for_conversion = PyInt_FromLong(err_ind); ++ tmp_for_conversion = PyLong_FromLong(err_ind); + if (!tmp_for_conversion) + return; /* nothing better to do? */ + PyObject_SetAttrString(session, "ErrorInd", tmp_for_conversion); +@@ -1323,7 +1349,7 @@ netsnmp_get(PyObject *self, PyObject *ar + + ss = (SnmpSession *)py_netsnmp_attr_void_ptr(session, "sess_ptr"); + +- if (py_netsnmp_attr_string(session, "ErrorStr", &tmpstr, &tmplen) < 0) { ++ if (py_netsnmp_attr_bytes(session, "ErrorStr", &tmpstr, &tmplen) < 0) { + goto done; + } + +@@ -2015,7 +2041,7 @@ netsnmp_walk(PyObject *self, PyObject *a + vars, tp, type, sprintval_flag); + str_buf[len] = '\0'; + +- py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf, ++ py_netsnmp_attr_set_bytes(varbind, "val", (char *) str_buf, + len); + + /* push the varbind onto the return varbinds */ +@@ -2266,7 +2292,7 @@ netsnmp_getbulk(PyObject *self, PyObject + + __get_type_str(type, type_str); + +- py_netsnmp_attr_set_string(varbind, "type", type_str, ++ py_netsnmp_attr_set_bytes(varbind, "type", type_str, + strlen(type_str)); + + len = __snprint_value((char **)&str_buf, &str_buf_len, +@@ -2409,7 +2435,7 @@ netsnmp_set(PyObject *self, PyObject *ar + } + } + +- if (py_netsnmp_attr_string(varbind, "val", &val, &tmplen) < 0) { ++ if (py_netsnmp_attr_bytes(varbind, "val", &val, &tmplen) < 0) { + snmp_free_pdu(pdu); + goto done; + } +@@ -2467,7 +2493,6 @@ netsnmp_set(PyObject *self, PyObject *ar + return (ret ? ret : Py_BuildValue("")); + } + +- + static PyMethodDef ClientMethods[] = { + {"session", netsnmp_create_session, METH_VARARGS, + "create a netsnmp session."}, +@@ -2490,10 +2515,23 @@ static PyMethodDef ClientMethods[] = { + {NULL, NULL, 0, NULL} /* Sentinel */ + }; + ++static struct PyModuleDef ModuleDefinition = { ++ PyModuleDef_HEAD_INIT, ++ "client_intf", ++ NULL, ++ -1, ++ ClientMethods, ++ NULL, ++ NULL, ++ NULL, ++ NULL ++}; ++ + PyMODINIT_FUNC +-initclient_intf(void) ++PyInit_client_intf(void) + { +- (void) Py_InitModule("client_intf", ClientMethods); ++ PyObject *module = PyModule_Create(&ModuleDefinition); ++ return module; + } + + +diff -urNp a/python/netsnmp/client.py b/python/netsnmp/client.py +--- a/python/netsnmp/client.py 2018-07-18 17:11:53.262147321 +0200 ++++ b/python/netsnmp/client.py 2018-07-18 17:37:10.489221397 +0200 +@@ -34,12 +34,12 @@ def _parse_session_args(kargs): + 'TheirHostname':'', + 'TrustCert':'' + } +- keys = kargs.keys() ++ keys = list(kargs.keys()) + for key in keys: +- if sessArgs.has_key(key): ++ if key in sessArgs: + sessArgs[key] = kargs[key] + else: +- print >>stderr, "ERROR: unknown key", key ++ print("ERROR: unknown key", key, file=stderr) + return sessArgs + + def STR(obj): +@@ -55,7 +55,7 @@ class Varbind(object): + def __init__(self, tag=None, iid=None, val=None, type_arg=None): + self.tag = STR(tag) + self.iid = STR(iid) +- self.val = STR(val) ++ self.val = val + self.type = STR(type_arg) + # parse iid out of tag if needed + if iid is None and tag is not None: +@@ -65,7 +65,10 @@ class Varbind(object): + (self.tag, self.iid) = match.group(1, 2) + + def __setattr__(self, name, val): +- self.__dict__[name] = STR(val) ++ if name == 'val': ++ self.__dict__[name] = val ++ else: ++ self.__dict__[name] = STR(val) + + def __str__(self): + return obj_to_str(self) +@@ -132,7 +135,7 @@ class Session(object): + + sess_args = _parse_session_args(args) + +- for k, v in sess_args.items(): ++ for k, v in list(sess_args.items()): + self.__dict__[k] = v + + +diff -urNp a/python/netsnmp/__init__.py b/python/netsnmp/__init__.py +--- a/python/netsnmp/__init__.py 2018-07-18 17:11:53.262147321 +0200 ++++ b/python/netsnmp/__init__.py 2018-07-18 17:37:32.553172525 +0200 +@@ -1 +1 @@ +-from client import * ++from .client import * +diff -urNp a/python/netsnmp/tests/test.py b/python/netsnmp/tests/test.py +--- a/python/netsnmp/tests/test.py 2018-07-18 17:11:53.263147318 +0200 ++++ b/python/netsnmp/tests/test.py 2018-07-18 17:38:21.272063355 +0200 +@@ -12,7 +12,7 @@ def snmp_dest(**kwargs): + 'DestHost': 'localhost:' + os.environ.get("SNMP_SNMPD_PORT", 161), + 'Community': 'public', + } +- for key, value in kwargs.iteritems(): ++ for key, value in kwargs.items(): + dest[key] = value + return dest + +@@ -62,107 +62,107 @@ class BasicTests(unittest.TestCase): + self.assertEqual(var.iid, '') + + def test_v1_get(self): +- print "\n" +- print "---v1 GET tests -------------------------------------\n" ++ print("\n") ++ print("---v1 GET tests -------------------------------------\n") + var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0') + res = netsnmp.snmpget(var, **snmp_dest()) + +- print "v1 snmpget result: ", res, "\n" ++ print("v1 snmpget result: ", res, "\n") + self.assertEqual(len(res), 1) + +- print "v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print("v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + self.assertEqual(var.tag, 'sysDescr') + self.assertEqual(var.iid, '0') + self.assertEqual(var.val, res[0]) + self.assertEqual(var.type, 'OCTETSTR') + + def test_v1_getnext(self): +- print "\n" +- print "---v1 GETNEXT tests-------------------------------------\n" ++ print("\n") ++ print("---v1 GETNEXT tests-------------------------------------\n") + var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0') + res = netsnmp.snmpgetnext(var, **snmp_dest()) + +- print "v1 snmpgetnext result: ", res, "\n" ++ print("v1 snmpgetnext result: ", res, "\n") + self.assertEqual(len(res), 1) + +- print "v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print("v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + self.assertTrue(var.tag is not None) + self.assertTrue(var.iid is not None) + self.assertTrue(var.val is not None) + self.assertTrue(var.type is not None) + + def test_v1_set(self): +- print "\n" +- print "---v1 SET tests-------------------------------------\n" ++ print("\n") ++ print("---v1 SET tests-------------------------------------\n") + var = netsnmp.Varbind('sysLocation', '0', 'my new location') + res = netsnmp.snmpset(var, **snmp_dest()) + +- print "v1 snmpset result: ", res, "\n" ++ print("v1 snmpset result: ", res, "\n") + self.assertEqual(res, 1) + +- print "v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print("v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + self.assertEqual(var.tag, 'sysLocation') + self.assertEqual(var.iid, '0') + self.assertEqual(var.val, 'my new location') + self.assertTrue(var.type is None) + + def test_v1_walk(self): +- print "\n" +- print "---v1 walk tests-------------------------------------\n" ++ print("\n") ++ print("---v1 walk tests-------------------------------------\n") + varlist = netsnmp.VarList(netsnmp.Varbind('system')) + +- print "v1 varlist walk in: " ++ print("v1 varlist walk in: ") + for var in varlist: +- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + + res = netsnmp.snmpwalk(varlist, **snmp_dest()) +- print "v1 snmpwalk result: ", res, "\n" ++ print("v1 snmpwalk result: ", res, "\n") + self.assertTrue(len(res) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') + + def test_v1_walk_2(self): +- print "\n" +- print "---v1 walk 2-------------------------------------\n" ++ print("\n") ++ print("---v1 walk 2-------------------------------------\n") + +- print "v1 varbind walk in: " ++ print("v1 varbind walk in: ") + var = netsnmp.Varbind('system') + self.assertEqual(var.tag, 'system') + self.assertEqual(var.iid, '') + self.assertEqual(var.val, None) + self.assertEqual(var.type, None) + res = netsnmp.snmpwalk(var, **snmp_dest()) +- print "v1 snmpwalk result (should be = orig): ", res, "\n" ++ print("v1 snmpwalk result (should be = orig): ", res, "\n") + self.assertTrue(len(res) > 0) + +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') + self.assertEqual(var.tag, 'system') + self.assertEqual(var.iid, '') + self.assertEqual(var.val, None) + self.assertEqual(var.type, None) + + def test_v1_mv_get(self): +- print "\n" +- print "---v1 multi-varbind test-------------------------------------\n" ++ print("\n") ++ print("---v1 multi-varbind test-------------------------------------\n") + sess = setup_v1() + + varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), + netsnmp.Varbind('sysContact', 0), + netsnmp.Varbind('sysLocation', 0)) + vals = sess.get(varlist) +- print "v1 sess.get result: ", vals, "\n" ++ print("v1 sess.get result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') + + vals = sess.getnext(varlist) +- print "v1 sess.getnext result: ", vals, "\n" ++ print("v1 sess.getnext result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') + + varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'), + netsnmp.Varbind('sysORLastChange'), +@@ -171,71 +171,71 @@ class BasicTests(unittest.TestCase): + netsnmp.Varbind('sysORUpTime')) + + vals = sess.getbulk(2, 8, varlist) +- print "v1 sess.getbulk result: ", vals, "\n" ++ print("v1 sess.getbulk result: ", vals, "\n") + self.assertEqual(vals, None) # GetBulk is not supported for v1 + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') + + def test_v1_set_2(self): +- print "\n" +- print "---v1 set2-------------------------------------\n" ++ print("\n") ++ print("---v1 set2-------------------------------------\n") + + sess = setup_v1() + varlist = netsnmp.VarList( + netsnmp.Varbind('sysLocation', '0', 'my newer location')) + res = sess.set(varlist) +- print "v1 sess.set result: ", res, "\n" ++ print("v1 sess.set result: ", res, "\n") + + def test_v1_walk_3(self): +- print "\n" +- print "---v1 walk3-------------------------------------\n" ++ print("\n") ++ print("---v1 walk3-------------------------------------\n") + + sess = setup_v1() + varlist = netsnmp.VarList(netsnmp.Varbind('system')) + + vals = sess.walk(varlist) +- print "v1 sess.walk result: ", vals, "\n" ++ print("v1 sess.walk result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + + def test_v2c_get(self): +- print "\n" +- print "---v2c get-------------------------------------\n" ++ print("\n") ++ print("---v2c get-------------------------------------\n") + + sess = setup_v2() + varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), + netsnmp.Varbind('sysContact', 0), + netsnmp.Varbind('sysLocation', 0)) + vals = sess.get(varlist) +- print "v2 sess.get result: ", vals, "\n" ++ print("v2 sess.get result: ", vals, "\n") + self.assertEqual(len(vals), 3) + + def test_v2c_getnext(self): +- print "\n" +- print "---v2c getnext-------------------------------------\n" ++ print("\n") ++ print("---v2c getnext-------------------------------------\n") + + sess = setup_v2() + varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), + netsnmp.Varbind('sysContact', 0), + netsnmp.Varbind('sysLocation', 0)) + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + + vals = sess.getnext(varlist) +- print "v2 sess.getnext result: ", vals, "\n" ++ print("v2 sess.getnext result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + + def test_v2c_getbulk(self): +- print "\n" +- print "---v2c getbulk-------------------------------------\n" ++ print("\n") ++ print("---v2c getbulk-------------------------------------\n") + + sess = setup_v2() + varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'), +@@ -245,16 +245,16 @@ class BasicTests(unittest.TestCase): + netsnmp.Varbind('sysORUpTime')) + + vals = sess.getbulk(2, 8, varlist) +- print "v2 sess.getbulk result: ", vals, "\n" ++ print("v2 sess.getbulk result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + + def test_v2c_set(self): +- print "\n" +- print "---v2c set-------------------------------------\n" ++ print("\n") ++ print("---v2c set-------------------------------------\n") + + sess = setup_v2() + +@@ -262,54 +262,54 @@ class BasicTests(unittest.TestCase): + netsnmp.Varbind('sysLocation', '0', 'my even newer location')) + + res = sess.set(varlist) +- print "v2 sess.set result: ", res, "\n" ++ print("v2 sess.set result: ", res, "\n") + self.assertEqual(res, 1) + + def test_v2c_walk(self): +- print "\n" +- print "---v2c walk-------------------------------------\n" ++ print("\n") ++ print("---v2c walk-------------------------------------\n") + + sess = setup_v2() + + varlist = netsnmp.VarList(netsnmp.Varbind('system')) + + vals = sess.walk(varlist) +- print "v2 sess.walk result: ", vals, "\n" ++ print("v2 sess.walk result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + + def test_v3_get(self): +- print "\n" ++ print("\n") + sess = setup_v3(); + varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), + netsnmp.Varbind('sysContact', 0), + netsnmp.Varbind('sysLocation', 0)) +- print "---v3 get-------------------------------------\n" ++ print("---v3 get-------------------------------------\n") + vals = sess.get(varlist) +- print "v3 sess.get result: ", vals, "\n" ++ print("v3 sess.get result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + + def test_v3_getnext(self): +- print "\n" +- print "---v3 getnext-------------------------------------\n" ++ print("\n") ++ print("---v3 getnext-------------------------------------\n") + + sess = setup_v3(); + varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0), + netsnmp.Varbind('sysContact', 0), + netsnmp.Varbind('sysLocation', 0)) + vals = sess.getnext(varlist) +- print "v3 sess.getnext result: ", vals, "\n" ++ print("v3 sess.getnext result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + + def test_v3_getbulk(self): + sess = setup_v3(); +@@ -320,47 +320,47 @@ class BasicTests(unittest.TestCase): + netsnmp.Varbind('sysORUpTime')) + + vals = sess.getbulk(2, 8, varlist) +- print "v3 sess.getbulk result: ", vals, "\n" ++ print("v3 sess.getbulk result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + + def test_v3_set(self): +- print "\n" +- print "---v3 set-------------------------------------\n" ++ print("\n") ++ print("---v3 set-------------------------------------\n") + + sess = setup_v3(); + varlist = netsnmp.VarList( + netsnmp.Varbind('sysLocation', '0', 'my final destination')) + res = sess.set(varlist) +- print "v3 sess.set result: ", res, "\n" ++ print("v3 sess.set result: ", res, "\n") + self.assertEqual(res, 1) + + def test_v3_walk(self): +- print "\n" +- print "---v3 walk-------------------------------------\n" ++ print("\n") ++ print("---v3 walk-------------------------------------\n") + sess = setup_v3(); + varlist = netsnmp.VarList(netsnmp.Varbind('system')) + + vals = sess.walk(varlist) +- print "v3 sess.walk result: ", vals, "\n" ++ print("v3 sess.walk result: ", vals, "\n") + self.assertTrue(len(vals) > 0) + + for var in varlist: +- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + + + class SetTests(unittest.TestCase): + """SNMP set tests for the Net-SNMP Python interface""" + def testFuncs(self): + """Test code""" +- print "\n-------------- SET Test Start ----------------------------\n" ++ print("\n-------------- SET Test Start ----------------------------\n") + + var = netsnmp.Varbind('sysUpTime', '0') + res = netsnmp.snmpget(var, **snmp_dest()) +- print "uptime = ", res[0] ++ print("uptime = ", res[0]) + self.assertEqual(len(res), 1) + + +@@ -370,19 +370,19 @@ class SetTests(unittest.TestCase): + + var = netsnmp.Varbind('sysUpTime', '0') + res = netsnmp.snmpget(var, **snmp_dest()) +- print "uptime = ", res[0] ++ print("uptime = ", res[0]) + self.assertEqual(len(res), 1) + + var = netsnmp.Varbind('nsCacheEntry') + res = netsnmp.snmpgetnext(var, **snmp_dest()) +- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + self.assertEqual(len(res), 1) + + var.val = 65 + res = netsnmp.snmpset(var, **snmp_dest()) + self.assertEqual(res, 1) + res = netsnmp.snmpget(var, **snmp_dest()) +- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')' ++ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')') + self.assertEqual(len(res), 1) + self.assertEqual(res[0], '65'); + +@@ -394,7 +394,7 @@ class SetTests(unittest.TestCase): + netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 4)) + res = sess.set(varlist) + +- print "res = ", res ++ print("res = ", res) + self.assertEqual(res, 1) + + varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'), +@@ -414,15 +414,15 @@ class SetTests(unittest.TestCase): + self.assertEqual(varlist[2].val, '3') + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + + varlist = netsnmp.VarList( + netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 6)) + + res = sess.set(varlist) + +- print "res = ", res ++ print("res = ", res) + self.assertEqual(res, 1) + + varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'), +@@ -436,10 +436,10 @@ class SetTests(unittest.TestCase): + self.assertNotEqual(varlist[2].tag, 'snmpTargetAddrRowStatus') + + for var in varlist: +- print var.tag, var.iid, "=", var.val, '(', var.type, ')' +- print "\n" ++ print(var.tag, var.iid, "=", var.val, '(', var.type, ')') ++ print("\n") + +- print "\n-------------- SET Test End ----------------------------\n" ++ print("\n-------------- SET Test End ----------------------------\n") + + + if __name__ == '__main__': +diff -urNp a/python/setup.py b/python/setup.py +--- a/python/setup.py 2018-07-18 17:11:53.262147321 +0200 ++++ b/python/setup.py 2018-07-18 17:40:36.922751382 +0200 +@@ -9,9 +9,9 @@ intree=0 + + args = sys.argv[:] + for arg in args: +- if string.find(arg,'--basedir=') == 0: +- basedir = string.split(arg,'=')[1] +- sys.argv.remove(arg) ++ if arg.find('--basedir=') == 0: ++ basedir = arg.split('=')[1] ++ sys.argv.remove(arg) #tabs + intree=1 + + if intree: diff --git a/net-snmp-5.8-test-debug.patch b/net-snmp-5.8-test-debug.patch new file mode 100644 index 0000000..1ecd2ab --- /dev/null +++ b/net-snmp-5.8-test-debug.patch @@ -0,0 +1,30 @@ +Don't check tests which depend on DNS - it's disabled in Koji + +diff -urNp a/testing/fulltests/default/T070com2sec_simple b/testing/fulltests/default/T070com2sec_simple +--- a/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:52:56.081185545 +0200 ++++ b/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:54:18.843968880 +0200 +@@ -134,6 +134,10 @@ SAVECHECKAGENT '<"c406a", 255.255.255.25 + SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies + SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies + ++FINISHED ++ ++# don't test the rest, it depends on DNS, which is not available in Koji ++ + CHECKAGENT '<"c408a"' + if [ "$snmp_last_test_result" -eq 0 ] ; then + CHECKAGENT 'line 32: Error:' +diff -urNp a/testing/fulltests/default/T071com2sec6_simple b/testing/fulltests/default/T071com2sec6_simple +--- a/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:52:56.080185548 +0200 ++++ b/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:55:17.779818732 +0200 +@@ -132,6 +132,10 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff + SAVECHECKAGENT 'line 27: Error:' + SAVECHECKAGENT 'line 28: Error:' + ++FINISHED ++ ++# don't test the rest, it depends on DNS, which is not available in Koji ++ + # 608 + CHECKAGENT '<"c608a"' + if [ "$snmp_last_test_result" -eq 0 ] ; then diff --git a/net-snmp.spec b/net-snmp.spec index 78e4cc1..49f313d 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -6,8 +6,8 @@ Summary: A collection of SNMP protocol tools and libraries Name: net-snmp -Version: 5.7.3 -Release: 40%{?dist} +Version: 5.8 +Release: 1%{?dist} Epoch: 1 License: BSD @@ -23,54 +23,25 @@ Source7: net-snmp-tmpfs.conf Source8: snmpd.service Source9: snmptrapd.service Source10: IETF-MIB-LICENSE.txt + Patch1: net-snmp-5.7.2-pie.patch -Patch2: net-snmp-5.5-dir-fix.patch -Patch3: net-snmp-5.6-multilib.patch -Patch4: net-snmp-5.5-apsl-copying.patch -Patch5: net-snmp-5.6-test-debug.patch -Patch6: net-snmp-5.7.2-systemd.patch -Patch7: net-snmp-5.7.2-create-user-multilib.patch -Patch8: net-snmp-5.7.2-autoreconf.patch -Patch9: net-snmp-5.7-agentx-crash.patch -Patch10: net-snmp-5.5-agentx-disconnect-crash.patch -Patch11: net-snmp-5.7.2-cert-path.patch -Patch12: net-snmp-5.7.3-snmpstatus-null.patch -Patch13: net-snmp-5.7.3-cflags.patch -# Remove U64 typedef to build against Perl 5.24 -# Backported from upstream -Patch14: net-snmp-5.7.3-Remove-U64-typedef.patch -# Fixed Makefile.PL to build against Perl 5.24 -# For more info: https://rt.perl.org/Public/Bug/Display.html?id=125907 -Patch15: net-snmp-5.7.3-Fix-Makefile-PL.patch -# Use strtok_r for strtok to avoid a race condition -Patch16: net-snmp-5.7.3-strtok-r.patch -# Fix build with MariaDB 10.2 -# https://sourceforge.net/p/net-snmp/bugs/2782/ -# Josef's patch from https://sourceforge.net/p/net-snmp/bugs/2782/#cbed -# but with the config_os_libs2 portion removed -Patch17: net-snmp-5.7.3-mariadb102.patch -# Fix issue with undefined symbol my_progname when try to load -# NetSNMP::TrapReceiver in perl script (#1470004) -# https://sourceforge.net/p/net-snmp/bugs/2792/ -# https://sourceforge.net/p/net-snmp/bugs/2792/attachment/0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch -# (rebased on 5.7.3) -Patch18: 0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch - -Patch19: net-snmp-5.7.3-mariadb-connector-c.patch -Patch20: net-snmp-5.7.3-strstr.patch -Patch21: net-snmp-5.7.3-iterator-fix.patch -Patch22: net-snmp-5.7.3-autofs.patch -Patch23: net-snmp-5.7.3-CVE-2018-1000116.patch - -# This patch fix issue with new OpenSLL library in rawhide (f26+) -# !!!WARNING!!! DO NOT USE IT FOR OLDER FEDORA RELEASES (>f26) -Patch100: net-snmp-5.7.3-openssl.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 # Modern RPM API means at least EL6 -Patch101: net-snmp-5.7.3-modern-rpm-api.patch +Patch101: net-snmp-5.8-modern-rpm-api.patch #disable this patch due compatibility issues -Patch102: net-snmp-5.7.3-python3.patch +Patch102: net-snmp-5.8-python3.patch Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release} @@ -79,13 +50,12 @@ Requires: gcc # is not valid. We can use %%post because this particular %triggerun script # should fire just after this package is installed. %{?systemd_requires} -BuildRequires: systemd - +BuildRequires: systemd +BuildRequires: gcc BuildRequires: openssl-devel, bzip2-devel, elfutils-devel BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel BuildRequires: perl-devel, perl(ExtUtils::Embed), procps BuildRequires: python3-devel, python3-setuptools -#BuildRequires: python2-devel, python2-setuptools BuildRequires: chrpath BuildRequires: mariadb-connector-c-devel # for netstat, needed by 'make test' @@ -225,27 +195,16 @@ cp %{SOURCE10} . %patch2 -p1 -b .dir-fix %patch3 -p1 -b .multilib -%patch4 -p1 -b .apsl -%patch5 -p1 -%patch6 -p1 -b .systemd -%patch7 -p1 -b .multilib -%patch8 -p1 -b .autoreconf -%patch9 -p1 -b .agentx-crash -%patch10 -p1 -b .agentx-disconnect-crash -%patch11 -p1 -b .cert-path -%patch12 -p1 -b .snmpstatus-null -%patch13 -p1 -b .cflags -%patch14 -p1 -b .U64 -%patch15 -p1 -b .make -%patch16 -p1 -b .strtok-r -%patch17 -p1 -b .mariadb102 -%patch18 -p1 -b .perlfix -%patch19 -p1 -b .mariadb-connector-c -%patch20 -p1 -b .strstr -%patch21 -p1 -b .iterator-fix -%patch22 -p1 -b .autofs-skip -%patch23 -p1 -b .CVE-2018-1000116 -%patch100 -p1 -b .openssl +%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 + %patch101 -p1 -b .modern-rpm-api %patch102 -p1 @@ -474,6 +433,7 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %{_bindir}/mib2c %{_bindir}/snmp-bridge-mib %{_bindir}/net-snmp-cert +%{_bindir}/checkbandwidth %dir %{_datadir}/snmp %{_datadir}/snmp/mib2c* %{_datadir}/snmp/*.pl @@ -485,6 +445,7 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %{perl_vendorarch}/*SNMP* %{perl_vendorarch}/auto/*SNMP* %{perl_vendorarch}/auto/Bundle/*SNMP* +%{perl_vendorarch}/Bundle/MakefileSubs.pm %files -n python3-net-snmp %doc README @@ -512,6 +473,11 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %{_libdir}/libnetsnmptrapd*.so.* %changelog +* Wed Jul 18 2018 Josef Ridky - 1:5.8-1 +- New upstream release 5.8 +- remove APSL downstream patch due this copyright is already + coveret by part 8 in COPYING file + * Wed Jun 27 2018 Jitka Plesnikova - 1:5.7.3-40 - Perl 5.28 rebuild diff --git a/sources b/sources index d945008..e71eafd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d4a3459e1577d0efa8d96ca70a885e53 net-snmp-5.7.3.tar.gz +SHA512 (net-snmp-5.8.tar.gz) = 27895a583b23f3e14c48562bc32f3ba83513d81aa848e878be9a3650f0458d45950635c937ef627135f80b757b663e71fab9a3bde4fd91889153998ae3468fe7