8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 21:23:04 +01:00

Improve detection and/or initialisation of security database

This commit is contained in:
Paul Reeves 2024-06-18 10:19:27 +02:00
parent 9f512314fc
commit 57546294bb
2 changed files with 28 additions and 7 deletions

View File

@ -482,7 +482,7 @@ Source: {#FilesDir}\databases.conf; DestDir: {app}; Components: ClientComponent;
Source: {#FilesDir}\replication.conf; DestDir: {app}; DestName: replication.conf.default; Components: ServerComponent;
Source: {#FilesDir}\replication.conf; DestDir: {app}; Components: ServerComponent; Flags: uninsneveruninstall onlyifdoesntexist; check: NoReplicationConfExists;
Source: {#FilesDir}\security{#FB_MAJOR_VER}.fdb; DestDir: {app}; Destname: security{#FB_MAJOR_VER}.fdb.empty; Components: ServerComponent;
Source: {#FilesDir}\security{#FB_MAJOR_VER}.fdb; DestDir: {app}; Components: ServerComponent; Flags: uninsneveruninstall onlyifdoesntexist
Source: {#FilesDir}\security{#FB_MAJOR_VER}.fdb; DestDir: {app}; Components: ServerComponent; Check: ConfigureAuthentication; Flags: uninsneveruninstall onlyifdoesntexist
Source: {#FilesDir}\firebird.msg; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
Source: {#FilesDir}\firebird.log; DestDir: {app}; Components: ServerComponent; Flags: uninsneveruninstall skipifsourcedoesntexist external dontcopy
@ -635,6 +635,10 @@ program Setup;
// b) Debugged.
// This hopefully keeps the main script simpler to follow.
const
UNDEFINED = -1;
Var
InstallRootDir: String;
FirebirdConfSaved: String;
@ -650,6 +654,8 @@ Var
SYSDBAPassword: String; // SYSDBA password
init_secdb: integer; // Is set to UNDEFINED by default in InitializeSetup
#ifdef setuplogging
// Not yet implemented - leave log in %TEMP%
// OkToCopyLog : Boolean; // Set when installation is complete.
@ -741,6 +747,7 @@ begin
InitExistingInstallRecords;
AnalyzeEnvironment;
result := AnalysisAssessment;
init_secdb := UNDEFINED;
end;
@ -1052,6 +1059,7 @@ begin
IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\security{#FB_MAJOR_VER}.fdb', false);
IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\replication.conf', false);
if init_secdb = 1 then
InitSecurityDB;
//Fix up conf file

View File

@ -1180,14 +1180,27 @@ end;
function ConfigureAuthentication: boolean;
// This function should only be called once - when the innosetup installer tries to
// install the secdb. If it is called a second time it will always find the secdb
// exists, even if it hasn't been configured. The only real way to test whether we
// should configure authentication is to actually _open_ a database and read the
// sec$users table. Except we cannot do that as we need this information before we
// install the files needed to read the database.
begin
if IsNotServerInstall then
// if it is the first time we are called test for existence of the security db
if init_secdb = UNDEFINED then begin
if FileExists(WizardDirValue + '\security{#FB_MAJOR_VER}.fdb') then
Result := false
else
if FileExists(WizardDirValue + '\security5.fdb') then
Result := false
Result := true
end
else
Result := true;
// else the result is the current setting of init_secdb
Result := Boolean(init_secdb);
// Whatever the result, cast it to an integer and update init_secdb
init_secdb := Integer(Result);
end;