@@ -928,16 +928,18 @@ static bool netsnmp_session_set_auth_protocol(struct snmp_session *s, zend_strin
928
928
if (zend_string_equals_literal_ci (prot , "MD5" )) {
929
929
s -> securityAuthProto = usmHMACMD5AuthProtocol ;
930
930
s -> securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN ;
931
- } else
931
+ return true;
932
+ }
932
933
#endif
934
+
933
935
if (zend_string_equals_literal_ci (prot , "SHA" )) {
934
936
s -> securityAuthProto = usmHMACSHA1AuthProtocol ;
935
937
s -> securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN ;
936
- } else {
937
- zend_value_error ("Authentication protocol must be either \"MD5\" or \"SHA\"" );
938
- return false;
938
+ return true;
939
939
}
940
- return true;
940
+
941
+ zend_value_error ("Authentication protocol must be either \"MD5\" or \"SHA\"" );
942
+ return false;
941
943
}
942
944
/* }}} */
943
945
@@ -948,32 +950,33 @@ static bool netsnmp_session_set_sec_protocol(struct snmp_session *s, zend_string
948
950
if (zend_string_equals_literal_ci (prot , "DES" )) {
949
951
s -> securityPrivProto = usmDESPrivProtocol ;
950
952
s -> securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN ;
951
- } else
953
+ return true;
954
+ }
952
955
#endif
956
+
953
957
#ifdef HAVE_AES
954
958
if (zend_string_equals_literal_ci (prot , "AES128" )
955
- || zend_string_equals_literal_ci (prot , "AES" )
959
+ || zend_string_equals_literal_ci (prot , "AES" )) {
956
960
s -> securityPrivProto = usmAESPrivProtocol ;
957
961
s -> securityPrivProtoLen = USM_PRIV_PROTO_AES_LEN ;
958
- } else
962
+ return true;
963
+ }
959
964
#endif
960
- {
965
+
961
966
#ifdef HAVE_AES
962
- #ifndef NETSNMP_DISABLE_DES
963
- zend_value_error ("Security protocol must be one of \"DES\", \"AES128\", or \"AES\"" );
964
- #else
965
- zend_value_error ("Security protocol must be one of \"AES128\", or \"AES\"" );
966
- #endif
967
- #else
968
- #ifndef NETSNMP_DISABLE_DES
969
- zend_value_error ("Security protocol must be \"DES\"" );
967
+ # ifndef NETSNMP_DISABLE_DES
968
+ zend_value_error ("Security protocol must be one of \"DES\", \"AES128\", or \"AES\"" );
969
+ # else
970
+ zend_value_error ("Security protocol must be one of \"AES128\", or \"AES\"" );
971
+ # endif
970
972
#else
971
- zend_value_error ("No security protocol supported" );
973
+ # ifndef NETSNMP_DISABLE_DES
974
+ zend_value_error ("Security protocol must be \"DES\"" );
975
+ # else
976
+ zend_value_error ("No security protocol supported" );
977
+ # endif
972
978
#endif
973
- #endif
974
- return false;
975
- }
976
- return true;
979
+ return false;
977
980
}
978
981
/* }}} */
979
982
0 commit comments