RPC(3N)

NAME
rpc_secure - library routines for secure remote procedure calls

SYNOPSIS AND DESCRIPTION
These routines are part of the RPC library. They implement DES Authentication. See rpc(3N) for further details about RPC.

#include <rpc/rpc.h>

AUTH *
authdes_create(name, window, syncaddr, ckey)
char *name;
unsigned window;
struct sockaddr_in *addr;
des_block *ckey;

    authdes_create() is the first of two routines which interface to the RPC secure authentication system, known as DES authentication. The second is authdes_getucred(), below. Note: the keyserver daemon keyserv(8C) must be running for the DES authentication system to work.

    authdes_create(), used on the client side, returns an authentication handle that will enable the use of the secure authentication system. The first parameter name is the network name, or netname, of the owner of the server process. This field usually represents a hostname derived from the utility routine host2netname, but could also represent a user name using user2netname. The second field is window on the validity of the client credential, given in seconds. A small window is more secure than a large one, but choosing too small of a window will increase the frequency of resynchronizations because of clock drift. The third parameter syncaddr is optional. If it is NULL, then the authentication system will assume that the local clock is always in sync with the server's clock, and will not attempt resynchronizations. If an address is supplied, however, then the system will use the address for consulting the remote time service whenever resynchronization is required. This parameter is usually the address of the RPC server itself. The final parameter ckey is also optional. If it is NULL, then the authentication system will generate a random DES key to be used for the encryption of credentials. If it is supplied, however, then it will be used instead.

authdes_getucred(adc, uid, gid, grouplen, groups)
struct authdes_cred *adc;
short *uid;
short *gid;
short *grouplen;
int *groups;

    authdes_getucred(), the second of the two DES authentication routines, is used on the server side for converting a DES credential, which is operating system independent, into a credential. This routine differs from utility routine netname2user in that authdes_getucred() pulls its information from a cache, and does not have to do a Yellow Pages lookup every time it is called to get its information.

host2netname(name, host, domain)
char *name;
char *host;
char *domain;

    Convert from a domain-specific hostname to an operating-system independent netname. Return TRUE if it succeeds and FALSE if it fails. Inverse of netname2host().

key_decryptsession(remotename, deskey)
char *remotename;
des_block *deskey;

    key_decryptsession() is an interface to the keyserver daemon, which is associated with RPC's secure authentication system (DES authentication). User programs rarely need to call it, or its associated routines key_encryptsession(), key_gendes() and key_setsecret(). System commands such as login and the RPC library are the main clients of these four routines.

    key_decryptsession() takes a server netname and a des key, and decrypts the key by using the the public key of the the server and the secret key associated with the effective uid of the calling process. It is the inverse of key_encryptsession().

key_encryptsession(remotename, deskey)
char *remotename;
des_block *deskey;

    key_encryptsession() is a keyserver interface routine. It takes a server netname and a des key, and encrypts it using the public key of the the server and the secret key associated with the effective uid of the calling process. It is the inverse of key_decryptsession().

key_gendes(deskey)
des_block *deskey;

    key_gendes() is a keyserver interface routine. It is used to ask the keyserver for a secure conversation key. Choosing one at “random” is usually not good enough, because the common ways of choosing random numbers, such as using the current time, are very easy to guess.

key_setsecret(key)
char *key;

    key_setsecret() is a keyserver interface routine. It is used to set the key for the effective uid of the calling process.

getnetname(name)
char name[MAXNETNAMELEN];

    getnetname() installs the unique, operating-system independent netname of the caller in the fixed-length array name. Returns TRUE if it succeeds and FALSE if it fails.

netname2host(name, host, hostlen)
char *name;
char *host;
int hostlen;

    Convert from an operating-system independent netname to a domain-specific hostname. Returns TRUE if it succeeds and FALSE if it fails. Inverse of host2netname().

netname2user(name, uidp, gidp, gidlenp, gidlist)
char *name;
int *uidp;
int *gidp;
int *gidlenp;
int *gidlist;

    Convert from an operating-system independent netname to a domain-specific user ID. Returns TRUE if it succeeds and FALSE if it fails. Inverse of user2netname().

user2netname(name, uid, domain)
char *name;
int uid;
char *domain;

    Convert from a domain-specific username to an operating-system independent netname. Returns TRUE if it succeeds and FALSE if it fails. Inverse of netname2user().

SEE ALSO
xdr(3N), keyserv(8C), rpc(3N)
The following manuals:
    Remote Procedure Calls: Protocol Specification
    Remote Procedure Call Programming Guide
    rpcgen Programming Guide
RPC: Remote Procedure Call Protocol Specification, RFC1050, Sun Microsystems, Inc., USC-ISI.