summaryrefslogtreecommitdiffstats
path: root/newlib/libc/sys/linux/net/rcmdsh.3
blob: 43e6a8daa8c77a97a58610f99211f62379687948 (plain)
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
RCMDSH(3)                          BSD Library Functions Manual                         RCMDSH(3)

NAME
     rcmdsh -- return a stream to a remote command without superuser

SYNOPSIS
     #include <unistd.h>

     int
     rcmdsh(char **ahost, int inport, const char *locuser, const char *remuser, const char *cmd,
         const char *rshprog);

DESCRIPTION
     The rcmdsh() function is used by normal users to execute a command on a remote machine using
     an authentication scheme based on reserved port numbers using rshd(8) or the value of
     rshprog (if non-NULL).

     The rcmdsh() function looks up the host *ahost using gethostbyname(3), returning -1 if the
     host does not exist.  Otherwise *ahost is set to the standard name of the host and a connec-
     tion is established to a server residing at the well-known Internet port "shell/tcp" (or
     whatever port is used by rshprog).  The parameter inport is ignored; it is only included to
     provide an interface similar to rcmd(3).

     If the connection succeeds, a socket in the UNIX domain of type SOCK_STREAM is returned to
     the caller, and given to the remote command as stdin, stdout, and stderr.

RETURN VALUES
     The rcmdsh() function returns a valid socket descriptor on success.  Otherwise, -1 is re-
     turned and a diagnostic message is printed on the standard error.

SEE ALSO
     rsh(1), socketpair(2), rcmd(3), rshd(8)

BUGS
     If rsh(1) encounters an error, a file descriptor is still returned instead of -1.

HISTORY
     The rcmdsh() function first appeared in OpenBSD 2.0, and made its way into FreeBSD 5.0.

BSD                                     September 1, 1996                                     BSD