security_sid_to_context(2)

security_sid_to_context2

Get the security context string for a sid

Usage

#include <ss.h>

int security_sid_to_context(security_id_t sid, security_context_t scontext, __u32 *scontext_len);

Overview

The security_sid_to_context call is used to obtain the security context string representation of the context associated with sid. The scontext_len argument is a value-result parameter, initialized to the size of the buffer associated with scontext, and modified on return to indicate the length of the context stored there, including the terminating NULL character. If the buffer is not large enough, then scontext_len is set to the actual size, -1 is returned, and errno is set to ENOSPC.

Return value

A zero is returned on success. On error, -1 is returned, and errno is set appropriately.

Errors

EINVAL

The SID was invalid.

EACCES

The process is not authorized to invoke this call on this SID.

ENOSPC

The buffer was too small.

From libselinux-dev 2002031409-4 in Debian 3.0 (Woody). Parsed by carta from the page's man source.