248 lines
5.8 KiB
HTML
248 lines
5.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of REXEC</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>REXEC</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
rexec, rexec_af - return stream to a remote command
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/netdb.h">netdb.h</A>></B>
|
|
|
|
<B>int rexec(char **</B><I>ahost</I><B>, int </B><I>inport</I><B>, const char *</B><I>user</I><B>, </B>
|
|
<B> const char *</B><I>passwd</I><B>, const char *</B><I>cmd</I><B>, int *</B><I>fd2p</I><B>);</B>
|
|
|
|
<B>int rexec_af(char **</B><I>ahost</I><B>, int </B><I>inport</I><B>, const char *</B><I>user</I><B>, </B>
|
|
<B> const char *</B><I>passwd</I><B>, const char *</B><I>cmd</I><B>, int *</B><I>fd2p</I><B>,</B>
|
|
<B> sa_family_t </B><I>af</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<B>rexec</B>(),
|
|
|
|
<B>rexec_af</B>():
|
|
|
|
<PRE>
|
|
Since glibc 2.19:
|
|
_DEFAULT_SOURCE
|
|
In glibc up to and including 2.19:
|
|
_BSD_SOURCE
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
This interface is obsoleted by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+rcmd">rcmd</A></B>(3).
|
|
|
|
<P>
|
|
|
|
The
|
|
<B>rexec</B>()
|
|
|
|
function
|
|
looks up the host
|
|
<I>*ahost</I>
|
|
|
|
using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+gethostbyname">gethostbyname</A></B>(3),
|
|
|
|
returning -1 if the host does not exist.
|
|
Otherwise,
|
|
<I>*ahost</I>
|
|
|
|
is set to the standard name of the host.
|
|
If a username and password are both specified, then these
|
|
are used to authenticate to the foreign host; otherwise
|
|
the environment and then the
|
|
<I>.netrc</I>
|
|
|
|
file in user's
|
|
home directory are searched for appropriate information.
|
|
If all this fails, the user is prompted for the information.
|
|
<P>
|
|
|
|
The port
|
|
<I>inport</I>
|
|
|
|
specifies which well-known DARPA Internet port to use for
|
|
the connection; the call
|
|
<I>getservbyname(exec, tcp)</I>
|
|
|
|
(see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+getservent">getservent</A></B>(3))
|
|
|
|
will return a pointer to a structure that contains the necessary port.
|
|
The protocol for connection is described in detail in
|
|
<B><A HREF="/cgi-bin/man/man2html?8+rexecd">rexecd</A></B>(8).
|
|
|
|
<P>
|
|
|
|
If the connection succeeds,
|
|
a socket in the Internet domain of type
|
|
<B>SOCK_STREAM</B>
|
|
|
|
is returned to
|
|
the caller, and given to the remote command as
|
|
<I>stdin</I>
|
|
|
|
and
|
|
<I>stdout</I>.
|
|
|
|
If
|
|
<I>fd2p</I>
|
|
|
|
is nonzero, then an auxiliary channel to a control
|
|
process will be setup, and a file descriptor for it will be placed
|
|
in
|
|
<I>*fd2p</I>.
|
|
|
|
The control process will return diagnostic
|
|
output from the command (unit 2) on this channel, and will also
|
|
accept bytes on this channel as being UNIX signal numbers, to be
|
|
forwarded to the process group of the command.
|
|
The diagnostic
|
|
information returned does not include remote authorization failure,
|
|
as the secondary connection is set up after authorization has been
|
|
verified.
|
|
If
|
|
<I>fd2p</I>
|
|
|
|
is 0, then the
|
|
<I>stderr</I>
|
|
|
|
(unit 2 of the remote
|
|
command) will be made the same as the
|
|
<I>stdout</I>
|
|
|
|
and no
|
|
provision is made for sending arbitrary signals to the remote process,
|
|
although you may be able to get its attention by using out-of-band data.
|
|
<A NAME="lbAE"> </A>
|
|
<H3>rexec_af()</H3>
|
|
|
|
The
|
|
<B>rexec</B>()
|
|
|
|
function works over IPv4
|
|
(<B>AF_INET</B>).
|
|
|
|
By contrast, the
|
|
<B>rexec_af</B>()
|
|
|
|
function provides an extra argument,
|
|
<I>af</I>,
|
|
|
|
that allows the caller to select the protocol.
|
|
This argument can be specified as
|
|
<B>AF_INET</B>,
|
|
|
|
<B>AF_INET6</B>,
|
|
|
|
or
|
|
<B>AF_UNSPEC</B>
|
|
|
|
(to allow the implementation to select the protocol).
|
|
<A NAME="lbAF"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
The
|
|
<B>rexec_af</B>()
|
|
|
|
function was added to glibc in version 2.2.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>rexec</B>(),
|
|
|
|
<B>rexec_af</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Unsafe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
These functions are not in POSIX.1.
|
|
The
|
|
<B>rexec</B>()
|
|
|
|
function first appeared in
|
|
4.2BSD, and is present on the BSDs, Solaris, and many other systems.
|
|
The
|
|
<B>rexec_af</B>()
|
|
|
|
function is more recent, and less widespread.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
The
|
|
<B>rexec</B>()
|
|
|
|
function sends the unencrypted password across the network.
|
|
<P>
|
|
|
|
The underlying service is considered a big security hole and therefore
|
|
not enabled on many sites; see
|
|
<B><A HREF="/cgi-bin/man/man2html?8+rexecd">rexecd</A></B>(8)
|
|
|
|
for explanations.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+rcmd">rcmd</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+rexecd">rexecd</A></B>(8)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="4"><A HREF="#lbAE">rexec_af()</A><DD>
|
|
</DL>
|
|
<DT id="5"><A HREF="#lbAF">VERSIONS</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">ATTRIBUTES</A><DD>
|
|
<DT id="7"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="8"><A HREF="#lbAI">BUGS</A><DD>
|
|
<DT id="9"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="10"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:54 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|