php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58149 GRANT does not work if table name finishes with an underscore
Submitted: 2008-04-10 09:44 UTC Modified: 2009-05-18 06:22 UTC
From: p dot frost at kent dot ac dot uk Assigned:
Status: Not a bug Package: ingres (PECL)
PHP Version: 4.4.2 OS: Solaris
Private report: No CVE-ID: None
 [2008-04-10 09:44 UTC] p dot frost at kent dot ac dot uk
Description:
------------
When issued via PHP, the following statement fails to take effect:

"GRANT all ON TABLE wuser.test_ TO userx" (followed by a commit, of course).

The PHP driver does not return any output after it has sent the SQL (it does not throw any errors either).

When userx attempts to access wuser.test_, Ingres complains:

"E_US0DAE SELECT on table test_ no GRANT or GRANT compatible permit exists."

When issued via isql in a terminal, the GRANT statement takes affect and userx is able to manipulate the data in test_.

If the underscore is removed from test_ and the command is issued from PHP, the GRANT takes effect and userx is able to access the table. It seems that the underscore is causing the problem somehow. Underscores within the name (as opposed to at the end) do not cause any problems.



For information, this is the output of "php -i | grep -i ingres" (the bug has also been confirmed using ingres2_query):

Configure Command =>  './configure' '--enable-track-vars' '--with-ingres=/u4/ingres/AI/ingres' '--prefix=/u1/www' '--with-apxs=/u1/www/bin/apxs' '--with-regex=php' '--with-gd=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-zlib-dir=/usr/local' '--with-xpm-dir=/usr/local' '--with-freetype-dir=/usr/local' '--with-expat-dir=/usr/local' '--with-iconv=/usr/local' '--with-dom' '--with-mssql=/usr/local' '--with-openssl=/usr/local/ssl'
ingres_ii
Ingres II Support => enabled
ingres.allow_persistent => On => On
ingres.default_database => no value => no value
ingres.default_password => no value => no value
ingres.default_user => no value => no value
ingres.max_links => Unlimited => Unlimited
ingres.max_persistent => Unlimited => Unlimited
LD_LIBRARY_PATH => /usr/local/lib:/usr/local/gnu/lib:/opt/SUNWspro/lib:/usr/openwin:/u4/ingres/AI/ingres/lib:/u4/ingres/AI/ingres/lib
VEC => /u4/ingres/AI/ingres/vec
TERM_INGRES => vt100f
II_SYSTEM => /u4/ingres/AI
PATH => /u4/ingres/AI/ingres/bin:/home/pkg/icedba/bin:/usr/local/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/local/gnu/bin:/usr/ccs/bin:/usr/local/sbin:/usr/local/bin:/usr/l/bin:/usr/l/misdev/utl:/usr/ucb:/usr/local/mh/bin:/usr/etc:/usr/bin:.:/usr/work/c102:/usr/work/c106
INGRES_KEYS => vt100f.map
_SERVER["LD_LIBRARY_PATH"] => /usr/local/lib:/usr/local/gnu/lib:/opt/SUNWspro/lib:/usr/openwin:/u4/ingres/AI/ingres/lib:/u4/ingres/AI/ingres/lib
_SERVER["VEC"] => /u4/ingres/AI/ingres/vec
_SERVER["TERM_INGRES"] => vt100f
_SERVER["II_SYSTEM"] => /u4/ingres/AI
_SERVER["PATH"] => /u4/ingres/AI/ingres/bin:/home/pkg/icedba/bin:/usr/local/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/local/gnu/bin:/usr/ccs/bin:/usr/local/sbin:/usr/local/bin:/usr/l/bin:/usr/l/misdev/utl:/usr/ucb:/usr/local/mh/bin:/usr/etc:/usr/bin:.:/usr/work/c102:/usr/work/c106
_SERVER["INGRES_KEYS"] => vt100f.map
_ENV["LD_LIBRARY_PATH"] => /usr/local/lib:/usr/local/gnu/lib:/opt/SUNWspro/lib:/usr/openwin:/u4/ingres/AI/ingres/lib:/u4/ingres/AI/ingres/lib
_ENV["VEC"] => /u4/ingres/AI/ingres/vec
_ENV["TERM_INGRES"] => vt100f
_ENV["II_SYSTEM"] => /u4/ingres/AI
_ENV["PATH"] => /u4/ingres/AI/ingres/bin:/home/pkg/icedba/bin:/usr/local/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/local/gnu/bin:/usr/ccs/bin:/usr/local/sbin:/usr/local/bin:/usr/l/bin:/usr/l/misdev/utl:/usr/ucb:/usr/local/mh/bin:/usr/etc:/usr/bin:.:/usr/work/c102:/usr/work/c106
_ENV["INGRES_KEYS"] => vt100f.map




Reproduce code:
---------------
wuser.test_ is a pre-existing table which is owned by wuser and was created via the following statement:

CREATE TABLE test_(testchar char(4)); commit;




PHP code:

  $link = ingres_connect("$dbserver::$db", "wuser", "");
  ingres_query("grant all on table wuser.test_ to userx",$link);
  ingres_commit($link);
  ingres_close($link);




Then (in isql or 4GL, as userx):

select * from wuser.test_;

Expected result:
----------------
I expected the SELECT statement to return the contents of the table.


Actual result:
--------------
"E_US0DAE SELECT on table test_ no GRANT or GRANT compatible permit exists."

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-10 09:46 UTC] p dot frost at kent dot ac dot uk
I should add that, after the GRANT is sent via PHP, the table does not appear in iipermits.
 [2009-05-18 06:22 UTC] grant dot croker at ingres dot com
Thank you for taking the time to report a problem with the package.
Unfortunately you are not using a current version of the package -- 
the problem might already be fixed. Please download a new
version from http://pecl.php.net/packages.php

If you are able to reproduce the bug with one of the latest
versions, please change the package version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PECL.

Does not reproduce in 2.1.0
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC