ruserok Subroutine

Purpose

Allows servers to authenticate clients.

Library

Standard C Library (libc.a)

Syntax

int ruserok (Host, RootUser, RemoteUser, LocalUser)
char * Host;
int  RootUser;
char * RemoteUser,
* LocalUser;

Description

The ruserok subroutine allows servers to authenticate clients requesting services.

Always specify the host name. If the local domain and remote domain are the same, specifying the domain parts is optional. To determine the domain of the host, use the gethostname subroutine.

All applications containing the ruserok subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Parameters

Item Description
Host Specifies the name of a remote host. The ruserok subroutine checks for this host in the /etc/host.equiv file. Then, if necessary, the subroutine checks a file in the user's home directory at the server called /$HOME/.rhosts for a host and remote user ID.
RootUser Specifies a value to indicate whether the effective user ID of the calling process is a root user. A value of 0 indicates the process does not have a root user ID. A value of 1 indicates that the process has local root user privileges, and the /etc/hosts.equiv file is not checked.
RemoteUser Points to a user name that is valid at the remote host. Any valid user name can be specified.
LocalUser Points to a user name that is valid at the local host. Any valid user name can be specified.

Return Values

The ruserok subroutine returns a 0, if the subroutine successfully locates the name specified by the Host parameter in the /etc/hosts.equiv file or the IDs specified by the Host and RemoteUser parameters are found in the /$HOME/.rhosts file.

If the name specified by the Host parameter was not found, the ruserok subroutine returns a -1.

Files

Item Description
/etc/services Contains service names.
/etc/host.equiv Specifies foreign host names.
/$HOME/.rhosts Specifies the remote users of a local user account.