[Ilugc] problem using popen with xinetd--VERY URGENT

  • From: umavichu1@xxxxxxxxx (Uma Viswanathan)
  • Date: Thu, 3 Jun 2004 00:27:26 -0700 (PDT)

--0-1538988507-1086247646=:61299
Content-Type: text/plain; charset=us-ascii

Hi Jayakumar,
  Thanks for replying.
 
  This should not be a problem, because the code retrieves the username from a 
tag in the xml message that is contained in the body of the http request and 
does the ps --User for this username. It searches if the particular process is 
running for this username retrieved from the message. As I have said, the read 
from the pipe opened to the command fails (when the process is run via xinetd) 
i.e., returns zero bytes as if the particular process is not running for the 
user. However, when run as standalone, the read succeeds and we are able to 
correctly determine if the particular process is already running for the 
username. The same scenario occurs when I try use system() instead of popen. In 
this case also the return value from the system() call is misleading when run 
via xinetd but is correct when run as standalone.
 
   My guess is there may be some parameter that we need to set properly in the 
xinetd.conf file against this service(which is running our application) which 
will enable the popen() or system() to correctly work. If I could get any help 
in this angle that is also welcome

Jayakumar KK <kk_jay82@xxxxxxxxxxx> wrote:
Uma Viswanathan wrote: > Hi,

I am currently working on an application that
receives a HTTP
request,processes it and sends back the response.
Part of the
processing involves validation of the user and to
see if the user
is running a particular process (whose name is
hard coded as of
now). To see if the process is being run by the
user, the
application does a popen to the shell command
(which involves doing
a ps --User | cut ..|grep 
) and reads the response
from the pipe. 

The problem that I am facing is that reading from
the pipe works
fine when the application is run as a standalone,
but when we
register it as a service with xinetd and execute
it, the reading
from the pipe fails. As an alternative, I tried
using system()
command for the above scenario. However, that too
fails when the
application is invoked via inetd. Please offer ur
sugesstions to
overcome this problem...This is VERY URGENT for my
project
completion. Please revert back at the earliest


Hi

I suppose that when u invoke a process thro' xinetd or
other daemons the process is not owned by the user.
hence when u give the ps --User command ur process
wont get listed. try using ps -ax instead of ps
--User.

Thanks
Jayakumar K K

________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. 
http://yahoo.shaadi.com/india-matrimony/


                
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger
--0-1538988507-1086247646=:61299
Content-Type: text/html; charset=us-ascii

<DIV>Hi Jayakumar,</DIV>
<DIV>&nbsp; Thanks for replying.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; This should not be a problem, because the code retrieves the 
username from a tag in the xml message that is contained in the body of the 
http request and does the ps --User for this username. It searches if the 
particular process is running for this username retrieved from the message. As 
I have said, the read from the pipe opened to the command fails (when the 
process is run via xinetd) i.e., returns zero bytes as if the particular 
process is not running for the user. However, when run as standalone, the read 
succeeds and we are able to correctly determine if the particular process is 
already running for the username. The same scenario occurs when I try use 
system() instead of popen. In this case also the return value from the system() 
call is misleading when run via xinetd but is correct when run as 
standalone.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;My guess is there may be some parameter that we need to 
set properly in the xinetd.conf file against this service(which is running our 
application) which will enable the popen() or system() to correctly work. If I 
could get any help in this angle that is also welcome<BR><BR><B><I>Jayakumar KK 
&lt;kk_jay82@xxxxxxxxxxx&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; 
BORDER-LEFT: #1010ff 2px solid">Uma Viswanathan wrote: &gt; Hi,<BR>&gt; &gt; I 
am currently working on an application that<BR>&gt; receives a HTTP<BR>&gt; 
&gt; request,processes it and sends back the response.<BR>&gt; Part of 
the<BR>&gt; &gt; processing involves validation of the user and to<BR>&gt; see 
if the user<BR>&gt; &gt; is running a particular process (whose name is<BR>&gt; 
hard coded as of<BR>&gt; &gt; now). To see if the process is being run by 
the<BR>&gt; user, the<BR>&gt; &gt; application does a popen to the shell 
command<BR>&gt; (which involves doing<BR>&gt; &gt; a ps --User | cut ..|grep 
<BR>&gt; ) and reads the response<BR>&gt; &gt; from the pipe. <BR>&gt; &gt; 
<BR>&gt; &gt; The problem that I am facing is that reading from<BR>&gt; the 
pipe works<BR>&gt; &gt; fine when the application is run as a 
standalone,<BR>&gt; but when we<BR>&gt; &gt; register it as a service with 
xinetd and execute<BR>&
 gt; it,
 the reading<BR>&gt; &gt; from the pipe fails. As an alternative, I 
tried<BR>&gt; using system()<BR>&gt; &gt; command for the above scenario. 
However, that too<BR>&gt; fails when the<BR>&gt; &gt; application is invoked 
via inetd. Please offer ur<BR>&gt; sugesstions to<BR>&gt; &gt; overcome this 
problem...This is VERY URGENT for my<BR>&gt; project<BR>&gt; &gt; completion. 
Please revert back at the earliest<BR>&gt; &gt; <BR><BR>Hi<BR><BR>I suppose 
that when u invoke a process thro' xinetd or<BR>other daemons the process is 
not owned by the user.<BR>hence when u give the ps --User command ur 
process<BR>wont get listed. try using ps -ax instead of 
ps<BR>--User.<BR><BR>Thanks<BR>Jayakumar K 
K<BR><BR>________________________________________________________________________<BR>Yahoo!
 India Matrimony: Find your partner online. 
http://yahoo.shaadi.com/india-matrimony/</BLOCKQUOTE><BR><BR><p>
                <hr size=1><font face=arial size=-1>Do you Yahoo!?<br>Friends.  
Fun. <a href="http://messenger.yahoo.com/";>Try the all-new Yahoo! Messenger</a>
--0-1538988507-1086247646=:61299--

Other related posts: