[Pkg-net-snmp-commits] [pkg-net-snmp] 10/16: Import Debian patch 5.7.3+dfsg-1.1

Hideki Yamane henrich at moszumanska.debian.org
Sun Aug 28 02:19:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch master
in repository pkg-net-snmp.

commit 6f0c2a20312c7ed21190c504a85d1f20cc21513b
Author: Steinar H. Gunderson <sesse at debian.org>
Date:   Tue Mar 29 10:30:24 2016 +0200

    Import Debian patch 5.7.3+dfsg-1.1
---
 debian/{snmpd.NEWS => NEWS}                        |   0
 debian/changelog                                   |  46 +++++---
 debian/control                                     |  16 +--
 debian/libsnmp-perl.manpages                       |   1 -
 debian/patches/26_kfreebsd.patch                   |  22 +---
 debian/patches/27_kfreebsd.patch                   |  25 ++++
 ...ix-kfreebsd-builds-with-kernel-headers-10.patch |  41 -------
 debian/patches/callback_print.diff                 |  13 +++
 .../do_not_callback_for_failed_reports.diff        | 129 +++++++++++++++++++++
 debian/patches/fix_engineid_reprobe.diff           |  16 +++
 debian/patches/fix_perl_bulk_gets.diff             |  88 ++++++++++++++
 debian/patches/let_perl_access_engineid.diff       |  94 +++++++++++++++
 debian/patches/series                              |   7 +-
 debian/rules                                       |  12 +-
 debian/snmp.prerm                                  |   1 +
 debian/snmpd.default                               |   2 +-
 debian/snmpd.init                                  |  38 +++---
 17 files changed, 441 insertions(+), 110 deletions(-)

diff --git a/debian/snmpd.NEWS b/debian/NEWS
similarity index 100%
rename from debian/snmpd.NEWS
rename to debian/NEWS
diff --git a/debian/changelog b/debian/changelog
index 1756eee..e4622d2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,10 @@
-net-snmp (5.7.3+dfsg-2) UNRELEASED; urgency=medium
+net-snmp (5.7.3+dfsg-1.1) unstable; urgency=medium
 
