Trusted Solaris Developer's Guide

Example Motif Application

The example Motif application in the following figure launches xclock or xterm applications. It is simple because its purpose is to show how Trusted Solaris X Windows programming interfaces are called from within a Motif application. The application's process sensitivity label is Confidential and the information label is ADMIN_LOW.

Figure 14-1 Simple Motif Application

Graphic

The next headings provide example code segments that use the Trusted Solaris interface calls to handle security attributes and translate a binary label to text with a font list. The code segments focus on handling window security attributes because those are the most common operations in application programs. Often a client will retrieve security attributes (using the appropriate privileges) for an object created by another application and check the attributes to determine if an operation on the object is permitted by the system's discretionary ownership policies and the mandatory write-equal and read-down policies. If access is denied, the application raises an error or uses privilege as appropriate. See "Privileged Operations" for information on when privileges are needed.

The source code for the simple Motif application including the code segments below is provided in "Code". Xlib calls to retrieve object IDs to pass to the Trusted Solaris programming interfaces should be made after the appropriate object has been created so there is an ID to retrieve. In this source code, the Xlib calls are after XtRealizeWidget() is called.