OLD | NEW |
1 /* | 1 /* |
2 ** 2003 January 11 | 2 ** 2003 January 11 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 ** If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed | 100 ** If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed |
101 ** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE | 101 ** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE |
102 ** is treated as SQLITE_DENY. In this case an error is left in pParse. | 102 ** is treated as SQLITE_DENY. In this case an error is left in pParse. |
103 */ | 103 */ |
104 int sqlite3AuthReadCol( | 104 int sqlite3AuthReadCol( |
105 Parse *pParse, /* The parser context */ | 105 Parse *pParse, /* The parser context */ |
106 const char *zTab, /* Table name */ | 106 const char *zTab, /* Table name */ |
107 const char *zCol, /* Column name */ | 107 const char *zCol, /* Column name */ |
108 int iDb /* Index of containing database. */ | 108 int iDb /* Index of containing database. */ |
109 ){ | 109 ){ |
110 sqlite3 *db = pParse->db; /* Database handle */ | 110 sqlite3 *db = pParse->db; /* Database handle */ |
111 char *zDb = db->aDb[iDb].zName; /* Name of attached database */ | 111 char *zDb = db->aDb[iDb].zDbSName; /* Schema name of attached database */ |
112 int rc; /* Auth callback return code */ | 112 int rc; /* Auth callback return code */ |
113 | 113 |
| 114 if( db->init.busy ) return SQLITE_OK; |
114 rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext | 115 rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext |
115 #ifdef SQLITE_USER_AUTHENTICATION | 116 #ifdef SQLITE_USER_AUTHENTICATION |
116 ,db->auth.zAuthUser | 117 ,db->auth.zAuthUser |
117 #endif | 118 #endif |
118 ); | 119 ); |
119 if( rc==SQLITE_DENY ){ | 120 if( rc==SQLITE_DENY ){ |
120 if( db->nDb>2 || iDb!=0 ){ | 121 if( db->nDb>2 || iDb!=0 ){ |
121 sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited",zDb,zTab,zCol); | 122 sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited",zDb,zTab,zCol); |
122 }else{ | 123 }else{ |
123 sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited", zTab, zCol); | 124 sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited", zTab, zCol); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 ** by sqlite3AuthContextPush | 252 ** by sqlite3AuthContextPush |
252 */ | 253 */ |
253 void sqlite3AuthContextPop(AuthContext *pContext){ | 254 void sqlite3AuthContextPop(AuthContext *pContext){ |
254 if( pContext->pParse ){ | 255 if( pContext->pParse ){ |
255 pContext->pParse->zAuthContext = pContext->zAuthContext; | 256 pContext->pParse->zAuthContext = pContext->zAuthContext; |
256 pContext->pParse = 0; | 257 pContext->pParse = 0; |
257 } | 258 } |
258 } | 259 } |
259 | 260 |
260 #endif /* SQLITE_OMIT_AUTHORIZATION */ | 261 #endif /* SQLITE_OMIT_AUTHORIZATION */ |
OLD | NEW |