Skip to content

Commit

Permalink
Merge branch 'PHP-8.0'
Browse files Browse the repository at this point in the history
* PHP-8.0:
  Fix snmp build without DES
  • Loading branch information
remicollet committed May 27, 2021
2 parents 265dd19 + f9fd359 commit 2237102
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ext/snmp/snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,21 +944,32 @@ static bool netsnmp_session_set_auth_protocol(struct snmp_session *s, zend_strin
/* {{{ Set the security protocol in the snmpv3 session */
static bool netsnmp_session_set_sec_protocol(struct snmp_session *s, zend_string *prot)
{
#ifndef NETSNMP_DISABLE_DES
if (zend_string_equals_literal_ci(prot, "DES")) {
s->securityPrivProto = usmDESPrivProtocol;
s->securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
} else
#endif
#ifdef HAVE_AES
} else if (zend_string_equals_literal_ci(prot, "AES128")
if (zend_string_equals_literal_ci(prot, "AES128")
|| zend_string_equals_literal_ci(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 false;
}
Expand Down

0 comments on commit 2237102

Please sign in to comment.