19f670da2Scgd.\" Copyright (c) 1983, 1991, 1993 29f670da2Scgd.\" The Regents of the University of California. All rights reserved. 39f670da2Scgd.\" 49f670da2Scgd.\" Redistribution and use in source and binary forms, with or without 59f670da2Scgd.\" modification, are permitted provided that the following conditions 69f670da2Scgd.\" are met: 79f670da2Scgd.\" 1. Redistributions of source code must retain the above copyright 89f670da2Scgd.\" notice, this list of conditions and the following disclaimer. 99f670da2Scgd.\" 2. Redistributions in binary form must reproduce the above copyright 109f670da2Scgd.\" notice, this list of conditions and the following disclaimer in the 119f670da2Scgd.\" documentation and/or other materials provided with the distribution. 12*eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors 139f670da2Scgd.\" may be used to endorse or promote products derived from this software 149f670da2Scgd.\" without specific prior written permission. 159f670da2Scgd.\" 169f670da2Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 179f670da2Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 189f670da2Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 199f670da2Scgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 209f670da2Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219f670da2Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229f670da2Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239f670da2Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249f670da2Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259f670da2Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269f670da2Scgd.\" SUCH DAMAGE. 279f670da2Scgd.\" 28e37aec67Slukem.\" from: @(#)rexec.3 8.1 (Berkeley) 6/4/93 29*eb7c1594Sagc.\" $NetBSD: rexec.3,v 1.13 2003/08/07 16:44:16 agc Exp $ 309f670da2Scgd.\" 319f670da2Scgd.Dd June 4, 1993 329f670da2Scgd.Dt REXEC 3 3338c96853Sgarbled.Os 349f670da2Scgd.Sh NAME 359f670da2Scgd.Nm rexec 369f670da2Scgd.Nd return stream to a remote command 37312aca53Sperry.Sh LIBRARY 38312aca53Sperry.Lb libcompat 399f670da2Scgd.Sh SYNOPSIS 409f670da2Scgd.Ft int 41177c3172Sphil.Fn rexec "char **ahost" "int inport" "char *user" "char *passwd" "char *cmd" "int *fd2p" 429f670da2Scgd.Sh DESCRIPTION 439f670da2Scgd.Bf -symbolic 4401bfb60dSsorenThis interface is obsoleted by 4501bfb60dSsoren.Xr rcmd 3 . 469f670da2ScgdIt is available from the compatibility library, libcompat. 479f670da2Scgd.Ef 489f670da2Scgd.Pp 499f670da2ScgdThe 509f670da2Scgd.Fn rexec 5128128e05Swizfunction looks up the host 529f670da2Scgd.Fa *ahost 539f670da2Scgdusing 549f670da2Scgd.Xr gethostbyname 3 , 559f670da2Scgdreturning \-1 if the host does not exist. 569f670da2ScgdOtherwise 579f670da2Scgd.Fa *ahost 589f670da2Scgdis set to the standard name of the host. 599f670da2ScgdIf a username and password are both specified, then these 609f670da2Scgdare used to authenticate to the foreign host; otherwise 619f670da2Scgdthe environment and then the user's 629f670da2Scgd.Pa .netrc 6328128e05Swizfile in his home directory are searched for appropriate information. 649f670da2ScgdIf all this fails, the user is prompted for the information. 659f670da2Scgd.Pp 669f670da2ScgdThe port 679f670da2Scgd.Fa inport 689f670da2Scgdspecifies which well-known 699f670da2Scgd.Tn DARPA 7028128e05SwizInternet port to use for the connection; the call 719f670da2Scgd.Ql getservbyname(\\*qexec\\*q, \\*qtcp\\*q) 729f670da2Scgd(see 739f670da2Scgd.Xr getservent 3 ) 749f670da2Scgdwill return a pointer to a structure, which contains the 759f670da2Scgdnecessary port. 769f670da2ScgdThe protocol for connection is described in detail in 779f670da2Scgd.Xr rexecd 8 . 789f670da2Scgd.Pp 7928128e05SwizIf the connection succeeds, a socket in the Internet domain of type 809f670da2Scgd.Dv SOCK_STREAM 8128128e05Swizis returned to the caller, and given to the remote command as 829f670da2Scgd.Em stdin 839f670da2Scgdand 849f670da2Scgd.Em stdout . 859f670da2ScgdIf 869f670da2Scgd.Fa fd2p 879f670da2Scgdis non-zero, then an auxiliary channel to a control 889f670da2Scgdprocess will be set up, and a descriptor for it will be placed 899f670da2Scgdin 909f670da2Scgd.Fa *fd2p . 919f670da2ScgdThe control process will return diagnostic 929f670da2Scgdoutput from the command (unit 2) on this channel, and will also 939f670da2Scgdaccept bytes on this channel as being 94dc026e05Sfair.Ux 9528128e05Swizsignal numbers, to be forwarded to the process group of the command. 9628128e05SwizThe diagnostic information returned does not include remote authorization 9728128e05Swizfailure, as the secondary connection is set up after authorization has been 989f670da2Scgdverified. 999f670da2ScgdIf 1009f670da2Scgd.Fa fd2p 1019f670da2Scgdis 0, then the 1029f670da2Scgd.Em stderr 10328128e05Swiz(unit 2 of the remote command) will be made the same as the 1049f670da2Scgd.Em stdout 1059f670da2Scgdand no 1069f670da2Scgdprovision is made for sending arbitrary signals to the remote process, 1079f670da2Scgdalthough you may be able to get its attention by using out-of-band data. 1089f670da2Scgd.Sh SEE ALSO 1099f670da2Scgd.Xr rcmd 3 , 1109f670da2Scgd.Xr rexecd 8 1119f670da2Scgd.Sh HISTORY 1129f670da2ScgdThe 1139f670da2Scgd.Fn rexec 1149f670da2Scgdfunction appeared in 1159f670da2Scgd.Bx 4.2 . 116