tsolprotocol.c revision 168
98N/A/* Copyright 2007 Sun Microsystems, Inc. All rights reserved. 0N/A * Permission is hereby granted, free of charge, to any person obtaining a 0N/A * copy of this software and associated documentation files (the 0N/A * "Software"), to deal in the Software without restriction, including 0N/A * without limitation the rights to use, copy, modify, merge, publish, 0N/A * distribute, and/or sell copies of the Software, and to permit persons 0N/A * to whom the Software is furnished to do so, provided that the above 0N/A * copyright notice(s) and this permission notice appear in all copies of 0N/A * the Software and that both the above copyright notice(s) and this 0N/A * permission notice appear in supporting documentation. 0N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 0N/A * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 0N/A * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 0N/A * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 0N/A * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL 0N/A * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING 0N/A * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 0N/A * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 0N/A * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 0N/A * Except as contained in this notice, the name of a copyright holder 0N/A * shall not be used in advertising or otherwise to promote the sale, use 0N/A * or other dealings in this Software without prior written authorization 0N/A * of the copyright holder. 0N/A * Changes in one should go with corresponding changes in another. 0N/A * Get number of atoms defined in the system 0N/A * Update Tsol info for atoms. This function gets 0N/A * called typically during initialization. But, it could also get 0N/A * called if some atoms are created internally by server. 0N/A /* Update may not be needed */ 0N/A /* Atom id 0 is invalid */ 0N/A ErrorF(
"Cannot allocate memory for Tsol node\n");
0N/A * Initialize the tsol node for each atom 0N/A /* TBD: NameForTSOLAtom */ 0N/A /* Make the atom as usual */ 0N/A /* tsol node info already present? */ 0N/A /* public atoms have null sl */ 0N/A /* private atoms must have a matching sl */ 0N/A /* tsol node table not big enough, expand it */ 0N/A /* Allocate storage for sl if needed */ 0N/A /* Expand storage space for sl if needed */ 0N/A /* Store client's sl */ 0N/A /* If the client's time stamp is in the future relative to the server's 0N/A time stamp, do not set the selection, just return success. */ 0N/A * First, see if the selection is already set... 0N/A * special processing for selection agent. Just note 0N/A * the owner of this special selection 0N/A /* for poly-selections, search further to see if sl,uid match */ 0N/A break;
/* match found */ 0N/A /* we use the existing code. So we left it unindented */ 0N/A /* If the timestamp in client's request is in the past relative 0N/A to the time stamp indicating the last time the owner of the 0N/A selection was set, do not set the selection, just return 0N/A * It doesn't exist, so add it... 0N/A * tsolseln == NULL, either seln does not exist, 0N/A * or there is no sl,uid match 0N/A /* create one & put it in place */ 0N/A /* if necessary put at the end of the list */ 0N/A /* no change to existing code. left as it is */ 0N/A /* find matching sl,uid in case of poly selns */ 0N/A break;
/* match found */ 0N/A * Selection Agent processing. Override the owner 0N/A /* end seln agent processing */ 0N/A /* find matching sl,uid in case of poly selns */ 0N/A break;
/* match found */ 0N/A * Special case for seln agent. 0N/A * SelectionRequest event is redirected to selection 0N/A * agent for unpirvileged clients and who do not own 0N/A /* Redirect only if client other than owner & does not have priv */ 0N/A /* end of special case seln handling */ 0N/A/* Allocate and initialize a tsolprop */ 168N/A * Allocate and initialize tsolprop created 168N/A * internally by the X server 0N/A * instantiated properties. Polyinstanticated property 0N/A /* first see if property already exists */ 0N/A /* Initialize secPrviate if property is not polyinstantiated */ 0N/A /* Initialize for internally created properties */ 0N/A /* Handle polyinstantiated property */ 0N/A }
/* end if !prop */ 0N/A /* To append or prepend to a property the request format and type 0N/A * must match those of the already defined property. The 0N/A * existing format and type are irrelevant when using the mode 0N/A * "PropModeReplace" since they will be written over. 0N/A /* search for a matching (sl, uid) pair */ 0N/A break;
/* match found */ 0N/A /* no match found. Create one */ 0N/A }
/* end else if !prop */ 0N/A /* Found a matching name. Further match for SL,UID */ 0N/A /* policy check for window */ 0N/A /* policy check for window */ 0N/A break;
/* match found */ 0N/A /* If the request type and actual type don't match. Return the 0N/A property information, but not the data. */ 0N/A * Return type, format, value to client 0N/A /* If longOffset is invalid such that it causes "len" to 0N/A be negative, it's a value error. */ 0N/A /* policy check for delete error ignored */ 0N/A {
/* send the event */ 0N/A {
/* delete the Property */ 0N/A /* remove the tsol struct */ 0N/A /* delete the prop for last reference */ 0N/A * Now enforce the restriction that "all of the non-zero keycodes must be 0N/A * in the range specified by min-keycode and max-keycode in the 0N/A * connection setup (else a Value error)" 0N/A * silently ignore the request. xview apps 0N/A * complain if we return error code. If we don't 0N/A * send the map notify event application hangs 36N/A /* Validate trusted stripe window */ 0N/A /* stripe is already at head, nothing to do */ 0N/A /* Initialize tsol security attributes */ 0N/A /* stuff tsol info into window from client */ 0N/A /* Client is Server itself */ 0N/A * HotKey is Meta(Diamond)+ Stop Key 0N/A * Breaks untusted Ptr and Kbd grabs. 0N/A * Trusted Grabs are NOT broken 0N/A * Warps pointer to the Trusted Stripe if not Trusted grabs in force. 0N/A * Warp the pointer to the Trusted Stripe 0N/A * Checks that tpwin & its siblings have same 0N/A * parents. Returns 0 if OK, a # indicating which 0N/A * Sibling has a bad parent 0N/A /* Reduce root window height = stripe height */ 0N/A /* turn off auditing because operation ignored */ 0N/A /* turn off auditing because operation ignored */ 0N/A /* Initialize security info */ 0N/A /* Client is Server itself */ 0N/A break;
/* match found */ 0N/A /* first on the list */ 0N/A /* handle the last reference */ 0N/A break;
/* match found */ 0N/A /* first on the list */ 0N/A /* handle the last reference */ 0N/A * check every colormap id for access. return default colormap 0N/A * id in case of failure 0N/A * Because of its recursive nature, QuerryTree can leave a huge trail 0N/A * of audit records which could make deciphering the audit log for 0N/A * critical records difficult. So we turn off any more auditing of 0N/A }
else {
/* otherwise its screen 0, and nothing changes */ 36N/A * events are non-protocol ones viz. ClientConnect, mapped to 9101 36N/A * and ClientDisconnect, mapped to 9102. 36N/A * The protocol events are mapped from 9103 onwards in the serial 36N/A * order of their respective protocol opcode, for eg, the protocol 36N/A * UngrabPointer which is has a protocol opcode 27 is mapped to 36N/A * 9129 (9102 + 27). 36N/A * All extension protocols are mapped to a single audit event 36N/A * AUE_XExtension as opcodes are assigined dynamically to these 36N/A * protocols. We set the extension protocol opcode to be 128, one 36N/A * more than the last standard opcode. 36N/A * Exclude Clients with Trusted Path such as tsoldtwm, tsoldtsession etc 36N/A * from generating the audit records for X protocols 36N/A /* Allow extensions in the labeled zones */ 36N/A /* Hide this extension */ 36N/A /* Allow extensions in the labeled zones */ 73N/A /* requested area must be a subset of the window area */ 64N/A if(
/* check for being viewable */ 64N/A /* check for being on screen */ 64N/A /* check for being inside of border */ 64N/A /* only planes asked for */ 64N/A /* we have to make sure intermediate buffers don't need padding */ 64N/A /* nothing to do */ 64N/A * fill the buffer with zeros in case of security failure 64N/A /* Note that this is NOT a call to WriteSwappedDataToClient, 64N/A as we do NOT byte swap */ 64N/A/* Don't split me, gcc pukes when you do */ 64N/A else /* XYPixmap */ 64N/A * fill the buffer with zeros in case of security failure 64N/A /* Note: NOT a call to WriteSwappedDataToClient, 64N/A as we do NOT byte swap */ 64N/A/* Don't split me, gcc pukes when you do */ 64N/A /* ignore the error message for DnD zap effect */ 64N/A /* ignore the error message */ 64N/A /* ignore the error message for DnD zap effect */ 64N/A /* ignore the error message for DnD zap effect */ 64N/A /* ignore the error message for DnD zap effect */ 64N/A /* ignore the error message for DnD zap effect */