getdomattr Subroutine

Purpose

Queries the domains that are defined in the domain database.

Library

Security Library (libc.a)

Syntax

#include <usersec.h>
int getdomattr ( Dom, Attribute, Value, Type)
char * Domain;
char * Attribute;

void *Value;
int Type;

Description

The getdomattr subroutine reads a specified attribute from the domain database. If the database is not open, this subroutine does an implicit open for reading. For the attributes of the SEC_CHAR and SEC_LIST types, the getdomattr subroutine returns the value to the allocated memory. The caller must free this memory.

Parameters

Item Description
Dom

Specifies the domain name.

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

S_DOMAINS

A list of all available domains on the system. This attribute is read only and is only available to the getdomattr subroutine when ALL is specified for the Dom parameter. The attribute type is SEC_LIST.

S_ID

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

S_DFLTMSG

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

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 description of the domain in the file that the S_MSGCAT attribute specifies. The attribute type is SEC_INT.

S_MSGNUMBER

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

Value

Specifies a pointer, or a pointer to a pointer according to the value specified in 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. For the subroutine, the user should supply a pointer to a defined integer variable.

Type

SEC_LIST

The format of the attribute is a series of concatenated strings that each of which is null-terminated. The last string in the series is terminated by two successive null characters. For the subroutine, the user should supply a pointer to a defined character pointer variable. Caller needs to free this memory.

Security

Files Accessed:

Item Description
File Mode
/etc/security/domains
R

Return Values

If successful, the getdomattr 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.

The Attribute or Type parameter is NULL or does not contain one of the defined values.

The Dom parameter is ALL and the Attribute parameter is not S_DOMAINS.

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

ENOATTR The Attribute parameter is S_DOMAINS, but the Dom parameter is not ALL

The attribute specified in the Attribute parameter is valid but no value is defined for the domain.

.
ENOENT The domain specified in the Dom parameter does not exist.
ENOMEM Memory cannot be allocated.
EPERM The operation is not permitted.
EACCES Access permission is denied for the data request.