|
|||
1. Solaris Trusted Extensions APIs and Security Policy Setting a File Sensitivity Label Determining the Relationship Between Two Labels Obtaining the Color Names of Labels Obtaining Printer Banner Information 4. Printing and the Label APIs 5. Interprocess Communications 8. Trusted Web Guard Prototype 9. Experimental Java Bindings for the Solaris Trusted Extensions Label APIs |
Obtaining a File LabelYou can obtain a file's sensitivity label and perform operations on that label. This code example uses the getlabel() routine to obtain the file's label. The fgetlabel() routine can be used in the same way, but it operates on a file descriptor. #include <tsol/label.h> main() { m_label_t* docLabel; const char* path = "/zone/restricted/documents/designdoc.odt"; int retval; char* label_string; /* allocate label and get the file label specified by path */ docLabel = m_label_alloc(MAC_LABEL); retval = getlabel(path, docLabel); /* translate the file's label to a string and print the string */ retval = label_to_str(docLabel, &label_string, M_LABEL, LONG_NAMES); printf("The file's label = %s\n", label_string); /* free allocated memory */ m_label_free(docLabel); free(label_string); } When you run this program, the output might look similar to this: The file's label = CONFIDENTIAL : INTERNAL USE ONLY |
||
|