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. 1233N/A * Copyright (c) 1990, 2011, 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 * resource.c - resource management for xlock, the X Window System lockscreen. 546N/A * 24-Jun-91: changed name to username. 546N/A * 06-Jun-91: Added flame mode. 546N/A * 24-May-91: Added -name and -usefirst and -resources. 546N/A * 16-May-91: Added random mode and pyro mode. 546N/A * 26-Mar-91: CheckResources: delay must be >= 0. 546N/A * 29-Oct-90: Added #include <ctype.h> for missing isupper() on some OS revs. 546N/A * moved -mode option, reordered Xrm database evaluation. 546N/A * 28-Oct-90: Added text strings. 546N/A * 26-Oct-90: Fix bug in mode specific options. 546N/A * 31-Jul-90: Fix ':' handling in parsefilepath 546N/A#
define DEF_FONT "-b&h-lucida-medium-r-normal-sans-24-*-*-*-*-*-iso8859-1" 546N/A#
define DEF_INFO "Enter password to unlock; select icon to lock." 546N/A#
define DEF_BC "100" /* vectors (or whatever) per batch */ 546N/A {
"-help",
"print out this message"},
546N/A {
"-resources",
"print default resource file to standard output"},
546N/A {
"-display displayname",
"X server to contact"},
546N/A {
"-name resourcename",
"class name to use for resources (default is XLock)"},
546N/A {
"-/+nolock",
"turn on/off no password required mode"},
546N/A {
"-/+remote",
"turn on/off remote host access"},
546N/A {
"-/+allowroot",
"turn on/off allow root password mode"},
546N/A {
"-/+enablesaver",
"turn on/off enable X server screen saver"},
546N/A {
"-/+allowaccess",
"turn on/off allow new clients to connect"},
546N/A {
"-/+echokeys",
"turn on/off echo '?' for each password key"},
546N/A {
"-/+usefirst",
"turn on/off using the first char typed in password"},
546N/A {
"-delay usecs",
"microsecond delay between screen updates"},
546N/A {
"-batchcount num",
"number of things per batch"},
546N/A {
"-nice level",
"nice level for xlock process"},
546N/A {
"-timeout seconds",
"number of seconds before password times out"},
546N/A {
"-saturation value",
"saturation of color ramp"},
546N/A {
"-font fontname",
"font to use for password prompt"},
546N/A {
"-bg color",
"background color to use for password prompt"},
546N/A {
"-fg color",
"foreground color to use for password prompt"},
546N/A {
"-name string",
"text string to use for Name prompt"},
546N/A {
"-password string",
"text string to use for Password prompt"},
546N/A {
"-info string",
"text string to use for instructions"},
546N/A {
"-validate string",
"text string to use for validating password message"},
546N/A {
"-invalid string",
"text string to use for invalid password message"},
546N/A/* 4036289. Limit the size of string to print. */ 546N/A/* 4036289, do not use stack buffer, allocate this buffer from the heap*/ 546N/A /* Scan through source, expanding % strings as necessary, and 546N/A passing completed paths to XrmGetFileDatabase when ':' or 546N/A end of string is found. To prevent buffer overflows (bug 546N/A 4483090) each time we decide to append to the string, we 546N/A set appenddata to point to the data to be appended & 546N/A appendsize to the size to be appended, and then do all the 546N/A appending & size checking in one place at the end. 546N/A /* Grow by a bit more than we need so we don't have to 546N/A * only restrict access to other displays if we are locking and if the 546N/A * Remote resource is not set. 546N/A * Get the ip address of $DISPLAY and the machine name. 546N/A * If both are matching then allow to open display. 546N/A * ( also check against the ip addr list returned by gethostbyname. 546N/A * Otherwise, report error and exit. 546N/A * display_ip contains IP address of the $DISPLAY 546N/A * host_ip contains IP address of the machine_name 546N/A * tmp_display contains the $DISPLAY - [:0.0 or :0] 546N/A * This fix will take care of long host name and IP address form. 546N/A /* check against the list of Internet address */ 546N/A /* display has been replaced tmp_display because 546N/A * display will be in :0.0 format and tmp_display 546N/A * get -name arg from command line so you can have different resource 546N/A/* 4036289, Limit the string to print */ 546N/A/* 4036289, Limit the string to print */ 546N/A/* 4036289, Limit the string to print */ 546N/A * if random mode, then just grab a random entry from the table 546N/A/* 4036289, Limit the string to print */ 546N/A /* Parse the rest of the command line */ 546N/A /* the RDB is set, now query load the variables from the database */ 546N/A Syntax(
"-saturation argument must be between 0.0 and 1.0.");