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