Fix #70461: disable md5 code when it is not supported in net-snmp

Patch contributed by Alexander Bergmann.

Closes GH-6389.
This commit is contained in:
Christoph M. Becker 2020-10-28 15:30:49 +01:00
parent ee3227af48
commit 9690ded288
2 changed files with 8 additions and 1 deletions

4
NEWS
View file

@ -25,6 +25,10 @@ PHP NEWS
- ODBC: - ODBC:
. Fixed bug #44618 (Fetching may rely on uninitialized data). (cmb) . Fixed bug #44618 (Fetching may rely on uninitialized data). (cmb)
- SNMP:
. Fixed bug #70461 (disable md5 code when it is not supported in net-snmp).
(Alexander Bergmann, cmb)
29 Oct 2020, PHP 7.3.24 29 Oct 2020, PHP 7.3.24
- Core: - Core:

View file

@ -1208,10 +1208,13 @@ static int netsnmp_session_set_sec_level(struct snmp_session *s, char *level)
Set the authentication protocol in the snmpv3 session */ Set the authentication protocol in the snmpv3 session */
static int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot) static int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot)
{ {
#ifndef DISABLE_MD5
if (!strcasecmp(prot, "MD5")) { if (!strcasecmp(prot, "MD5")) {
s->securityAuthProto = usmHMACMD5AuthProtocol; s->securityAuthProto = usmHMACMD5AuthProtocol;
s->securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN; s->securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN;
} else if (!strcasecmp(prot, "SHA")) { } else
#endif
if (!strcasecmp(prot, "SHA")) {
s->securityAuthProto = usmHMACSHA1AuthProtocol; s->securityAuthProto = usmHMACSHA1AuthProtocol;
s->securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN; s->securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN;
} else { } else {