Read Username(s) from FB 2.5

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
werkstattboss
Posts: 20
Joined: Fri 15 May 2009 17:53

Read Username(s) from FB 2.5

Post by werkstattboss » Wed 31 Aug 2011 12:32

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

AndreyZ

Post by AndreyZ » Wed 31 Aug 2011 13:27

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

werkstattboss
Posts: 20
Joined: Fri 15 May 2009 17:53

Thank you

Post by werkstattboss » Wed 31 Aug 2011 14:18

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

Post Reply