fix build with net-snmp without DES

Related: #1953492
This commit is contained in:
Remi Collet 2021-05-31 09:25:22 +02:00
parent 4053076902
commit 7dc7b305ad
2 changed files with 53 additions and 1 deletions

47
php-net-snmp.patch Normal file
View File

@ -0,0 +1,47 @@
From eb8fb56b9b91996912bf9f5765963bf1efea025a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 27 May 2021 14:20:07 +0200
Subject: [PATCH] Fix snmp build without DES
---
ext/snmp/snmp.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 35d19c8738828..d31995827880d 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -955,19 +955,31 @@ static int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot)
Set the security protocol in the snmpv3 session */
static int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot)
{
+#ifndef NETSNMP_DISABLE_DES
if (!strcasecmp(prot, "DES")) {
s->securityPrivProto = usmDESPrivProtocol;
s->securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
+ } else
+#endif
#ifdef HAVE_AES
- } else if (!strcasecmp(prot, "AES128") || !strcasecmp(prot, "AES")) {
+ if (!strcasecmp(prot, "AES128") || !strcasecmp(prot, "AES")) {
s->securityPrivProto = usmAESPrivProtocol;
s->securityPrivProtoLen = USM_PRIV_PROTO_AES_LEN;
+ } else
#endif
- } else {
+ {
#ifdef HAVE_AES
+#ifndef NETSNMP_DISABLE_DES
zend_value_error("Security protocol must be one of \"DES\", \"AES128\", or \"AES\"");
#else
+ zend_value_error("Security protocol must be one of \"AES128\", or \"AES\"");
+#endif
+#else
+#ifndef NETSNMP_DISABLE_DES
zend_value_error("Security protocol must be \"DES\"");
+#else
+ zend_value_error("No security protocol supported");
+#endif
#endif
return (-1);
}

View File

@ -62,7 +62,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: php
Version: %{upver}%{?rcver:~%{rcver}}
Release: 4%{?dist}
Release: 5%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@ -115,6 +115,7 @@ Patch47: php-8.0.0-phpinfo.patch
# Upstream fixes (100+)
Patch100: php-openssl3.patch
Patch101: php-net-snmp.patch
# Security fixes (200+)
@ -712,6 +713,7 @@ in pure PHP.
# upstream patches
%patch100 -p1 -b .openssl3
%patch101 -p1 -b .nodes
# security patches
@ -1523,6 +1525,9 @@ systemctl try-restart php-fpm.service >/dev/null 2>&1 || :
%changelog
* Mon May 31 2021 Remi Collet <rcollet@redhat.com> - 8.0.6-5
- fix build with net-snmp without DES #1953492
* Tue May 18 2021 Remi Collet <rcollet@redhat.com> - 8.0.6-4
- fix build with openssl 3.0 #1953492