[oe] [PATCH] net-snmp: fix compile error with --disable-des

changqing.li at windriver.com changqing.li at windriver.com
Tue Feb 26 07:45:51 UTC 2019


From: Changqing Li <changqing.li at windriver.com>

| scapi.c: In function 'sc_encrypt':
| scapi.c:1256:5: error: 'pad_size' undeclared (first use in this function); did you mean 'dysize'?
|      pad_size = pai->pad_size;
|      ^~~~~~~~
|      dysize

pad_size is defined only without --disable-des
[snip]
    int             pad, plast, pad_size = 0;

but used when disable-des
[snip]
        QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);
    }
    pad_size = pai->pad_size;

    memset(my_iv, 0, sizeof(my_iv));

    if (USM_CREATE_USER_PRIV_DES == (pai->type & USM_PRIV_MASK_ALG)) {

        /*

fix by move it into #ifndef NETSNMP_DISABLE_DES

Signed-off-by: Changqing Li <changqing.li at windriver.com>
---
 ...01-net-snmp-fix-compile-error-disable-des.patch | 62 ++++++++++++++++++++++
 .../recipes-protocols/net-snmp/net-snmp_5.8.bb     |  1 +
 2 files changed, 63 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-net-snmp-fix-compile-error-disable-des.patch

diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-net-snmp-fix-compile-error-disable-des.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-net-snmp-fix-compile-error-disable-des.patch
new file mode 100644
index 0000000..7e686ce
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-net-snmp-fix-compile-error-disable-des.patch
@@ -0,0 +1,62 @@
+From e38c508ef401593b1d4fe42b62e42a49cfec82af Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li at windriver.com>
+Date: Tue, 26 Feb 2019 14:26:07 +0800
+Subject: [PATCH] net-snmp: fix compile error with --disable-des
+
+| scapi.c: In function 'sc_encrypt':
+| scapi.c:1256:5: error: 'pad_size' undeclared (first use in this function); did you mean 'dysize'?
+|      pad_size = pai->pad_size;
+|      ^~~~~~~~
+|      dysize
+
+pad_size is defined only without --disable-des
+[snip]
+#ifndef NETSNMP_DISABLE_DES
+    int             pad, plast, pad_size = 0; 
+
+but used when disable-des,
+[snip]
+        QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);
+    }    
+    pad_size = pai->pad_size;
+
+    memset(my_iv, 0, sizeof(my_iv));
+
+#ifndef NETSNMP_DISABLE_DES
+    if (USM_CREATE_USER_PRIV_DES == (pai->type & USM_PRIV_MASK_ALG)) {
+
+        /*
+
+fix by move it into #ifndef NETSNMP_DISABLE_DES
+
+Upstream-Status: Submitted [https://sourceforge.net/p/net-snmp/bugs/2927/]
+
+Signed-off-by: Changqing Li <changqing.li at windriver.com>
+---
+ snmplib/scapi.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/snmplib/scapi.c b/snmplib/scapi.c
+index 43caddf..c09deb0 100644
+--- a/snmplib/scapi.c
++++ b/snmplib/scapi.c
+@@ -1253,7 +1253,6 @@ sc_encrypt(const oid * privtype, size_t privtypelen,
+ 
+         QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);
+     }
+-    pad_size = pai->pad_size;
+ 
+     memset(my_iv, 0, sizeof(my_iv));
+ 
+@@ -1263,6 +1262,8 @@ sc_encrypt(const oid * privtype, size_t privtypelen,
+         /*
+          * now calculate the padding needed 
+          */
++
++       pad_size = pai->pad_size;
+         pad = pad_size - (ptlen % pad_size);
+         plast = (int) ptlen - (pad_size - pad);
+         if (pad == pad_size)
+-- 
+2.7.4
+
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb
index e1c780b..1e87fd0 100644
--- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.8.bb
@@ -26,6 +26,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://net-snmp-fix-for-disable-des.patch \
            file://reproducibility-have-printcap.patch \
            file://reproducibility-accept-configure-options-from-env.patch \
+           file://0001-net-snmp-fix-compile-error-disable-des.patch \
            "
 SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
 SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
-- 
2.7.4



More information about the Openembedded-devel mailing list