1513N/A * Copyright (c) 1988, 2015, Oracle and/or its affiliates. All rights reserved. 546N/A * Permission is hereby granted, free of charge, to any person obtaining a 919N/A * copy of this software and associated documentation files (the "Software"), 919N/A * to deal in the Software without restriction, including without limitation 919N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense, 919N/A * and/or sell copies of the Software, and to permit persons to whom the 919N/A * Software is furnished to do so, subject to the following conditions: 919N/A * The above copyright notice and this permission notice (including the next 919N/A * paragraph) shall be included in all copies or substantial portions of the 919N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 919N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 919N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 919N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 919N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 919N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 919N/A * DEALINGS IN THE SOFTWARE. 546N/A * xlock.c - X11 client to lock a display and show a screen saver. 546N/A * Copyright (c) 1988-91 by Patrick J. Naughton. 546N/A * Permission to use, copy, modify, and distribute this software and its 546N/A * documentation for any purpose and without fee is hereby granted, 546N/A * provided that the above copyright notice appear in all copies and that 546N/A * both that copyright notice and this permission notice appear in 546N/A * supporting documentation. 546N/A * This file is provided AS IS with no warranties of any kind. The author 546N/A * shall have no liability with respect to the infringement of copyrights, 546N/A * trade secrets or any patents by this file or any part thereof. In no 546N/A * event will the author be liable for any lost revenue or profits or 546N/A * other special, indirect and consequential damages. 546N/A * Comments and additions should be sent to the author: 546N/A * Sun Laboritories, Inc. 546N/A * Mountain View, CA 94043 546N/A * 24-Jun-91: make foreground and background color get used on mono. 546N/A * 24-May-91: added -usefirst. 546N/A * 16-May-91: added pyro and random modes. 546N/A * ripped big comment block out of all other files. 546N/A * 08-Jan-91: fix some problems with password entry. 546N/A * removed renicing code. 546N/A * 29-Oct-90: added cast to XFree() arg. 546N/A * added volume arg to call to XBell(). 546N/A * 28-Oct-90: center prompt screen. 546N/A * make sure Xlib input buffer does not use up all of swap. 546N/A * make displayed text come from resource file for better I18N. 546N/A * add backward compatible signal handlers for pre 4.1 machines. 546N/A * 31-Aug-90: added blank mode. 546N/A * 29-Jul-90: added support for multiple screens to be locked by one xlock. 546N/A * removed use of allowsig(). 546N/A * 07-Jul-90: reworked commandline args and resources to use Xrm. 546N/A * 02-Jul-90: reworked colors to not use dynamic colormap. 546N/A * 23-May-90: added autoraise when obscured. 546N/A * 15-Apr-90: added hostent alias searching for host authentication. 546N/A * 18-Feb-90: added SunOS3.5 fix. 546N/A * changed -mono -> -color, and -saver -> -lock. 546N/A * allow non-locking screensavers to display on remote machine. 546N/A * added -echokeys to disable echoing of '?'s on input. 546N/A * cleaned up all of the parameters and defaults. 546N/A * 20-Dec-89: added -xhost to allow access control list to be left alone. 546N/A * added -screensaver (don't disable screen saver) for the paranoid. 546N/A * Moved seconds() here from all of the display mode source files. 546N/A * Fixed bug with calling XUngrabHosts() in finish(). 546N/A * 19-Dec-89: Fixed bug in GrabPointer. 546N/A * Changed fontname to XLFD style. 546N/A * 23-Sep-89: Added fix to allow local hostname:0 as a display. 546N/A * Moved colormap installation later in startup. 546N/A * 20-Sep-89: Linted and made -saver mode grab the keyboard and mouse. 546N/A * Replaced SunView code for life mode with Jim Graham's version, 546N/A * so I could contrib it without legal problems. 546N/A * Sent to expo for X11R4 contrib. 546N/A * 19-Sep-89: Added '?'s on input. 546N/A * 27-Mar-89: Added -qix mode. 546N/A * 20-Mar-89: Added backup font (fixed) if XQueryLoadFont() fails. 546N/A * Changed default font to lucida-sans-24. 546N/A * 08-Mar-89: Added -nice, -mode and -display, built vector for life and hop. 546N/A * 24-Feb-89: Replaced hopalong display with life display from SunView1. 546N/A * 22-Feb-89: Added fix for color servers with n < 8 planes. 546N/A * 16-Feb-89: Updated calling conventions for XCreateHsbColormap(); 546N/A * Added -count for number of iterations per color. 546N/A * Fixed defaulting mechanism. 546N/A * Ripped out VMS hacks. 546N/A * Sent to expo for X11R3 contrib. 546N/A * 15-Feb-89: Changed default font to pellucida-sans-18. 546N/A * 20-Jan-89: Added -verbose and fixed usage message. 546N/A * 19-Jan-89: Fixed monochrome gc bug. 546N/A * 16-Dec-88: Added SunView style password prompting. 546N/A * 19-Sep-88: Changed -color to -mono. (default is color on color displays). 546N/A * Added -saver option. (just do display... don't lock.) 546N/A * 31-Aug-88: Added -time option. 546N/A * Removed code for fractals to separate file for modularity. 546N/A * Added signal handler to restore host access. 546N/A * Installs dynamic colormap with a Hue Ramp. 546N/A * If grabs fail then exit. 546N/A * Added VMS Hacks. (password 'iwiwuu'). 546N/A * Sent to expo for X11R2 contrib. 546N/A * 08-Jun-88: Fixed root password pointer problem and changed PASSLENGTH to 20. 546N/A * 20-May-88: Added -root to allow root to unlock. 546N/A * 12-Apr-88: Added root password override. 546N/A * Added screen saver override. 546N/A * Added access control handling instead. 546N/A * 30-Mar-88: Removed startup password requirement. 546N/A * Removed cursor to avoid phosphor burn. 546N/A * 27-Mar-88: Rotate fractal by 45 degrees clockwise. 546N/A * 24-Mar-88: Added color support. [-color] 546N/A * 23-Mar-88: Added HOPALONG routines from Scientific American Sept. 86 p. 14. 546N/A * added password requirement for invokation 546N/A * removed option for command line password 546N/A * added requirement for display to be "unix:0". 546N/A * 22-Mar-88: Recieved Walter Milliken's comp.windows.x posting. 546N/Astatic char no_bits[] = {0};
/* dummy array for the blank cursor */ 546N/A * Server access control support. 546N/A * Simple wrapper to get an asynchronous grab on the keyboard and mouse. 546N/A * If either grab fails, we sleep for one second and try again since some 546N/A * window manager might have had the mouse grabbed to drive the menu choice 546N/A * that picked "Lock Screen..". If either one fails the second time we print 546N/A * an error message and exit. 546N/A * Assuming that we already have an asynch grab on the pointer, 546N/A * just grab it again with a new cursor shape and ignore the return code. 546N/A * Restore all grabs, reset screensaver, restore colormap, close connection. 1513N/A /* note that we were caught, but don't try to re-enter Xlib from here */ 1513N/A error(
"caught terminate signal %d.\nAccess control list restored.\n",
546N/A * eat all events if there are more than enough pending... this 546N/A * keeps the Xlib event buffer from growing larger than all 546N/A * available memory and crashing xlock. 546N/A * eat all events if there are more than enough pending... this 546N/A * keeps the Xlib event buffer from growing larger than all 546N/A * available memory and crashing xlock. 546N/A /* timeout or other error */ 546N/A * audit_lock - audit entry to screenlock 546N/A * Entry Process running with appropriate privilege to generate 546N/A * audit records and real uid of the user. 546N/A * Exit ADT_screenlock audit record written. 546N/A /* Audit start of screen lock -- equivalent to logout ;-) */ 546N/A "adt_alloc_event(ADT_screenlock): %m");
546N/A "adt_put_event(ADT_screenlock): %m");
546N/A * audit_unlock - audit screen unlock 546N/A * Entry Process running with appropriate privilege to generate 546N/A * audit records and real uid of the user. 546N/A * pam_status = PAM error code; reason for failure. 546N/A * Exit ADT_screenunlock audit record written. 546N/A "adt_start_session(ADT_screenunlock): %m");
546N/A "adt_alloc_event(ADT_screenunlock): %m");
546N/A "adt_put_event(ADT_screenunlock(%s): %m",
546N/A * audit_passwd - audit password change 546N/A * Entry Process running with appropriate privilege to generate 546N/A * audit records and real uid of the user. 546N/A * pam_status = PAM error code; reason for failure. 546N/A * Exit ADT_passwd audit record written. 546N/A "adt_start_session(ADT_passwd): %m");
546N/A "adt_alloc_event(ADT_passwd): %m");
546N/A "adt_put_event(ADT_passwd(%s): %m",
546N/A PAM_DISALLOW_NULL_AUTHTOK to pam_flags */ 546N/A /* Disable user password non-PAM authentication */ 546N/A * This section gets a little messy. In SYSV, the number of 546N/A * cases to handle increases because of the existence of the 546N/A * shadow file. There are also a number of cases that need 546N/A * to be dealt with where either root or user passwords are 546N/A * nil. Hopefully the code below is easy enough to follow. 546N/A /* clear plaintext password so you can't grunge around /dev/kmem */ 546N/A /* clear encrypted passwords just in case */ 546N/A /* clear encrypted passwords just in case */ 1233N/A "\tYou need to run xlock in setuid root mode on your local machine.\n" 1233N/A "\tContact your system administrator.\n");