Trusted Solaris Developer's Guide

Getting Window Attributes

The XTSOLgetPropAttributes(3) routine returns security-related attributes for a window. You supply the display and window IDs, a flag to indicate the object you want security attributes on is a window, and an XtsolResAttributes structure to receive the returned attributes. The client is getting the security attributes for a window it created so no privileges are required.

/* Retrieve underlying window and display IDs with Xlib calls */
	window = XtWindow(topLevel);
	display = XtDisplay(topLevel);

/* Retrieve window security attributes */
	retval = XTSOLgetResAttributes(display, window, IsWindow, &winattrs);

/* Translate labels to strings */
	retval = bsltos(&winattrs.sl, &string1, 0, LONG_WORDS);
	
/* Print security attribute information */
	printf("Workstation owner ID = %d, User ID = %d, Label = %s\n",
   winattrs.ouid, winattrs.uid,string1, string2,	string3);

The printf(1) statement prints the following:


Workstation owner ID = 29378
User ID = 29378
Label = CONFIDENTIAL