mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Always enable URI filenames when compiling with SQLITE_HAS_CODEC. Also allow
plaintext keys using the key= query parameter. FossilOrigin-Name: 31a51b4d168065fa59cc0e52ba798bd87ac82160c675bd531442b65133edb401
This commit is contained in:
16
src/main.c
16
src/main.c
@@ -3095,16 +3095,18 @@ opendb_out:
|
||||
#endif
|
||||
#if defined(SQLITE_HAS_CODEC)
|
||||
if( rc==SQLITE_OK ){
|
||||
const char *zHexKey = sqlite3_uri_parameter(zOpen, "hexkey");
|
||||
if( zHexKey && zHexKey[0] ){
|
||||
const char *zKey;
|
||||
if( (zKey = sqlite3_uri_parameter(zOpen, "hexkey"))!=0 && zKey[0] ){;
|
||||
u8 iByte;
|
||||
int i;
|
||||
char zKey[40];
|
||||
for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zHexKey[i]); i++){
|
||||
iByte = (iByte<<4) + sqlite3HexToInt(zHexKey[i]);
|
||||
if( (i&1)!=0 ) zKey[i/2] = iByte;
|
||||
char zDecoded[40];
|
||||
for(i=0, iByte=0; i<sizeof(zDecoded)*2 && sqlite3Isxdigit(zKey[i]); i++){
|
||||
iByte = (iByte<<4) + sqlite3HexToInt(zKey[i]);
|
||||
if( (i&1)!=0 ) zDecoded[i/2] = iByte;
|
||||
}
|
||||
sqlite3_key_v2(db, 0, zKey, i/2);
|
||||
sqlite3_key_v2(db, 0, zDecoded, i/2);
|
||||
}else if( (zKey = sqlite3_uri_parameter(zOpen, "key"))!=0 ){
|
||||
sqlite3_key_v2(db, 0, zKey, sqlite3Strlen30(zKey));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user