rcmd.3n (2010 09)

r
rcmd(3N) rcmd(3N)
rcmd_af()
rcmd_af() function behaves the same as rcmd()
, but it can also create an AF_INET6 TCP socket.
The type of socket to be created is specified through the
af argument. rcmd_af() fails with [EAF-
NOSUPPORT] if the address family
af is not supported.
rresvport()
The
rresvport() function creates a socket and binds it to a reserved port. This socket is suitable for
use by rcmd() and several other routines.
The caller is expected to set the initial value of
*port to a number between 512 and
IPPORT_RESERVED
1. (The value of IPPORT_RESERVED
is defined in netinet/in.h and is 1024.)
Typically, the initial value of
*port is set to IPPORT_RESERVED
1. If the value is outside the valid
range,
rresvport() resets it silently to IPPORT_RESERVED
1. The function uses the inital value of
*port as the first port number that it tries to bind to the created socket. If the operation fails,
rresvport() decrements *port and attempts to bind the new port number to the socket. The process
is repeated until either the operation succeeds, or the port numbers between 512 and
IPPORT_RESERVED
1 are exhausted.
If the call succeeds, the socket descriptor is returned to the caller and the port number is returned in the
location pointed to by port . If the call fails, 1 is returned to the caller.
The socket returned by
rresvport() has the SO_KEEPALIVE option on.
Only the superuser is permitted to bind a privileged address to a socket. Therefore, any program using
rresvport() must be run as superuser.
rresvport_af()
rresvport_af() function behaves the same as
rresvport(), but it can also create an AF_INET6
TCP socket. The type of socket to be created is specified through the af
argument. rresvport_af()
fails with EAFNOSUPPORT if the address family af is not supported.
ruserok()
The
ruserok() function is used by servers to authenticate clients requesting service with rcmd().
ruserok() verifies that ruser on rhost is authorized to act as luser on the local host.
superuser is an integer flag that should be nonzero if the local user name corresponds to a superuser. If
the superuser flag is not set,
ruserok() first checks the file /etc/hosts.equiv
to authenticate the
request for service. If this check succeeds,
ruserok() returns 0. If the superuser flag is set, or if there
is no file /etc/hosts.equiv
, or if the check fails, ruserok() then checks the file .rhosts (if there
is one) in the local users home directory.
ruserok() returns 0 if this check succeeds. Otherwise, it
returns 1.
Typically, the file
/etc/hosts.equiv
contains a list of host names, and users .rhosts files contain
host-name/user-name pairs. A remote user is authenticated by
ruserok() if the remote host name
appears in
/etc/hosts.equiv
and the remote user name and local user name are the same, or if the
remote host name and the remote user name appear together in
.rhosts in the home directory of the
local user.
For a complete explanation of the syntax understood by
ruserok(), see hosts.equiv (4).
DIAGNOSTICS
rcmd() Diagnostic Messages
rcmd() generates the following diagnostic messages.
hostname
: Unknown host
gethostbyname was unable to find an entry in the hosts database matching the name of the
server (see gethostent (3N) and hosts (4)).
Next step : Have the system administrator of your host check whether the remote host’s entry
is in the
hosts database (see hosts (4)).
connect: hostname : ...
Unable to establish a connection to the reserved port. A message that specifies the reason for
the failure is appended to this diagnostic message.
write: Setting up stderr
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010