This example uses the bltocolor(3TSOL) call to get the character-coded color name associated with a sensitivity label of a particular level. The character-coded color names are specified in the label_encodings(4) file.
This example inquires about the character-coded color name associated with Confidential sensitivity labels. The process is running at Confidential so no privileges are needed for the inquiry. The calling process needs the sys_trans_label privilege in its effective set to inquire about labels that dominate the current process's sensitivity label.
#include <tsol/label.h>
main()
{
int retval, error;
bslabel_t senslabel;
char *string = "CONFIDENTIAL";
char *string1;
retval = stobsl(string, &senslabel, NEW_LABEL, &error);
string1 = bltocolor(&senslabel);
printf("Confidential label color = %s\n", string1);
}
The printf statement prints the following:
Confidential label color = BLUE |