Board index » delphi » Permission problem loading IDAPI32.DLL in different user context (D2NT4)

Permission problem loading IDAPI32.DLL in different user context (D2NT4)

I've made a couple of CGI apps with Delphi these past weeks and I recently
discovered a problem with the BDE:

I use IIS 2.0 (part of NT4) as a test web server, and it runs under an
account with guest priviligies. Everything works ok, but if I'm at the
console and I'm running e.g. BDECFG32, then the CGI apps are prevented
from using the BDE (IDAPI32.DLL)!

If I configure a directory to be accssible by only a couple of users, then
I will get the same problem. IIS will ask the browser for a user name and
password, and if one user has a different access level than say a guest user,
then the guest user will be denied access to IDAPI32.DLL.

The user at the console will see this error dialog:
"dbcgitest.exe - DLL Initialization Failed

Initialization of the dynamic link library
d:\prog\Borland\common files\bde\idapi32.dll failed.
The process is terminating abnormally."

When "OK" is pressed, the following appears in the web browser:
"Exception EDatabaseError in module dbcgitest.exe at 00030D56.
An error occurred while attempting to initialize the Borland Database Engine
(error $2108)."

To verify this for yourselves, all you need is NT4 Server with IIS running.
I've got the same results both at home (default setup) and at work.

Put the following program in your \inetpub\scripts directory and invoke
it from your browser as http://localhost/scripts/dbcgitest.exe. It will
normally work, but if you are logged in as say, administrator, and are using
another IDAPI32 app, like BDECFG32.EXE, it will fail.

--cut  (dbCGITest.dpr)--
program dbCGITest;

{$APPTYPE CONSOLE}
uses windows, dbtables, db;

var i : integer;
begin
  WriteLn('Content-type: text/html');
  WriteLn;
  with ttable.create(nil) do
  try
    DatabaseName := 'DBDEMOS';
    TableName := 'Customer.db';
    Open;
    writeln('<table border>');
    while not eof do
    begin
      write('<tr>');
      for i := 0 to fieldcount - 1 do
        Write('<td>', fields[i].AsString);
      next;
    end;
    writeln('</table>');
  finally
    free;
  end;
end.
--cut--

Workarounds (both non-options for me):
 - grant IIS administrator access. Will pretty much make IIS unusable if you
   wish to limit access to certain dirs
 - limit usage of other BDE apps on the web server. Remotely make
   modifications to idapi.cfg if necessary and generally only run db CGI
   apps from the same user account.

FYI: Error $2108 translates to (from BDE.INT):
  ERRCAT_SYSTEM = $2100
      ERRCODE_CANTFINDIDAPI         = 8;      { Cannot locate IDAPIxx.DLL }

BTW: I tried copying the BDE files to the scripts directory, which resulted
in two-three message boxes being dumped in my face. It looked like it first
tried the idapi32.dll in the current directory, then went for the one in the
BDE directory, complaining as it tried to load each of them. :-)

Any takers?

--
=\                       homepage @ http://www.qsd.no/staff/rune
 *=- R.Moberg, CD-Player Pro info @ http://home.sn.no/home/mobergru/
=/               my own webserver @ http://pumba.qsd.no

 

Re:Permission problem loading IDAPI32.DLL in different user context (D2NT4)


Dear Rune,

I've had the same problem.  My "solution" was to grant high level
privileges to the guest.  

It gets better: My ISAPI programs couldn't write to disk (eg I couldn't log
info into a paradox table) unless the guest user had write access to the
relevant directory.  A ISAPI or CGI program running under IIS seems to
inherit the access rights of the user who has logged on.  (This was with NT
3.51 SP4 and the original IIS).

A dangerous  business!

--
Paul Motyer
pa...@linuxserver.pccity.com.au
SoftStuff, Croydon, Vic,  Australia, 3136.

Rune Moberg <mober...@oslonett.no> wrote in article
<Zx9Xy0JfFyVX08...@oslonett.no>...

Quote
> I've made a couple of CGI apps with Delphi these past weeks and I
recently
> discovered a problem with the BDE:

> I use IIS 2.0 (part of NT4) as a test web server, and it runs under an
> account with guest priviligies. Everything works ok, but if I'm at the
> console and I'm running e.g. BDECFG32, then the CGI apps are prevented
> from using the BDE (IDAPI32.DLL)!

