Skip to content

Commit 2237102

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fix snmp build without DES
2 parents 265dd19 + f9fd359 commit 2237102

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

ext/snmp/snmp.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,21 +944,32 @@ static bool netsnmp_session_set_auth_protocol(struct snmp_session *s, zend_strin
944944
/* {{{ Set the security protocol in the snmpv3 session */
945945
static bool netsnmp_session_set_sec_protocol(struct snmp_session *s, zend_string *prot)
946946
{
947+
#ifndef NETSNMP_DISABLE_DES
947948
if (zend_string_equals_literal_ci(prot, "DES")) {
948949
s->securityPrivProto = usmDESPrivProtocol;
949950
s->securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
951+
} else
952+
#endif
950953
#ifdef HAVE_AES
951-
} else if (zend_string_equals_literal_ci(prot, "AES128")
954+
if (zend_string_equals_literal_ci(prot, "AES128")
952955
|| zend_string_equals_literal_ci(prot, "AES")
953-
) {
954956
s->securityPrivProto = usmAESPrivProtocol;
955957
s->securityPrivProtoLen = USM_PRIV_PROTO_AES_LEN;
958+
} else
956959
#endif
957-
} else {
960+
{
958961
#ifdef HAVE_AES
962+
#ifndef NETSNMP_DISABLE_DES
959963
zend_value_error("Security protocol must be one of \"DES\", \"AES128\", or \"AES\"");
960964
#else
965+
zend_value_error("Security protocol must be one of \"AES128\", or \"AES\"");
966+
#endif
967+
#else
968+
#ifndef NETSNMP_DISABLE_DES
961969
zend_value_error("Security protocol must be \"DES\"");
970+
#else
971+
zend_value_error("No security protocol supported");
972+
#endif
962973
#endif
963974
return false;
964975
}

0 commit comments

Comments
 (0)