diff options
author | dan <dan@noemail.net> | 2015-01-01 18:03:49 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2015-01-01 18:03:49 +0000 |
commit | 37db72f1f7ca41c61b1c084bdb75f3111ceba6f8 (patch) | |
tree | 5a01dcb28b6513353a64e93b11d6243845e69bc7 /src/auth.c | |
parent | 6024772ba292a9abc6810dd0b12767d02b47ccf1 (diff) | |
parent | a0de826c9ff84bd19de76ebbc0d4bdafa9686d3a (diff) | |
download | sqlite-37db72f1f7ca41c61b1c084bdb75f3111ceba6f8.tar.gz sqlite-37db72f1f7ca41c61b1c084bdb75f3111ceba6f8.zip |
Merge latest trunk changes with this branch.
FossilOrigin-Name: 4b3651677e7132c4c45605bc1f216fc08ef31198
Diffstat (limited to 'src/auth.c')
-rw-r--r-- | src/auth.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/auth.c b/src/auth.c index d38bb836a..9768fc2fc 100644 --- a/src/auth.c +++ b/src/auth.c @@ -72,8 +72,11 @@ int sqlite3_set_authorizer( int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pArg ){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(db->mutex); - db->xAuth = xAuth; + db->xAuth = (sqlite3_xauth)xAuth; db->pAuthArg = pArg; sqlite3ExpirePreparedStatements(db); sqlite3_mutex_leave(db->mutex); @@ -108,7 +111,11 @@ int sqlite3AuthReadCol( char *zDb = db->aDb[iDb].zName; /* Name of attached database */ int rc; /* Auth callback return code */ - rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext); + rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext +#ifdef SQLITE_USER_AUTHENTICATION + ,db->auth.zAuthUser +#endif + ); if( rc==SQLITE_DENY ){ if( db->nDb>2 || iDb!=0 ){ sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited",zDb,zTab,zCol); @@ -208,7 +215,11 @@ int sqlite3AuthCheck( if( db->xAuth==0 ){ return SQLITE_OK; } - rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext); + rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext +#ifdef SQLITE_USER_AUTHENTICATION + ,db->auth.zAuthUser +#endif + ); if( rc==SQLITE_DENY ){ sqlite3ErrorMsg(pParse, "not authorized"); pParse->rc = SQLITE_AUTH; |