Skip to content

Commit f9fd359

Browse files
committed
Fix snmp build without DES
1 parent ac65f6a commit f9fd359

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ext/snmp/snmp.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,19 +955,31 @@ static int netsnmp_session_set_auth_protocol(struct snmp_session *s, char *prot)
955955
Set the security protocol in the snmpv3 session */
956956
static int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot)
957957
{
958+
#ifndef NETSNMP_DISABLE_DES
958959
if (!strcasecmp(prot, "DES")) {
959960
s->securityPrivProto = usmDESPrivProtocol;
960961
s->securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
962+
} else
963+
#endif
961964
#ifdef HAVE_AES
962-
} else if (!strcasecmp(prot, "AES128") || !strcasecmp(prot, "AES")) {
965+
if (!strcasecmp(prot, "AES128") || !strcasecmp(prot, "AES")) {
963966
s->securityPrivProto = usmAESPrivProtocol;
964967
s->securityPrivProtoLen = USM_PRIV_PROTO_AES_LEN;
968+
} else
965969
#endif
966-
} else {
970+
{
967971
#ifdef HAVE_AES
972+
#ifndef NETSNMP_DISABLE_DES
968973
zend_value_error("Security protocol must be one of \"DES\", \"AES128\", or \"AES\"");
969974
#else
975+
zend_value_error("Security protocol must be one of \"AES128\", or \"AES\"");
976+
#endif
977+
#else
978+
#ifndef NETSNMP_DISABLE_DES
970979
zend_value_error("Security protocol must be \"DES\"");
980+
#else
981+
zend_value_error("No security protocol supported");
982+
#endif
971983
#endif
972984
return (-1);
973985
}

0 commit comments

Comments
 (0)