diff options
author | drh <drh@noemail.net> | 2003-04-24 01:45:04 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2003-04-24 01:45:04 +0000 |
commit | 5cf590c128509b27de24da8f66b717f0c8d8afee (patch) | |
tree | 376e8a0e60116c459d73c0564a92d5b649bf2fd0 /src/auth.c | |
parent | b5a20d3cebe7872a747b3d316403fa36fb46b1f2 (diff) | |
download | sqlite-5cf590c128509b27de24da8f66b717f0c8d8afee.tar.gz sqlite-5cf590c128509b27de24da8f66b717f0c8d8afee.zip |
Fix some issues with INSTEAD OF triggers. (CVS 930)
FossilOrigin-Name: 206b17397b1d2b55179c935927ff1d8215728c32
Diffstat (limited to 'src/auth.c')
-rw-r--r-- | src/auth.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/auth.c b/src/auth.c index 47b6600a5..4703ba013 100644 --- a/src/auth.c +++ b/src/auth.c @@ -14,7 +14,7 @@ ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 ** -** $Id: auth.c,v 1.6 2003/04/22 20:30:38 drh Exp $ +** $Id: auth.c,v 1.7 2003/04/24 01:45:04 drh Exp $ */ #include "sqliteInt.h" @@ -95,11 +95,7 @@ void sqliteAuthRead( const char *zCol; /* Name of the column of the table */ int iSrc; /* Index in pTabList->a[] of table being read */ const char *zDBase; /* Name of database being accessed */ - const char *zTrig; /* Name of the trigger doing the accessing */ - TriggerStack *pStack; /* The stack of current triggers */ - pStack = pParse->trigStack; - zTrig = pStack ? pStack->pTrigger->name : 0; if( db->xAuth==0 ) return; assert( pExpr->op==TK_COLUMN ); iSrc = pExpr->iTable - base; @@ -109,6 +105,8 @@ void sqliteAuthRead( /* This must be an attempt to read the NEW or OLD pseudo-tables ** of a trigger. */ + TriggerStack *pStack; /* The stack of current triggers */ + pStack = pParse->trigStack; assert( pStack!=0 ); assert( pExpr->iTable==pStack->newIdx || pExpr->iTable==pStack->oldIdx ); pTab = pStack->pTab; @@ -123,9 +121,10 @@ void sqliteAuthRead( }else{ zCol = "ROWID"; } - assert( pExpr->iDb>=0 && pExpr->iDb<db->nDb ); + assert( pExpr->iDb<db->nDb ); zDBase = db->aDb[pExpr->iDb].zName; - rc = db->xAuth(db->pAuthArg, SQLITE_READ, pTab->zName, zCol, zDBase, zTrig); + rc = db->xAuth(db->pAuthArg, SQLITE_READ, pTab->zName, zCol, zDBase, + pParse->zAuthContext); if( rc==SQLITE_IGNORE ){ pExpr->op = TK_NULL; }else if( rc==SQLITE_DENY ){ @@ -158,13 +157,11 @@ int sqliteAuthCheck( ){ sqlite *db = pParse->db; int rc; - const char *zTrigName; if( db->xAuth==0 ){ return SQLITE_OK; } - zTrigName = pParse->trigStack ? pParse->trigStack->pTrigger->name : 0; - rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, zTrigName); + rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext); if( rc==SQLITE_DENY ){ sqliteSetString(&pParse->zErrMsg, "not authorized", 0); pParse->rc = SQLITE_AUTH; |