aboutsummaryrefslogtreecommitdiff
path: root/src/tclsqlite.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-08-26 21:33:34 +0000
committerdrh <drh@noemail.net>2008-08-26 21:33:34 +0000
commit1f1549f8f3d4acaafb5b4da014389af9b404ceaf (patch)
tree80f9df629ce27f9505f5f8c95e60262724d3b4c7 /src/tclsqlite.c
parent7426f864ae2df7e20c90d7132b20b9707900fc51 (diff)
downloadsqlite-1f1549f8f3d4acaafb5b4da014389af9b404ceaf.tar.gz
sqlite-1f1549f8f3d4acaafb5b4da014389af9b404ceaf.zip
In the TCL interface, disable the authorizer when during a BEGIN, COMMIT,
or ROLLBACK associated with the transaction method. Ticket #3336. (CVS 5618) FossilOrigin-Name: 7e1032ab0031ba535f37b6338a3ac81cb1449d76
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r--src/tclsqlite.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 35a69b8c1..3da23c3ad 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -12,7 +12,7 @@
** A TCL Interface to SQLite. Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite.
**
-** $Id: tclsqlite.c,v 1.219 2008/07/10 17:52:49 danielk1977 Exp $
+** $Id: tclsqlite.c,v 1.220 2008/08/26 21:33:34 drh Exp $
*/
#include "tcl.h"
#include <errno.h>
@@ -104,6 +104,7 @@ struct SqliteDb {
char *zProfile; /* The profile callback routine */
char *zProgress; /* The progress callback routine */
char *zAuth; /* The authorization callback routine */
+ int disableAuth; /* Disable the authorizer if it exists */
char *zNull; /* Text to substitute for an SQL NULL value */
SqlFunc *pFunc; /* List of SQL functions */
Tcl_Obj *pUpdateHook; /* Update hook script (if any) */
@@ -761,6 +762,7 @@ static int auth_callback(
int rc;
const char *zReply;
SqliteDb *pDb = (SqliteDb*)pArg;
+ if( pDb->disableAuth ) return SQLITE_OK;
switch( code ){
case SQLITE_COPY : zCode="SQLITE_COPY"; break;
@@ -2224,7 +2226,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
}
inTrans = !sqlite3_get_autocommit(pDb->db);
if( !inTrans ){
+ pDb->disableAuth++;
(void)sqlite3_exec(pDb->db, zBegin, 0, 0, 0);
+ pDb->disableAuth--;
}
rc = Tcl_EvalObjEx(interp, pScript, 0);
if( !inTrans ){
@@ -2234,9 +2238,11 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
} else {
zEnd = "COMMIT";
}
+ pDb->disableAuth++;
if( sqlite3_exec(pDb->db, zEnd, 0, 0, 0) ){
sqlite3_exec(pDb->db, "ROLLBACK", 0, 0, 0);
}
+ pDb->disableAuth--;
}
break;
}