diff options
| -rw-r--r-- | ext/snmp/snmp.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 6846cf5139..84d800c080 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -781,7 +781,21 @@ static int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot T s->securityPrivProtoLen = OIDSIZE(usmDESPrivProtocol); return (0); #ifdef HAVE_AES - } else if (!strcasecmp(prot, "AES128")) { + } else if (!strcasecmp(prot, "AES128") +#ifdef SNMP_VALIDATE_ERR +/* +* In Net-SNMP before 5.2, the following symbols exist: +* usmAES128PrivProtocol, usmAES192PrivProtocol, usmAES256PrivProtocol +* In an effort to be more standards-compliant, 5.2 removed the last two. +* As of 5.2, the symbols are: +* usmAESPrivProtocol, usmAES128PrivProtocol +* +* As we want this extension to compile on both versions, we use the latter +* symbol on purpose, as it's defined to be the same as the former. +*/ + || !strcasecmp(prot, "AES")) { +#else + ) { s->securityPrivProto = usmAES128PrivProtocol; s->securityPrivProtoLen = OIDSIZE(usmAES128PrivProtocol); return (0); @@ -794,6 +808,7 @@ static int netsnmp_session_set_sec_protocol(struct snmp_session *s, char *prot T s->securityPrivProtoLen = OIDSIZE(usmAES256PrivProtocol); return (0); #endif +#endif } else if (strlen(prot)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid privacy protocol: %s", prot); } |
