putdomattr Subroutine

Purpose

Modifies the domains that are defined in the domain database.

Library

Security Library (libc.a)

Syntax

#include <usersec.h>
int putdomattr ( Dom, Attributes, Value, Type)
char * Dom;
char * Attribute;void * Value;
int Type;

Description

The putdomattr subroutine modifies the domain database.

New domains can be added to the domain database by calling the putdomattr subroutine with the SEC_NEW type and specifying the new domain name. Deletion of a domain or domain attribute is done using the SEC_DELETE type for the putdomattr subroutine. Data changed by the putdomattr subroutine must be explicitly committed by calling the putdomattr subroutine with a Type parameter specifying the SEC_COMMIT type. Until all the data is committed, only the getdomattr and getdomattrs subroutines within the process return the modified data. Changes that are made to the domain database do not impact security considerations until the entire database is sent to the Kernel Security Tables using the setkst command or until the system is rebooted.

Parameters

Item Description
Dom

The domain name. This parameter must be specified unless the Type parameter is SEC_COMMIT.

Specifies the attribute to be written. The following possible attributes are defined in the usersec.h file:

S_DFLTMSG

Specifies a default domain description to use if message catalogs are not in use. The attribute type is SEC_CHAR.

S_ID

Specifies a unique integer that is used to identify the domain. The attribute type is SEC_INT.

Note:

Do not modify this value after it is set initially when the domain is created. Modifying the value might compromise the security of the system.

Attribute

S_MSGCAT

Specifies the message catalog file name that contains the description of the domain. The attribute type is SEC_CHAR.

S_MSGSET

Specifies the message set that contains the message for the description of the domain in the file specified by the S_MSGCAT attribute. The attribute type is SEC_INT.

S_MSGNUMBER

Specifies the message number for the description of the domain in the file that is specified by the S_MSGCAT attribute and the message set that is specified by the S_MSGSET attribute. The attribute type is SEC_INT.

Value

Specifies a buffer, a pointer to a buffer, or a pointer to a pointer according to the values of the Attribute and Type parameters. See the Type parameter for more details.

Specifies the type of attribute. The following valid types are defined in the usersec.h file:

SEC_INT

The format of the attribute is an integer. The user should supply an integer value.

SEC_CHAR

The format of the attribute is a null-terminated character string. The user should supply a character pointer.

Type

SEC_LIST

The format of the attribute is a series of concatenated strings, each of which is null-terminated. The last string in the series is terminated by two successive null characters. The user should supply a character pointer.

SEC_COMMIT

Specifies that the changes to the named domain are to be committed to permanent storage. The values of the Attribute and Value parameters are ignored. If no domain is specified, the changes to all modified domains are committed to permanent storage.

SEC_DELETE

If the Attribute parameter is specified, the corresponding attribute is deleted from the domain database. If no Attribute parameter is specified, the entire domain definition is deleted from the domain database.

SEC_NEW

Creates a new domain in the domain database.

Security

Files Accessed:

Item Description
File Mode
/etc/security/domains
rw

Return Values

If successful, the putdomattr subroutine returns zero. Otherwise, a value of -1 is returned and the errno global value is set to indicate the error.

Error Codes

Item Description
EINVAL

The Dom parameter is NULL and the Type parameter is not SEC_COMMIT.

The Dom parameter is default or ALL

The Attribute parameter is NULL and the Type parameter is not SEC_NEW, SEC_DELETE or SEC_COMMIT.

The Attribute parameter does not contain one of the defined attributes.

The Type parameter does not contain one of the defined values.

The Value parameter does not point to a valid buffer or to valid data for this type of attribute.

ENOENT The domain specified in the Dom parameter does not exist.
ENOMEM Memory cannot be allocated.
EPERM The operation is not permitted.