initlabeldb and endlabeldb Subroutines

Purpose

Initializes or terminates database.

Library

Trusted AIX® Library ( libmls.a )

Syntax

#include <mls/mls.h>
int initlabeldb (dbfile)
const char * dbfile;

int endlabeldb (void)

Description

The initlabeldb subroutine initializes the label database that the dbfile parameter specifies. When the dbfile parameter is specified to NULL, the initlabeldb subroutine initializes the library data members using the /etc/security/enc/LabelEncodings file. The initlabeldb subroutine succeeds only if the formation of the label file is correct.

Before any operations on a label, must use the initlabeldb subroutine to initialize the database. The database that is initialized will be read only.

The endlabeldb subroutine terminates the database by freeing all of the memory that is allocated. There is no write back in this operation.

Parameters

Item Description
dbfile Specifies the file name that is to be used for label database initialization.

Security

Access Control: To access the default encodings file /etc/security/enc/LabelEncodings, the process must have the PV_LAB_LEF privilege.

File Accessed
Mode File
r /etc/security/enc/LabelEncodings

Return Values

If successful, the initlabeldb and endlabeldb subroutines return a value of zero. Otherwise, they return a value of -1.

Errors

If the initlabeldb subroutine fails, one of the following errno values can be set:

Item Description
EBADF The parameter that is passed is not NULL and is not a regular file.
EALREADY The database specified is already initialized with a different encoding file.
EACCESS The operation is not permitted.
ENOENT The label encoding file is not found.
If the endlabeldb subroutine fails, it returns the following errno value:
Item Description
ENOTREADY The database is not initialized.