/ Check-in [e64e1453]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the ATTACH command so that the filename argument can be any expression and so that if authorizer callback gets a NULL pointer for the filename if the filename argument is anything other than a string literal. Ticket [9013e13dba5b58c7]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e64e1453a9c204d93de1af92dc0b3ca26762b024
User & Date: drh 2011-02-04 00:51:16
Context
2011-02-04
05:47
If a deferred foreign key constraint fails on a statement that is not part of a larger transation, make sure that the statement fully ends so that subsequent invocations of the same statement will not pass the constraint because they think the transaction is not closed. This is a merge of the deferred-fk-quirk branch together with a test case. check-in: 2f94d462 user: drh tags: trunk
00:51
Fix the ATTACH command so that the filename argument can be any expression and so that if authorizer callback gets a NULL pointer for the filename if the filename argument is anything other than a string literal. Ticket [9013e13dba5b58c7] check-in: e64e1453 user: drh tags: trunk
2011-02-03
12:48
Extra tests for fts4 compress/uncompress hooks. Fix some minor problems with the same. check-in: 80225abe user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/attach.c.

   308    308     ){
   309    309       pParse->nErr++;
   310    310       goto attach_end;
   311    311     }
   312    312   
   313    313   #ifndef SQLITE_OMIT_AUTHORIZATION
   314    314     if( pAuthArg ){
   315         -    char *zAuthArg = pAuthArg->u.zToken;
   316         -    if( NEVER(zAuthArg==0) ){
   317         -      goto attach_end;
          315  +    char *zAuthArg;
          316  +    if( pAuthArg->op==TK_STRING ){
          317  +      zAuthArg = pAuthArg->u.zToken;
          318  +    }else{
          319  +      zAuthArg = 0;
   318    320       }
   319    321       rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0);
   320    322       if(rc!=SQLITE_OK ){
   321    323         goto attach_end;
   322    324       }
   323    325     }
   324    326   #endif /* SQLITE_OMIT_AUTHORIZATION */

Changes to test/auth.test.

  1624   1624         }
  1625   1625         return SQLITE_OK
  1626   1626       }
  1627   1627       catchsql {
  1628   1628         ATTACH DATABASE ':memory:' AS test1
  1629   1629       }
  1630   1630     } {0 {}}
  1631         -  do_test auth-1.252 {
         1631  +  do_test auth-1.252a {
  1632   1632       set ::authargs
  1633   1633     } {:memory: {} {} {}}
         1634  +  do_test auth-1.252b {
         1635  +    db eval {DETACH test1}
         1636  +    set ::attachfilename :memory:
         1637  +    db eval {ATTACH $::attachfilename AS test1}
         1638  +    set ::authargs
         1639  +  } {{} {} {} {}}
         1640  +  do_test auth-1.252c {
         1641  +    db eval {DETACH test1}
         1642  +    db eval {ATTACH ':mem' || 'ory:' AS test1}
         1643  +    set ::authargs
         1644  +  } {{} {} {} {}}
  1634   1645     do_test auth-1.253 {
  1635   1646       catchsql {DETACH DATABASE test1}
  1636   1647       proc auth {code arg1 arg2 arg3 arg4} {
  1637   1648         if {$code=="SQLITE_ATTACH"} {
  1638   1649           set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1639   1650           return SQLITE_DENY
  1640   1651         }