setroledb or endroledb Subroutine

Purpose

Opens and closes the role database.

Library

Security Library (libc.a)

Syntax

#include <usersec.h>
int setroledb(Mode)
int Mode;
int endroledb

Description

These functions may be used to open and close access to the role database. Programs that call the getroleattr subroutine should call the setroledb subroutine to open the role database and the endroledb subroutine to close the role database.

The setroledb subroutine opens the role database in the specified mode, if it is not already open. The open count is increased by 1.

The endroledb subroutine decreases the open count by 1 and closes the role database when this count goes to 0. Any uncommitted changed data is lost.

Parameters

Item Description
Mode Specifies the mode of the open. This parameter may contain one or more of the following values defined in the usersec.h file:
S_READ
Specifies read access.
S_WRITE
Specifies update access.

Return Values

The setroledb and endroledb subroutines return a value of 0 to indicate success. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The setroledb subroutine fails if the following is true:

Item Description
EACCES Access permission is denied for the data request.

Both subroutines return errors from other subroutines.

Security

Files Accessed: The calling process must have access to the role data.

Mode File rw/etc/security/roles