ID:               29652
 Updated by:       [EMAIL PROTECTED]
 Reported By:      yannick at agl dot fr
-Status:           Open
+Status:           Feedback
 Bug Type:         OCI8 related
 Operating System: Linux Redhat 7.3
 PHP Version:      4.3.7
 New Comment:

Please, try this patch:
http://tony2001.phpclub.net/dev/tmp/bug29652.diff.txt
It was done against HEAD, so please use latest snapshot from
http://snaps.php.net

The problem becomes complicated because I still can't reproduce this
under Linux and Apache 1.3.31, no matter with or without the patch.


Previous Comments:
------------------------------------------------------------------------

[2004-09-15 14:58:08] rvs at angara dot ru

Also note that PHP 5 has similar code for OCIEnvNlsCreate() and frees
environment handle (OCI_HTYPE_ENV) only at shutdown.
So the problem seems to be in PHP 5 also.

Sergei V. Rozinov
Leading RISC-Systems engineer
JSC Sibron, RUSSIA

------------------------------------------------------------------------

[2004-09-15 13:59:10] rvs at angara dot ru

I have the same error on php4.3.8/ora9.2.0.1.0/Solaris 9/sparc.

Some details: the .msb file descriptors grow in the following cases:
A. using ocinlogon()
B. using ocilogon() and working as a Apache module
C. using oci*logon() with invalid credentials.

The following code of case "C" may exhaust filedescriptor limit very
easily and quickly.

for ($i=0; $i < 200; $i++)
 @ocilogon($i, $i, $db);

After extensive researching I've found that:
1. the .msb file openings occur when OCIEnvNlsCreate() is called.
2. in ext/oci8.c,v 1.183.2.12 line 2257, function _oci_open_session()
the OCIEnvNlsCreate() invoked when session is not persistent, not
cached, or is exclusive.
3. if the session setup is unsuccessful, the environment handle is not
freed.
4. the environment handle is freed only when PHP shuts down, see line
613.

The result will be filedescriptor and memory leakage in all cases A,B,C
mentioned above. This could lead to security/DOS problem for websites
which use ocilogon()/ocinlogon() or passthrough Oracle authentication
in their php scripts.

Recommendations, workaround:
1. in module mode, avoid using ocilogon(), use ociplogon() instead.
2. avoid using Oracle pass-through authentication (i.e. when username
and password for ociplogon() is given from the website user).
3. fixing oci8.c code to free env handle at least after unsuccessful
logon is necessary.

With regards,
Sergei V. Rozinov
Leading RISC-Systems engineer
JSC Sibron, RUSSIA

------------------------------------------------------------------------

[2004-08-23 16:19:59] yannick at agl dot fr

oci library: 9.2.0.3

------------------------------------------------------------------------

[2004-08-23 16:08:47] esartoni at omniaglobal dot net

Hey Yannick, could you please tell us what version of oci libraries are
you using?

With php 4.3.8 using oci 8.1.7.0.0 i have no problem at all.

------------------------------------------------------------------------

[2004-08-20 14:43:46] yannick at agl dot fr

i tried with 4.3.8 without HAVE_OCI_9_2
there is no problem. if i defined HAVE_OCI_9_2 the issue occurs.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/29652

-- 
Edit this bug report at http://bugs.php.net/?id=29652&edit=1

Reply via email to