/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/attach.c.

308
309
310
311
312
313
314


315

316
317
318
319
320
321
322
323
324
  ){
    pParse->nErr++;
    goto attach_end;
  }

#ifndef SQLITE_OMIT_AUTHORIZATION
  if( pAuthArg ){


    char *zAuthArg = pAuthArg->u.zToken;

    if( NEVER(zAuthArg==0) ){
      goto attach_end;
    }
    rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0);
    if(rc!=SQLITE_OK ){
      goto attach_end;
    }
  }
#endif /* SQLITE_OMIT_AUTHORIZATION */







>
>
|
>
|
<







308
309
310
311
312
313
314
315
316
317
318
319

320
321
322
323
324
325
326
  ){
    pParse->nErr++;
    goto attach_end;
  }

#ifndef SQLITE_OMIT_AUTHORIZATION
  if( pAuthArg ){
    char *zAuthArg;
    if( pAuthArg->op==TK_STRING ){
      zAuthArg = pAuthArg->u.zToken;
    }else{
      zAuthArg = 0;

    }
    rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0);
    if(rc!=SQLITE_OK ){
      goto attach_end;
    }
  }
#endif /* SQLITE_OMIT_AUTHORIZATION */

Changes to test/auth.test.

1624
1625
1626
1627
1628
1629
1630
1631
1632
1633











1634
1635
1636
1637
1638
1639
1640
      }
      return SQLITE_OK
    }
    catchsql {
      ATTACH DATABASE ':memory:' AS test1
    }
  } {0 {}}
  do_test auth-1.252 {
    set ::authargs
  } {:memory: {} {} {}}











  do_test auth-1.253 {
    catchsql {DETACH DATABASE test1}
    proc auth {code arg1 arg2 arg3 arg4} {
      if {$code=="SQLITE_ATTACH"} {
        set ::authargs [list $arg1 $arg2 $arg3 $arg4]
        return SQLITE_DENY
      }







|


>
>
>
>
>
>
>
>
>
>
>







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