key_setsecret Subroutine

Important: The subroutine is exported from both the libc and the libnsl libraries.

key_setsecret Subroutine Exported from the libc Library

Purpose

Sets the key for the effective user number (UID) of the calling process.

Library

C Library (libc.a)

Syntax

#include <rpc/rpc.h>

key_setsecret ( key)
char *key;

Description

The key_setsecret subroutine interfaces to the keyserv daemon, which is associated with the secure authentication system known as Data Encryption Standard (DES). This subroutine is used to set the key for the effective UID of the calling process. User programs rarely need to call this subroutine. System commands such as keylogin and the Remote Procedure Call (RPC) library are the main clients.

Parameters

Item Description
key Points to the key name.

Return Values

Upon successful completion, this subroutine returns a value of 0. If unsuccessful, it returns a value of -1.

key_setsecret Subroutine Exported from the libnsl Library

Purpose

Sets the key for the effective user number (UID) of the calling process.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
int key_setsecret ( key)
const char *key;

Description

The key_setsecret subroutine, which belongs to the secure RPC category, is an interface routine to the keyserver daemon. User programs rarely need to call this subroutine.
Note: You must run the keyserv daemon to enable the subroutine.

Parameters

Item Description
key Specifies the key to be set for an effective user ID of the calling process.

Return Values

Item Description
0 successful
-1 unsuccessful

Examples

#include <rpc/rpc.h>
int main()
{
  char key[255] = "deskey"; /* contains the key to be set */

  if (key_setsecret(key) != 0) {
    fprintf(stderr, "\nkey_setsecret() failed\n");
    exit(1);
  }
  return 0;
}