JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris Trusted Extensions Reference Manual
search filter icon
search icon

Document Information

Preface

Introduction

User Commands

System Administration Commands

System Calls

Trusted Extensions Library

bcleartoh(3TSOL)

bcleartoh_r(3TSOL)

bcleartos(3TSOL)

blcompare(3TSOL)

bldominates(3TSOL)

blequal(3TSOL)

blinrange(3TSOL)

blmaximum(3TSOL)

blminimum(3TSOL)

blminmax(3TSOL)

blstrictdom(3TSOL)

bltocolor(3TSOL)

bltocolor_r(3TSOL)

bltos(3TSOL)

bsltoh(3TSOL)

bsltoh_r(3TSOL)

bsltos(3TSOL)

btohex(3TSOL)

getdevicerange(3TSOL)

getpathbylabel(3TSOL)

getplabel(3TSOL)

getuserrange(3TSOL)

getzoneidbylabel(3TSOL)

getzonelabelbyid(3TSOL)

getzonelabelbyname(3TSOL)

getzonerootbyid(3TSOL)

getzonerootbylabel(3TSOL)

getzonerootbyname(3TSOL)

h_alloc(3TSOL)

hextob(3TSOL)

h_free(3TSOL)

htobclear(3TSOL)

htobsl(3TSOL)

labelbuilder(3TSOL)

labelclipping(3TSOL)

label_to_str(3TSOL)

m_label(3TSOL)

m_label_alloc(3TSOL)

m_label_dup(3TSOL)

m_label_free(3TSOL)

sbcleartos(3TSOL)

sbltos(3TSOL)

sbsltos(3TSOL)

setflabel(3TSOL)

stobclear(3TSOL)

stobl(3TSOL)

stobsl(3TSOL)

str_to_label(3TSOL)

tsol_getrhtype(3TSOL)

tsol_lbuild_create(3TSOL)

tsol_lbuild_destroy(3TSOL)

tsol_lbuild_get(3TSOL)

tsol_lbuild_set(3TSOL)

Xbcleartos(3TSOL)

Xbsltos(3TSOL)

X Library Extensions

File Formats

Standards, Environments, and Macros

Index

setflabel

- move file to zone with corresponding sensitivity label

Synopsis

cc [flag...] file... -ltsol [library...]
#include <tsol/label.h>

int setflabel(const char *path, const m_label_t *label_p);

Description

The file that is named by path is relabeled by moving it to a new pathname relative to the root directory of the zone corresponding to label_p. If the source and destination file systems are loopback mounted from the same underlying file system, the file is renamed. Otherwise, the file is copied and removed from the source directory.

The following policy checks are enforced by this function:

Additional policy constraints can be implemented by customizing the shell script /etc/security/tsol/relabel. See the comments in this file.

Return Values

setflabel() returns:

0

On success.

-1

On failure, and sets errno to indicate the error.

Errors

setflabel() fails and the file is unchanged if any of these conditions prevails:

EACCES

Search permission is denied for a component of the path prefix of path.

The calling process does not have mandatory write access to the final component of path because the sensitivity label of the final component of path does not dominate the sensitivity label of the calling process and the calling process does not have PRIV_FILE_MAC_WRITE in its set of effective privileges.

EBUSY

There is an open file descriptor reference to the final component of path.

ECONNREFUSED

A connection to the label daemon could not be established.

EEXIST

A file with the same name exists in the destination directory.

EINVAL

Improper parameters were received by the label daemon.

EISDIR

The existing file is a directory.

ELOOP

Too many symbolic links were encountered in translating path.

EMLINK

The existing file is hardlinked to another file.

ENAMETOOLONG

The length of the path argument exceeds PATH_MAX.

ENOENT

The file referred to by path does not exist.

EROFS

The file system is read-only or its label is ADMIN_LOW or ADMIN_HIGH.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
SUNWcslr
MT-Level
MT-Safe
Interface Stability
Stable

See Also

attributes(5)

Setting a File Sensitivity Label in Solaris Trusted Extensions Developer’s Guide