File: rcmd.3

package info (click to toggle)
manpages-es 1.24a-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,256 kB
  • ctags: 7
  • sloc: makefile: 66; sh: 62
file content (193 lines) | stat: -rw-r--r-- 7,001 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
.\"	$NetBSD: rcmd.3,v 1.9 1996/05/28 02:07:39 mrg Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)rcmd.3	8.1 (Berkeley) 6/4/93
.\"
.\" Contributed as Linux man page by David A. Holland, 970908
.\" I have not checked whether the Linux situation is exactly the same.
.\" Translated June 14 1998 by Juan Piernas <piernas@dif.um.es>
.TH RCMD 3 "4 Junio 1993" "4.2BSD" "Manual del programador de Linux"
.SH NOMBRE
rcmd, rresvport, iruserok, ruserok \- Funciones que devuelven un flujo (stream)
hacia una orden remota
.SH SINOPSIS
.B #include <unistd.h>
.sp
.BI "int rcmd(char **" ahost ", int " inport ", const char *" locuser ", const char *" remuser ", const char *" cmd ", int *" fd2p )
.sp
.BI "int rresvport(int *" port )
.sp
.BI "int iruserok(u_int32_t " raddr ", int " superuser ", const char *" ruser ", const char *" luser )
.sp
.BI "int ruserok(const char *" rhost ", int " superuser ", const char *" ruser ", const char *" luser )
.SH DESCRIPCIN
La funcin
.B rcmd
es utilizada por el superusuario para ejecutar una orden en una mquina
remota usando un esquema de autenticacin basado en nmeros de puertos
reservados.
La funcin
.B rresvport
devuelve el descriptor de un enchufe (socket) cuya direccin cae dentro del
espacio de puertos privilegidados.
Los servidores utilizan las funciones
.B iruserok
y
.B ruserok
para autenticar a los clientes que solicitan servicios mediante
.BR rcmd .
Estas cuatro funciones se encuentran en el mismo fichero y son usadas por el
servidor
.BR rshd (8)
(entre otros).
.PP
La funcin
.B rcmd
busca al anfitrin (host)
.I *ahost
usando 
.BR gethostbyname (3),
devolviendo \-1 si el anfitrin no existe.
En caso contrario, se asigna a
.I *ahost
el nombre estndar del anfitrin y se establece una conexin con el servidor
que reside en el, bien definido, puerto de Internet
.IR inport .
.PP
Si la conexin tiene xito, se devuelve al invocador un socket
dentro del dominio de Internet del tipo
.BR SOCK_STREAM ,
y dicho socket se convierte en la
.B entrada estndar (stdin)
y la
.B salida estndar (stdout)
de la orden remota.
Si
.I fd2p
no es cero, se crear un canal auxiliar hacia un proceso de control y
en
.I *fd2p
se colocar un descriptor para dicho canal.
El proceso de control devolver la salida de error (descriptor
de fichero nmero 2) de la orden remota sobre este canal, y tambin aceptar
sobre este canal el envo de bytes que se comportarn como nmeros
de seal de
.B UNIX
para ser enviados al grupo de procesos de la orden.
Si
.I fd2p
es 0, entonces la
.B salida de error estndar (stderr)
(descriptor de fichero nmero 2 de la orden remota) coincidirn con la
.B salida estndar (stdout)
y no habr forma de enviar seales arbitrarias al proceso remoto, aunque
podr llamar su atencin usando datos "fuera de orden" (out-of-band).
.PP
El protocolo se describe con detalle en
.BR rshd (8).
.PP
La funcin
.B rresvport
se utiliza para obtener un socket que tenga una direccin
privilegiada ligada a l. Este socket es adecuado para ser usado por
.B rcmd
y otras funciones diversas. Los puertos de Internet privilegiados son
aquellos que van de 0 a 1023. Slo el superusuario puede ligar una direccin
de este tipo a un socket.
.PP
Las funciones
.B iruserok
y
.B ruserok
toman la direccin IP o el nombre de un anfitrin remoto, respectivamente,
dos nombres de usuario y una bandera que indica si el nombre del usuario
local es o no el del superusuario.
A continuacin, si el usuario
.B NO
es el superusuario, comprueba el fichero
.IR /etc/hosts.equiv .
Si dicha bsqueda no se realiza o no tiene xito, se comprueba el fichero
.I .rhosts
en el directorio raz (home) del usuario local para ver si se permite la
peticin de servicio.
.PP
Si el fichero no existe, no es un fichero regular, pertenece a alguien
que no es el usuario ni el superusuario, o puede ser escrito por alguien que
no sea el propietario, la comprobacin fracasa automticamente.
Si el nombre de la mquina aparece en el fichero
.I hosts.equiv
o si el anfitrin y el nombre del usuario remoto se encuentran en el fichero
.IR .rhosts ,
se devuelve un 0; en caso contrario
.B iruserok
y
.B ruserok
devuelven \-1.
Si el dominio local (como se obtiene de
.BR gethostname (2))
es el mismo que el dominio remoto, slo se necesita especificar el nombre de
la mquina.
.PP
Si se conoce la direccin IP del anfitrin remoto, preferentemente se debe
usar
.B iruserok
en lugar de
.BR ruserok ,
ya que no necesita consultar al servidor DNS para el dominio del anfitrin
remoto.
.SH ERRORES
La funcin
.B rcmd
devuelve un descriptor vlido de socket en caso de xito. Devuelve \-1 en
caso de error y muestra un mensaje de error en la salida de error
estndar.
.PP
La funcin
.B rresvport
devuelve un descriptor de socket vlido, y ya ligado, en caso de xito.
Devuelve \-1 en caso de error y asigna a
.I errno
un valor que indica la razn del fallo.
Se sobrecarga el significado del cdigo de error
.B EAGAIN
para indicar que ``Todos los puertos de red estn en uso.''
.SH "VASE TAMBIN"
.BR rlogin (1),
.BR rsh (1),
.BR intro (2),
.BR rexec (3),
.BR rexecd (8),
.BR rlogind (8),
.BR rshd (8)
.SH HISTORIA
Estas funciones aparecieron en 4.2BSD.