#1 2013-10-04 08:42:28

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Password protected database not working

When I create DBServer with password protection, the DBServer is not working (ESQLite3Exception is raised with message: "library routine called out of sequence").

 WPlaceServer := TWPManagerServer.Create(WPModel, DefaultWorkPlace + 'wp.db3', true, 'password');
20131004 11315922  +    TWPManagerServer(0177FA90).wps/auth?UserName=Admin&Password=d9d759bb3ce365ff9ab7f15f6ee96e64be0886b15df2e547fb13f95faef7d4ec&ClientNonce=fee18bc34e265666e1549fe5f1e8ef9b99dfede52907dbd2946be260e3266277
20131004 11315922 call  	TWPManagerServer(0177FA90) Auth
20131004 11315922 cache 	TSQLDatabase(017FA9A0) not in cache
20131004 11315922 SQL   	TWPManagerServer(0177FA90) SELECT ID,LogonName,DisplayName,PasswordHashHexa,GroupRights FROM AuthUser WHERE LogonName=:('Admin'): LIMIT 1; prepared as SELECT ID,LogonName,DisplayName,PasswordHashHexa,GroupRights FROM AuthUser WHERE LogonName=? LIMIT 1; with 1 param
20131004 11315922 EXC   	ESQLite3Exception ("library routine called out of sequence") at 002A24A3 SynSQLite3.sqlite3_check (3977)  stack trace API 00220850 SynCommons.SynRtlUnwind (31343) 000096C4 System.@HandleOnException (18403) 
20131004 11315922 res   	null

Offline

#2 2013-10-04 10:00:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Password protected database not working

... when there is no password, there is no problem?

Ensure no previous database file is existing before running the server with a password - or ensure you converted the database file first.

Offline

#3 2013-10-04 10:24:12

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Re: Password protected database not working

Without password works fine. Before execute application the database file does not exists. Version latest.

Offline

#4 2013-10-04 11:50:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Password protected database not working

Are you using the mapped files pragma explicitly?
Or any other SQLite3 custom pragma?
Are you in Win32 or Win64 mode?
Which version of Delphi?
Are you sure you retrieved the latest sqlite3 .obj files (i.e. 3.8.0.2)?

Do the regression tests pass?
This kind of configuration is tested in TTestExternalDatabase.CryptedDatabase of SynSelfTest.pas.
I just run the tests with no problem.

Offline

#5 2013-10-07 06:05:08

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Re: Password protected database not working

I found the problem - after starting the program, I create backup of the database:

WPlaceServer.BackupGZ(DefaultWorkPlace + 'wp.db3.backup');

After this WPlaceServer is not working correctly.

Offline

#6 2013-10-07 07:14:26

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Password protected database not working

Yes, backup is not tested with encryption...

The faster and safer is to backup the database file BEFORE starting the server.

I've added a ticket in order to support the official backup API of SQlite3.

Offline

Board footer

Powered by FluxBB