tsolextension.c revision 712
1117N/A#pragma ident "@(#)tsolextension.c 1.40 09/05/21 SMI"
1117N/A#include "auditwrite.h"
#include <ucred.h>
#include <netdb.h>
#include <strings.h>
#include <string.h>
#include <pwd.h>
#include <unistd.h>
#include <zone.h>
#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include "misc.h"
#include "osdep.h"
#include "tsol.h"
#include "inputstr.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "xace.h"
#include "xacestr.h"
#ifdef PANORAMIX
#include "../Xext/panoramiXsrv.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include "security.h"
#include "../Xext/securitysrv.h"
#include "tsolpolicy.h"
#define BadCmapCookie 0
static unsigned char TsolReqCode = 0;
static int OwnerUIDint;
_X_EXPORT void
TsolExtensionInit(void)
if (!is_system_labeled()) {
init_xtsol();
if (serverClient) {
for (i = 0; i < PROCVECTORSIZE; i++) {
static CALLBACK(
int msgType;
int msgVerb;
int reqtype;
switch (rtype) {
case RT_GC:
if (id != 0) {
switch (reqtype) {
case X_SetInputFocus:
case X_GetInputFocus:
case X_ChangeWindowAttributes:
case X_GrabPointer:
case X_UngrabPointer:
case X_GrabKeyboard:
case X_UngrabKeyboard:
case X_GrabKey:
case X_UngrabKey:
case X_GrabButton:
case X_UngrabButton:
case RT_PIXMAP:
switch (reqtype) {
case X_CreatePixmap:
case X_PolyPoint:
case X_PolyLine:
case X_PolyArc:
case X_FillPoly:
case X_PolyFillRectangle:
case X_PolyFillArc:
case X_PutImage:
case X_PolyText8:
case X_PolyText16:
case X_ImageText8:
case X_ImageText16:
case X_GetImage:
case X_ClearArea:
case RT_CURSOR:
case RT_FONT:
#ifndef NO_TSOL_DEBUG_MESSAGES
#ifdef NO_TSOL_DEBUG_MESSAGES
case SelectionClientClose:
case SelectionWindowDestroy:
case ClientStateInitial:
case ClientStateRunning:
case ClientStateGone:
int retval;
case X_SetPolyInstInfo:
case X_SetPropLabel:
case X_SetPropUID:
case X_SetResLabel:
case X_SetResUID:
case X_GetClientAttributes:
case X_GetClientLabel:
case X_GetPropAttributes:
case X_GetResAttributes:
case X_MakeTPWindow:
case X_MakeTrustedWindow:
case X_MakeUntrustedWindow:
return (retval);
int retval;
case X_SetPolyInstInfo:
case X_SetPropLabel:
case X_SetPropUID:
case X_SetResLabel:
case X_SetResUID:
case X_GetClientAttributes:
case X_GetClientLabel:
case X_GetPropAttributes:
case X_GetResAttributes:
case X_MakeTPWindow:
case X_MakeTrustedWindow:
case X_MakeUntrustedWindow:
return (retval);
int err_code;
return (err_code);
int err_code;
int rc;
return rc;
if (!pWin)
return (BadWindow);
return (err_code);
return (BadAtom);
while (pProp)
if (!pProp)
return (BadAtom);
return (err_code);
int err_code;
int rc;
return rc;
if (!pWin)
return (BadWindow);
return (BadAtom);
while (pProp)
if (!pProp)
return (BadAtom);
return (err_code);
int err_code;
int rc;
return (err_code);
return (err_code);
case IsWindow:
return rc;
if (pWin)
return (BadWindow);
case IsPixmap:
return rc;
if (pMap)
return (BadPixmap);
return (BadValue);
return (err_code);
return rc;
int ScreenNumber;
int err_code;
int rc;
case STRIPEHEIGHT:
return (err_code);
case RES_OUID:
return (err_code);
case IsWindow:
return rc;
if (pWin)
return (BadWindow);
case IsPixmap:
return rc;
if (pMap)
return (BadPixmap);
return (BadValue);
return (err_code);
int err_code;
int rc;
return rc;
return (BadWindow);
return (err_code);
int reply_length = 0;
int rc;
int err_code;
return rc;
return (BadWindow);
return (err_code);
return (BadAlloc);
int reply_length = 0;
int rc;
return rc;
return (BadAtom);
while (pProp)
if (!pProp)
return (BadAlloc);
int reply_length = 0;
int rc;
return rc;
return rc;
return (BadAlloc);
int rc;
int err_code;
#if defined(PANORAMIX)
if (!noPanoramiXExtension)
== NULL)
return BadWindow;
return rc;
return (BadWindow);
return (err_code);
return rc;
return (BadWindow);
return (err_code);
int rc;
int err_code;
return rc;
return (BadWindow);
return (err_code);
int rc;
int err_code;
return rc;
return (BadWindow);
return (err_code);
if (kbdgrab) {
if (ptrgrab) {
if (tsolMultiLevel) {
int errcode;
if (errcode) {
char *temp_inmsg;
struct svc_req r;
memset((char *)&r, 0, sizeof(r));
goto bad1;
goto bad2;
goto bad2;
#ifdef SVR4
goto bad2;
bad2:
bad1:
static Bool
extern int getdomainname(char *, int);
static XID
char audit_ret;
int client_gidlen;
char *fullname;
audit_val = 0;
if (system_audit_on &&
int status;
case AF_INET:
case AF_INET6:
if (!status)
return (auth_token);
static CALLBACK(
static CALLBACK(
static CALLBACK(
static CALLBACK(
int reqtype;
switch (reqtype) {
case X_Bell:
case X_GetPointerControl:
case X_ChangePointerControl:
case X_GetKeyboardControl:
case X_ChangeKeyboardControl:
case X_GetKeyboardMapping:
case X_ChangeKeyboardMapping:
case X_GetMotionEvents:
case X_QueryKeymap:
case X_SetModifierMapping:
#ifndef NO_TSOL_DEBUG_MESSAGES
static CALLBACK(
int reqtype;
switch (reqtype) {
case X_SetSelectionOwner:
if (polySelection) {
if (pSel) {
case X_GetSelectionOwner:
case X_ConvertSelection:
if (polySelection) {
if (pSel) {
#ifndef NO_TSOL_DEBUG_MESSAGES
static CALLBACK(
int reqtype;
int tsol_method;
if (!polyprop) {
while (pProp) {
if (pProp) {
#ifndef NO_TSOL_DEBUG_MESSAGES
static CALLBACK(
#ifdef UNUSED
char *rhost;
return FALSE;
return TRUE;
return FALSE;