1833194 Members
3297 Online
110051 Solutions
New Discussion

Passing parms to inetd

 
Scott McCort
Advisor

Passing parms to inetd

Is there a way to pass parameters to inetd. I have configured a port in /etc/services and have set it up in /etc/inetd.conf. When I make a connection to that port it calls the appropriate program. This is working fine. I want to be able to pass a parameter to the program when I make the port connection. i.e.
telnet host_name port_num parameter.
Is this even possible?
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: Passing parms to inetd

Just do a "man inetd.conf"; it will tell you all you need to know but, yes, arguments can be passed to a program started by inetd.
If it ain't broke, I can fix that.
Mark Grant
Honored Contributor

Re: Passing parms to inetd

Afraid not.

If you want to pass this information to the application started by inetd, you are going to have to handle it in the code itself. i.e when you connect to the port, you "server" application requests the information and your "client" application sends it.

You can specify a static parameter in the ined.conf file but I guess that isn't waht you want. If you want to go mad and do all sorts of horrible things to your system and write a god awful program, you could edit inetd.conf and send a SIGHUP to inetd each time you connected using (remsh or something) but please don't do that!!
Never preceed any demonstration with anything more predictive than "watch this"
Zeev Schultz
Honored Contributor

Re: Passing parms to inetd

Read man page for service you'd like to pass
options to (when inetd calls such a service ie telnet - its a process called telnetd which is started ) later edit /etc/inetd.conf.
So computers don't think yet. At least not chess computers. - Seymour Cray
A. Clay Stephenson
Acclaimed Contributor

Re: Passing parms to inetd

I really shgould have read your question more carefully because the subject doesn't quite match your question. Inetd can pass arguments to services/daemons/programs specified in inetd.conf but in your case, you want to pass arguments specified in the client (telnet, in this case) to the daemon (telnetd, in this case) and no, that example won't work. In fact, you would have to use arguments that the client recognizes and then a protocol would have to be developed that both the client and the corresponding server/daemon understands. In your case, that would mean you need to develop a telnet-like client and a telnetd-like server that would understand each other.
If it ain't broke, I can fix that.
Massimo Bianchi
Honored Contributor

Re: Passing parms to inetd

You can always build the server/client to accept parameters, like using expet or echo.

echo PIPPO \n PLUTO \n PAPERINO \n | telnet host port


if the server, in its code, has three read var

read ONE
read TWO
read THREE


you will get what you need.


Not nice, but (i think) working

Massimo