@@ -828,7 +828,7 @@ static bool php_snmp_parse_oid(
828828/* {{{ snmp_session_init
829829 allocates memory for session and session->peername, caller should free it manually using snmp_session_free() and efree()
830830*/
831- static bool snmp_session_init (php_snmp_session * * session_p , int version , zend_string * hostname , zend_string * community , zend_long timeout , zend_long retries , int hostname_arg_num , int timeout_arg_num )
831+ static bool snmp_session_init (php_snmp_session * * session_p , int version , zend_string * hostname , zend_string * community , zend_long timeout , zend_long retries , uint32_t hostname_arg_num , uint32_t timeout_arg_num )
832832{
833833 php_snmp_session * session ;
834834 char * pptr , * host_ptr ;
@@ -852,7 +852,7 @@ static bool snmp_session_init(php_snmp_session **session_p, int version, zend_st
852852 return false;
853853 }
854854
855- if (timeout_arg_num != -1 ) {
855+ if (timeout_arg_num != 0 ) {
856856 if (timeout < -1 || timeout > LONG_MAX ) {
857857 zend_argument_value_error (timeout_arg_num , "must be between -1 and %ld" , LONG_MAX );
858858 return false;
@@ -1228,14 +1228,16 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
12281228{
12291229 zend_string * oid_str , * type_str = NULL , * value_str = NULL ;
12301230 HashTable * oid_ht , * type_ht = NULL , * value_ht = NULL ;
1231- zend_string * a1 = NULL , * a2 = NULL , * a3 = NULL , * a4 = NULL , * a5 = NULL , * a6 = NULL , * a7 = NULL ;
1231+ zend_string * hostname = NULL , * community_or_security_name = NULL ;
1232+ zend_string * security_level = NULL , * auth_protocol = NULL , * auth_passphrase = NULL ;
1233+ zend_string * privacy_protocol = NULL , * privacy_passphrase = NULL ;
12321234 bool use_orignames = 0 , suffix_keys = 0 ;
12331235 zend_long timeout = SNMP_DEFAULT_TIMEOUT ;
12341236 zend_long retries = SNMP_DEFAULT_RETRIES ;
12351237 struct objid_query objid_query ;
12361238 php_snmp_session * session ;
12371239 int session_less_mode = (getThis () == NULL );
1238- int timeout_arg_num = -1 ;
1240+ uint32_t timeout_arg_num = 0 ;
12391241 uint32_t oid_arg_num = 1 , type_arg_num = 0 , value_arg_num = 0 ;
12401242 php_snmp_object * snmp_object ;
12411243 php_snmp_object glob_snmp_object ;
@@ -1249,13 +1251,13 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
12491251 if (version == SNMP_VERSION_3 ) {
12501252 if (st & SNMP_CMD_SET ) {
12511253 ZEND_PARSE_PARAMETERS_START (10 , 12 )
1252- Z_PARAM_PATH_STR (a1 )
1253- Z_PARAM_PATH_STR (a2 )
1254- Z_PARAM_STR (a3 )
1255- Z_PARAM_STR (a4 )
1256- Z_PARAM_STR (a5 )
1257- Z_PARAM_STR (a6 )
1258- Z_PARAM_STR (a7 )
1254+ Z_PARAM_PATH_STR (hostname )
1255+ Z_PARAM_PATH_STR (community_or_security_name )
1256+ Z_PARAM_STR (security_level )
1257+ Z_PARAM_STR (auth_protocol )
1258+ Z_PARAM_STR (auth_passphrase )
1259+ Z_PARAM_STR (privacy_protocol )
1260+ Z_PARAM_STR (privacy_passphrase )
12591261 Z_PARAM_ARRAY_HT_OR_STR (oid_ht , oid_str )
12601262 Z_PARAM_ARRAY_HT_OR_STR (type_ht , type_str )
12611263 Z_PARAM_ARRAY_HT_OR_STR (value_ht , value_str )
@@ -1274,13 +1276,13 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
12741276 * SNMP_CMD_WALK
12751277 */
12761278 ZEND_PARSE_PARAMETERS_START (8 , 10 )
1277- Z_PARAM_PATH_STR (a1 )
1278- Z_PARAM_PATH_STR (a2 )
1279- Z_PARAM_STR (a3 )
1280- Z_PARAM_STR (a4 )
1281- Z_PARAM_STR (a5 )
1282- Z_PARAM_STR (a6 )
1283- Z_PARAM_STR (a7 )
1279+ Z_PARAM_PATH_STR (hostname )
1280+ Z_PARAM_PATH_STR (community_or_security_name )
1281+ Z_PARAM_STR (security_level )
1282+ Z_PARAM_STR (auth_protocol )
1283+ Z_PARAM_STR (auth_passphrase )
1284+ Z_PARAM_STR (privacy_protocol )
1285+ Z_PARAM_STR (privacy_passphrase )
12841286 Z_PARAM_ARRAY_HT_OR_STR (oid_ht , oid_str )
12851287 Z_PARAM_OPTIONAL
12861288 Z_PARAM_LONG (timeout )
@@ -1293,8 +1295,8 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
12931295 } else {
12941296 if (st & SNMP_CMD_SET ) {
12951297 ZEND_PARSE_PARAMETERS_START (5 , 7 )
1296- Z_PARAM_PATH_STR (a1 )
1297- Z_PARAM_PATH_STR (a2 )
1298+ Z_PARAM_PATH_STR (hostname )
1299+ Z_PARAM_PATH_STR (community_or_security_name )
12981300 Z_PARAM_ARRAY_HT_OR_STR (oid_ht , oid_str )
12991301 Z_PARAM_ARRAY_HT_OR_STR (type_ht , type_str )
13001302 Z_PARAM_ARRAY_HT_OR_STR (value_ht , value_str )
@@ -1313,8 +1315,8 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
13131315 * SNMP_CMD_WALK
13141316 */
13151317 ZEND_PARSE_PARAMETERS_START (3 , 5 )
1316- Z_PARAM_PATH_STR (a1 )
1317- Z_PARAM_PATH_STR (a2 )
1318+ Z_PARAM_PATH_STR (hostname )
1319+ Z_PARAM_PATH_STR (community_or_security_name )
13181320 Z_PARAM_ARRAY_HT_OR_STR (oid_ht , oid_str )
13191321 Z_PARAM_OPTIONAL
13201322 Z_PARAM_LONG (timeout )
@@ -1369,12 +1371,12 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
13691371 }
13701372
13711373 if (session_less_mode ) {
1372- if (!snmp_session_init (& session , version , a1 , a2 , timeout , retries , 1 , timeout_arg_num )) {
1374+ if (!snmp_session_init (& session , version , hostname , community_or_security_name , timeout , retries , 1 , timeout_arg_num )) {
13731375 php_free_objid_query (& objid_query , oid_ht , value_ht , st );
13741376 snmp_session_free (& session );
13751377 RETURN_FALSE ;
13761378 }
1377- if (version == SNMP_VERSION_3 && !snmp_session_set_security (session , a3 , a4 , a5 , a6 , a7 , NULL , NULL , 4 , 0 )) {
1379+ if (version == SNMP_VERSION_3 && !snmp_session_set_security (session , security_level , auth_protocol , auth_passphrase , privacy_protocol , privacy_passphrase , NULL , NULL , 4 , 0 )) {
13781380 php_free_objid_query (& objid_query , oid_ht , value_ht , st );
13791381 snmp_session_free (& session );
13801382 /* An error has already been emitted, just bail out. */
0 commit comments