Commit | Line | Data |
---|---|---|
11a95b5f KM |
1 | .\" Copyright (c) 1983 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
4e102a5b | 5 | .\" @(#)rcmd.3 6.3 (Berkeley) %G% |
11a95b5f | 6 | .\" |
1173f46b | 7 | .TH RCMD 3X "" |
11a95b5f KM |
8 | .UC 5 |
9 | .SH NAME | |
10 | rcmd, rresvport, ruserok \- routines for returning a stream to a remote command | |
11 | .SH SYNOPSIS | |
12 | .nf | |
13 | .B "rem = rcmd(ahost, inport, locuser, remuser, cmd, fd2p);" | |
14 | .B char **ahost; | |
15 | .B u_short inport; | |
16 | .B "char *locuser, *remuser, *cmd;" | |
17 | .B int *fd2p; | |
18 | .PP | |
19 | .B s = rresvport(port); | |
20 | .B int *port; | |
21 | .PP | |
22 | .B "ruserok(rhost, superuser, ruser, luser);" | |
23 | .B char *rhost; | |
24 | .B int superuser; | |
25 | .B char *ruser, *luser; | |
26 | .fi | |
27 | .SH DESCRIPTION | |
28 | .I Rcmd | |
29 | is a routine used by the super-user to execute a command on | |
30 | a remote machine using an authentication scheme based | |
31 | on reserved port numbers. | |
32 | .I Rresvport | |
33 | is a routine which returns a descriptor to a socket | |
34 | with an address in the privileged port space. | |
35 | .I Ruserok | |
36 | is a routine used by servers | |
37 | to authenticate clients requesting service with | |
38 | .IR rcmd . | |
39 | All three functions are present in the same file and are used | |
40 | by the | |
41 | .IR rshd (8C) | |
42 | server (among others). | |
43 | .PP | |
44 | .I Rcmd | |
45 | looks up the host | |
46 | .I *ahost | |
47 | using | |
48 | .IR gethostbyname (3N), | |
49 | returning \-1 if the host does not exist. | |
50 | Otherwise | |
51 | .I *ahost | |
52 | is set to the standard name of the host | |
53 | and a connection is established to a server | |
54 | residing at the well-known Internet port | |
55 | .IR inport . | |
56 | .PP | |
57 | If the call succeeds, a socket of type SOCK_STREAM | |
58 | is returned to the caller, and given to the remote | |
59 | command as | |
60 | .B stdin | |
61 | and | |
62 | .BR stdout . | |
63 | If | |
64 | .I fd2p | |
65 | is non-zero, then an auxiliary channel to a control | |
66 | process will be set up, and a descriptor for it will be placed | |
67 | in | |
68 | .IR *fd2p . | |
69 | The control process will return diagnostic | |
70 | output from the command (unit 2) on this channel, and will also | |
71 | accept bytes on this channel as being UNIX signal numbers, to be | |
72 | forwarded to the process group of the command. | |
73 | If | |
74 | .I fd2p | |
75 | is 0, then the | |
76 | .B stderr | |
77 | (unit 2 of the remote | |
78 | command) will be made the same as the | |
79 | .B stdout | |
80 | and no | |
81 | provision is made for sending arbitrary signals to the remote process, | |
82 | although you may be able to get its attention by using out-of-band data. | |
83 | .PP | |
84 | The protocol is described in detail in | |
85 | .IR rshd (8C). | |
86 | .PP | |
87 | The | |
88 | .I rresvport | |
89 | routine is used to obtain a socket with a privileged | |
90 | address bound to it. This socket is suitable for use | |
91 | by | |
92 | .I rcmd | |
48270c22 | 93 | and several other routines. Privileged addresses consist |
11a95b5f KM |
94 | of a port in the range 0 to 1023. Only the super-user |
95 | is allowed to bind an address of this sort to a socket. | |
96 | .PP | |
97 | .I Ruserok | |
98 | takes a remote host's name, as returned by a | |
99 | .IR gethostent (3N) | |
100 | routine, two user names and a flag indicating if | |
101 | the local user's name is the super-user. It then | |
102 | checks the file | |
103 | .I /etc/hosts.equiv | |
104 | and, possibly, | |
105 | .I .rhosts | |
106 | in the current working directory (normally the local | |
107 | user's home directory) to see if the request for | |
4e102a5b | 108 | service is allowed. A 0 is returned if the machine |
11a95b5f KM |
109 | name is listed in the ``hosts.equiv'' file, or the |
110 | host and remote user name are found in the ``.rhosts'' | |
111 | file; otherwise | |
112 | .I ruserok | |
4e102a5b | 113 | returns \-1. If the |
11a95b5f KM |
114 | .I superuser |
115 | flag is 1, the checking of the ``host.equiv'' file is | |
116 | bypassed. | |
117 | .SH SEE ALSO | |
118 | rlogin(1C), | |
119 | rsh(1C), | |
120 | rexec(3X), | |
121 | rexecd(8C), | |
122 | rlogind(8C), | |
123 | rshd(8C) | |
124 | .SH BUGS | |
125 | There is no way to specify options to the | |
126 | .I socket | |
127 | call | |
128 | which | |
129 | .I rcmd | |
130 | makes. |