> If I configure a directory to be accssible by only a couple of users,
then
> I will get the same problem. IIS will ask the browser for a user name and
> password, and if one user has a different access level than say a guest
user,
> then the guest user will be denied access to IDAPI32.DLL.

> The user at the console will see this error dialog:
> "dbcgitest.exe - DLL Initialization Failed

> Initialization of the dynamic link library
> d:\prog\Borland\common files\bde\idapi32.dll failed.
> The process is terminating abnormally."

> When "OK" is pressed, the following appears in the web browser:
> "Exception EDatabaseError in module dbcgitest.exe at 00030D56.
> An error occurred while attempting to initialize the Borland Database
Engine
> (error $2108)."

> To verify this for yourselves, all you need is NT4 Server with IIS
running.
> I've got the same results both at home (default setup) and at work.

> Put the following program in your \inetpub\scripts directory and invoke
> it from your browser as http://localhost/scripts/dbcgitest.exe. It will
> normally work, but if you are logged in as say, administrator, and are
using
> another IDAPI32 app, like BDECFG32.EXE, it will fail.

> --cut  (dbCGITest.dpr)--
> program dbCGITest;

> {$APPTYPE CONSOLE}
> uses windows, dbtables, db;

> var i : integer;
> begin
>   WriteLn('Content-type: text/html');
>   WriteLn;
>   with ttable.create(nil) do
>   try
>     DatabaseName := 'DBDEMOS';
>     TableName := 'Customer.db';
>     Open;
>     writeln('<table border>');
>     while not eof do
>     begin
>       write('<tr>');
>       for i := 0 to fieldcount - 1 do
>         Write('<td>', fields[i].AsString);
>       next;
>     end;
>     writeln('</table>');
>   finally
>     free;
>   end;
> end.
> --cut--

> Workarounds (both non-options for me):
>  - grant IIS administrator access. Will pretty much make IIS unusable if
you
>    wish to limit access to certain dirs
>  - limit usage of other BDE apps on the web server. Remotely make
>    modifications to idapi.cfg if necessary and generally only run db CGI
>    apps from the same user account.

> FYI: Error $2108 translates to (from BDE.INT):
>   ERRCAT_SYSTEM = $2100
>       ERRCODE_CANTFINDIDAPI         = 8;      { Cannot locate IDAPIxx.DLL
}

> BTW: I tried copying the BDE files to the scripts directory, which
resulted
> in two-three message boxes being dumped in my face. It looked like it
first
> tried the idapi32.dll in the current directory, then went for the one in
the
> BDE directory, complaining as it tried to load each of them. :-)

> Any takers?

> --
> =\                       homepage @ http://www.qsd.no/staff/rune
>  *=- R.Moberg, CD-Player Pro info @ http://home.sn.no/home/mobergru/
> =/               my own webserver @ http://pumba.qsd.no

Re:Permission problem loading IDAPI32.DLL in different user context (D2NT4)


In article <01bbb963$db875180$114c8...@paulm.pccity>,

Quote
"Paul Motyer" <pa...@linusserver.pccity.com.au> wrote:
>I've had the same problem.  My "solution" was to grant high level
>privileges to the guest.  

Yes, but if you do that, you pretty much loose the ability to have
different access levels to documents or CGI apps.

Another tidbit is that I have a CGI app that runs with different user
permissions. Users can log in, and they're usually either domain
users or domain administrators...

Quote
>It gets better: My ISAPI programs couldn't write to disk (eg I couldn't log
>info into a paradox table) unless the guest user had write access to the
>relevant directory.  A ISAPI or CGI program running under IIS seems to
>inherit the access rights of the user who has logged on.  (This was with NT
>3.51 SP4 and the original IIS).

This is normal and what I expected. A CGI app can't all of the sudden
run as an administrator. I realise that it's awkward, since the CGI app
needs write access to the database files, pdoxusrs.net (it must be able to
add it too), the exe directory (this one puzzled me) and the directory where
the database resides (I think the .lck files would go there).

--
=\                       homepage @ http://www.qsd.no/staff/rune
 *=- R.Moberg, CD-Player Pro info @ http://home.sn.no/home/mobergru/
=/               my own webserver @ http://pumba.qsd.no

Other Threads