|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-02-22 08:39 UTC] nbougues at axialys dot net
According to the source in snmp.c, it looks like it's impossible to use an snmp* function on a non standard remote port (other that 161). For that, the session structure passed to snmp_open needs to have its remote_port field filled. Maybe it could be possible to add a new argument to the snmp functions, or handle something like "hostname:port" in the hostname field ? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
Here is a small patch that will enable "host:port" in snmp connections : *** snmp.c.old Thu Sep 14 22:22:02 2000 --- snmp.c Thu Feb 22 17:02:06 2001 *************** *** 148,153 **** --- 148,156 ---- int myargc = ZEND_NUM_ARGS(); char type = (char) 0; char *value = (char *) 0; + char hostname[MAX_NAME_LEN]; + int remote_port = 161; + char *pptr; if (myargc < 3 || myargc > 7 || zend_get_parameters_ex(myargc, &a1, &a2, &a3, &a4, &a5, &a6, &a7) == FAILURE) { *************** *** 210,216 **** memset(&session, 0, sizeof(struct snmp_session)); ! session.peername = (*a1)->value.str.val; session.version = SNMP_VERSION_1; /* * FIXME: potential memory leak --- 213,226 ---- memset(&session, 0, sizeof(struct snmp_session)); ! strcpy (hostname, (*a1)->value.str.val); ! if ((pptr = strchr (hostname, ':'))) { ! remote_port = strtol (pptr + 1, NULL, 0); ! *pptr = 0; ! } ! ! session.peername = hostname; ! session.remote_port = remote_port; session.version = SNMP_VERSION_1; /* * FIXME: potential memory leak