]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libc/net/rcmdsh.3
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libc / net / rcmdsh.3
1 .\"     $OpenBSD: rcmdsh.3,v 1.6 1999/07/05 04:41:00 aaron Exp $
2 .\"
3 .\" Copyright (c) 1983, 1991, 1993
4 .\"     The Regents of the University of California.  All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 4. Neither the name of the University nor the names of its contributors
15 .\"    may be used to endorse or promote products derived from this software
16 .\"    without specific prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd September 1, 1996
33 .Dt RCMDSH 3
34 .Os
35 .Sh NAME
36 .Nm rcmdsh
37 .Nd return a stream to a remote command without superuser
38 .Sh SYNOPSIS
39 .In unistd.h
40 .Ft int
41 .Fo rcmdsh
42 .Fa "char **ahost"
43 .Fa "int inport"
44 .Fa "const char *locuser"
45 .Fa "const char *remuser"
46 .Fa "const char *cmd"
47 .Fa "const char *rshprog"
48 .Fc
49 .Sh DESCRIPTION
50 The
51 .Fn rcmdsh
52 function
53 is used by normal users to execute a command on
54 a remote machine using an authentication scheme based
55 on reserved port numbers using
56 .Xr rshd 8
57 or the value of
58 .Fa rshprog
59 (if
60 .No non- Ns Dv NULL ) .
61 .Pp
62 The
63 .Fn rcmdsh
64 function
65 looks up the host
66 .Fa *ahost
67 using
68 .Xr gethostbyname 3 ,
69 returning \-1 if the host does not exist.
70 Otherwise
71 .Fa *ahost
72 is set to the standard name of the host
73 and a connection is established to a server
74 residing at the well-known Internet port
75 .Dq Li shell/tcp
76 (or whatever port is used by
77 .Fa rshprog ) .
78 The
79 .Fa inport
80 argument
81 is ignored; it is only included to provide an interface similar to
82 .Xr rcmd 3 .
83 .Pp
84 If the connection succeeds,
85 a socket in the
86 .Ux
87 domain of type
88 .Dv SOCK_STREAM
89 is returned to the caller, and given to the remote
90 command as
91 .Dv stdin , stdout ,
92 and
93 .Dv stderr .
94 .Sh RETURN VALUES
95 The
96 .Fn rcmdsh
97 function
98 returns a valid socket descriptor on success.
99 Otherwise, \-1 is returned
100 and a diagnostic message is printed on the standard error.
101 .Sh SEE ALSO
102 .Xr rsh 1 ,
103 .Xr socketpair 2 ,
104 .Xr rcmd 3 ,
105 .Xr rshd 8
106 .Sh HISTORY
107 The
108 .Fn rcmdsh
109 function first appeared in
110 .Ox 2.0 ,
111 and made its way into
112 .Fx 4.6 .
113 .Sh BUGS
114 If
115 .Xr rsh 1
116 encounters an error, a file descriptor is still returned instead of \-1.