Re: Enable authorizer-feature in PDO_SQLITE
| From: | Mario Wolff | Date: | Thu, 16 Nov 2006 14:52:25 +0000 |
| Subject: | Re: Enable authorizer-feature in PDO_SQLITE | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26642@lists.php.net to get a copy of this message | ||
@Wez: Whoop, just found you as maintainer in Pecl and send the same
request direct to you, sorry!
2006/11/16, Wez Furlong <kingwez@gmail.com>:
Two comments about the patch: - could you create a unified diff and post that instead?Here it is!
- static local variable usage is not thread safe; state should be stored in the pdo_dbh_t structure.Makes sense, even for cleanup. pdo_sqlite_request_shutdown cant free the callback-zval right now.
And one concern: I deliberately left this feature unimplemented so far because the authorization callback will happen "a lot", and frequent callbacks into PHP script will make things slower.It is only called at compiletime of a query! I think thats not as hard! Maybe it could be an optional feature?
I suggest that you adjust your patch to cache the function callback information in the pdo_dbh_t to reduce some of that overhead, and run some benchmarks for a simple authorizer function in PHP that always returns true vs the same script with no authorizer, so that we get a feel for what kind of impact that has for various common queries.The Sqlite-Api keeps the user-authorizer in the userdata-void-pointer. The static definition is only ment for clean up!
One other thing that is important is to ensure that the PHP safe_mode/open_basedir checks have higher priority than the PHP script callback. If safe_mode/open_basedir decide that the path is not accessible, then the PHP script must not be able to override that. However, if safe_mode/open_basedir say that access is ok, the PHP script can optionally override that decision.Have a look on my authorizer, the user-authorizer is only called if your rules gives SQLITE_OK. The user-authorizer is called from a default authorizer, not from the sqlite-api!
--Wez.Regards, Mario
On 11/16/06, Mario Wolff <wolfshoehle@googlemail.com> wrote: Hello list, i've extended sqlite_driver to get access to the authorizer-feature of sqlite. This is my first contact with the Zend-API and my last c skill is more than a bit outdated. Could someone review/cleanup my code to get it merged to the distribution? Hint and comment welcome! Thanks, Mario Wolff PS: Patch applys against 5.2.0! -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Attachment: [text/x-patch] sqlite_driver.diff