home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>send - Execute a command in a different application</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> send - Execute a command in a different application</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#application names">APPLICATION NAMES</A></LI>
- <LI><A HREF="#what is a send">WHAT IS A SEND</A></LI>
- <LI><A HREF="#security">SECURITY</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>send - Execute a command in a different application</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P> <EM>$result</EM> = <EM>$widget</EM>-><STRONG>send</STRONG>(?<EM>options</EM>,?<EM>app</EM>=><EM>cmd</EM>?<EM>arg arg ...</EM>?)</P>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>This method arranges for <EM>cmd</EM> (and <EM>arg</EM>s) to be 'sent' to the
- application named by <EM>app</EM>. It returns the result or
- an error (hence above should probably be 'wrapped' in <STRONG>eval{}</STRONG> and $@ tested).
- <EM>App</EM> may be the name of any application whose main window is
- on the display containing the sender's main window; it need not
- be within the same process.
- If no <EM>arg</EM> arguments are present, then the string to be sent
- is contained entirely within the <EM>cmd</EM> argument. If one or
- more <EM>arg</EM>s are present, they are concatenated separated by white space to
- form the string to be sent.</P>
- <P>If the initial arguments of the call begin with ``-''
- they are treated as options. The following options are
- currently defined:</P>
- <DL>
- <DT><STRONG><A NAME="item_%2Dasync"><STRONG>-async</STRONG></A></STRONG><BR>
- <DD>
- Requests asynchronous invocation. In this case the <STRONG>send</STRONG>
- command will complete immediately without waiting for <EM>cmd</EM>
- to complete in the target application; no result will be available
- and errors in the sent command will be ignored.
- If the target application is in the same process as the sending
- application then the <STRONG>-async</STRONG> option is ignored.
- <P></P>
- <DT><STRONG><A NAME="item_%2D%2D"><STRONG>--</STRONG></A></STRONG><BR>
- <DD>
- Serves no purpose except to terminate the list of options. This
- option is needed only if <EM>app</EM> could contain a leading ``-''
- character.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="application names">APPLICATION NAMES</A></H1>
- <P>The name of an application is set initially from the name of the
- program or script that created the application.
- You can query and change the name of an application with the
- <STRONG>appname</STRONG> method.</P>
- <P>
- <HR>
- <H1><A NAME="what is a send">WHAT IS A SEND</A></H1>
- <P>The <STRONG>send</STRONG> mechanism was designed to allow Tcl/Tk applications
- to send Tcl Scripts to each other. This does not map very well onto perl/Tk.
- Perl/Tk ``sends'' a string to <EM>app</EM>, what happens as a result of this
- depends on the receiving application. If the other application is a Tcl/Tk4.*
- application it will be treated as a Tcl Script. If the ``other'' application is
- perl/Tk application (including sends to self) then the string is
- passed as an argument to a method call of the following form:</P>
- <P><EM>$mainwindow</EM>-><STRONG>Receive(</STRONG><EM>string</EM>);</P>
- <P>There is a default (AutoLoaded) <STRONG>Tk::Receive</STRONG> which returns an error to the
- sending application. A particular application may define its own
- <STRONG>Receive</STRONG> method in any class in <STRONG>MainWindow</STRONG>'s inheritance tree
- to do whatever it sees fit. For example it could <STRONG>eval</STRONG> the string,
- possibly in a <STRONG>Safe</STRONG> ``compartment''.</P>
- <P>If a Tcl/Tk application ``sends'' anything to a perl/Tk application
- then the perl/Tk application would have to attempt to interpret the
- incoming string as a Tcl Script. Simple cases are should not be too hard to
- emulate (split on white space and treat first element as ``command'' and other
- elements as arguments).</P>
- <P>
- <HR>
- <H1><A NAME="security">SECURITY</A></H1>
- <P>The <STRONG>send</STRONG> command is potentially a serious security loophole,
- since any application that can connect to your X server can send
- scripts to your applications. Hence the default behaviour outlined above.
- (With the availability of <STRONG>Safe</STRONG> it may make sense to relax default behaviour
- a little.)</P>
- <P>Unmonitored <STRONG>eval</STRONG>'ing of these incoming ``scripts'' can cause perl to
- read and write files and invoke subprocesses under your name.
- Host-based access control such as that provided by <STRONG>xhost</STRONG>
- is particularly insecure, since it allows anyone with an account
- on particular hosts to connect to your server, and if disabled it
- allows anyone anywhere to connect to your server.
- In order to provide at least a small amount of
- security, core Tk checks the access control being used by the server
- and rejects incoming sends unless (a) <STRONG>xhost</STRONG>-style access control
- is enabled (i.e. only certain hosts can establish connections) and (b) the
- list of enabled hosts is empty.
- This means that applications cannot connect to your server unless
- they use some other form of authorization
- such as that provide by <STRONG>xauth</STRONG>.</P>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P>Perl's <STRONG>eval</STRONG>
- perl's <STRONG>Safe</STRONG> Module
- system's administrator/corporate security guidelines etc.</P>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>application, name, remote execution, security, send</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> send - Execute a command in a different application</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-