From: phdokc at cox dot net
Operating system: HP-UX 11.11
PHP version: 4.3.10
PHP Bug Type: Compile Failure
Bug description: Compilation fails on 4.3.8, 4.3.9, 4.3.10 and php4-STABLE
after net-snmp patch
Description:
------------
After Net-SNMP team supplied patch to net-snmp 5.2 to correct a coredump
under certain situations, php 4.3.8 would no longer compile. 4.3.9 had
exact problem as 4.3.8. 4.3.10 had an error similar to bug #31121 (way
too much error detail to attach but I have it if you want it). Following
#31121 I downloaded CVS snapshot for 200503181930 and 200503191330 and
both had a ld error while ld sapi/cli/php. DSO appeared to ld correctly.
Details of all in Actual Results Section of this bug report (including
net-snmp patch - dif.proto).
ENV is HP-UX 11.11i, GMAKE 3.80, GCC 3.3.3, Apache 2.0.53, MySQL 3.23.58,
Net-SNMP 5.2(patched). Any other questions, please email. Thanks.
Expected result:
----------------
Successful compile.
Actual result:
--------------
Failure on 4.3.8 and 4.3.9 compile after applying net-snmp 5.2 patch
/bin/sh /backup1/php/php-4.3.8/libtool --silent --preserve-dup-deps
--mode=compile /backup1/php/php-4.3.8/meta_ccld -Iext/snmp/
-I/backup1/php/php-4.3.8/ext/snmp/ -DPHP_ATOM_INC
-I/backup1/php/php-4.3.8/include -I/backup1/php/php-4.3.8/main
-I/backup1/php/php-4.3.8 -I/backup1/php/php-4.3.8/Zend
-I/usr/local/include -I/backup1/php/php-4.3.8/ext/xml/expat -D_REENTRANT
-I/backup1/php/php-4.3.8/TSRM -DTHREAD=1 -g -O2 -pthread -DZTS
-prefer-pic -c /backup1/php/php-4.3.8/ext/snmp/snmp.c -o ext/snmp/snmp.lo
/backup1/php/php-4.3.8/ext/snmp/snmp.c: In function `php_snmp_internal':
/backup1/php/php-4.3.8/ext/snmp/snmp.c:349: warning: passing arg 3 of
`snmp_parse_oid' from incompatible pointer type
/backup1/php/php-4.3.8/ext/snmp/snmp.c:389: warning: passing arg 3 of
`snmp_parse_oid' from incompatible pointer type
/backup1/php/php-4.3.8/ext/snmp/snmp.c: In function
`netsnmp_session_set_sec_protocol':
/backup1/php/php-4.3.8/ext/snmp/snmp.c:777: error: `usmAES192PrivProtocol'
undeclared (first use in this function)
/backup1/php/php-4.3.8/ext/snmp/snmp.c:777: error: (Each undeclared
identifier is reported only once
/backup1/php/php-4.3.8/ext/snmp/snmp.c:777: error: for each function it
appears in.)
/backup1/php/php-4.3.8/ext/snmp/snmp.c:781: error: `usmAES256PrivProtocol'
undeclared (first use in this function)
/backup1/php/php-4.3.8/ext/snmp/snmp.c: In function
`netsnmp_session_gen_auth_key':
/backup1/php/php-4.3.8/ext/snmp/snmp.c:804: warning: initialization
discards qualifiers from pointer target type
/backup1/php/php-4.3.8/ext/snmp/snmp.c: In function
`netsnmp_session_gen_sec_key':
/backup1/php/php-4.3.8/ext/snmp/snmp.c:833: warning: initialization
discards qualifiers from pointer target type
gmake: *** [ext/snmp/snmp.lo] Error 1
Failure on 4.3.9 compile after applying net-snmp 5.2 patch
/bin/sh /backup1/php/php-4.3.9/libtool --silent --preserve-dup-deps
--mode=compile gcc -Iext/snmp/ -I/backup1/php/php-4.3.9/ext/snmp/
-DPHP_ATOM_INC -I/backup1/php/php-4.3.9/include
-I/backup1/php/php-4.3.9/main -I/backup1/php/php-4.3.9
-I/backup1/php/php-4.3.9/Zend -I/usr/local/include
-I/backup1/php/php-4.3.9/ext/xml/expat -I/backup1/php/php-4.3.9/TSRM -g
-O2 -prefer-pic -c /backup1/php/php-4.3.9/ext/snmp/snmp.c -o
ext/snmp/snmp.lo
/backup1/php/php-4.3.9/ext/snmp/snmp.c: In function `php_snmp_internal':
/backup1/php/php-4.3.9/ext/snmp/snmp.c:349: warning: passing arg 3 of
`snmp_parse_oid' from incompatible pointer type
/backup1/php/php-4.3.9/ext/snmp/snmp.c:389: warning: passing arg 3 of
`snmp_parse_oid' from incompatible pointer type
/backup1/php/php-4.3.9/ext/snmp/snmp.c: In function
`netsnmp_session_set_sec_protocol':
/backup1/php/php-4.3.9/ext/snmp/snmp.c:777: error: `usmAES192PrivProtocol'
undeclared (first use in this function)
/backup1/php/php-4.3.9/ext/snmp/snmp.c:777: error: (Each undeclared
identifier is reported only once
/backup1/php/php-4.3.9/ext/snmp/snmp.c:777: error: for each function it
appears in.)
/backup1/php/php-4.3.9/ext/snmp/snmp.c:781: error: `usmAES256PrivProtocol'
undeclared (first use in this function)
/backup1/php/php-4.3.9/ext/snmp/snmp.c: In function
`netsnmp_session_gen_auth_key':
/backup1/php/php-4.3.9/ext/snmp/snmp.c:804: warning: initialization
discards qualifiers from pointer target type
/backup1/php/php-4.3.9/ext/snmp/snmp.c: In function
`netsnmp_session_gen_sec_key':
/backup1/php/php-4.3.9/ext/snmp/snmp.c:833: warning: initialization
discards qualifiers from pointer target type
gmake: *** [ext/snmp/snmp.lo] Error 1
Last line of failure on 4.3.10 compile after applying net-snmp 5.2 patch
/backup/php/php-4.3.10/Zend/zend_strtod.c:1571: error: dereferencing
pointer to incomplete type
gmake: *** [Zend/zend_strtod.lo] Error 1
Failure on CVS Snapshot's php4-STABLE-200503191330 and
php4-STABLE-200503181930 (exact same error).
/usr/ccs/bin/ld: Unsatisfied symbols:
ntohs (code)
collect2: ld returned 1 exit status
gmake: *** [sapi/cli/php] Error 1
net-snmp 5.2 patch dif.proto
Index: include/net-snmp/library/snmp_api.h
===================================================================
RCS file:
/cvsroot/net-snmp/net-snmp/include/net-snmp/library/snmp_api.h,v
retrieving revision 5.11
diff -u -r5.11 snmp_api.h
--- include/net-snmp/library/snmp_api.h 8 Jul 2004 15:36:01 -0000
5.11
+++ include/net-snmp/library/snmp_api.h 14 Mar 2005 23:09:25 -0000
@@ -484,8 +484,9 @@
#define SNMPERR_VAR_TYPE (-61)
#define SNMPERR_MALLOC (-62)
#define SNMPERR_KRB5 (-63)
+#define SNMPERR_PROTOCOL (-64)
-#define SNMPERR_MAX (-63)
+#define SNMPERR_MAX (-64)
#define non_repeaters errstat
#define max_repetitions errindex
Index: snmplib/snmp_api.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/snmplib/snmp_api.c,v
retrieving revision 5.68
diff -u -r5.68 snmp_api.c
--- snmplib/snmp_api.c 15 Oct 2004 18:52:29 -0000 5.68
+++ snmplib/snmp_api.c 14 Mar 2005 23:09:28 -0000
@@ -295,6 +295,7 @@
"Bad variable type", /* SNMPERR_VAR_TYPE */
"Out of memory (malloc failure)", /* SNMPERR_MALLOC */
"Kerberos related error", /* SNMPERR_KRB5 */
+ "Protocol error", /* SNMPERR_PROTOCOL */
};
static const char *secLevelName[] = {
@@ -496,19 +497,21 @@
snmp_api_errstring(int snmp_errnumber)
{
const char *msg = "";
- static char msg_buf[256];
+ static char msg_buf[SPRINT_MAX_LEN];
if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <=
SNMPERR_GENERR) {
msg = api_errors[-snmp_errnumber];
} else if (snmp_errnumber != SNMPERR_SUCCESS) {
- msg = "Unknown Error";
+ msg = NULL;
}
- if (snmp_detail_f) {
- snprintf(msg_buf, 256, "%s (%s)", msg, snmp_detail);
+ if (!msg)
+ snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d",
snmp_errnumber);
+ else if (snmp_detail_f) {
+ snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
snmp_detail_f = 0;
} else {
- strncpy(msg_buf, msg, 256);
+ strncpy(msg_buf, msg, sizeof(msg_buf));
}
- msg_buf[255] = '\0';
+ msg_buf[sizeof(msg_buf)-1] = '\0';
return (msg_buf);
}
@@ -535,12 +538,16 @@
strcpy(buf, "");
snmp_errnumber = psess->s_snmp_errno;
if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <=
SNMPERR_GENERR) {
- strncpy(buf, api_errors[-snmp_errnumber], 256);
+ if (snmp_detail_f)
+ snprintf(buf, sizeof(buf), "%s (%s)",
api_errors[-snmp_errnumber],
+ snmp_detail);
+ else
+ strncpy(buf, api_errors[-snmp_errnumber], sizeof(buf));
} else {
if (snmp_errnumber)
- snprintf(buf, 256, "Unknown Error %d", snmp_errnumber);
+ snprintf(buf, sizeof(buf), "Unknown Error %d",
snmp_errnumber);
}
- buf[255] = '\0';
+ buf[sizeof(buf)-1] = '\0';
/*
* append a useful system errno interpretation.
@@ -549,10 +556,10 @@
const char* error = strerror(psess->s_errno);
if(error == NULL)
error = "Unknown Error";
- snprintf (&buf[strlen(buf)], 256-strlen(buf),
+ snprintf (&buf[strlen(buf)], sizeof(buf)-strlen(buf),
" (%s)", error);
}
- buf[255] = '\0';
+ buf[sizeof(buf)-1] = '\0';
*p_str = strdup(buf);
}
@@ -4177,6 +4184,7 @@
data = asn_parse_header(data, length, &msg_type);
if (data == NULL)
return -1;
+ DEBUGMSGTL(("dumpv_recv"," Command 0x%.2x\n", msg_type));
pdu->command = msg_type;
pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
Index: snmplib/snmp_client.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/snmplib/snmp_client.c,v
retrieving revision 5.6.2.1
diff -u -r5.6.2.1 snmp_client.c
--- snmplib/snmp_client.c 10 Dec 2004 02:21:38 -0000 5.6.2.1
+++ snmplib/snmp_client.c 14 Mar 2005 23:09:28 -0000
@@ -188,6 +188,16 @@
state->status = STAT_SUCCESS;
session->s_snmp_errno = SNMPERR_SUCCESS;
}
+ else {
+ char msg_buf[50];
+ state->status = STAT_ERROR;
+ session->s_snmp_errno = SNMPERR_PROTOCOL;
+ SET_SNMP_ERROR(SNMPERR_PROTOCOL);
+ snprintf(msg_buf, sizeof(msg_buf), "Expected RESPONSE pdu but
got 0x%.2X",
+ pdu->command);
+ snmp_set_detail(msg_buf);
+ return 0;
+ }
} else if (op == NETSNMP_CALLBACK_OP_TIMED_OUT) {
state->pdu = NULL;
state->status = STAT_TIMEOUT;
--
Edit bug report at http://bugs.php.net/?id=32374&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32374&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32374&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32374&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32374&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32374&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32374&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32374&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32374&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32374&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32374&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32374&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32374&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32374&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32374&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32374&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32374&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32374&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32374&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32374&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32374&r=mysqlcfg