Page 1 of 1

Read Username(s) from FB 2.5

Posted: Wed 31 Aug 2011 12:32
by werkstattboss
Hi all,
if I try to read a Username via IBCSecurityService I get a message that I have no permission to access security Database ...

Firebird Website says that the only way to work with the 'security2.fdb' in FB > 2.0 is via gsec or the Firebird API.

Gsec seems familiar, though not to be a solution, and the API is what the IBCSecurityService wraps for me doesn't it?
But I haven't found any hint about this.

I use IBDac 3.10... with Delphi 2007 on FB 2.5.

I want to log the users in with their Database Login. So I need to compare Username and password with the input Values.

Is there already a solution ? or
What can I do?

Rolf

Posted: Wed 31 Aug 2011 13:27
by AndreyZ
Hello,

The point is that to get user names, you should use the SYSDBA user. Here is an example:

Code: Select all

procedure TMainForm.BitBtn1Click(Sender: TObject);
var
  i: integer;
begin
  IBCSecurityService1.ClientLibrary := 'fbclient.dll';
  IBCSecurityService1.Username := 'SYSDBA';
  IBCSecurityService1.Password := 'masterkey';
  IBCSecurityService1.LoginPrompt := False;
  IBCSecurityService1.Attach;
  IBCSecurityService1.DisplayUsers;
  for i := 0 to IBCSecurityService1.UserInfosCount - 1 do
    Memo1.Lines.Add(IBCSecurityService1.UserInfos[i].UserName);
  IBCSecurityService1.Detach;
end;
Note that you cannot retrieve passwords because they are encrypted using a one-way encryption algorithm. For more information about it, please refer to the following article: http://www.firebirdfaq.org/faq55

Thank you

Posted: Wed 31 Aug 2011 14:18
by werkstattboss
Thank you.
I think you brought me a big step forward.
My Idea would be, to get the username and the Password anyway, but instead of testing both, I just verify the Username and then log this user with the password from the input on to the Database.
If I get an Error - try again.

Not really state of the art, but you have to walk in the shoes you have.

Thank you again

Rolf