Subject: Calling shell from server application - please help.
From: [email-masked] (Ian Collins)

25 May 1998 05:33:46 -0700
Message-ID: <F3332E1142DFD111873E0000F879A2BA0FACDF.cygnus.gnu-win32@NTMAIL>
Mime-Version: 1.0
Content-Type: text/plain
To: "'Gnu Mailing list'" <[email-masked]>

I have a client server application whose server end is running in the
Gnu-Win32 environment.
I start this process from inetd. I have an entry in services as,

kidd            2326/tcp                 #Kiwiplan ISAM database server 

and an entry in inetd.conf as,

kidd    stream  tcp     nowait  root    /usr3/ian/kids/kidd kidd 

The kidd process starts fine (just like Unix!).
This process has an internal protocol that gets information from the
client, authenticates it, and then starts another process (dependant on
the authentication information). I start this second process using,

sexeclp(hToken, myproc, argvv, 0);

(I got hToken from the NT authentication).

Again, this process starts fine, and for 99% of it's functionality works
like a dream.
HOWEVER (theres always a "however'), part of the servers functionality
is to access the operating system via shell scripts (for example, when
it has to sort a file, it calls a shell script).

EVERY TIME, A SHELL SCRIPT IS EXECUTED, AN ERROR IS GENERATED,
"Permission Denied".

I created a test harness that allows the client to request an
application to be executed by the server to try to isolate the problem.
I told it to execute a script called "ian".

All "ian" does is,

echo Hello World > /usr3/ian/ian.out

It responds with "ian: Permission Denied".

I know I have a valid PATH setup.
I have tried putting a #!/bin/sh in "ian".
I have setup a valid SHELL variable in the server app.

If my client tells the server to execute a program like for instance,
"mount", then it works fine.

More information:
I was using "system" to execute the scripts. I changed this to a "fork"
and "execvp", and hey Presto, the scripts work!
HOWEVER, if those scripts call any other scipts (or programs), then
those programs fail!

PLEASE HELP! 

Ian Collins. 
KIWIPLAN NZ.

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".