php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32613 ext/snmp: use of snmp_shutdown() causes snmpapp.conf access errors
Submitted: 2005-04-06 23:50 UTC Modified: 2005-07-24 22:58 UTC
From: ric at arizona dot edu Assigned:
Status: Closed Package: SNMP related
PHP Version: 4.3.11 OS: Solaris 8
Private report: No CVE-ID: None
 [2005-04-06 23:50 UTC] ric at arizona dot edu
Description:
------------
Build environment is Solaris 8 with net-snmp5.1.

I built php 4.3.11 with
 ./configure --with-mysql=/usr/local  \
     --with-openssl=/usr/local/ssl --with-ldap \
     --with-apxs=/private/apache/bin/apxs --with-xml --with-pspell \
     --with-snmp --with-zlib
    make

The build completed normally, but when I then run
 $ /dfs/src/solaris/php-4.3.11/sapi/cli/php--version
I get
 PHP 4.3.11 (cli) (built: Apr  6 2005 11:12:09)
 Copyright (c) 1997-2004 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
 Cannot rename /var/net-snmp/snmpapp.conf to /var/net-snmp/snmpapp.0.conf
 Cannot unlink /var/net-snmp/snmpapp.conf
 read_config_store open failure on /var/net-snmp/snmpapp.conf
 read_config_store open failure on /var/net-snmp/snmpapp.conf
 read_config_store open failure on /var/net-snmp/snmpapp.conf

On the same computer with the same environment, I built
php 4.3.10, and it produces no such errors, viz:
 $ /dfs/src/solaris/php-4.3.10/sapi/cli/php --version
 PHP 4.3.10 (cli) (built: Apr  6 2005 14:30:39)
 Copyright (c) 1997-2004 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

4.3.11 appears to need write access to /var/snmp to 
be able to rename files and read/write access to snmpapp.conf.   Short of making /var/snmp world write,
and snmpapp.conf world write is there a way to restore
the 4.3.10 behvior which doesn't even require the
existance of /var/net-snmp?

Thanks
Ric Anderson (ric@arizona.edu)

Reproduce code:
---------------
Configure and build 4.3.11 --with-snmp, and then try
to run
 sapi/cli/php --version
as a mortal (non-root) user.

Expected result:
----------------
I expect to see the version info e.g.
 PHP 4.3.11 (cli) (built: Apr  6 2005 11:12:09)
 Copyright (c) 1997-2004 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

Actual result:
--------------
 PHP 4.3.11 (cli) (built: Apr  6 2005 11:12:09)
 Copyright (c) 1997-2004 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
 Cannot rename /var/net-snmp/snmpapp.conf to /var/net-snmp/snmpapp.0.conf
 Cannot unlink /var/net-snmp/snmpapp.conf
 read_config_store open failure on /var/net-snmp/snmpapp.conf
 read_config_store open failure on /var/net-snmp/snmpapp.conf
 read_config_store open failure on /var/net-snmp/snmpapp.conf

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-11 20:33 UTC] ric at arizona dot edu
After much reading on this, I found the problem to be the
snmp_shutdown() call added in php 4.3.11.  The fix for the
errors this is twofold
a) modify php to include
   netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
    NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
   in php startup, so the newly added snmp_shutdown call 
   won't try to write data.
-AND-
b) update to net-snmp-5.2.1 which recognizes the above
   call.
---
 [2005-04-11 22:39 UTC] jorton@php.net
I agree this is a regression; you see the spam similarly in the httpd error_log at each shutdown, if it *can't* create the snmpapp.conf since it's not running as root (at least using the net-snmp default paths in Fedora Core).

That looks like a good solution, except it will inhibit *reading* the config data as well, which might not be desired?  I'm not familiar with this area at all.
 [2005-05-10 13:25 UTC] sniper@php.net
I have now reverted the memleak fix from PHP_4_3 branch.

 [2005-05-10 14:18 UTC] sniper@php.net
Fixed in HEAD/PHP_5_0 branches by disabling the persistent stage stuff. Thanks for the tip!

Here is the patch:

  http://www.php.net/~jani/patches/bug32613.patch

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC