Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix authentication so that it works with AS aliases. Ticket #1338. (CVS 2570) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cc7ae73ed01f0b89e31dd8de48b913bb |
User & Date: | drh 2005-07-29 15:36:15 |
Context
2005-07-29
| ||
19:43 | Fix problems caused by over-agressive optimization of ORDER BY in joins. Lots more testing needed. (CVS 2571) check-in: 1a4e526d user: drh tags: trunk | |
15:36 | Fix authentication so that it works with AS aliases. Ticket #1338. (CVS 2570) check-in: cc7ae73e user: drh tags: trunk | |
15:10 | Optimizer now converts OR-connected WHERE-clause terms into an IN operator so that they can be used with indices. There are known problems with the ORDER BY optimization in this and in several prior check-ins. This check-in is not recommended for production use. (CVS 2569) check-in: d23c8bf8 user: drh tags: trunk | |
Changes
Changes to src/auth.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
** ************************************************************************* ** This file contains code used to implement the sqlite3_set_authorizer() ** API. This facility is an optional feature of the library. Embedded ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 ** ** $Id: auth.c,v 1.21 2005/01/29 08:32:44 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** All of the code in this file may be omitted by defining a single ** macro. */ ................................................................................ Table *pTab; /* The table being read */ 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 */ TriggerStack *pStack; /* The stack of current triggers */ if( db->xAuth==0 ) return; assert( pExpr->op==TK_COLUMN ); for(iSrc=0; pTabList && iSrc<pTabList->nSrc; iSrc++){ if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break; } if( iSrc>=0 && pTabList && iSrc<pTabList->nSrc ){ pTab = pTabList->a[iSrc].pTab; }else if( (pStack = pParse->trigStack)!=0 ){ |
|
>
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
** ************************************************************************* ** This file contains code used to implement the sqlite3_set_authorizer() ** API. This facility is an optional feature of the library. Embedded ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 ** ** $Id: auth.c,v 1.22 2005/07/29 15:36:15 drh Exp $ */ #include "sqliteInt.h" /* ** All of the code in this file may be omitted by defining a single ** macro. */ ................................................................................ Table *pTab; /* The table being read */ 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 */ TriggerStack *pStack; /* The stack of current triggers */ if( db->xAuth==0 ) return; if( pExpr->op==TK_AS ) return; assert( pExpr->op==TK_COLUMN ); for(iSrc=0; pTabList && iSrc<pTabList->nSrc; iSrc++){ if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break; } if( iSrc>=0 && pTabList && iSrc<pTabList->nSrc ){ pTab = pTabList->a[iSrc].pTab; }else if( (pStack = pParse->trigStack)!=0 ){ |
Changes to test/auth.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
|
# May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: auth.test,v 1.28 2005/07/23 02:17:03 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is # defined during compilation. ................................................................................ SQLITE_SELECT {} {} {} v1 \ SQLITE_READ t2 a main v1 \ SQLITE_READ t2 b main v1 \ SQLITE_INSERT v1chng {} main r3 \ SQLITE_READ v1 x main r3] } ;# ifcapable view && trigger rename proc {} rename proc_real proc finish_test |
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
|
# May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: auth.test,v 1.29 2005/07/29 15:36:15 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is # defined during compilation. ................................................................................ SQLITE_SELECT {} {} {} v1 \ SQLITE_READ t2 a main v1 \ SQLITE_READ t2 b main v1 \ SQLITE_INSERT v1chng {} main r3 \ SQLITE_READ v1 x main r3] } ;# ifcapable view && trigger # Ticket #1338: Make sure authentication works in the presence of an AS # clause. # do_test auth-5.1 { proc auth {code arg1 arg2 arg3 arg4} { return SQLITE_OK } execsql { SELECT count(a) AS cnt FROM t4 ORDER BY cnt } } {1} rename proc {} rename proc_real proc finish_test |