Issue Details (XML | Word | Printable)

Key: CORE-5292
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Alexander Peshkov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Database corrupted when trying to encrypt it but appropriate key is missing

Created: 24/Jun/16 09:18 AM   Updated: 29/Oct/16 12:16 PM
Component/s: None
Affects Version/s: 4.0 Initial, 3.0.0
Fix Version/s: 3.0.1, 4.0 Alpha 1

QA Status: Deferred
Test Details:
Could NOT reproduce on:
1) LI-T4.0.0.238 (build on sources of 23-JUN-2016)
2) WI-V3.0.1.32539 (SNAPSHOT of 19-JUN-2016)
3) WI-T4.0.0.258 (SNAPSHOT of 19-JUN-2016), WI-T4.0.0.267 (SNAPSHOT of 23-JUN-2016)
(every of them use SS arch.)

In all cases name "CryptPluginName" was used (and there was no such file), but 'encrypted' flag always stay unchanged.

This is .sh for checking on Linux:
===
fbc=/root/downloads/chroot/64-gcc.4.8.2/opt/fb40hist/bin
host=localhost/3407
dbnm=/var/db/fb40/c5292.fdb
rm -f /var/db/fb40/c5292.fdb

echo "create database '$host:$dbnm';" | $fbc/isql -q -z

echo "set list on; show database; select * from mon\$database; commit; alter database encrypt with \"CryptPluginName\" key KeyName; commit; show database; select * from mon\$database;" \
     | $fbc/isql $host:$dbnm \
     | grep -i crypt

$fbc/gstat -h $host:$dbnm | grep -i attrib
===

Its output:
===
ISQL Version: LI-T4.0.0.238 Firebird 4.0 Unstable
Server version:
LI-T4.0.0.238 Firebird 4.0 Unstable
LI-T4.0.0.238 Firebird 4.0 Unstable/tcp (oel64)/P13
LI-T4.0.0.238 Firebird 4.0 Unstable/tcp (oel64)/P13
Database not encrypted
MON$CRYPT_PAGE 0
Statement failed, SQLSTATE = HY024
unsuccessful metadata update
-ALTER DATABASE failed
-Crypt plugin CryptPluginName failed to load
Database not encrypted
MON$CRYPT_PAGE 0
        Attributes force write
===

This is batch for checking on Windows:
===
@echo off
setlocal
set fbc=C:\MIX\firebird\fb40tmp
set host=localhost/3401
set dbnm=C:\MIX\firebird\QA\fbt-repo\tmp\c5292-40.fdb

del %dbnm% 2>nul

echo create database '%host%:%dbnm%'; | %fbc%\isql -q -z

echo show version; alter database encrypt with "CryptPluginName" key KeyName; commit; show database; ^
     | %fbc%\isql %host%:%dbnm% ^
     | findstr /i /c:encrypt

gstat -z -h %host%:%dbnm% | findstr /i /c:attrib
===

Its output:
===
ISQL Version: WI-T4.0.0.267 Firebird 4.0 Unstable
Server version:
WI-T4.0.0.267 Firebird 4.0 Unstable
WI-T4.0.0.267 Firebird 4.0 Unstable/tcp (csprog)/P13
WI-T4.0.0.267 Firebird 4.0 Unstable/tcp (csprog)/P13
Statement failed, SQLSTATE = HY024
unsuccessful metadata update
-ALTER DATABASE failed
-Crypt plugin CryptPluginName failed to load
Database not encrypted
        Attributes force write
===

Any idea how to implement this test properly ?


 Description  « Hide
When one issues

alter database encrypt with "CryptPluginName" key KeyName;

but key is missing for some reason (up to incorrectly typed name) plugin correctly rejects an attempt with an exception but database header gets corrupted (flag 'encypted' is anyway set).

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.