putconfattrs Subroutine

Purpose

Accesses system information in the system information database.

Library

Security Library (libc.a)

Syntax

#include <usersec.h>
#include <userconf.h>
int putconfattrs (TableAttributesCount)
char * Table;
dbattr_t * Attributes;
int Count

Description

The putconfattrs subroutine writes one or more attributes into the system information database. If the database is not already open, the subroutine does an implicit open for reading and writing. Data changed by putconfattrs must be explicitly committed by calling the putconfattr subroutine with a Type parameter specifying the SEC_COMMIT value. Until the data is committed, only get subroutine calls within the process return the written data.

The Attributes array contains information about each attribute that is to be written. The dbattr_t data structure contains the following fields:
attr_name
The name of the desired attribute.
attr_idx
Used internally by the putconfattrs subroutine.
attr_type
The type of the desired attribute. The list of attribute types is defined in the usersec.h header file.
attr_flag
The results of the request to write the desired attribute.
attr_un
A union containing the values to be written. Its union members that follow correspond to the definitions of the attr_char, attr_int, attr_long, and attr_llong macros, respectively:
au_char
Attributes of type SEC_CHAR and SEC_LIST store a pointer to the value to be written.
au_int
Attributes of type SEC_INT and SEC_BOOL contain the value of the attribute to be written.
au_long
Attributes of type SEC_LONG contain the value of the attribute to be written.
au_llong
Attributes of type SEC_LLONG contain the value of the attribute to be written.
attr_domain
The authentication domain containing the attribute. The putconfattrs subroutine stores the name of the authentication domain that was used to write this attribute if it is not initialized by the caller. The putconfattrs subroutine is responsible for managing the memory referenced by this pointer.

Use the setuserdb and enduserdb subroutines to open and close the system information database. Failure to explicitly open and close the system information database can result in loss of memory and performance.

Parameters

Item Description
Table The system information table containing the desired attributes. The list of valid system information tables is defined in the userconf.h header file.
Attributes A pointer to an array of one or more elements of type dbattr_t. The list of system attributes is defined in the usersec.h header file.
Count The number of array elements in Attributes.

Security

Files accessed:

Item Description
Mode File
rw /etc/security/.ids
rw /etc/security/audit/config
rw /etc/security/audit/events
rw /etc/security/audit/objects
rw /etc/security/login.cfg
rw /etc/security/portlog
rw /etc/security/roles
rw /usr/lib/security/methods.cfg
rw /usr/lib/security/mkuser.sys

Return Values

The putconfattrs subroutine, when successfully completed, returns a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The putconfattrs subroutine fails if one or more of the following are true:

Item Description
EACCES The system information database could not be accessed for writing.
EINVAL The Table parameter is the NULL pointer.
EINVAL The Attributes parameter does not point to valid data for the requested attribute. Limited testing is possible and all errors might not be detected.
EINVAL The Count parameter is less than or equal to 0.
ENOENT The specified Table does not exist.

If the putconfattrs subroutine fails to write an attribute, one or more of the following errors is returned in the attr_flag field of the corresponding Attributes element:

Item Description
EACCES The user does not have access to the attribute specified in the attr_name field.
EINVAL The attr_type field in the Attributes entry contains an invalid type.
EINVAL The attr_un field in the Attributes entry does not point to a valid buffer or to valid data for this type of attribute. Limited testing is possible and all errors might not be detected.
ENOATTR The attr_name field in the Attributes entry specifies an attribute that is not defined for this system table.