+  * Non-maintainer upload, done on top of the latest version in pkg-net-snmp
+    git, as well as adding Steven Chamberlain's kFreeBSD patches from
+    bug #810892.
+
+  [ Hideki Yamane ]
   * debian/patches
     - add Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch (Closes: #788964)
     - add 0026-fix-Bug-785380-incorrect-date-format.patch (Closes: #785380)
@@ -13,23 +18,30 @@ net-snmp (5.7.3+dfsg-2) UNRELEASED; urgency=medium
       (Closes: #794641, #794647)
   * debian/snmp.preinst
     - revert "killall", it is unnecessary anymore (Closes: #781257)
-  * debian/control
-    - fix lintian error "old-style-config-script-multiarch-path" by adding
-      "Multi-Arch: no" to libsnmp-dev. It also fix multi-arch install
-      (Closes: #774775)
-    - note net-snmp-config script moved to libsnmp-dev (Closes: #801991)
-      Thanks to Vanush Misha Paturyan <misha at cs.nuim.ie>
-    - use https for Vcs-*
-  * debian/libsnmp-perl.manpages
-    - fix to install perl modules man pages (Closes: #778539)
-      Thanks to Guillem Jover <gjover at sipwise.com> for the patch
-  * debian/rules
-    - make it parallel build
-  * move debian/NEWS to debian/snmpd.NEWS (Closes: #586722, #587183)
-  * make init script sane (add Missing log_end_msg, etc) (Closes: #746397)
-    Thanks to Uwe Storbeck <uwe at ibr.ch> for the patch.
 
- -- Hideki Yamane <henrich at debian.org>  Thu, 18 Jun 2015 06:43:28 +0900
+  [ Steven Chamberlain ]
+  * Fix a typo in 26_kfreebsd.patch
+  * Add 27_kfreebsd.patch: (Closes: #810982)
+    - Add missing dependency of mibII/icmp on kfreebsd
+    - Add kfreebsd definitions not in GNU libc's icmp6.h
+  * Remove obsolete Fix-kfreebsd-builds-with-kernel-headers-10.patch
+  * Re-enable IPv6 on kfreebsd (Closes: #765846)
+  * Build with the libbsd overlay on kfreebsd, for nlist
+
+  [ Steinar H. Gunderson ]
+  * New patches, mostly for various bug fixes (some of them for crash bugs):
+    * fix_engineid_reprobe.diff: Do not probe engineID for USM
+      if it is already given. (Closes: #765873)
+    * callback_print.diff: Fix enum formatting when doing asynchronous queries
+      from Perl. (Closes: #765289)
+    * do_not_callback_for_failed_reports.diff: Fix access of freed data due to
+      callbacks for reports occasionally coming twice.
+    * fix_perl_bulk_gets.diff: Fix handling of truncated bulk get responses
+      in the Perl module. (Patch 1278 in upstream patch tracker.)
+    * let_perl_access_engineid.diff: Add a new functions to let Perl code
+      access the security engine ID.
+
+ -- Steinar H. Gunderson <sesse at debian.org>  Tue, 29 Mar 2016 10:30:24 +0200
 
 net-snmp (5.7.3+dfsg-1) unstable; urgency=medium
 
diff --git a/debian/control b/debian/control
index 3a117fa..0aa5574 100644
--- a/debian/control
+++ b/debian/control
@@ -14,8 +14,8 @@ Build-Depends: debhelper (>= 9), libtool, libwrap0-dev, libssl-dev (>> 0.9.8), p
  libmysqld-dev, libpci-dev
 Build-Conflicts: libsnmp-dev
 Standards-Version: 3.9.6
-Vcs-Git: https://anonscm.debian.org/git/pkg-net-snmp/pkg-net-snmp.git
-Vcs-Browser: https://anonscm.debian.org/cgit/pkg-net-snmp/pkg-net-snmp.git
+Vcs-Git: git://anonscm.debian.org/pkg-net-snmp/pkg-net-snmp.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-net-snmp/pkg-net-snmp.git
 XS-Python-Version: 2.7
 Homepage: http://net-snmp.sourceforge.net/
 
@@ -73,9 +73,10 @@ Description: SNMP configuration script, MIBs and documentation
  for the exchange of management information between agents (servers)
  and clients.
  .
- This package includes documentation and MIBs (Management Information Bases)
- for the SNMP libraries, agents and applications. MIBs contain a formal
- description of the data that can be managed using SNMP and applications.
+ This package includes net-snmp-config scripts, documentation and MIBs
+ (Management Information Bases) for the SNMP libraries, agents and
+ applications. MIBs contain a formal description of the data that can be
+ managed using SNMP and applications.
  .
  NOTE: If you want the OIDs (Object Identifiers) to resolve to their text
  description, you need to activate the non-free repository and install the
@@ -113,7 +114,6 @@ Description: SNMP (Simple Network Management Protocol) library debug
 Package: libsnmp-dev
 Section: libdevel
 Architecture: any
-Multi-Arch: no
 Replaces: libsnmp9-dev, libsnmp15-dev, snmp (<< 5.4~dfsg), libsnmp-base (<< 5.7.2~dfsg-8.1~)
 Provides: libsnmp9-dev
 Conflicts: libsnmp9-dev, libsnmp15-dev, snmp (<< 5.4~dfsg)
@@ -127,8 +127,8 @@ Description: SNMP (Simple Network Management Protocol) development files
  and clients.
  .
  The Net-SNMP development files include the library headers, static
- libraries, net-snmp-config scripts and documentation needed for development
- of custom SNMP applications.
+ libraries, and documentation needed for development of custom SNMP
+ applications.
 
 Package: libsnmp-perl
 Section: perl
diff --git a/debian/libsnmp-perl.manpages b/debian/libsnmp-perl.manpages
deleted file mode 100644
index 832c276..0000000
--- a/debian/libsnmp-perl.manpages
+++ /dev/null
@@ -1 +0,0 @@
-perl/blib/man3/*
diff --git a/debian/patches/26_kfreebsd.patch b/debian/patches/26_kfreebsd.patch
index d758e17..60fa7a0 100644
--- a/debian/patches/26_kfreebsd.patch
+++ b/debian/patches/26_kfreebsd.patch
@@ -1,14 +1,4 @@
-From: Net-SNMP Packaging Team <pkg-net-snmp-devel at lists.alioth.debian.org>
-Date: Thu, 18 Jun 2015 06:12:05 +0900
-Subject: _kfreebsd
-
 Preliminary support for kfreebsd.
----
- agent/mibgroup/hardware/cpu/cpu_sysctl.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/agent/mibgroup/hardware/cpu/cpu_sysctl.c b/agent/mibgroup/hardware/cpu/cpu_sysctl.c
-index 5ecb68e..f0899c2 100644
 --- a/agent/mibgroup/hardware/cpu/cpu_sysctl.c
 +++ b/agent/mibgroup/hardware/cpu/cpu_sysctl.c
 @@ -12,7 +12,7 @@
@@ -20,7 +10,7 @@ index 5ecb68e..f0899c2 100644
  #include <sys/resource.h>
  #if !defined(CPUSTATES)
  #include <sys/dkstat.h>
-@@ -89,7 +89,7 @@ void init_cpu_sysctl( void ) {
+@@ -89,7 +89,7 @@
  #elif defined(KERN_CPTIME)                /* OpenBSD */
  #define NETSNMP_KERN_CPU  KERN_CPTIME
  
@@ -29,7 +19,7 @@ index 5ecb68e..f0899c2 100644
  #define NETSNMP_KERN_MCPU 1    /* Enable support for multi-cpu stats. Valid for FreeBSD >=6.4, >=7.1, >=8.0 and beyond */
  #define NETSNMP_KERN_MCPU_TYPE NETSNMP_CPU_STATS
  
-@@ -129,7 +129,7 @@ void init_cpu_sysctl( void ) {
+@@ -129,7 +129,7 @@
  #define NETSNMP_VM_STATS_TYPE  struct uvmexp
  #endif  /* VM_UVMEXP2 || VM_UVMEXP */
  
@@ -38,12 +28,12 @@ index 5ecb68e..f0899c2 100644
  #define NETSNMP_VM_STATS       VM_METER
  #define NETSNMP_VM_STATS_TYPE  struct vmmeter
      #define NS_VM_INTR		v_intr
-@@ -169,10 +169,10 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+@@ -169,10 +169,10 @@
       */
      NETSNMP_CPU_STATS cpu_stats[CPUSTATES];
      size_t         cpu_size  = sizeof(cpu_stats);
 -#if !defined(__FreeBSD__) && !defined(__NetBSD__)
-+#if !defined(__FreeBSD__) || defined(__FreeBSD_kernel__) && !defined(__NetBSD__)
++#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__NetBSD__)
      int            cpu_mib[] = { CTL_KERN, NETSNMP_KERN_CPU };
  #endif
 -#ifdef __FreeBSD__
@@ -51,7 +41,7 @@ index 5ecb68e..f0899c2 100644
      static int     cp_times = -1;
  #endif
  #ifdef KERN_CPTIME2
-@@ -189,7 +189,7 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+@@ -189,7 +189,7 @@
      size_t         mem_size  = sizeof(NETSNMP_VM_STATS_TYPE);
      netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
  
@@ -60,7 +50,7 @@ index 5ecb68e..f0899c2 100644
      sysctlbyname("kern.cp_time", cpu_stats, &cpu_size, NULL, 0);
  #else
      sysctl(cpu_mib, 2,  cpu_stats, &cpu_size, NULL, 0);
-@@ -226,7 +226,7 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+@@ -226,7 +226,7 @@
      mcpu_size  = cpu_num*sizeof(cpu_stats);
      mcpu_stats = malloc(mcpu_size);
      sysctlbyname("kern.cp_time", mcpu_stats, &mcpu_size, NULL, 0);
diff --git a/debian/patches/27_kfreebsd.patch b/debian/patches/27_kfreebsd.patch
new file mode 100644
index 0000000..4620da4
--- /dev/null
+++ b/debian/patches/27_kfreebsd.patch
@@ -0,0 +1,25 @@
+--- a/agent/mibgroup/mibII/icmp.h
++++ b/agent/mibgroup/mibII/icmp.h
+@@ -14,6 +14,7 @@
+ config_arch_require(freebsd8,  mibII/kernel_sysctl)
+ config_arch_require(freebsd9,  mibII/kernel_sysctl)
+ config_arch_require(freebsd10, mibII/kernel_sysctl)
++config_arch_require(kfreebsd,  mibII/kernel_sysctl)
+ config_arch_require(netbsd,    mibII/kernel_netbsd)
+ config_arch_require(netbsdelf, mibII/kernel_netbsd)
+ config_arch_require(openbsd4,  mibII/kernel_sysctl)
+--- a/agent/mibgroup/mibII/kernel_sysctl.c
++++ b/agent/mibgroup/mibII/kernel_sysctl.c
+@@ -14,6 +14,12 @@
+ #include <netinet/icmp_var.h>
+ #include <netinet/icmp6.h>
+ 
++#if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
++/* definitions unavailable in GNU libc's icmp6.h */
++#define ICMP6_MAXTYPE		201
++#define ICMPV6CTL_STATS		1
++#endif
++
+ #include <net-snmp/net-snmp-config.h>
+ #include <net-snmp/net-snmp-includes.h>
+ #include <net-snmp/agent/net-snmp-agent-includes.h>
diff --git a/debian/patches/Fix-kfreebsd-builds-with-kernel-headers-10.patch b/debian/patches/Fix-kfreebsd-builds-with-kernel-headers-10.patch
deleted file mode 100644
index c878ee3..0000000
--- a/debian/patches/Fix-kfreebsd-builds-with-kernel-headers-10.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From: Niko Tyni <ntyni at debian.org>
-Date: Wed, 16 Jul 2014 21:42:30 +0000
-Subject: Fix kfreebsd builds with kernel headers >= 10
-
-This fixes warnings like
-
-In file included from ../../include/net-snmp/net-snmp-config.h:2085:0,
-                 from host/data_access/swinst_apt.c:5:
-../../include/net-snmp/system/kfreebsd.h:5:0: warning: "__FreeBSD_version" redefined [enabled by default]
- #define __FreeBSD_version __FreeBSD_kernel_version
- ^
-In file included from /usr/include/sys/kern/param.h:1:0,
-                 from /usr/include/osreldate.h:1,
-                 from ../../include/net-snmp/system/kfreebsd.h:4,
-                 from ../../include/net-snmp/net-snmp-config.h:2085,
-                 from host/data_access/swinst_apt.c:5:
-/usr/include/sys/kglue/sys/param.h:67:0: note: this is the location of the previous definition
- #define __FreeBSD_version 1000510 /* Master, propagated to newvers */
-
-and makes agent/mibgroup/host/data_access/swrun_kinfo.c use the modern
-kinfo_proc field names.
-
-Bug-Debian: http://bugs.debian.org/753144
----
- include/net-snmp/system/kfreebsd.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/include/net-snmp/system/kfreebsd.h b/include/net-snmp/system/kfreebsd.h
-index dbf7024..cb32758 100644
---- a/include/net-snmp/system/kfreebsd.h
-+++ b/include/net-snmp/system/kfreebsd.h
-@@ -2,7 +2,9 @@
- #define freebsd6 freebsd6
- 
- #include <osreldate.h>
-+#if defined(__FreeBSD_kernel_version) && !defined(__FreeBSD_version)
- #define __FreeBSD_version __FreeBSD_kernel_version
-+#endif
- 
- #include <sys/queue.h>
- #include <sys/_types.h>
diff --git a/debian/patches/callback_print.diff b/debian/patches/callback_print.diff
new file mode 100644
index 0000000..f4b6df6
--- /dev/null
+++ b/debian/patches/callback_print.diff
@@ -0,0 +1,13 @@
+--- net-snmp-5.7.2.1~dfsg.orig/perl/SNMP/SNMP.xs
++++ net-snmp-5.7.2.1~dfsg/perl/SNMP/SNMP.xs
+@@ -1300,6 +1300,10 @@ void *cb_data;
+          netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, 1);
+          netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, NETSNMP_OID_OUTPUT_NUMERIC);
+       }
++      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
++         sprintval_flag = USE_ENUMS;
++      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
++         sprintval_flag = USE_SPRINT_VALUE;
+ 
+       sv_bless(varlist_ref, gv_stashpv("SNMP::VarList",0));
+       for(vars = (pdu?pdu->variables:NULL); vars; vars = vars->next_variable) {
diff --git a/debian/patches/do_not_callback_for_failed_reports.diff b/debian/patches/do_not_callback_for_failed_reports.diff
new file mode 100644
index 0000000..96db193
--- /dev/null
+++ b/debian/patches/do_not_callback_for_failed_reports.diff
@@ -0,0 +1,129 @@
+Index: net-snmp-5.7.3/snmplib/snmp_api.c
+===================================================================
+--- net-snmp-5.7.3.orig/snmplib/snmp_api.c
++++ net-snmp-5.7.3/snmplib/snmp_api.c
+@@ -5346,71 +5346,71 @@ _sess_process_packet(void *sessp, netsnm
+        * should be per session ! 
+        */
+ 
+-      if (callback == NULL
+-	  || callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE, sp,
+-		      pdu->reqid, pdu, magic) == 1) {
+-	if (pdu->command == SNMP_MSG_REPORT) {
+-	  if (sp->s_snmp_errno == SNMPERR_NOT_IN_TIME_WINDOW ||
+-	      snmpv3_get_report_type(pdu) ==
+-	      SNMPERR_NOT_IN_TIME_WINDOW) {
+-	    /*
+-	     * trigger immediate retry on recoverable Reports 
+-	     * * (notInTimeWindow), incr_retries == TRUE to prevent
+-	     * * inifinite resend                      
+-	     */
+-	    if (rp->retries <= sp->retries) {
+-	      snmp_resend_request(slp, rp, TRUE);
+-	      break;
+-	    } else {
+-	      /* We're done with retries, so no longer waiting for a response */
+-	      if (magic) {
+-		((struct synch_state*)magic)->waiting = 0;
+-	      }
+-	    }
++      if (pdu->command == SNMP_MSG_REPORT) {
++	if (sp->s_snmp_errno == SNMPERR_NOT_IN_TIME_WINDOW ||
++	    snmpv3_get_report_type(pdu) ==
++	    SNMPERR_NOT_IN_TIME_WINDOW) {
++	  /*
++	   * trigger immediate retry on recoverable Reports 
++	   * * (notInTimeWindow), incr_retries == TRUE to prevent
++	   * * inifinite resend		      
++	   */
++	  if (rp->retries <= sp->retries) {
++	    snmp_resend_request(slp, rp, TRUE);
++	    break;
+ 	  } else {
+-	    if (SNMPV3_IGNORE_UNAUTH_REPORTS) {
+-	      break;
+-	    } else { /* Set the state to no longer be waiting, since we're done with retries */
+-	      if (magic) {
+-		((struct synch_state*)magic)->waiting = 0;
+-	      }
++	    /* We're done with retries, so no longer waiting for a response */
++	    if (magic) {
++	      ((struct synch_state*)magic)->waiting = 0;
++	    }
++	  }
++	} else {
++	  if (SNMPV3_IGNORE_UNAUTH_REPORTS) {
++	    break;
++	  } else { /* Set the state to no longer be waiting, since we're done with retries */
++	    if (magic) {
++	      ((struct synch_state*)magic)->waiting = 0;
+ 	    }
+ 	  }
++	}
+ 
+-	  /*
+-	   * Handle engineID discovery.  
+-	   */
+-	  if (!sp->securityEngineIDLen && pdu->securityEngineIDLen) {
+-	    sp->securityEngineID =
+-	      (u_char *) malloc(pdu->securityEngineIDLen);
+-	    if (sp->securityEngineID == NULL) {
++	/*
++	 * Handle engineID discovery.  
++	 */
++	if (!sp->securityEngineIDLen && pdu->securityEngineIDLen) {
++	  sp->securityEngineID =
++	    (u_char *) malloc(pdu->securityEngineIDLen);
++	  if (sp->securityEngineID == NULL) {
++	    /*
++	     * TODO FIX: recover after message callback *?
++	     */
++	    return -1;
++	  }
++	  memcpy(sp->securityEngineID, pdu->securityEngineID,
++		 pdu->securityEngineIDLen);
++	  sp->securityEngineIDLen = pdu->securityEngineIDLen;
++	  if (!sp->contextEngineIDLen) {
++	    sp->contextEngineID =
++	      (u_char *) malloc(pdu->
++				securityEngineIDLen);
++	    if (sp->contextEngineID == NULL) {
+ 	      /*
+ 	       * TODO FIX: recover after message callback *?
+-               */
++	       */
+ 	      return -1;
+ 	    }
+-	    memcpy(sp->securityEngineID, pdu->securityEngineID,
++	    memcpy(sp->contextEngineID,
++		   pdu->securityEngineID,
+ 		   pdu->securityEngineIDLen);
+-	    sp->securityEngineIDLen = pdu->securityEngineIDLen;
+-	    if (!sp->contextEngineIDLen) {
+-	      sp->contextEngineID =
+-		(u_char *) malloc(pdu->
+-				  securityEngineIDLen);
+-	      if (sp->contextEngineID == NULL) {
+-		/*
+-		 * TODO FIX: recover after message callback *?
+-		 */
+-                return -1;
+-	      }
+-	      memcpy(sp->contextEngineID,
+-		     pdu->securityEngineID,
+-		     pdu->securityEngineIDLen);
+-	      sp->contextEngineIDLen =
+-		pdu->securityEngineIDLen;
+-	    }
++	    sp->contextEngineIDLen =
++	      pdu->securityEngineIDLen;
+ 	  }
+ 	}
++      }
+ 
++      if (callback == NULL || 
++	 callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE, sp,
++		  pdu->reqid, pdu, magic) == 1) {
+ 	/*
+ 	 * Successful, so delete request.  
+ 	 */
diff --git a/debian/patches/fix_engineid_reprobe.diff b/debian/patches/fix_engineid_reprobe.diff
new file mode 100644
index 0000000..c9d4778
--- /dev/null
+++ b/debian/patches/fix_engineid_reprobe.diff
@@ -0,0 +1,16 @@
+Index: net-snmp-5.7.3/snmplib/snmpusm.c
+===================================================================
+--- net-snmp-5.7.3.orig/snmplib/snmpusm.c
++++ net-snmp-5.7.3/snmplib/snmpusm.c
+@@ -3129,6 +3129,11 @@ int usm_discover_engineid(void *slpv, ne
+     int status, i;
+     struct session_list *slp = (struct session_list *) slpv;
+ 
++    if (slp->session->securityEngineIDLen != 0) {
++        DEBUGMSGTL(("snmp_api", "engineID already known, skipping probe\n"));
++        return SNMPERR_SUCCESS;
++    }
++
+     if (usm_build_probe_pdu(&pdu) != 0) {
+         DEBUGMSGTL(("snmp_api", "unable to create probe PDU\n"));
+         return SNMP_ERR_GENERR;
diff --git a/debian/patches/fix_perl_bulk_gets.diff b/debian/patches/fix_perl_bulk_gets.diff
new file mode 100644
index 0000000..88d1fe4
--- /dev/null
+++ b/debian/patches/fix_perl_bulk_gets.diff
@@ -0,0 +1,88 @@
+Index: net-snmp-5.7.2.1+dfsg/perl/SNMP/SNMP.pm
+===================================================================
+--- net-snmp-5.7.2.1+dfsg.orig/perl/SNMP/SNMP.pm
++++ net-snmp-5.7.2.1+dfsg/perl/SNMP/SNMP.pm
+@@ -866,22 +866,11 @@ sub _gettable_do_it() {
+ 
+     $vbl = $_[$#_] if ($state->{'options'}{'callback'});
+ 
+-    while ($#$vbl > -1 && !$this->{ErrorNum}) {
+-	if (($#$vbl + 1) % ($#{$state->{'stopconds'}} + 1) != 0) {
+-	    if ($vbl->[$#$vbl][2] ne 'ENDOFMIBVIEW') {
+-		# unless it's an end of mib view we didn't get the
+-		# proper number of results back.
+-		print STDERR "ack: gettable results not appropriate\n";
+-	    }
+-	    my @k = keys(%{$state->{'result_hash'}});
+-	    last if ($#k > -1);  # bail with what we have
+-	    return;
+-	}
+-
+-	$state->{'varbinds'} = [];
+-	my $newstopconds;
++    my $num_vbls = defined($vbl) ? scalar @$vbl : 0;
++    my $num_stopconds = scalar @{$state->{'stopconds'}};
+ 
+-	my $lastsetstart = ($state->{'repeatcount'}-1) * ($#{$state->{'stopconds'}}+1);
++    while ($num_vbls > 0 && !$this->{ErrorNum}) {
++	my @found_eof = (0) x $num_stopconds;
+ 
+ 	for (my $i = 0; $i <= $#$vbl; $i++) {
+ 	    my $row_oid = SNMP::translateObj($vbl->[$i][0]);
+@@ -890,9 +879,11 @@ sub _gettable_do_it() {
+ 	    my $row_value = $vbl->[$i][2];
+ 	    my $row_type = $vbl->[$i][3];
+ 
+-	    if ($row_oid =~ 
+-		/^$state->{'stopconds'}[$i % ($#{$state->{'stopconds'}}+1)]/ &&
+-		$row_value ne 'ENDOFMIBVIEW' ){
++	    my $stopcond_num = $i % $num_stopconds;
++	    my $stopcond = $state->{'stopconds'}[$stopcond_num];
++	    if ($row_oid !~ /^\Q$stopcond\E/ || $row_value eq 'ENDOFMIBVIEW') {
++		$found_eof[$stopcond_num] = 1;
++	    } else {
+ 
+ 		if ($row_type eq "OBJECTID") {
+ 
+@@ -903,26 +894,30 @@ sub _gettable_do_it() {
+ 
+ 		}
+ 
++		# continue past this next time
++
++		$state->{'varbinds'}[$stopcond_num] = [ $row_text, $row_index ];
++
+ 		# Place the results in a hash
+ 
+ 		$state->{'result_hash'}{$row_index}{$row_text} = $row_value;
++	    }
++	}
+ 
+-		# continue past this next time
+-		if ($i >= $lastsetstart) {
+-		    push @$newstopconds,
+-		      $state->{'stopconds'}->[$i%($#{$state->{'stopconds'}}+1)];
+-		    push @{$state->{'varbinds'}},[$vbl->[$i][0],$vbl->[$i][1]];
+-		}
++	my @newstopconds = ();
++	my @newvarbinds = ();
++	for (my $i = 0; $i < $num_stopconds; ++$i) {
++	    unless ($found_eof[$i]) {
++		push @newstopconds, $state->{'stopconds'}[$i];
++		push @newvarbinds, $state->{'varbinds'}[$i];
+ 	    }
+ 	}
+-	if ($#$newstopconds == -1) {
++	if ($#newstopconds == -1) {
+ 	    last;
+ 	}
+-	if ($#{$state->{'varbinds'}} == -1) {
+-	    print "gettable ack.  shouldn't get here\n";
+-	}
++	$state->{'varbinds'} = \@newvarbinds;
++	$state->{'stopconds'} = \@newstopconds;
+ 	$vbl = $state->{'varbinds'};
+-	$state->{'stopconds'} = $newstopconds;
+ 
+         #
+         # if we've been configured with a callback, then call the
diff --git a/debian/patches/let_perl_access_engineid.diff b/debian/patches/let_perl_access_engineid.diff
new file mode 100644
index 0000000..b65135f
--- /dev/null
+++ b/debian/patches/let_perl_access_engineid.diff
@@ -0,0 +1,94 @@
+Index: net-snmp-5.7.2.1+dfsg/perl/SNMP/SNMP.pm
+===================================================================
+--- net-snmp-5.7.2.1+dfsg.orig/perl/SNMP/SNMP.pm
++++ net-snmp-5.7.2.1+dfsg/perl/SNMP/SNMP.pm
+@@ -1238,6 +1238,16 @@ sub inform {
+    return(wantarray() ? @res : $res[0]);
+ }
+ 
++sub get_sec_engine_id {
++   my $this = shift;
++   return SNMP::_get_sec_engine_id($this);
++}
++
++sub get_context_engine_id {
++   my $this = shift;
++   return SNMP::_get_context_engine_id($this);
++}
++
+ package SNMP::TrapSession;
+ @SNMP::TrapSession::ISA = ('SNMP::Session');
+ 
+@@ -2034,6 +2044,17 @@ as well.
+ 
+ =back
+ 
++=item $sess->get_sec_engine_id
++
++Returns the security engine ID for the current session, whether probed
++or provided by the client, in hex format suitable for the SecEngineId
++parameter when creating a session in the future. Returns undef if we have not
++had not had any contact with the remote agent yet.
++
++=item $sess->get_context_engine_id
++
++Like get_sec_engine_id, but for the context engine ID (ContextEngineId).
++
+ =back
+ 
+ =head1 SNMP::TrapSession
+Index: net-snmp-5.7.2.1+dfsg/perl/SNMP/SNMP.xs
+===================================================================
+--- net-snmp-5.7.2.1+dfsg.orig/perl/SNMP/SNMP.xs
++++ net-snmp-5.7.2.1+dfsg/perl/SNMP/SNMP.xs
+@@ -4741,6 +4741,50 @@ done:
+ 
+ 
+ char *
++snmp_get_sec_engine_id(sess_ref)
++        SV *	sess_ref
++	CODE:
++	{
++           RETVAL = NULL;
++           if (SvROK(sess_ref)) {
++              SV **sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
++	      SnmpSession *ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
++              if (ss->securityEngineIDLen > 0) {
++                 binary_to_hex(ss->securityEngineID,
++                               ss->securityEngineIDLen,
++                               &RETVAL);
++              }
++           }
++	}
++	OUTPUT:
++        RETVAL
++        CLEANUP:
++        netsnmp_free(RETVAL);
++
++
++char *
++snmp_get_context_engine_id(sess_ref)
++        SV *	sess_ref
++	CODE:
++	{
++           RETVAL = NULL;
++           if (SvROK(sess_ref)) {
++              SV **sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
++	      SnmpSession *ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
++              if (ss->contextEngineIDLen > 0) {
++                 binary_to_hex(ss->contextEngineID,
++                               ss->contextEngineIDLen,
++                               &RETVAL);
++              }
++           }
++	}
++	OUTPUT:
++        RETVAL
++        CLEANUP:
++        netsnmp_free(RETVAL);
++
++
++char *
+ snmp_get_type(tag, best_guess)
+ 	char *		tag
+         int             best_guess
diff --git a/debian/patches/series b/debian/patches/series
index d51c163..a93def2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,6 +4,7 @@
 06_extramibs.patch
 07_docfiles.patch
 26_kfreebsd.patch
+27_kfreebsd.patch
 60_libsensors_api.patch
 61_vacm_missing_dependency_check.patch
 62_add_lib_cflags.patch
@@ -20,8 +21,12 @@ fix_manpage-has-errors_break_line.patch
 add_rocommunity6.patch
 fix_manpage-has-errors-from-man.patch
 agentx-crash.patch
-Fix-kfreebsd-builds-with-kernel-headers-10.patch
 fix-request-id-0.patch
 0025-Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch
 0026-fix-Bug-785380-incorrect-date-format.patch
 0027-fix-455707-traptoemail-use-FQDN.patch
+let_perl_access_engineid.diff
+fix_perl_bulk_gets.diff
+do_not_callback_for_failed_reports.diff
+callback_print.diff
+fix_engineid_reprobe.diff
diff --git a/debian/rules b/debian/rules
index ef7d9ec..d2e7ece 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,8 +23,10 @@ IPV6 = --enable-ipv6
 DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libsensors4-dev"
 else
 ifeq (kfreebsd,$(DEB_BUILD_ARCH_OS))
-IPV6 = --disable-ipv6
+IPV6 = --enable-ipv6
 DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libkvm-dev"
+CFLAGS += $(shell pkg-config --cflags libbsd-overlay)
+LDFLAGS += $(shell pkg-config --libs libbsd-overlay)
 endif
 endif
 ifeq (hurd,$(DEB_BUILD_ARCH_OS))
@@ -35,7 +37,7 @@ MIB_MODULES += host
 endif
 
 %:
-	dh $@ --with autotools-dev,autoreconf,python2 --parallel
+	dh $@ --with autotools-dev,autoreconf,python2
 
 override_dh_auto_configure:
 	dh_auto_configure -- --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man \
@@ -62,7 +64,11 @@ override_dh_clean:
 	dh_clean
 	rm -rf `find . -name .libs` \
 	       python/build         \
-	       python/netsnmp_python.egg-info
+	       python/netsnmp_python.egg-info \
+	       dist/generation-scripts/gen-variables \
+	       perl/SNMP/t/snmptest.cmd \
+	       perl/TrapReceiver/const-c.inc \
+	       perl/TrapReceiver/const-xs.inc
 
 override_dh_strip:
 	dh_strip -plibsnmp$(LIB_VERSION) --dbg-package=libsnmp$(LIB_VERSION)-dbg
diff --git a/debian/snmp.prerm b/debian/snmp.prerm
index 6788f5f..a02114d 100644
--- a/debian/snmp.prerm
+++ b/debian/snmp.prerm
@@ -4,6 +4,7 @@ set -e
 
 case "$1" in
     remove|upgrade|deconfigure)
+    killall -u snmp  2>/dev/null || true
     ;;
 
     failed-upgrade)
diff --git a/debian/snmpd.default b/debian/snmpd.default
index e47dec8..f4ee7a7 100644
--- a/debian/snmpd.default
+++ b/debian/snmpd.default
@@ -8,4 +8,4 @@ export MIBS=
 SNMPDRUN=yes
 
 # snmpd options (use syslog, close stdin/out/err).
-SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'
+SNMPDOPTS='-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'
diff --git a/debian/snmpd.init b/debian/snmpd.init
index fac8a32..3e6dc03 100644
--- a/debian/snmpd.init
+++ b/debian/snmpd.init
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 ### BEGIN INIT INFO
 # Provides:           snmpd
 # Required-Start:     $network $remote_fs $syslog
@@ -34,11 +34,9 @@ SNMPDOPTS="-Lsd -Lf /dev/null -p $SNMP_PID"
 # Cd to / before starting any daemons.
 cd /
 
-status=0
-
 case "$1" in
   start)
-    log_daemon_msg "Starting SNMP services"
+    log_daemon_msg "Starting SNMP services:"
     # remove old symlink with previous version
     if [ -L /var/run/agentx ]; then
 	    rm -f /var/run/agentx
@@ -47,40 +45,36 @@ case "$1" in
 	    mkdir -p /var/run/agentx
     fi
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-	log_progress_msg "snmpd"
 	start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmpd \
-	    -- $SNMPDOPTS || status=$?
+	    -- $SNMPDOPTS
+	log_progress_msg " snmpd"
     fi
-    log_end_msg $status
     ;;
   stop)
-    log_daemon_msg "Stopping SNMP services" "snmpd"
-    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd || status=$?
-    [ $status -eq 0 -a -f $SNMP_PID ] && rm $SNMP_PID
-    log_end_msg $status
+    log_daemon_msg "Stopping SNMP services:"
+    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+    log_progress_msg " snmpd"
     ;;
   restart)
-    log_daemon_msg "Restarting SNMP services"
-    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd || status=$?
-    [ $status -eq 0 -a -f $SNMP_PID ] && rm $SNMP_PID
+    log_daemon_msg "Restarting SNMP services:"
+    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd  && [ ! -f $SNMP_PID ] || rm $SNMP_PID
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-	log_progress_msg "snmpd"
-	start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS || status=$?
+	start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS
+	log_progress_msg " snmpd"
     fi
-    log_end_msg $status
     ;;
   reload|force-reload)
-    log_daemon_msg "Reloading SNMP services"
+    log_daemon_msg "Reloading SNMP services:"
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-	log_progress_msg "snmpd"
         start-stop-daemon --quiet --stop --signal 1 \
-	    --pidfile "$SNMP_PID" --exec /usr/sbin/snmpd || status=$?
+	    --pidfile "$SNMP_PID" --exec /usr/sbin/snmpd
+	log_progress_msg " snmpd"
     fi
-    log_end_msg $status
     ;;
   status)
+    status=0
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-	status_of_proc /usr/sbin/snmpd snmpd || status=$?
+    	status_of_proc /usr/sbin/snmpd snmpd || status=$?
     fi
     exit $status
     ;;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-net-snmp/pkg-net-snmp.git



More information about the Pkg-net-snmp-commits mailing list