sidget(3)

sidget3

Obtain and manipulate selinux security id's

Part of avc_context_to_sid(3).

Usage

#include <selinux/selinux.h>
#include <selinux/avc.h>

int avc_context_to_sid(const char *ctx, security_id_t *sid);

int avc_sid_to_context(security_id_t sid, char **ctx);

int avc_get_initial_sid(const char *name, security_id_t *sid);

Overview

Security ID's (SID's) are opaque representations of security contexts, managed by the userspace AVC.

avc_context_to_sid() returns a SID for the given context in the memory referenced by sid.

avc_sid_to_context() returns a copy of the context represented by sid in the memory referenced by ctx. The user must free the copy with freecon(3).

avc_get_initial_sid() returns a SID for the kernel initial security identifier specified by name.

Return value

avc_context_to_sid() and avc_sid_to_context() return zero on success. On error, -1 is returned and errno is set appropriately.

Errors

ENOMEM

An attempt to allocate memory failed.

Notes

As of libselinux version 2.0.86, SID's are no longer reference counted. A SID will be valid from the time it is first obtained until the next call to avc_destroy(3). The sidget(3) and sidput(3) functions, formerly used to adjust the reference count, are no-ops and are deprecated.

Releases

11 releases since Debian 3.1 (Sarge); the text changed 5 times.

  1. 3.1–4.0
  2. 5.0
  3. 6.0–7
  4. 8–9
  5. 10–12
  6. 13

Author

Eamon Walsh <[email protected]>

From libselinux1-dev 3.8.1-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.