Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Database path and user roles
Mon, Jan 9 2017 4:36 AMPermanent Link

Hershcu Sorin

Hello

I run the command: SELECT Path FROM Databases WHERE Name = myData

If I run as public user the Path is empty.
As administrator I get right Path.

Is this the normal behavior?
Thanks Sorin
Mon, Jan 9 2017 1:25 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hershcu,

<< I run the command: SELECT Path FROM Databases WHERE Name = myData

If I run as public user the Path is empty.
As administrator I get right Path.

Is this the normal behavior? >>

Yes, this is done as a security measure to ensure that non-administrators do not get access to internal information about the machine on which the EDB Server (or the process that is using EDB) is running.

There *is* a way around this, but you specifically have to take some steps to allow it, namely creating this function in your database(s):

CREATE FUNCTION "GetDatabasePath" (IN "DBName" VARCHAR COLLATE "ANSI")
RETURNS VARCHAR COLLATE "ANSI"
BEGIN
  DECLARE LookupCursor SENSITIVE CURSOR FOR LookupStmt;
  DECLARE Result VARCHAR;

  PREPARE LookupStmt FROM 'SELECT Path FROM Configuration.Databases '+
                          ' WHERE Name = ?';
  OPEN LookupCursor USING DBName;
  FETCH FIRST FROM LookupCursor ('Path') INTO Result;

  RETURN Result;
END

You *can* run such a function as a normal user and have it return the result because such functions/procedures run as the special "System" user, not as the current user.

Tim Young
Elevate Software
www.elevatesoft.com
Image