/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/Xprotostr.h>
#include "auditwrite.h"
#include <bsm/audit_uevents.h>
#include <regex.h>
#include <priv.h>
#include "windowstr.h"
#include "scrnintstr.h"
#include "xkbstr.h"
#include "xkbsrv.h"
#include "tsol.h"
#include "tsolinfo.h"
#include "tsolpolicy.h"
#include "misc.h"
#include "inputstr.h"
#include "propertyst.h"
#include "panoramiXsrv.h"
#include "registry.h"
#define EMPTIED 0
/*
* The following need to be moved to tsolextension.c
* after all references in Xsun is pulled out
*/
/*
* Use the NodeRec struct in tsolinfo.h. This is referenced
* in policy routines. So we had to move it there
*/
unsigned int StripeHeight = 0;
int tsol_nodelength = 0;
/* This structure is used for protocol request ListHosts */
struct xUIDreply
{
unsigned char family;
unsigned char pad;
unsigned short length;
};
struct slentry
{
char allocated;
};
/* This table contains list of users who can connect to the server */
struct uidentry
{
char allocated;
};
/* Index must match with keywords */
"extension", "privilege"};
typedef struct _TsolConfig
{
int count;
char **list;
{0, NULL},
{0, NULL},
{0, NULL},
{0, NULL},
{0, NULL}
};
"_TSOL_CMWLABEL_CHANGE",
"_TSOL_GRABNOTIFY",
"_TSOL_CLIENT_TERM",
"_TSOL_SEL_AGNT"
};
static void
init_TSOL_cached_SL(void)
{
}
/* Initialize UID table, this table should at least contains owner UID */
static void
init_TSOL_uid_table(void)
{
}
#if UNUSED
/* Count how many valid entried in the uid table */
int
count_uid_table(void)
{
int i, count = 0;
/* Search entire table */
for (i = 0; i < MAX_UID_ENTRY; i++)
{
count++;
}
return (count);
}
/* return (1); if userid is in the table */
int
{
int i;
for (i = 0; i < MAX_UID_ENTRY; i++)
{
{
return (1); /* yes, found it */
}
}
return (0); /* not found */
}
/* Passed into a pointer to a storage which is used to store UID */
/* and nUid represents how many UID in the table(returned by count_uid_table) */
int
int nUid)
{
int i, j = 0;
for (i = 0; i < MAX_UID_ENTRY; i++)
{
{
j++;
}
}
if (nUid != j)
{
ErrorF("Invalid no. of uid entries? \n");
return (0);
}
return (1);
}
#endif /* UNUSED */
/* add userid into UIDtable */
int
{
int i = 0;
/*
* Search entire uidtable, to prevent duplicate uid
* entry in the table
*/
while (i < MAX_UID_ENTRY)
{
{
/* this uid entry is already in the table; no-op */
return (1); /* Success, uid in the table */
}
i++;
}
i = 0;
/*
* If we can find an empty entry, then add this uid
* into the table
*/
while (i < MAX_UID_ENTRY)
{
{
return (1); /* Success, uid in the table */
}
i++;
}
/* uidtable overflow */
ErrorF("Server problem: Please enlarge the table size of uidtable \n");
return (0);
}
#if UNUSED
/* remove userid from UIDtable */
int
{
int i = 0;
if (*userid == 0)
{
ErrorF("\n UID 0 can not be removed from server UID list");
return (0);
}
while (i < MAX_UID_ENTRY)
{
{
/* delete this entry in the table */
return (1); /* Success, uid in the table */
}
i++;
}
/* no such entry in the table, why delete it? no-op */
return (0);
}
#endif
lookupSL_low(void)
{
}
{
int i = 0;
return (slptr);
{
{
/* found a matching sensitivity label in sltable */
}
i++;
}
if (i < MAX_SL_ENTRY)
{
/*
* can't find a matching entry in sltable,
* however, we have empty entry to store this
* new sensitivity label; store it.
*/
}
/*
* no matching entry in sltable, and no room to
* store this new sensitivity label,
* the server needs to recomplie with a larger slabel
*/
ErrorF("Server problem: Please enlarge the table size of sltable \n");
return (NULL);
}
/* Updated version based roughly on RREditConnectionInfo in randr/rrscreen.c */
int
{
int i, j;
char *vendor;
int old_height;
float height_mult;
sizeof (xPixmapFormat) *
for (i = 0; i < screen_num; i++)
{
sizeof (xWindowRoot));
{
sizeof (xDepth));
sizeof (xVisualType));
}
}
if (noPanoramiXExtension)
{
} else
{
}
/* compute new millimeter height */
return (0);
}
extern int cannot_audit(int); /* bsm function */
void
init_xtsol(void)
{
if (cannot_audit(TRUE))
else
}
/*
* Converts keycode to keysym, helper function.
* Modelled after Xlib code
*/
static KeySym
{
return NoSymbol;
if (col < 4) {
if (col > 1) {
per--;
if (per < 3)
col -= 2;
}
if (!(col & 1))
return lsym;
return NoSymbol;
else
return usym;
}
}
}
/*
* Converts keysym to a keycode
* Modelled after Xlib code
*/
static KeyCode
{
int i, j;
for (j = 0; j < curKeySyms->mapWidth; j++) {
return i;
}
}
return 0;
}
/*
* converts a keysym to modifier equivalent mask
* Modelled after Xlib
*/
static unsigned
{
KeySym *k;
mods = 0;
while (k < kmax) {
if (*k == ks ) {
int j = maxKeysPerModifier << 3;
while (--j >= 0) {
if (code == modifierKeyMap[j])
}
}
k++;
}
return mods;
}
/*
* Initialize Hot Key keys. On A Sun type 5/6 keyboard
* It's Meta(Diamond) + Stop. On a non-Sun keyboard, it's
* Alt + Break(Pause) key. Hold down the meta or alt key
* press stop or break key.
*
* NOTE:
* Both Left & Right keys for (Meta or Alt) return the
* same modifier mask
*/
void
{
int rc;
int max_keys_per_mod = 0;
/* Meta + Stop */
}
static void
{
int i;
int count;
char **newlist;
return; /* ignore incomplete entries */
/* find a matching keyword */
for (i = 0; i < KEYWORDCOUNT; i++) {
break;
}
}
/* Invalid keyword */
if (i >= KEYWORDCOUNT) {
return;
}
return;
}
tsolconfig[i].count++;
}
static void
InitPrivileges(void)
{
int i;
int count;
char **list;
for (i = 0; i < count; i++) {
priv_win_dga = TRUE;
}
}
/*
* Load Trusted Solaris configuration file
*/
void
LoadTsolConfig(void)
{
char *keyword;
char *value;
/* open the file from /etc first followed by /usr */
ErrorF("Cannot load %s. Some desktop applications may not\n"
"work correctly\n", TSOLPOLICYFILE);
return;
}
/* Read and parse the config file */
/* ignore all comments, lines starting with white space */
continue;
}
}
/*
* It does not really tell if this atom is to be polyinstantiated
* or not. Further check should be done to determine this.
*/
int
{
}
void
MakeTSOLAtoms(void)
{
int i;
char *atomname;
/* Create new TSOL atoms */
for (i = 0; i < TSOL_ATOMCOUNT; i++) {
AtomError();
}
/* Create atoms defined in config file */
AtomError();
}
}
}
/*
* Names starting with a slash in selection.atoms and property.atoms
* are treated as regular expressions to be matched against the
* selection and property names. They may optionally end with a slash.
*/
static int
{
int status;
char *regexpstrp;
int regexpstrlen;
/* Extract regular expression from between slashes */
/* Compile the regular expression */
if (status == 0) {
/* Make null-terminated copy of string */
/* Compare string to regular expression */
if (status == 0)
return (TRUE);
else
return (FALSE);
}
return (TRUE);
}
return (FALSE);
}
int
{
int i;
int count;
char **list;
unsigned int flags = 0;
for (i = 0; i < count; i++) {
flags |= TSOLM_PROPERTY;
break;
}
}
for (i = 0; i < count; i++) {
flags |= TSOLM_SELECTION;
break;
}
}
return (flags);
}
{
return TsolClientPrivate(client);
}
/* Property is polyinstantiated only on root window */
int
{
if (WindowIsRoot(pWin) &&
return TRUE;
return FALSE;
}
int
{
return TRUE;
return FALSE;
}
/*
* client or is a default server xid
*/
int
{
return TRUE;
else
return FALSE;
}
/*
* Same as TopClientWin()
* except that it returns a Window ID
* and not a ptr
*/
{
if (pWin)
{
}
return (NULL);
}
#ifdef UNUSED
/*
* Return root window of pWin
*/
{
if (pWin)
{
}
return (pWin);
}
#endif
{
if (pWin)
{
}
return (NULL);
}
/*
* client
*/
int
{
return FALSE;
if((SERVER_BIT & xid) == 0)
{
return TRUE;
{
return TRUE;
}
}
return FALSE;
}
{
{
{
#ifdef SHAPE
#endif
)
return(pSib);
}
}
}
/*
* Return Top level client window of pWin
*/
{
if (pWin)
{
{
break;
}
}
return (pWin);
}
/*
* Matches in the list of disabled extensions via
* the policy file (TrustedExtensionsPolicy)
* Returns
* TRUE - if a match is found
* FALSE - otherwise
*/
int
{
int i;
return TRUE;
}
}
return FALSE;
}
/*****************************************************************************/
/* Returns a string representation of the access mode for debugging messages */
_X_HIDDEN const char *
int l = 0;
access_mode_str[0] = '\0';
if (access_mode & (mode)) \
if ( (l > 3) && (l < sizeof(access_mode_str)) ) {
/* strip off trailing " | " */
}
return access_mode_str;
}
/* Returns a string representation of the tsol policy for debugging messages */
_X_HIDDEN const char *
{
if (pr == XTSOL_FAIL) {
return "FAIL";
} else if (pr == XTSOL_ALLOW) {
return "ALLOW";
} else if (pr == XTSOL_IGNORE) {
return "IGNORE";
} else {
return str;
}
}
_X_HIDDEN const char *
{
"error code #%d", errcode);
return unknown_string;
}
return regentry;
}
_X_HIDDEN const char *
{
return unknown_string;
}
return regentry;
}
_X_HIDDEN const char *
{
const char *regentry;
if (req < 0) {
return "<no request>";
}
"request type #%d", req);
return unknown_string;
}
return regentry;
}