diff options
Diffstat (limited to 'ext/sqlite/libsqlite/src/auth.c')
-rw-r--r-- | ext/sqlite/libsqlite/src/auth.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/ext/sqlite/libsqlite/src/auth.c b/ext/sqlite/libsqlite/src/auth.c index 06b8126ae0..3f861c710d 100644 --- a/ext/sqlite/libsqlite/src/auth.c +++ b/ext/sqlite/libsqlite/src/auth.c @@ -85,12 +85,9 @@ int sqlite_set_authorizer( ** user-supplied authorization function returned an illegal value. */ static void sqliteAuthBadReturnCode(Parse *pParse, int rc){ - char zBuf[20]; - sprintf(zBuf, "(%d)", rc); - sqliteSetString(&pParse->zErrMsg, "illegal return value ", zBuf, - " from the authorization function - should be SQLITE_OK, " - "SQLITE_IGNORE, or SQLITE_DENY", (char*)0); - pParse->nErr++; + sqliteErrorMsg(pParse, "illegal return value (%d) from the " + "authorization function - should be SQLITE_OK, SQLITE_IGNORE, " + "or SQLITE_DENY", rc); pParse->rc = SQLITE_MISUSE; } @@ -150,13 +147,11 @@ void sqliteAuthRead( pExpr->op = TK_NULL; }else if( rc==SQLITE_DENY ){ if( db->nDb>2 || pExpr->iDb!=0 ){ - sqliteSetString(&pParse->zErrMsg,"access to ", zDBase, ".", - pTab->zName, ".", zCol, " is prohibited", (char*)0); + sqliteErrorMsg(pParse, "access to %s.%s.%s is prohibited", + zDBase, pTab->zName, zCol); }else{ - sqliteSetString(&pParse->zErrMsg,"access to ", pTab->zName, ".", - zCol, " is prohibited", (char*)0); + sqliteErrorMsg(pParse, "access to %s.%s is prohibited", pTab->zName,zCol); } - pParse->nErr++; pParse->rc = SQLITE_AUTH; }else if( rc!=SQLITE_OK ){ sqliteAuthBadReturnCode(pParse, rc); @@ -179,14 +174,13 @@ int sqliteAuthCheck( sqlite *db = pParse->db; int rc; - if( db->xAuth==0 ){ + if( db->init.busy || db->xAuth==0 ){ return SQLITE_OK; } rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext); if( rc==SQLITE_DENY ){ - sqliteSetString(&pParse->zErrMsg, "not authorized", (char*)0); + sqliteErrorMsg(pParse, "not authorized"); pParse->rc = SQLITE_AUTH; - pParse->nErr++; }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){ rc = SQLITE_DENY; sqliteAuthBadReturnCode(pParse, rc); |