6179N/AFrom 8c50007e132d474a772ac456786342c0fe7fe189 Mon Sep 17 00:00:00 2001
5559N/AFrom: Alan Coopersmith <alan.coopersmith@oracle.com>
5559N/ADate: Sat, 2 Jan 2016 20:36:57 -0800
5398N/ASolaris uses the gtk unlock dialog program originally written by
5398N/AXimian & Wipro, in order to provide a dialog box that works with
5398N/Athe GNOME accessibility framework. This was done as a fork of
5398N/Athe original xscreensaver because the maintainer would not allow
5398N/Ause of a toolkit in the lock dialog - he has since softened his
5398N/Astance a bit, but this has not been presented to him to see if it
5398N/Ameets his requirements as spelled out at:
5398N/AThis patch also contains fixes for:
5398N/A15134570 SUNBT4782515 user is prompted to enter PIN or password when screen
5398N/A15134983 SUNBT4783832 No date on xscreensaver-lock and warning on screen
5398N/A15179562 SUNBT4931584 xscreensaver-demo cores with GTK_MODULES=gail:atk-bridge
5398N/A15209082 SUNBT5039876 "User:" should not look like an input field
5398N/A15209083 SUNBT5039878 "Password:" field should be focused / have flashing caret
5398N/A15214348 SUNBT5059445 pam service name, screen kb and screen reader support
5398N/A15220008 SUNBT5077989 Bug 147580: password input dialogue obscures GOK
5398N/A15220010 SUNBT5077993 Bug 147639: Gok cant automatically UI grab screensaver
5398N/A15220705 SUNBT5079870 147587: password field should set ATK_ROLE_PASSWORD_TEXT
5398N/A15221761 SUNBT5083155 Unable to unlock screen when running dual head
5398N/A15231258 SUNBT6176524 passwdTimeoutEnable for disabled user (xscreensaver-lock)
5398N/A15231818 SUNBT6178584 Xscreensaver needs to use ROLE_PASSWORD_TEXT
5398N/A15233078 SUNBT6182506 Screensaver dialog isn't magnified properly
5398N/A15239418 SUNBT6203951 xscreensaver lockscreen translation errors for fr_FR
5398N/A15252945 SUNBT6237901 Ldap and Gnome xscreensaver authentication failure
5398N/A15265442 SUNBT6269444 snv_14 xscreensaver prints out gratuitous debug messages
5398N/A15280862 SUNBT6308859 xscreensaver: password lock dialog is not localized
5398N/A15295912 SUNBT6346056 xscreensaver should not enable input method
5398N/A15317555 SUNBT6395649 at-spi-registryd starts when screen is locked even when
5398N/A accessible device support is off
5398N/A15326852 SUNBT6417168 xscreensaver loops while trying to unlock a session for
5398N/A a user whose password was expired
5398N/A15346556 SUNBT6461887 GNOME screen lock does not prevent access to other
5398N/A15352585 SUNBT6475285 xscreensaver core dumps in kill_job() after unlocking
5398N/A15354012 SUNBT6478362 When the AT support is enabled, the input focus is
5398N/A15356879 SUNBT6484604 X should stop linking against -lcmd
5398N/A15387793 SUNBT6541240 Screen saver will lock user out of the system if they
5398N/A15405753 SUNBT6573182 after applying patch 120094-11(or later), xscreensaver
5398N/A15427168 SUNBT6611183 xscreensaver needs to put Sun logos in files loaded at
5398N/A15461985 SUNBT6670025 xscreensaver passwd dialog image missing in nv_85
5398N/A15462355 SUNBT6670659 password dialog window remains on the screen even after
5398N/A15463666 SUNBT6673036 prepare for Indiana unlock logos
5398N/A15500787 SUNBT6736157 Security problem when desktop a11y support is turned on
5398N/A15521700 SUNBT6769901 popup windows appearing through xscreensaver
5398N/A15553552 SUNBT6825374 xscreensaver issues under Xorg
5398N/A15561643 SUNBT6839026 Regression in screensaver may cause Performance
5398N/A Degradation and make locked screensaver unresponsive
5398N/A15565807 SUNBT6845751 xscreensaver-lock chews CPU when daemon dies while unlock
5398N/A after password change warning
5398N/A15573881 SUNBT6857559 Nevada build was broken because of 6849124
5559N/A15652522 SUNBT6964562 xscreensaver dumps core whenever it unlocks in svn-142
5559N/A15700093 SUNBT7023648 xscreensaver does not allow user to enter password
5559N/A22706313 xscreensaver calls to pam_setcred with the wrong flag
6179N/A 17 files changed, 2451 insertions(+), 161 deletions(-)
5559N/Aindex 3524ec4..6b6d077 100644
5398N/A make use of this if it is available. */
5398N/A+/* Define this to build the external lock dialog */
5398N/A+#undef HAVE_XSCREENSAVER_LOCK
5398N/A /* Define this if you have the X Shared Memory Extension. */
5559N/A@@ -2666,6 +2666,7 @@ if test "$with_gtk" = yes; then
5398N/A pkg_check_version libglade-2.0 1.99.0
5398N/A pkg_check_version gdk-pixbuf-2.0 2.0.0
5398N/A pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
5398N/A+ pkg_check_version gconf-2.0 2.6.1
5398N/A if test "$have_gtk" = no; then
6179N/A@@ -2681,6 +2682,9 @@ if test "$with_gtk" = yes; then
5398N/A if test "$have_gtk" = yes; then
5398N/A+ AC_DEFINE(HAVE_XSCREENSAVER_LOCK,[],[Define this to build the external lock dialog])
5398N/A AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags,
5398N/A [ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`])
5398N/A AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs,
6179N/A@@ -3933,6 +3937,16 @@ if test "$have_gtk" = yes; then
5398N/A ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
5398N/A+if test "$have_gtk" = yes; then
5398N/A+ PREFERRED_LOCK_PROGRAM=xscreensaver-lock-Gtk
5398N/A+ ALL_LOCK_PROGRAMS="$PREFERRED_LOCK_PROGRAM $ALL_LOCK_PROGRAMS"
5398N/A+ LOCK_PROGRAM=xscreensaver-lock
5398N/A if test "$have_kerberos" = yes; then
5398N/A PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
6179N/A@@ -4077,6 +4091,11 @@ AC_SUBST(INCLUDES)
5398N/A AC_SUBST(PREFERRED_DEMO_PROGRAM)
5398N/A AC_SUBST(ALL_DEMO_PROGRAMS)
5398N/A+AC_SUBST(PREFERRED_LOCK_PROGRAM)
5398N/A+AC_SUBST(ALL_LOCK_PROGRAMS)
6179N/A@@ -4598,7 +4617,8 @@ HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'`
5398N/A-for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do
5398N/A+# SUNW addition: added xscreensaver-lock to list on next line
5398N/A+for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command xscreensaver-lock ; do
5398N/A if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then
5398N/A AC_MSG_ERROR([\"--with-hackdir=${bindir}/${bad_choice}\" won't work.
5398N/A@@ -29,6 +29,7 @@ GTK_APPDIR = $(GTK_DATADIR)/applications
5398N/A GTK_ICONDIR = $(GTK_DATADIR)/pixmaps
5398N/A HACK_CONF_DIR = @HACK_CONF_DIR@
5398N/A@@ -42,6 +43,7 @@ SUBP_DEFS = $(DEFS) -DHACK_PATH='"@HACKDIR@"' \
5398N/A GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' \
5398N/A CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"'
5398N/A+LOCK_DEFS = $(DEFS) -DLOCKDIR=\"$(LOCK_DIR)\"
5559N/A@@ -217,8 +221,8 @@ GETIMG_LIBS = $(LIBS) $(X_LIBS) $(XPM_LIBS) $(JPEG_LIBS) \
5398N/A $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS)
5398N/A EXES = xscreensaver xscreensaver-command xscreensaver-demo \
5398N/A- xscreensaver-getimage @EXES_OSX@
5398N/A-EXES2 = @ALL_DEMO_PROGRAMS@
5398N/A+ xscreensaver-getimage @EXES_OSX@ @LOCK_PROGRAM@
5398N/A+EXES2 = @ALL_DEMO_PROGRAMS@ @ALL_LOCK_PROGRAMS@
5398N/A SCRIPTS_1 = xscreensaver-getimage-file xscreensaver-getimage-video \
5398N/A-TARFILES = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) \
5398N/A+TARFILES = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) $(GTK_LOCK_SRCS) \
5398N/A $(MOTIF_SRCS) $(GTK_SRCS) $(PWENT_SRCS) $(PWHELPER_SRCS) \
5398N/A $(KERBEROS_SRCS) $(PAM_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) \
5398N/A $(CMD_SRCS) $(GETIMG_SRCS_1) $(PDF2JPEG_SRCS) $(HDRS) \
5559N/A@@ -260,7 +264,7 @@ all: $(EXES) $(EXES2)
5398N/A install: install-program install-ad install-scripts \
5398N/A- install-gnome install-man install-xml install-pam
5398N/A+ install-gnome install-man install-xml
5398N/A uninstall: uninstall-program uninstall-ad \
5398N/A uninstall-gnome uninstall-man uninstall-xml
5559N/A@@ -272,6 +276,9 @@ install-program: $(EXES)
5398N/A @if [ ! -d $(install_prefix)$(bindir) ]; then \
5398N/A $(INSTALL_DIRS) $(install_prefix)$(bindir) ; \
5398N/A+ @if [ -n "@LOCK_PROGRAM@" -a ! -d $(install_prefix)$(LOCK_DIR) ]; then \
5398N/A+ $(INSTALL_DIRS) $(install_prefix)$(LOCK_DIR) ; \
5398N/A @inst="$(INSTALL_PROGRAM)" ; \
5398N/A if [ @NEED_SETUID@ = yes ]; then \
5559N/A@@ -300,6 +307,12 @@ install-program: $(EXES)
5398N/A echo $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
5398N/A $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
5398N/A+ @if [ -n "@LOCK_PROGRAM@" ]; then \
5398N/A+ echo $(INSTALL_PROGRAM) xscreensaver-lock \
5398N/A+ $(install_prefix)$(LOCK_DIR)/xscreensaver-lock ; \
5398N/A+ $(INSTALL_PROGRAM) xscreensaver-lock \
5398N/A+ $(install_prefix)$(LOCK_DIR)/xscreensaver-lock ; \
5398N/A @if [ ! -d $(install_prefix)$(AD_DIR) ]; then \
5559N/A@@ -736,7 +749,7 @@ $(SAVER_UTIL_OBJS):
5398N/A # How we build object files in this directory.
5559N/A- $(CC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $<
5559N/A+ $(CC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(INTL_DEFS) $(CFLAGS) $(X_CFLAGS) $<
5559N/A $(OBJCC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $<
5559N/A $(CC) -c $(INCLUDES) $(CONF_DEFS) $(GTK_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \
5398N/A+# lock takes an extra -D option.
5398N/A+ $(CC) -c $(INCLUDES) $(LOCK_DEFS) $(CFLAGS) $(X_CFLAGS) \
5398N/A+# lock-Gtk takes extra -D and -I options.
5398N/A+ $(CC) -c $(INCLUDES) -I$(ICON_SRC) $(GTK_DEFS) \
5398N/A+ $(CFLAGS) $(X_CFLAGS) $(INTL_DEFS) \
5398N/A # How we build the default app-defaults file into the program.
5398N/A # The executables linked in this directory.
5398N/A xscreensaver: $(SAVER_OBJS)
5559N/A- $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS) $(INTL_LIBS)
5559N/A+ $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS) $(INTL_LIBS) \
5559N/A+ -lgconf-2 -lgobject-2.0 -lglib-2.0
5398N/A xscreensaver-command: $(CMD_OBJS)
5398N/A $(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS)
5559N/A@@ -792,6 +816,15 @@ xscreensaver-demo: @PREFERRED_DEMO_PROGRAM@
5398N/A cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@ ; \
5398N/A+xscreensaver-lock: @PREFERRED_LOCK_PROGRAM@
5398N/A+ $(INSTALL_PROGRAM) @PREFERRED_LOCK_PROGRAM@ $@
5398N/A+xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS)
5398N/A+ $(CC) $(LDFLAGS) -o $@ $(GTK_LOCK_OBJS) $(LIBS) $(X_LIBS) \
5398N/A+ $(GTK_LIBS) $(XML_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
5398N/A xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS)
5398N/A $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(MOTIF_OBJS) $(LIBS) $(X_LIBS) \
5398N/A $(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
5559N/A@@ -815,7 +848,7 @@ pdf2jpeg: $(PDF2JPEG_OBJS)
5559N/Aindex 65e00f3..4fcbb34 100644
5398N/A@@ -51,4 +51,8 @@ xss_authenticate(saver_info *si, Bool verbose_p);
5398N/A auth_finished_cb (saver_info *si);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+extern int write_to_child (saver_info* si, const char* cmd, const char *msg);
5398N/A # define G_MODULE_EXPORT /**/
5398N/A #if defined(DEFAULT_ICONDIR) && !defined(GLADE_DIR)
5398N/A # define GLADE_DIR DEFAULT_ICONDIR
5559N/A@@ -5042,6 +5044,22 @@ main (int argc, char **argv)
5398N/A+ /* Bug 147639: Gok cant automatically UI grab screensaver preferences */
5398N/A+ GConfClient *client = gconf_client_get_default ();
5398N/A+ /* check if accessibilty mode is enabled */
5398N/A+ if (gconf_client_get_bool (client, KEY, NULL))
5398N/A+ /* GTK Accessibility Module initialized */
5398N/A+ const char *modulesptr = g_getenv ("GTK_MODULES");
5398N/A+ if (!modulesptr || (modulesptr [0] == '\0'))
5398N/A+ putenv ("GTK_MODULES=gail:atk-bridge");
5398N/A /* Now that Xt has been initialized, and the resources have been read,
5398N/A we can set our `progname' variable to something more in line with
5398N/A+/* xscreensaver, Copyright (c) 1993-2008 Jamie Zawinski <jwz@jwz.org>
5398N/A+ * Permission to use, copy, modify, distribute, and sell this software and its
5398N/A+ * documentation for any purpose is hereby granted without fee, provided that
5398N/A+ * the above copyright notice appear in all copies and that both that
5398N/A+ * copyright notice and this permission notice appear in supporting
5398N/A+ * documentation. No representations are made about the suitability of this
5398N/A+ * software for any purpose. It is provided "as is" without express or
5398N/A+#define MAX_BYTES_PER_CHAR 8 /* UTF-8 uses no more than 3, I think */
5398N/A+#define MAX_PASSWD_CHARS 128 /* Longest possible passphrase */
5398N/A+struct passwd_dialog_data {
5398N/A+ saver_screen_info *prompt_screen;
5398N/A+ int previous_mouse_x, previous_mouse_y;
5398N/A+ /* "Characters" in the password may be a variable number of bytes long.
5398N/A+ typed_passwd contains the raw bytes.
5398N/A+ typed_passwd_char_size indicates the size in bytes of each character,
5398N/A+ so that we can make backspace work.
5398N/A+ char typed_passwd [MAX_PASSWD_CHARS * MAX_BYTES_PER_CHAR];
5398N/A+ char typed_passwd_char_size [MAX_PASSWD_CHARS];
5398N/A+ Bool show_stars_p; /* "I regret that I have but one asterisk for my country."
5398N/A+ /* The entry field shall only be displayed if prompt_label is not NULL */
5398N/A+ Bool passwd_changed_p; /* Whether the user entry field needs redrawing */
5398N/A+ Bool caps_p; /* Whether we saw a keypress with caps-lock on */
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A+ XFontStruct *heading_font;
5398N/A+ Dimension preferred_logo_width, logo_width;
5398N/A+ Dimension preferred_logo_height, logo_height;
5398N/A+ Dimension internal_border;
5398N/A+ Dimension passwd_field_x, passwd_field_y;
5398N/A+ Dimension passwd_field_width, passwd_field_height;
5398N/A+ Dimension unlock_button_x, unlock_button_y;
5398N/A+ Dimension unlock_button_width, unlock_button_height;
5398N/A+ Dimension login_button_x, login_button_y;
5398N/A+ Dimension login_button_width, login_button_height;
5398N/A+ Dimension thermo_field_x, thermo_field_y;
5398N/A+ Dimension thermo_field_height;
5398N/A+ unsigned long *logo_pixels;
5398N/A+#endif /* ! HAVE_XSCREENSAVER_LOCK */
5398N/A+ Bool unlock_button_down_p;
5398N/A+ Bool login_button_enabled_p;
5398N/A+ Bool button_state_changed_p; /* Refers to both buttons */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* extern passwd dialog stuff */
5398N/A+ XtInputId stdout_input_id;
5398N/A+ int stdin_fd; /* child's stdin - parent writes to this */
5398N/A+ int stdout_fd; /* child's stdout - parent reads from this */
5398N/A+ FILE *stdin_file; /* child's stdin - parent writes to this */
5398N/A+ FILE *stdout_file; /* child's stdout - parent reads from this */
5398N/A+#endif /* __DIALOG_DATA_H__ */
5398N/A+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
5398N/A+ * Permission to use, copy, modify, distribute, and sell this software and its
5398N/A+ * documentation for any purpose is hereby granted without fee, provided that
5398N/A+ * the above copyright notice appear in all copies and that both that
5398N/A+ * copyright notice and this permission notice appear in supporting
5398N/A+ * documentation. No representations are made about the suitability of this
5398N/A+ * software for any purpose. It is provided "as is" without express or
5398N/A+/* GTK+ locking code written by Jacob Berkman <jacob@ximian.com> for
6179N/A+ * Copyright (c) 2002, 2016, Oracle
and/or its affiliates. All rights reserved.
5398N/A+ * Permission is hereby granted, free of charge, to any person obtaining a
5398N/A+ * copy of this software and associated documentation files (the "Software"),
5398N/A+ * to deal in the Software without restriction, including without limitation
5398N/A+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
5398N/A+ *
and/or sell copies of the Software, and to permit persons to whom the
5398N/A+ * Software is furnished to do so, subject to the following conditions:
5398N/A+ * The above copyright notice and this permission notice (including the next
5398N/A+ * paragraph) shall be included in all copies or substantial portions of the
5398N/A+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5398N/A+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5398N/A+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
5398N/A+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5398N/A+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5398N/A+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5398N/A+ * DEALINGS IN THE SOFTWARE.
5398N/A+#ifdef HAVE_GTK2 /* whole file */
5398N/A+#if GTK_CHECK_VERSION(2,14,0)
5398N/A+# define GET_WINDOW(w) gtk_widget_get_window (w)
5398N/A+# define GET_WINDOW(w) ((w)->window)
5398N/A+static Atom XA_UNLOCK_RATIO;
5398N/A+ GtkWidget *user_prompt_label;
5398N/A+ GtkWidget *user_input_entry;
5398N/A+ GtkWidget *pam_message_label;
5398N/A+FILE *parent_file = NULL; /* child writes to parent on this */
5398N/A+/* Send a command to the xscreensaver parent daemon
5398N/A+ - msg - type of message - "input", "raise_wid", etc.
5398N/A+ - flush - whether to flush now or allow stdio to buffer
5398N/A+ Message format sent to parent:
5398N/A+ "msg\n" if no data, otherwise "msg=data\n"
5398N/A+ Can be used to flush previously buffered messages by calling
5398N/A+ with NULL msg & data, and TRUE for flush.
5398N/A+write_to_parent (const char* msg, const char *data, gboolean flush)
5398N/A+ fprintf (stderr, "-->Child write_to_parent() string to send is: %s=%s\n",
5398N/A+ msg, data ? data : "(null)");
5398N/A+ len = fprintf (parent_file, "%s=%s\n", msg, data);
5398N/A+ len = fprintf (parent_file, "%s\n", msg);
5398N/A+/* Send parent a message with a window id as the data */
5398N/A+write_windowid (const char* msg, Window w)
5398N/A+ char s[16]; /* more than long enough to hold a 32-bit integer + '\0' */
5398N/A+ snprintf(s, sizeof(s), "0x%lx", w);
5398N/A+ write_to_parent(msg, s, FALSE);
5398N/A+load_unlock_logo_image (void)
5398N/A+ if (stat (logofile, &statbuf) != 0)
5398N/A+ return gtk_image_new_from_file (logofile);
5398N/A+make_dialog (gboolean center_pos)
5398N/A+ GtkWidget *frame1, *frame2;
5398N/A+ GtkWidget *title_label, *msg_label, *prompt_label,
5398N/A+ *user_label, *date_label, *pam_msg_label;
5398N/A+ AtkObject *atk_title_label, *atk_prompt_label;
5398N/A+ gchar *format_string_locale, *format_string_utf8;
5398N/A+ server_xscreensaver_version (GDK_DISPLAY (), &version, &user, &host);
5398N/A+ fprintf (stderr, "%s: no xscreensaver running on display %s, exiting.\n",
5398N/A+ progname, gdk_get_display ());
5398N/A+ gtk_widget_push_colormap (gdk_rgb_get_cmap ());
5398N/A+ pwd = g_new0 (PasswdDialog, 1);
5398N/A+ dialog = gtk_window_new (GTK_WINDOW_POPUP);
5398N/A+ ** bugid: 5077989(P2)Bug 147580: password input dialogue obscures GOK
5398N/A+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
5398N/A+ bugid: 5002244: scr unlock dialog incompatible with MAG technique
5398N/A+ ** 6182506: scr dialog is obscured by MAG window
5398N/A+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
5398N/A+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
5398N/A+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); /*mali99 irritating*/
5398N/A+ /* AT-enabled dialog role = frame */
5398N/A+ atk_dialog = gtk_widget_get_accessible (dialog);
5398N/A+ atk_object_set_description (atk_dialog, _("screen unlock dialog"));
5398N/A+ frame1 = g_object_new (GTK_TYPE_FRAME,
5559N/A+ "shadow-type", GTK_SHADOW_OUT,
5398N/A+ gtk_container_add (GTK_CONTAINER (dialog), frame1);
5398N/A+ vbox = gtk_vbox_new (FALSE, 10);
5398N/A+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
5398N/A+ gtk_container_add (GTK_CONTAINER (frame1), vbox);
5398N/A+ /* AT role= filler(default) */
5398N/A+ hbox1 = gtk_hbox_new (FALSE, 5);
5398N/A+ gtk_box_pack_start (GTK_BOX (vbox), hbox1,
5398N/A+ frame2 = g_object_new (GTK_TYPE_FRAME,
5559N/A+ "shadow-type", GTK_SHADOW_ETCHED_IN,
5398N/A+ gtk_box_pack_start (GTK_BOX (hbox1), frame2,
5398N/A+ /* AT role= filler(default) */
5398N/A+ image = load_unlock_logo_image ();
5398N/A+ gtk_container_add (GTK_CONTAINER (frame2), image);
5398N/A+ progress = g_object_new (GTK_TYPE_PROGRESS_BAR,
5398N/A+ "orientation", GTK_PROGRESS_BOTTOM_TO_TOP,
5398N/A+ gtk_box_pack_start (GTK_BOX (hbox1), progress,
5398N/A+ atk_object_set_description (gtk_widget_get_accessible (progress),
5398N/A+ _("Percent of time you have left to unlock the screen."));
5398N/A+ vbox2 = gtk_vbox_new (FALSE, 20);
5398N/A+ gtk_box_pack_start (GTK_BOX (hbox1), vbox2,
5398N/A+ s = g_markup_printf_escaped ("<span size=\"xx-large\"><b>%s </b></span>",
5398N/A+ /* XScreenSaver foo label */
5398N/A+ title_label = g_object_new (GTK_TYPE_LABEL,
5398N/A+ gtk_box_pack_start (GTK_BOX (vbox2), title_label,
5398N/A+ /* AT role = label prog name */
5398N/A+ atk_title_label = gtk_widget_get_accessible (title_label);
5398N/A+ atk_object_add_relationship (atk_title_label, ATK_RELATION_LABEL_FOR,
5398N/A+ atk_object_add_relationship (atk_dialog, ATK_RELATION_LABELLED_BY,
5398N/A+ /* This display is locked. */
5398N/A+ msg_label = g_object_new (GTK_TYPE_LABEL,
5398N/A+ "label", _("<b>This display is locked.</b>"),
5398N/A+ pwd->msg_label = msg_label;
5398N/A+ gtk_box_pack_start (GTK_BOX (vbox2), msg_label,
5398N/A+ s = g_strdup_printf (_("User: %s"), user ? user : "");
5398N/A+ user_label = g_object_new (GTK_TYPE_LABEL,
5398N/A+ gtk_label_set_width_chars (GTK_LABEL (user_label), 35);
5398N/A+ gtk_box_pack_start (GTK_BOX (vbox2), user_label, FALSE, FALSE, 0);
5398N/A+ hbox2 = gtk_widget_new (GTK_TYPE_HBOX,
5398N/A+ prompt_label = g_object_new (GTK_TYPE_LABEL,
5398N/A+ /* blank space for prompt */
5398N/A+ "justify", GTK_JUSTIFY_CENTER,
5398N/A+ pwd->user_prompt_label = prompt_label;
5398N/A+ entry = g_object_new (GTK_TYPE_ENTRY,
5398N/A+ "activates-default", TRUE,
5398N/A+ pwd->user_input_entry = entry;
5398N/A+ /* gtk_widget_grab_focus (entry); */
5398N/A+ atk_entry = gtk_widget_get_accessible (entry);
5398N/A+ atk_object_set_role (atk_entry, ATK_ROLE_PASSWORD_TEXT);
5398N/A+ /* AT role = label for input widget */
5398N/A+ atk_prompt_label = gtk_widget_get_accessible (prompt_label);
5398N/A+ atk_object_add_relationship (atk_prompt_label, ATK_RELATION_LABEL_FOR,
5398N/A+ atk_object_add_relationship (atk_entry, ATK_RELATION_LABELLED_BY,
5398N/A+ gtk_box_pack_start (GTK_BOX (hbox2), prompt_label, FALSE, FALSE, 0);
5398N/A+ gtk_box_pack_end (GTK_BOX (hbox2), entry, TRUE, TRUE, 0);
5398N/A+ gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
5398N/A+ pam_msg_label = g_object_new (GTK_TYPE_LABEL,
5398N/A+ pwd->pam_message_label = pam_msg_label;
5398N/A+ gtk_box_pack_start (GTK_BOX (vbox2), pam_msg_label, FALSE, FALSE, 0);
5398N/A+ memset (buf, 0, sizeof (buf));
5398N/A+ format_string_utf8 = _("%d-%b-%y (%a); %I:%M %p");
5398N/A+ format_string_locale = g_locale_from_utf8 (format_string_utf8, -1,
5398N/A+ strftime (buf, sizeof (buf) - 1, format_string_locale, tm);
5398N/A+ g_free (format_string_locale);
5398N/A+ utf8_format = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
5398N/A+ s = g_markup_printf_escaped ("<small>%s</small>", utf8_format);
5398N/A+ date_label = g_object_new (GTK_TYPE_LABEL,
5398N/A+ gtk_box_pack_start (GTK_BOX (vbox2), date_label,
5398N/A+ bbox = g_object_new (GTK_TYPE_HBUTTON_BOX,
5398N/A+ "layout-style", GTK_BUTTONBOX_END,
5398N/A+ button = gtk_button_new_from_stock (GTK_STOCK_OK);
5398N/A+ gtk_box_pack_end (GTK_BOX (bbox), button,
5398N/A+ gtk_widget_pop_colormap ();
5398N/A+/* Callback for when user has finished entering input, even though
5398N/A+ we don't display an "OK" button for them to click on */
5398N/A+ok_clicked_cb (GtkWidget *button, PasswdDialog *pwd)
5398N/A+ g_object_set (pwd->msg_label, "label", _("<b>Checking...</b>"), NULL);
5398N/A+ s = gtk_entry_get_text (GTK_ENTRY (pwd->user_input_entry));
5398N/A+ write_to_parent ("input", s, TRUE);
5398N/A+ /* Reset password field to blank, else passwd field shows old passwd *'s,
5398N/A+ visible when passwd is expired, and pam is walking the user to change
5398N/A+ gtk_editable_delete_text (GTK_EDITABLE (pwd->user_input_entry), 0, -1);
5398N/A+ gtk_widget_hide (pwd->user_input_entry);
5398N/A+ gtk_widget_hide (pwd->user_prompt_label);
5398N/A+connect_signals (PasswdDialog *pwd)
5398N/A+ g_signal_connect (pwd->button, "clicked",
5398N/A+ G_CALLBACK (ok_clicked_cb),
5398N/A+ g_signal_connect (pwd->user_input_entry, "activate",
5398N/A+ G_CALLBACK (ok_clicked_cb),
5398N/A+ g_signal_connect (pwd->dialog, "delete-event",
5398N/A+ G_CALLBACK (gtk_main_quit),
5398N/A+dialog_filter_func (GdkXEvent *xevent, GdkEvent *gevent, gpointer data)
5398N/A+ return GDK_FILTER_CONTINUE;
5398N/A+ /* CR 6176524 passwdTimeoutEnable for disabled user */
5398N/A+ g_object_set (pwd->progress, "fraction", ratio, NULL);
5398N/A+handle_input (GIOChannel *source, GIOCondition cond, gpointer data)
5398N/A+ status = g_io_channel_read_line (source, &str, NULL, NULL, NULL);
5398N/A+ while (status == G_IO_STATUS_AGAIN);
5398N/A+ if (status == G_IO_STATUS_ERROR)
5398N/A+ g_message ("handle input() status_error %s\n",str);
5398N/A+ if (status == G_IO_STATUS_EOF)
5398N/A+ g_message ("handle input() status_eof %s\n",str);
5398N/A+ if (status == G_IO_STATUS_NORMAL)
5398N/A+ g_message ("handle input() status_normal %s\n",str);
5398N/A+ Most likely, the returned error msg of g_io_channel_read_line(),
5398N/A+
i.e str will not be translated into other locales ...
5398N/A+ /* strip trailing newline */
5398N/A+ char *nl = strrchr(str, '\n');
5398N/A+ /* Handle commands from parent daemon */
5398N/A+ if (((strncmp (str, "ul_", 3)) == 0))
5398N/A+ /* search for =, and if found, split into two strings there */
5398N/A+ char *msgstr = strchr(str, '='); /* Data sent with command */
5398N/A+ if ((strcmp (str, "ul_ok") == 0))
5398N/A+ hmsg = _("Authentication Successful!");
5398N/A+ else if ((strcmp (str, "ul_acct_ok") == 0))
5398N/A+ hmsg = _("PAM Account Management Also Successful!");
5398N/A+ else if ((strcmp (str, "ul_setcred_fail") == 0))
5398N/A+ hmsg = _("Just a Warning PAM Set Credential Failed!");
5398N/A+ else if ((strcmp (str, "ul_setcred_ok") == 0))
5398N/A+ hmsg = _("PAM Set Credential Also Successful!");
5398N/A+ else if ((strcmp (str, "ul_acct_fail") == 0))
5398N/A+ hmsg = _("Your Password has expired.");
5398N/A+ else if ((strcmp (str, "ul_fail") == 0))
5398N/A+ else if ((strcmp (str, "ul_read") == 0))
5398N/A+ hmsg = _("Waiting for user input!");
5398N/A+ else if ((strcmp (str, "ul_time") == 0))
5398N/A+ else if ((strcmp (str, "ul_null") == 0))
5398N/A+ hmsg = _("Still Checking!");
5398N/A+ else if ((strcmp (str, "ul_cancel") == 0))
5398N/A+ hmsg = _("Authentication Cancelled!");
5398N/A+ else if ((strcmp (str, "ul_pamprompt") == 0))
5398N/A+ gtk_label_set_text (GTK_LABEL (pwd->user_prompt_label), msgstr);
5398N/A+ gtk_widget_show (pwd->user_prompt_label);
5398N/A+ msgstr = NULL; /* clear message so we don't show it twice */
5398N/A+ else if ((strcmp (str, "ul_prompt_echo") == 0))
5398N/A+ if ((strcmp (msgstr, "true") == 0))
5398N/A+ (GTK_ENTRY (pwd->user_input_entry), TRUE);
5398N/A+ if ((strcmp (msgstr, "stars") == 0))
5398N/A+ /* reset to default display of "*" or bullet */
5398N/A+ gtk_entry_unset_invisible_char
5398N/A+ (GTK_ENTRY (pwd->user_input_entry));
5398N/A+ gtk_entry_set_invisible_char
5398N/A+ (GTK_ENTRY (pwd->user_input_entry), 0);
5398N/A+ (GTK_ENTRY (pwd->user_input_entry), FALSE);
5398N/A+ msgstr = NULL; /* clear message so we don't show it to user */
5398N/A+ /* Show the entry field */
5398N/A+ gtk_widget_show (pwd->user_input_entry);
5398N/A+ gtk_widget_grab_focus (pwd->user_input_entry);
5398N/A+ (gtk_widget_get_display (pwd->user_input_entry));
5398N/A+ else if ((strcmp (str, "ul_message") == 0))
5398N/A+ hmsg = NULL; /* only show msg */
5398N/A+ /* Should not be others, but if so just show it */
5398N/A+ label = g_markup_printf_escaped ("<b>%s</b>", hmsg);
5398N/A+ g_object_set (pwd->msg_label, "label", label, NULL);
5398N/A+ gtk_label_set_text (GTK_LABEL (pwd->pam_message_label), msgstr);
5398N/A+ else if ((strcmp (str, "cmd_exit") == 0))
5398N/A+ else /* something came through that didn't start with ul_ */
5398N/A+ gtk_label_set_text (GTK_LABEL (pwd->pam_message_label), str);
5398N/A+ return (status != G_IO_STATUS_EOF);
5398N/A+main (int argc, char *argv[])
5398N/A+ char *real_progname = argv[0];
5398N/A+ const char *modulesptr = NULL;
5559N/A+ const char *locale = NULL;
5398N/A+ gboolean at_enable = FALSE; /* accessibility mode enabled ? */
5398N/A+ gboolean center_position = TRUE; /* center dialog on screen? */
5398N/A+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
5398N/A+ textdomain (GETTEXT_PACKAGE);
5398N/A+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
5398N/A+ if (!setlocale (LC_ALL, ""))
5398N/A+ fprintf (stderr, "%s: locale not supported by C library\n", real_progname);
5398N/A+ s = strrchr (real_progname, '/');
5398N/A+ if (s) real_progname = s+1;
5398N/A+ parent_file = fdopen(FD_TO_PARENT, "w");
5398N/A+ fprintf (stderr, "%s: can't communicate with parent, exiting.\n",
5398N/A+ /* Intern the atoms that xscreensaver_command() needs.
5398N/A+ Display *dpy = gdk_x11_get_default_xdisplay();
5398N/A+ const struct atom_request unlock_atoms[] =
5398N/A+ { &XA_UNLOCK_RATIO, "UNLOCK_RATIO" },
5398N/A+ { NULL, NULL } /* Must be last to terminate list */
5398N/A+ const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
5398N/A+ atom_lists[0] = remote_control_atoms;
5398N/A+ atom_lists[1] = unlock_atoms;
5398N/A+ request_atoms (dpy, atom_lists);
5398N/A+ putenv ("GTK_IM_MODULE=gtk-im-context-simple");
5398N/A+ /* accessibility mode enabled ? */
5398N/A+ client = gconf_client_get_default ();
5398N/A+ at_enable = gconf_client_get_bool (client,
5398N/A+ /* GTK Accessibility Module initialized */
5398N/A+ modulesptr = g_getenv ("GTK_MODULES");
5398N/A+ if (!modulesptr || modulesptr [0] == '\0')
5398N/A+ putenv ("GTK_MODULES=gail:atk-bridge");
5398N/A+ * 6182506: unlock dialog can be obscured by the magnifier window
5398N/A+ * if it's always centered, so don't force that if any accessibility
5398N/A+ } /* accessibility enabled */
5398N/A+ pwd = make_dialog (center_position);
5398N/A+ gtk_widget_show_all (pwd->dialog);
5398N/A+ gtk_window_present (GTK_WINDOW (pwd->dialog));
5398N/A+ gtk_widget_map (pwd->dialog);
5398N/A+ gdk_display_sync (gtk_widget_get_display (pwd->dialog));
5398N/A+ gdk_window_add_filter (GET_WINDOW (pwd->dialog), dialog_filter_func, pwd);
5398N/A+ write_windowid ("dialog_win", GDK_WINDOW_XID (GET_WINDOW (pwd->dialog)));
5398N/A+ /* Flush dialog window ids & any messages about login helpers to parent */
5398N/A+ write_to_parent(NULL, NULL, TRUE);
5398N/A+ gtk_widget_grab_focus (pwd->user_input_entry);
5398N/A+ ioc = g_io_channel_unix_new (0);
5559N/A+ g_io_channel_set_encoding(ioc, locale, NULL);
5398N/A+ g_io_add_watch (ioc, G_IO_IN | G_IO_HUP, handle_input, pwd);
5398N/A@@ -83,126 +88,631 @@ vms_passwd_valid_p(char *pw, Bool verbose_p)
5398N/A typedef struct info_dialog_data info_dialog_data;
5398N/A-#define MAX_BYTES_PER_CHAR 8 /* UTF-8 uses no more than 3, I think */
5398N/A-#define MAX_PASSWD_CHARS 128 /* Longest possible passphrase */
5398N/A-struct passwd_dialog_data {
5398N/A- saver_screen_info *prompt_screen;
5398N/A- int previous_mouse_x, previous_mouse_y;
5398N/A- /* "Characters" in the password may be a variable number of bytes long.
5398N/A- typed_passwd contains the raw bytes.
5398N/A- typed_passwd_char_size indicates the size in bytes of each character,
5398N/A- so that we can make backspace work.
5398N/A- char typed_passwd [MAX_PASSWD_CHARS * MAX_BYTES_PER_CHAR];
5398N/A- char typed_passwd_char_size [MAX_PASSWD_CHARS];
5398N/A- Bool show_stars_p; /* "I regret that I have but one asterisk for my country."
5398N/A- /* The entry field shall only be displayed if prompt_label is not NULL */
5398N/A- Bool passwd_changed_p; /* Whether the user entry field needs redrawing */
5398N/A- Bool caps_p; /* Whether we saw a keypress with caps-lock on */
5398N/A- XFontStruct *heading_font;
5398N/A- Dimension preferred_logo_width, logo_width;
5398N/A- Dimension preferred_logo_height, logo_height;
5398N/A- Dimension internal_border;
5398N/A- Dimension passwd_field_x, passwd_field_y;
5398N/A- Dimension passwd_field_width, passwd_field_height;
5398N/A- Dimension unlock_button_x, unlock_button_y;
5398N/A- Dimension unlock_button_width, unlock_button_height;
5398N/A- Dimension login_button_x, login_button_y;
5398N/A- Dimension login_button_width, login_button_height;
5398N/A- Dimension thermo_field_x, thermo_field_y;
5398N/A- Dimension thermo_field_height;
5398N/A- unsigned long *logo_pixels;
5398N/A- Bool unlock_button_down_p;
5398N/A- Bool login_button_enabled_p;
5398N/A- Bool button_state_changed_p; /* Refers to both buttons */
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A static void draw_passwd_window (saver_info *si);
5398N/A static void update_passwd_window (saver_info *si, const char *printed_passwd,
5398N/A static void destroy_passwd_window (saver_info *si);
5398N/A+static int ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error);
5398N/A static void undo_vp_motion (saver_info *si);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A static void finished_typing_passwd (saver_info *si, passwd_dialog_data *pw);
5398N/A static void cleanup_passwd_window (saver_info *si);
5398N/A static void restore_background (saver_info *si);
5398N/A extern void xss_authenticate(saver_info *si, Bool verbose_p);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+#define WIN_ALLOC_INCREMENT 8 /* allocate entries in the window lists in
5398N/A+ increments of 8 at a time for fewer
5398N/A+ reallocs and less chance of malloc error
5398N/A+#define EXTRA_RAISE_WIN_SLOTS 4 /* Need to leave four extra slots free in
5398N/A+ raise_wins to allow calling XRestackWindows
5398N/A+ when a window pops up without having to
5398N/A+ realloc or copy to a new list.
5398N/A+ These slots would be used by:
5398N/A+ - xscreensaver virtual root
5398N/A+ - an interloper popup we need to hide
5398N/A+extern Atom XA_UNLOCK_RATIO;
5398N/A+Bool g_passwd_dialog_created = 0;
5398N/A+GConfClient *client = NULL;
5398N/A+static const char *switch_windows_gconf_key
5398N/A+static char *global_switch_key = NULL;
5398N/A+static const char *main_menu_gconf_key
5398N/A+static char *global_menu_key = NULL;
5398N/A+extern Bool safe_XDestroyWindow (Display *dpy, Window window);
5398N/A+static Bool safe_XRestackWindows(Display *dpy, Window windows[], int nwindows);
5398N/A+static Bool safe_XSendEvent(Display *dpy, Window w, Bool propagate,
5398N/A+ long event_mask, XEvent *event_send);
5398N/A+static void passwd_animate_timer (XtPointer closure, XtIntervalId *id);
5398N/A+extern void swallow_unlock_typeahead_events (saver_info *si, XEvent *e);
5398N/A+find_screen_for_window (saver_info *si, Window wid)
5398N/A+ Window root, root_ret, parent_ret, *children = NULL;
5398N/A+ unsigned int nchildren = 0;
5398N/A+ status = XQueryTree (si->dpy, wid, &root_ret, &parent_ret,
5398N/A+ if (status == 0) /* failed */
5398N/A+ for (screen_no = 0; screen_no < si->nscreens; screen_no++)
5398N/A+ ssi = &si->screens[screen_no];
5398N/A+ root = RootWindowOfScreen (screen);
5398N/A+ return NULL; /* Didn't match the root on any screen we know of - PUNT! */
5398N/A+ 5083155 Unable to unlock screen when running dual-head MAG
5398N/A+ adding dual or multiple heads for magnifier support
5398N/A+ screen 0: loginhelp can pass the raisedWid of GOK or MAG or both
5398N/A+ found: return its parent Wid (child of root)
5398N/A+ other screen: MAG only if the target screen no > 0 is selected
5398N/A+ found: restack on that screen
5398N/A+check_raisedWid (saver_info *si, Window wid)
5398N/A+ Window root, root_ret, parent_ret, *children = NULL;
5398N/A+ unsigned int nchildren = 0;
5398N/A+ status = XQueryTree (si->dpy, wid, &root_ret, &parent_ret,
5398N/A+ if (status == 0) /* failed */
5398N/A+ for (screen_no = 0; screen_no < si->nscreens; screen_no++)
5398N/A+ ssi = &si->screens[screen_no];
5398N/A+ root = RootWindowOfScreen (screen);
5398N/A+ if ( screen_no >= si->nscreens ) /* Didn't match the root on any screen */
5398N/A+ return 0; /* we know of - PUNT! */
5398N/A+ /* Climb the tree until we find an ancestor that's a child of root */
5398N/A+ while ( root_ret != parent_ret )
5398N/A+ status = XQueryTree (si->dpy, wid, &root_ret, &parent_ret,
5398N/A+ if (status == 0) /* failed */
5398N/A+ if ( ssi != si->pw_data->prompt_screen )
5398N/A+ /* found in other screen (not the one with the unlock dialog),
5398N/A+ implies MAG target screen, invoke XRestackWindow() there
5398N/A+ Window screen_win[2] = { wid, ssi->screensaver_window };
5398N/A+ safe_XRestackWindows(si->dpy, screen_win, 2);
5398N/A+ return 0; /* no need to do the restack on prompt screen */
5398N/A+/* Enforce window stacking order when a new window arrives.
5398N/A+ Only allow raising windows the unlock dialog has told us to raise
5398N/A+restack_my_windows (saver_info* si, saver_screen_info *ssi, Window newWin)
5398N/A+ Window short_stack[EXTRA_RAISE_WIN_SLOTS];
5398N/A+ /* If window is on another screen than the unlock dialog,
5398N/A+ or we have list of no windows to raise */
5398N/A+ if ((si->raise_wins == NULL) || (ssi != si->pw_data->prompt_screen))
5398N/A+ restack_list = short_stack;
5398N/A+ restack_list = si->raise_wins;
5398N/A+ for (n = 0; n < si->num_raise_wins; n++)
5398N/A+ if (si->raise_wins[n] == newWin)
5398N/A+ if (si->passwd_dialog && (ssi == si->pw_data->prompt_screen))
5398N/A+ restack_list[n++] = si->passwd_dialog;
5398N/A+ if (si->passwd_dialog == newWin)
5398N/A+ if (ssi->stderr_overlay_window)
5398N/A+ restack_list[n++] = ssi->stderr_overlay_window;
5398N/A+ if (ssi->stderr_overlay_window == newWin)
5398N/A+ if (ssi->screensaver_window)
5398N/A+ restack_list[n++] = ssi->screensaver_window;
5398N/A+ if (ssi->screensaver_window == newWin)
5398N/A+ /* If it's not in the allowed list, it goes behind
5398N/A+ the screensaver_window. */
5398N/A+ restack_list[n++] = newWin;
5398N/A+ safe_XRestackWindows (si->dpy, restack_list, n);
5398N/A+/* Send a command to the xscreensaver-lock child process
5398N/A+ - msg - message to send, such as ul_ok
5398N/A+ - data - additional data, such as string to display for this message,
5398N/A+ Message format sent to child:
5398N/A+ "msg\n" if no data, otherwise "msg=data\n"
5398N/A+write_to_child (saver_info* si, const char* msg, const char *data)
5398N/A+ fprintf (stderr, "Invalid null message written to child\n");
5398N/A+ if (si->external_passwd && g_passwd_dialog_created &&
5398N/A+ si->pw_data->stdin_fd != -1)
5398N/A+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
5398N/A+ "HAVE_SCRSVR_LOCK writing to fd:%d message is:\n%s=%s\n"
5398N/A+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n",
5398N/A+ si->pw_data->stdin_fd, msg, data ? data : "(null)");
5398N/A+ len = fprintf (si->pw_data->stdin_file, "%s=%s\n", msg, data);
5398N/A+ len = fprintf (si->pw_data->stdin_file, "%s\n", msg);
5398N/A+ fflush (si->pw_data->stdin_file);
5398N/A+ return (0); /* if we didn't write anything return 0 */
5398N/A+sane_dup2 (int fd1, int fd2)
5398N/A+ while (ret < 0 && errno == EINTR);
5398N/A+close_and_invalidate (int *fd)
5398N/A+handle_passwd_input (XtPointer xtdata, int *fd, XtInputId *id)
5398N/A+ saver_info *si = (saver_info *)xtdata;
5398N/A+ saver_preferences *p = &si->prefs;
5398N/A+ passwd_dialog_data *pw = si->pw_data;
5398N/A+ fprintf (stderr, "passwd input handler() fd=%d\n", *fd);
5398N/A+ msg = fgets (buffer, sizeof (buffer), pw->stdout_file);
5398N/A+ if (!msg) /* child closed pipe */
5398N/A+ fprintf (stderr, "done reading...\n");
5398N/A+ fprintf (stderr, "removing input handler...\n");
5398N/A+ fprintf (stderr, "Child sent message: %s\n", msg);
5398N/A+ /* search for =, and if found, split msg & data into two strings there */
5398N/A+ /* strip trailing newline */
5398N/A+ /* All the messages we currently expect require data! */
5398N/A+ fprintf (stderr, "*** Invalid message: no data found, discarding\n");
5398N/A+ if ((strcmp(msg, "input") == 0)) /* User input */
5398N/A+ si->unlock_state = ul_finished;
5398N/A+ pw->passwd_string = strdup (data);
5398N/A+ memset (data, 0, strlen(data));
5398N/A+ else if ((strcmp(msg, "ungrab_keyboard") == 0))
5398N/A+ /* An accessibility helper needs to access the keyboard, so we have
5398N/A+ to release our grab - unfortunately this risks other apps acting
5398N/A+ on keys they shouldn't, so first we disable metacity keys that
5398N/A+ could allow getting back to the locked session windows, and hope
5398N/A+ we don't crash or die before restoring them later.
5398N/A+ Other window managers are likely to be risky to use in this case.
5398N/A+ client = gconf_client_get_default();
5398N/A+ if (global_switch_key == NULL)
5398N/A+ gconf_client_get_string (client, switch_windows_gconf_key, NULL);
5398N/A+ if (global_switch_key && strncmp (global_switch_key, "dis", 3))
5398N/A+ gconf_client_set_string (client, switch_windows_gconf_key,
5398N/A+ if (global_menu_key == NULL)
5398N/A+ gconf_client_get_string (client, main_menu_gconf_key, NULL);
5398N/A+ if (global_menu_key && strncmp(global_menu_key, "dis", 3))
5398N/A+ gconf_client_set_string (client, main_menu_gconf_key,
5398N/A+ XUngrabKeyboard (si->dpy, CurrentTime);
5398N/A+ else if ((strcmp(msg, "ungrab_pointer") == 0))
5398N/A+ /* An accessibility helper needs to access the mouse, so we have
5398N/A+ to release our grab - this is simpler, since we don't worry about
5398N/A+ mouse gestures that may get through, though maybe we should...
5398N/A+ XUngrabPointer (si->dpy, CurrentTime);
5398N/A+ else /* Get a window id of an interesting window from the child */
5398N/A+ Window window = strtoul (data, NULL, 0);
5398N/A+ if ((strcmp (msg, "dialog_win") == 0))
5398N/A+ /* The unlock dialog itself */
5398N/A+ si->passwd_dialog = window;
5398N/A+ move_mouse_grab (si, si->passwd_dialog, pw->passwd_cursor,
5398N/A+ pw->prompt_screen->number);
5398N/A+ passwd_animate_timer ((XtPointer) si, 0);
5398N/A+ /* Flush queue of captured typeahead events */
5398N/A+ if (si->typeahead_events && si->num_typeahead_events)
5398N/A+ for (i = 0; i < si->num_typeahead_events; i++)
5398N/A+ si->typeahead_events[i].window = window;
5398N/A+ safe_XSendEvent (si->dpy, window, False, KeyPressMask,
5398N/A+ (XEvent *) &si->typeahead_events[i]);
5398N/A+ si->num_typeahead_events = 0;
5398N/A+ XGrabKeyboard (si->dpy, window, True, GrabModeAsync, GrabModeAsync, CurrentTime);
5398N/A+ XGrabPointer (si->dpy, window, True, 0, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
5398N/A+ XSetInputFocus (si->dpy, window, RevertToPointerRoot, CurrentTime);
5398N/A+ else if ((strcmp (msg, "raise_win") == 0))
5398N/A+ /* Accessibility helpers that need to be raised above the
5398N/A+ full-screen blanking window hiding the user's desktop */
5398N/A+ if ( (si->num_raise_wins + EXTRA_RAISE_WIN_SLOTS)
5398N/A+ int raise_alloc = si->max_raise_wins + WIN_ALLOC_INCREMENT;
5398N/A+ newlist = realloc(si->raise_wins, raise_alloc * sizeof(Window));
5398N/A+ si->max_raise_wins = raise_alloc;
5398N/A+ overwin = check_raisedWid (si, window);
5398N/A+ status = XGetWindowAttributes (si->dpy, overwin, &attrs);
5398N/A+ unsigned long valuemask = CWOverrideRedirect;
5398N/A+ XSetWindowAttributes setwinattr;
5398N/A+ XChangeWindowAttributes (si->dpy, overwin,
5398N/A+ if (si->num_override_wins >= si->max_override_wins)
5398N/A+ = si->max_override_wins + WIN_ALLOC_INCREMENT;
5398N/A+ newlist = realloc(si->override_wins,
5398N/A+ over_alloc * sizeof(Window));
5398N/A+ si->override_wins = newlist;
5398N/A+ si->max_override_wins = over_alloc;
5398N/A+ si->override_wins[si->num_override_wins++] = overwin;
5398N/A+ XMapSubwindows(si->dpy, overwin);
5398N/A+ si->raise_wins[si->num_raise_wins++] = overwin;
5398N/A+ si->raise_wins[si->num_raise_wins++] = window;
5398N/A+ restack_my_windows(si, si->pw_data->prompt_screen, 0);
5398N/A+spawn_external_passwd_process (saver_info *si, passwd_dialog_data *pw)
5398N/A+ saver_preferences *p = &si->prefs;
5398N/A+ const char *command = LOCKDIR "/xscreensaver-lock";
5398N/A+ int stdin_pipe[2] = { -1, -1 };
5398N/A+ int stdout_pipe[2] = { -1, -1 };
5398N/A+ pw->stdin_fd = pw->stdout_fd = -1;
5398N/A+ fprintf(stderr, "-->spawn_external_passwd()\n");
5398N/A+ fprintf (stderr,"pid %ld still exists. Killing it with SIGKILL\n",
5398N/A+ kill_job (si, si->passwd_pid, SIGKILL);
5398N/A+ if (pipe (stdin_pipe) < 0)
5398N/A+ perror ("pipe(stdin_pipe) failed!");
5398N/A+ if (pipe (stdout_pipe) < 0)
5398N/A+ perror ("pipe(stdout_pipe) failed!");
5398N/A+ close_and_invalidate (&stdin_pipe[0]);
5398N/A+ close_and_invalidate (&stdin_pipe[1]);
5398N/A+ switch ((int) (forked = fork ()))
5398N/A+ fprintf (stderr, "%s: ", blurb ());
5398N/A+ close_and_invalidate (&stdin_pipe[0]);
5398N/A+ close_and_invalidate (&stdin_pipe[1]);
5398N/A+ close_and_invalidate (&stdout_pipe[0]);
5398N/A+ close_and_invalidate (&stdout_pipe[1]);
5398N/A+ close (ConnectionNumber (si->dpy)); /* close display fd */
5398N/A+ /* limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); */
5398N/A+ /* hack_subproc_environment (ssi); */ /* FIX $DISPLAY */
5398N/A+ /* Inside Child Process */
5398N/A+ fprintf (stderr, "%s: spawning \"%s\" in pid %lu.\n",
5398N/A+ blurb(), command, (unsigned long) getpid ());
5398N/A+ close_and_invalidate (&stdin_pipe[1]);
5398N/A+ close_and_invalidate (&stdout_pipe[0]);
5398N/A+ sane_dup2 (stdin_pipe[0], 0); /* Listen to Parent from here */
5398N/A+ sane_dup2 (stdout_pipe[1], 9); /* Talk to Parent from here */
5398N/A+ /* Make sure we have relinquished setuid privs or lock dialog gtk
5398N/A+ * program will not run as libgtk is not setuid safe.
5398N/A+ exec_command (p->shell, command, 0);
5398N/A+ /* print_path_error (command); */
5398N/A+ fprintf (stderr, "%s: couldn't exec: %s\n",
5398N/A+ make_job(forked, 0, command);
5398N/A+ close_and_invalidate (&stdin_pipe[0]);
5398N/A+ close_and_invalidate (&stdout_pipe[1]);
5398N/A+ sane_dup2 (stdin_pipe[0], 0); /* Listen to Child from here */
5398N/A+ sane_dup2 (stdout_pipe[1], 13); /* Talk to Child from here */
5398N/A+ pw->stdin_fd = stdin_pipe[1]; /* Talk to child from here */
5398N/A+ pw->stdout_fd = stdout_pipe[0]; /* Listen to Child from here */
5398N/A+ pw->stdin_file = fdopen (pw->stdin_fd, "w");
5398N/A+ write_to_child (si, "Hello", NULL); /* Send a test message to Child */
5398N/A+ pw->stdout_file = fdopen (pw->stdout_fd, "r");
5398N/A+ pw->stdout_input_id = XtAppAddInput (si->app, pw->stdout_fd,
5398N/A+ (XtPointer) XtInputReadMask,
5398N/A+ /* Set global flag to indicate that lock dialog is visible */
5398N/A+ g_passwd_dialog_created = True;
5398N/A+#endif /* HAVE_XSCREENSAVER_LOCK */
5398N/A new_passwd_window (saver_info *si)
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A saver_screen_info *ssi = &si->screens [mouse_screen (si)];
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
5398N/A+ if (!spawn_external_passwd_process (si, pw))
5398N/A+ si->external_passwd = True;
5398N/A pw = (passwd_dialog_data *) calloc (1, sizeof(*pw));
5398N/A@@ -211,17 +721,21 @@ new_passwd_window (saver_info *si)
5398N/A pw->passwd_cursor = XCreateFontCursor (si->dpy, XC_top_left_arrow);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A screen = pw->prompt_screen->screen;
5398N/A cmap = DefaultColormapOfScreen (screen);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A@@ -376,6 +890,7 @@ new_passwd_window (saver_info *si)
5398N/A if (pw->shadow_width == 0) pw->shadow_width = 4;
5398N/A if (pw->thermo_width == 0) pw->thermo_width = pw->shadow_width;
5398N/A+#endif /* ! HAVE_XSCREENSAVER_LOCK */
5398N/A /* We need to remember the mouse position and restore it afterward, or
5398N/A sometimes (perhaps only with Xinerama?) the mouse gets warped to
5398N/A@@ -442,12 +957,16 @@ make_passwd_window (saver_info *si,
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A XSetWindowAttributes attrs;
5398N/A unsigned long attrmask = 0;
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A Dimension max_string_width_px;
5398N/A saver_screen_info *ssi = &si->screens [mouse_screen (si)];
5398N/A cleanup_passwd_window (si);
5398N/A@@ -455,7 +974,12 @@ make_passwd_window (saver_info *si,
5398N/A if (! ssi) /* WTF? Trying to prompt while no screens connected? */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
5398N/A+ if (!si->pw_data->got_windowid)
5398N/A if (new_passwd_window (si) < 0)
5398N/A@@ -470,6 +994,29 @@ make_passwd_window (saver_info *si,
5398N/A blurb(), pw->prompt_screen->number,
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Wipe the old password, so we get prompted to enter new password. */
5398N/A+ memset(pw->passwd_string, 0, strlen (pw->passwd_string));
5398N/A+ write_to_child (si, "ul_message", info_msg);
5398N/A+ write_to_child (si, "ul_pamprompt", prompt);
5398N/A+ write_to_child (si, "ul_prompt_echo", "true");
5398N/A+ else if (pw->show_stars_p)
5398N/A+ write_to_child (si, "ul_prompt_echo", "stars");
5398N/A+ write_to_child (si, "ul_prompt_echo", "false");
5398N/A screen = pw->prompt_screen->screen;
5398N/A cmap = DefaultColormapOfScreen (screen);
5559N/A@@ -721,11 +1268,13 @@ make_passwd_window (saver_info *si,
5398N/A XInstallColormap (si->dpy, cmap);
5398N/A+#endif /* ! HAVE_XSCREENSAVER_LOCK */
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A draw_passwd_window (saver_info *si)
5559N/A@@ -1071,17 +1620,48 @@ draw_button(Display *dpy,
5398N/A draw_shaded_rectangle(dpy, dialog, x, y, width, height,
5398N/A shadow_width, shadow_light, shadow_dark);
5398N/A+#endif /* !HAVE_XSCREENSAVER_LOCK */
5398N/A update_passwd_window (saver_info *si, const char *printed_passwd, float ratio)
5398N/A passwd_dialog_data *pw = si->pw_data;
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Send countdown timer ratio to child lock dialog */
5398N/A+ if (!safe_XSendEvent (si->dpy, si->passwd_dialog, False, 0L, &event))
5398N/A+ fprintf (stderr, "%s: error sending ratio to lock dialog\n", blurb ());
5398N/A+ "-->update_passwd_window() lockdialog not created, returning!!\n");
5398N/A gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground|GCFont, &gcv);
5559N/A@@ -1226,6 +1806,7 @@ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio)
5398N/A+#endif /* !HAVE_XSCREENSAVER_LOCK */
5559N/A@@ -1257,6 +1838,9 @@ cleanup_passwd_window (saver_info *si)
5398N/A+ fprintf (stderr, "cleanup_passwd_window\n");
5559N/A@@ -1274,7 +1858,13 @@ cleanup_passwd_window (saver_info *si)
5398N/A memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd));
5398N/A memset (pw->typed_passwd_char_size, 0, sizeof(pw->typed_passwd_char_size));
5398N/A- memset (pw->passwd_string, 0, strlen(pw->passwd_string));
5398N/A+ memset (pw->passwd_string, 0, strlen(pw->passwd_string));
5559N/A@@ -1297,8 +1887,10 @@ destroy_passwd_window (saver_info *si)
5398N/A passwd_dialog_data *pw = si->pw_data;
5398N/A saver_screen_info *ssi = pw->prompt_screen;
5398N/A Colormap cmap = DefaultColormapOfScreen (ssi->screen);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A Pixel black = BlackPixelOfScreen (ssi->screen);
5398N/A Pixel white = WhitePixelOfScreen (ssi->screen);
5398N/A cleanup_passwd_window (si);
5559N/A@@ -1314,6 +1906,81 @@ destroy_passwd_window (saver_info *si)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* reset global flag to indicate passwd dialog is no longer there */
5398N/A+ g_passwd_dialog_created = False;
5398N/A+ write_to_child (si, "cmd_exit", NULL);
5398N/A+ close_and_invalidate (&pw->stdin_fd);
5398N/A+ XtRemoveInput (pw->stdout_input_id);
5398N/A+ else if (pw->stdout_fd != -1)
5398N/A+ close_and_invalidate (&pw->stdout_fd);
5398N/A+ kill_job (si, si->passwd_pid, SIGTERM);
5398N/A+ unsigned long valuemask = CWOverrideRedirect;
5398N/A+ XSetWindowAttributes setwinattr;
5398N/A+ for (n = 0; n < si->num_override_wins; n++)
5398N/A+ XChangeWindowAttributes (si->dpy, si->override_wins[n],
5398N/A+ si->num_override_wins = 0;
5398N/A+ si->max_override_wins = 0;
5398N/A+ si->pw_data->got_windowid = False;
5398N/A+ si->external_passwd = False;
5398N/A+ /* restore any metacity keys we temporarily disabled */
5398N/A+ gconf_client_set_string (client, switch_windows_gconf_key,
5398N/A+ g_free(global_switch_key);
5398N/A+ gconf_client_set_string (client, main_menu_gconf_key,
5398N/A+#endif /* HAVE_XSCREENSAVER_LOCK */
5398N/A move_mouse_grab (si, RootWindowOfScreen (ssi->screen),
5559N/A@@ -1348,7 +2015,14 @@ destroy_passwd_window (saver_info *si)
5398N/A fprintf (stderr, "%s: %d: destroying password dialog.\n",
5398N/A blurb(), pw->prompt_screen->number);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Ignore X error if window was already closed by the child,
5398N/A+ and make sure any VisibilityNotify events are removed
5398N/A+ from the event queue before we forget the window id. */
5398N/A+ safe_XDestroyWindow (si->dpy, si->passwd_dialog);
5398N/A XDestroyWindow (si->dpy, si->passwd_dialog);
5559N/A@@ -1359,6 +2033,7 @@ destroy_passwd_window (saver_info *si)
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A if (pw->heading_label) free (pw->heading_label);
5398N/A if (pw->body_label) free (pw->body_label);
5398N/A if (pw->user_label) free (pw->user_label);
5559N/A@@ -1409,6 +2084,7 @@ destroy_passwd_window (saver_info *si)
5398N/A+#endif /* ! HAVE_XSCREENSAVER_LOCK */
5398N/A XFreePixmap (si->dpy, pw->save_under);
5559N/A@@ -1416,9 +2092,12 @@ destroy_passwd_window (saver_info *si)
5398N/A XInstallColormap (si->dpy, cmap);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
5398N/A memset (pw, 0, sizeof(*pw));
5559N/A@@ -1435,6 +2114,49 @@ ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error)
5559N/A #endif /* HAVE_XF86MISCSETGRABKEYSSTATE || HAVE_XF86VMODE */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+/* Catch errors from XRestackWindows, since there's an inherent race
5398N/A+ condition in which other clients can destroy windows between when
5398N/A+ we get the notification event and when we send the RestackWindows
5398N/A+safe_XRestackWindows(Display *dpy, Window windows[], int nwindows)
5398N/A+ XErrorHandler old_handler;
5398N/A+ error_handler_hit_p = False;
5398N/A+ old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
5398N/A+ XRestackWindows (dpy, windows, nwindows);
5398N/A+ XSetErrorHandler (old_handler);
5398N/A+ return (!error_handler_hit_p);
5398N/A+safe_XSendEvent(Display *dpy, Window w, Bool propagate,
5398N/A+ long event_mask, XEvent *event_send)
5398N/A+ XErrorHandler old_handler;
5398N/A+ error_handler_hit_p = False;
5398N/A+ old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
5398N/A+ status = XSendEvent (dpy, w, propagate, event_mask, event_send);
5398N/A+ XSetErrorHandler (old_handler);
5398N/A+ return (!error_handler_hit_p && status);
5398N/A #ifdef HAVE_XHPDISABLERESET
5398N/A /* This function enables and disables the C-Sh-Reset hot-key, which
5559N/A@@ -1636,6 +2358,17 @@ passwd_animate_timer (XtPointer closure, XtIntervalId *id)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* We want to make sure dialog is up before we update countdown timer */
5559N/A@@ -1655,6 +2388,7 @@ passwd_animate_timer (XtPointer closure, XtIntervalId *id)
5398N/A idle_timer ((XtPointer) si, 0);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A static XComposeStatus *compose_status;
5559N/A@@ -1732,6 +2466,7 @@ finished_typing_passwd (saver_info *si, passwd_dialog_data *pw)
5398N/A update_passwd_window (si, "", pw->ratio);
5398N/A+#endif /* !HAVE_XSCREENSAVER_LOCK */
5398N/A handle_passwd_key (saver_info *si, XKeyEvent *event)
6179N/A@@ -1740,6 +2475,7 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
5398N/A unsigned char decoded [MAX_BYTES_PER_CHAR * 10]; /* leave some slack */
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A /* XLookupString may return more than one character via XRebindKeysym;
5398N/A and on some systems it returns multi-byte UTF-8 characters (contrary
5398N/A to its documentation, which says it returns only Latin1.)
5559N/A@@ -1773,11 +2509,40 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
5398N/A pw->passwd_changed_p = True;
5398N/A+#endif /* !HAVE_XSCREENSAVER_LOCK */
5398N/A /* Add 10% to the time remaining every time a key is pressed. */
5398N/A if (pw->ratio > 1) pw->ratio = 1;
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ if (si->pw_data->got_windowid)
5398N/A+ event->window = si->passwd_dialog;
5398N/A+ status = safe_XSendEvent (si->dpy, si->passwd_dialog,
5398N/A+ False, KeyPressMask, (XEvent *) event);
5398N/A+ fprintf (stderr, "sent key...\n");
5398N/A+ fprintf (stderr, "error %d sending key...\n", status);
5398N/A+ update_passwd_window (si, NULL, pw->ratio);
5398N/A+ swallow_unlock_typeahead_events (si, (XEvent *) event);
5398N/A+#else /* !HAVE_XSCREENSAVER_LOCK */
5398N/A if (decoded_size == 1) /* Handle single-char commands */
5559N/A@@ -1867,6 +2632,7 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
5398N/A update_passwd_window (si, "", pw->ratio);
5398N/A+#endif /* !HAVE_XSCREENSAVER_LOCK */
5559N/A@@ -1890,7 +2656,9 @@ passwd_event_loop (saver_info *si)
5398N/A passwd_animate_timer ((XtPointer) si, 0);
5559N/A reset_watchdog_timer (si, False); /* Disable watchdog while dialog up */
5398N/A- while (si->unlock_state == ul_read)
5398N/A+ si->pw_data->got_passwd = FALSE;
5398N/A+ while (si->unlock_state == ul_read && si->pw_data->got_passwd == FALSE)
5559N/A@@ -1931,12 +2699,17 @@ passwd_event_loop (saver_info *si)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+#endif /* !HAVE_XSCREENSAVER_LOCK */
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5559N/A@@ -1945,6 +2718,82 @@ passwd_event_loop (saver_info *si)
5398N/A if (si->pw_data->login_button_p)
5398N/A+#endif /* !HAVE_XSCREENSAVER_LOCK */
5398N/A+ 5077974 P1 "Bug 147583: Screen Lock unlocks because of GOK dwell movement in
5398N/A+ ScreenLock did not unlock the screen, but WM's XRestackWindow() did.
5398N/A+ repositioning the Wids in the wrong positions when
5398N/A+ 1. the window type is changed from NORMAL to DOCK or vice versa
5398N/A+ within the X window stack with or without screen-lock in a mixed Wids
5398N/A+ there are two temp. get-around solutions:
5398N/A+ 1. non-managed GOK or MAG Wid
5398N/A+ 2. screensaver picks up the WM's restacking task and fixes the prevous
5398N/A+ the cons: there is a flashing screen when corepointer is touching
5398N/A+ GOK or MAG and mouse is moved in a fast way
5398N/A+ when GOK or MAG window type is DOCK only.
5398N/A+ and it is not a good temp. get-around solution.
5398N/A+ This is the only choice if WM did not want to fix the problem now
5398N/A+ and AT group did not want to use non-managed Wids.
5398N/A+ not to be used, and GOK cannot disable it
5398N/A+ bugid 6769901,6839026: popup windows appearing through xscreensaver
5398N/A+ /* Find the handle of popup window
5398N/A+ * Note: we can not get handle of popup window with
5398N/A+ saver_screen_info *ssi = find_screen_for_window (si, wPopWin);
5398N/A+ /* This if case is for safety, it prevent screensaver stuck in
5398N/A+ if ((wPopWin != si->passwd_dialog) && (ssi != NULL) &&
5398N/A+ (wPopWin != ssi->screensaver_window) &&
5398N/A+ (wPopWin != ssi->stderr_overlay_window))
5398N/A+ restack_my_windows(si, ssi, wPopWin);
5398N/A+ /* the above new code for restacking under the condition */
5559N/A@@ -1970,8 +2819,13 @@ passwd_event_loop (saver_info *si)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ write_to_child (si, "ul_message", msg);
5398N/A+ usleep (250000); /* 1/4 second */
5398N/A update_passwd_window (si, msg, 0.0);
5559N/A@@ -1989,6 +2843,10 @@ passwd_event_loop (saver_info *si)
5398N/A handle_typeahead (saver_info *si)
5398N/A+/* HAVE_XSCREENSAVER_LOCK: typeahead events are flushed to the external
5398N/A+ dialog program in handle_passwd_input when we get the dialog_win notice
5398N/A+ that it has created the window */
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A passwd_dialog_data *pw = si->pw_data;
5559N/A@@ -2016,6 +2874,7 @@ handle_typeahead (saver_info *si)
5398N/A free (si->unlock_typeahead);
5559N/A@@ -2121,9 +2980,11 @@ gui_auth_conv(int num_msg,
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5398N/A compose_status = calloc (1, sizeof (*compose_status));
5398N/A si->unlock_state = ul_read;
5559N/A@@ -2133,7 +2994,14 @@ gui_auth_conv(int num_msg,
5398N/A if (si->unlock_state == ul_cancel)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ if ((si->unlock_state != ul_time) && si->pw_data->passwd_string)
5398N/A+ responses[i].response = strdup (si->pw_data->passwd_string);
5398N/A responses[i].response = strdup(si->pw_data->typed_passwd);
5398N/A /* Cache the first response to a PROMPT_NOECHO to save prompting for
5559N/A@@ -2141,8 +3009,10 @@ gui_auth_conv(int num_msg,
5398N/A auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_NOECHO)
5398N/A si->cached_passwd = strdup(responses[i].response);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5559N/A@@ -2150,9 +3020,11 @@ gui_auth_conv(int num_msg,
5398N/A return (si->unlock_state == ul_finished) ? 0 : -1;
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5559N/A@@ -2213,11 +3085,14 @@ auth_finished_cb (saver_info *si)
5398N/A XNextEvent (si->dpy, &event);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5559N/A@@ -2226,7 +3101,7 @@ auth_finished_cb (saver_info *si)
5559N/A+ if (si->pw_data && si->pw_data->prompt_screen)
5559N/A destroy_passwd_window (si);
5559N/Aindex 0c60d50..93c73f1 100644
5398N/A #ifndef NO_LOCKING /* whole file */
5398N/A@@ -58,6 +64,7 @@ extern char *blurb(void);
5398N/A extern sigset_t block_sigchld (void);
5398N/A@@ -82,7 +89,10 @@ extern void unblock_sigchld (void);
5398N/A static int pam_conversation (int nmsgs,
5398N/A- const struct pam_message **msg,
5398N/A struct pam_response **resp,
5398N/A@@ -183,6 +193,11 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
5398N/A+ int pam_auth_status = 0; /* Specific for pam_authenticate() status*/
5398N/A+ int acct_rc, setcred_rc, chauth_rc;
5398N/A@@ -191,6 +206,23 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
5398N/A `closure' argument to
pc.conv always comes in as random garbage. */
5398N/A suns_pam_implementation_blows = (void *) si;
5398N/A+ fprintf (stderr, "Before uid=%d euid=%d \n\n", getuid(), geteuid());
5398N/A+ perror("Could not change euid to root, pam may not work!\n");
5398N/A+ fprintf (stderr, "After seteuid(0) uid=%d euid=%d \n\n",
5398N/A+ fprintf (stderr, "PAM is using SERVICE_NAME=\"%s\"\n\n", service);
5398N/A@@ -201,11 +233,35 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
5398N/A status, PAM_STRERROR (pamh, status));
5398N/A if (status != PAM_SUCCESS) goto DONE;
5398N/A+ PAM_DISALLOW_NULL_AUTHTOK to pam_flags */
5398N/A+ int flags = defcntl(DC_GETFLAGS, 0);
5398N/A+ (void) defcntl(DC_SETFLAGS, flags);
5398N/A+ if ((ptr = defread("PASSREQ=")) != NULL &&
5398N/A+ strcasecmp("YES", ptr) == 0)
5398N/A+ pam_flags |= PAM_DISALLOW_NULL_AUTHTOK;
5398N/A+ (void) defopen((char *)NULL); /* close current file */
5398N/A /* #### We should set PAM_TTY to the display we're using, but we
5398N/A don't have that handy from here. So set it to :0.0, which is a
5398N/A good guess (and has the bonus of counting as a "secure tty" as
5398N/A far as PAM is concerned...)
5398N/A+/* From the pam trace and log file, it is found out that the
5398N/A+ Sun pam modules can drive itself.
5398N/A char *tty = strdup (":0.0");
5398N/A status = pam_set_item (pamh, PAM_TTY, tty);
5398N/A@@ -214,6 +270,7 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
5398N/A blurb(), tty, status, PAM_STRERROR(pamh, status));
5398N/A /* Try to authenticate as the current user.
5398N/A We must turn off our SIGCHLD handler for the duration of the call to
5559N/A@@ -243,56 +300,102 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
5398N/A- status = pam_authenticate (pamh, 0);
5398N/A+ pam_auth_status = pam_authenticate (pamh, pam_flags);
5398N/A sigtimedwait (&set, NULL, &timeout);
5398N/A /* #### What is the portable thing to do if we don't have it? */
5398N/A # endif /* HAVE_SIGTIMEDWAIT */
5559N/A- fprintf (stderr, "%s: pam_authenticate (...) ==> %d (%s)\n",
5559N/A- blurb(), status, PAM_STRERROR(pamh, status));
5559N/A- if (status == PAM_SUCCESS) /* Win! */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Send status message to unlock dialog */
5398N/A+ if (pam_auth_status == PAM_SUCCESS)
5559N/A- /* On most systems, it doesn't matter whether the account modules
5559N/A- are run, or whether they fail or succeed.
5398N/A+ write_to_child (si, "ul_ok", PAM_STRERROR (pamh, pam_auth_status));
5398N/A+ else if (si->unlock_state != ul_cancel && si->unlock_state != ul_time)
5398N/A+ write_to_child (si, "ul_fail", PAM_STRERROR (pamh, pam_auth_status));
5559N/A- On some systems, the account modules fail, because they were
5559N/A- never configured properly, but it's necessary to run them anyway
5559N/A- because certain PAM modules depend on side effects of the account
5398N/A+ fprintf (stderr, "after calling pam_authenticate state is: %s\n",
5398N/A+ si->unlock_state == ul_success ? "ul_success" : "ul_fail");
5559N/A- And on still other systems, the account modules are actually
5559N/A- used, and failures in them should be considered to be true!
5559N/A+ fprintf (stderr, "%s: pam_authenticate (...) ==> %d (%s)\n",
5398N/A+ blurb(), pam_auth_status, PAM_STRERROR(pamh, pam_auth_status));
5559N/A- - We run the account modules on all systems.
5559N/A- - Whether we ignore them is a configure option.
5398N/A+ if (pam_auth_status == PAM_SUCCESS) /* Win! */
5398N/A+ /* perform PAM account validation procedures for login user only */
5398N/A+ acct_rc = pam_acct_mgmt(pamh, pam_flags);
5398N/A- status2 = pam_acct_mgmt (pamh, 0);
5398N/A+ /******************************************************************
5398N/A+ ignore other cases for the time being
5398N/A+ PAM_USER_UNKNOWN, PAM_AUTH_ERR, PAM_ACCT_EXPIRED
5398N/A+ (password mgn service module)
5398N/A+ same as pam_setcred(), focus on auth. service module only
5398N/A+ *****************************************************************/
5398N/A fprintf (stderr, "%s: pam_acct_mgmt (...) ==> %d (%s)\n",
5398N/A- blurb(), status2, PAM_STRERROR(pamh, status2));
5398N/A+ blurb(), acct_rc, PAM_STRERROR(pamh, acct_rc));
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Send status message to unlock dialog ***/
5398N/A+ if (acct_rc == PAM_SUCCESS)
5398N/A+ write_to_child (si, "ul_acct_ok", PAM_STRERROR(pamh, acct_rc));
5398N/A+ write_to_child (si, "ul_acct_fail", PAM_STRERROR(pamh, acct_rc));
5398N/A /* HPUX for some reason likes to make PAM defines different from
5398N/A- if (status2 == PAM_AUTHTOKEN_REQD)
5398N/A+ if (acct_rc == PAM_AUTHTOKEN_REQD)
5398N/A- if (status2 == PAM_NEW_AUTHTOK_REQD)
5398N/A+ if (acct_rc == PAM_NEW_AUTHTOK_REQD)
5398N/A- status2 = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
5398N/A+ chauth_rc = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
5398N/A+ if (chauth_rc == PAM_AUTHTOK_ERR ||
5398N/A+ chauth_rc == PAM_TRY_AGAIN )
5398N/A+ si->unlock_state = ul_read;
5398N/A+ else break; /* get out of the loop */
5398N/A fprintf (stderr, "%s: pam_chauthtok (...) ==> %d (%s)\n",
5398N/A- blurb(), status2, PAM_STRERROR(pamh, status2));
5398N/A+ blurb(), chauth_rc, PAM_STRERROR(pamh, chauth_rc));
5398N/A+ if (chauth_rc != PAM_SUCCESS)
5398N/A+ pam_auth_status = chauth_rc;
5398N/A+ else if (acct_rc != PAM_SUCCESS)
5398N/A+ pam_auth_status = acct_rc;
5398N/A+ write_to_child (si, "pw_acct_fail", PAM_STRERROR(pamh, acct_rc));
5559N/A /* If 'configure' requested that we believe the results of PAM
5559N/A@@ -306,30 +409,68 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
5398N/A /* Each time we successfully authenticate, refresh credentials,
5559N/A failure and blunder along; it shouldn't matter.
5559N/A Note: this used to be PAM_REFRESH_CRED instead of
5559N/A PAM_REINITIALIZE_CRED, but Jason Heiss <jheiss@ee.washington.edu>
5398N/A says that the Linux PAM library ignores that one, and only refreshes
5398N/A credentials when using PAM_REINITIALIZE_CRED.
5398N/A- status2 = pam_setcred (pamh, PAM_REINITIALIZE_CRED);
5398N/A+ setcred_rc = pam_setcred (pamh, PAM_REINITIALIZE_CRED);
5559N/A+ setcred_rc = pam_setcred (pamh, PAM_REFRESH_CRED);
5398N/A fprintf (stderr, "%s: pam_setcred (...) ==> %d (%s)\n",
5398N/A- blurb(), status2, PAM_STRERROR(pamh, status2));
5398N/A+ blurb(), setcred_rc, PAM_STRERROR(pamh, setcred_rc));
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Send status message to unlock dialog ***/
5398N/A+ if (setcred_rc == PAM_SUCCESS)
5398N/A+ write_to_child (si, "ul_setcred_ok", PAM_STRERROR(pamh, setcred_rc));
5398N/A+ write_to_child (si, "ul_setcred_fail", PAM_STRERROR(pamh, setcred_rc));
5398N/A- int status2 = pam_end (pamh, status);
5398N/A+ int status2 = pam_end (pamh, pam_auth_status);
5398N/A fprintf (stderr, "%s: pam_end (...) ==> %d (%s)\n",
5398N/A (status2 == PAM_SUCCESS ? "Success" : "Failure"));
5398N/A- if (status == PAM_SUCCESS)
5398N/A+ perror("Error pam could not revert euid to user running as euid root,"
5398N/A+ " locking may not work now\n");
5398N/A+ "<--end of pam_authenticate() returning ok_to_unblank = %d\n",
5398N/A+ (int) ((pam_auth_status == PAM_SUCCESS) ? True : False));
5398N/A+ if (si->pw_data->passwd_string)
5398N/A+ memset(si->pw_data->passwd_string, 0,
5398N/A+ strlen(si->pw_data->passwd_string));
5398N/A+ free (si->pw_data->passwd_string);
5398N/A+ si->pw_data->passwd_string = NULL;
5398N/A+ if (pam_auth_status == PAM_SUCCESS)
5398N/A si->unlock_state = ul_success; /* yay */
5398N/A else if (si->unlock_state == ul_cancel ||
5398N/A si->unlock_state == ul_time)
5559N/A@@ -355,6 +496,13 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
5398N/A+ if (! verbose_p) /* SUN addition: only print warnings in verbose mode */
5398N/A+ { /* since they are rarely useful and mostly just */
5398N/A+ return True; /* cause confusion when users see them. */
5398N/A # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
5559N/A@@ -381,6 +529,8 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
5398N/A+#ifndef __sun /* disable the misleading message */
5559N/A@@ -388,9 +538,11 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
5398N/A "%s: password authentication via PAM is unlikely to work.\n",
5398N/A blurb(), file2, PAM_SERVICE_NAME, blurb());
5398N/A /* else warn about file2 existing but being unreadable? */
5398N/A+#ifndef __sun /* disable the misleading message */
5559N/A@@ -398,15 +550,19 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
5398N/A "%s: password authentication via PAM is unlikely to work.\n",
5398N/A blurb(), file2, file, blurb());
5398N/A /* Return true anyway, just in case. */
5398N/A pam_conversation (int nmsgs,
5398N/A- const struct pam_message **msg,
5398N/A struct pam_response **resp,
5559N/Aindex ac5a3f0..0618642 100644
5398N/A@@ -145,7 +145,10 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret)
5398N/A gid_errno = errno ? errno : -1;
5398N/A+/*mali if (setuid (uid) != 0)**we need root privs back at pam_authenticate
5398N/A+ this is causing to loose root priv for good, not good **/
5398N/A uid_errno = errno ? errno : -1;
5398N/A if (uid_errno == 0 && gid_errno == 0 && sgs_errno == 0)
5398N/A@@ -243,7 +243,11 @@ show_job_list (void)
5398N/A static void clean_job_list (void);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A static struct screenhack_job *
5398N/A make_job (pid_t pid, int screen, const char *cmd)
5398N/A struct screenhack_job *job = (struct screenhack_job *) malloc (sizeof(*job));
5559N/A@@ -413,7 +417,11 @@ unblock_sigchld (void)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A kill_job (saver_info *si, pid_t pid, int signal)
5398N/A saver_preferences *p = &si->prefs;
5559N/A@@ -598,9 +606,14 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
5398N/A mention them) if we've just killed the subprocess. But mention them
5398N/A if they happen on their own.
5398N/A- (p->verbose_p || job->status != job_killed)))
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+#endif /* HAVE_XSCREENSAVER_LOCK */
5398N/A+ (p->verbose_p || (job && job->status != job_killed))))
5398N/A /* Don't call fprintf() from signal handlers, as it might malloc.
5559N/A@@ -640,8 +653,12 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
5398N/A else if (WIFSIGNALED (wait_status))
5398N/A- job->status != job_killed ||
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+#endif /* HAVE_XSCREENSAVER_LOCK */
5398N/A+ (job && job->status != job_killed) ||
5398N/A WTERMSIG (wait_status) != SIGTERM)
5398N/A /* Don't call fprintf() from signal handlers, as it might malloc.
5559N/A@@ -709,12 +726,20 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
5398N/A /* Clear out the pid so that screenhack_running_p() knows it's dead.
5398N/A if (!job || job->status == job_dead)
5398N/A for (i = 0; i < si->nscreens; i++)
5398N/A saver_screen_info *ssi = &si->screens[i];
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ if (kid == si->passwd_pid)
5559N/Aindex 81c8adb..9afc752 100644
5398N/A #define ABS(x)((x)<0?-(x):(x))
5398N/A@@ -60,6 +62,11 @@ static Bool proc_interrupts_activity_p (saver_info *si);
5398N/A #endif /* HAVE_PROC_INTERRUPTS */
5398N/A static void check_for_clock_skew (saver_info *si);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+static void watchdog_timer (XtPointer closure, XtIntervalId *id);
5398N/A+extern Bool g_passwd_dialog_created;
5559N/A@@ -257,7 +264,11 @@ cycle_timer (XtPointer closure, XtIntervalId *id)
5398N/A crash. So, restart the thing once an hour. */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A fprintf (stderr, "%s: dialog box up; delaying hack change.\n",
5559N/A@@ -310,7 +321,28 @@ activate_lock_timer (XtPointer closure, XtIntervalId *id)
5398N/A fprintf (stderr, "%s: timed out; activating lock.\n", blurb());
5398N/A+ "-->activate_lock_timer returning because screen already locked\n");
5398N/A+ /* Make sure screen is blanked before posting dialog box */
5398N/A+ ok_to_unblank = unlock_p (si);
5398N/A+ if (ok_to_unblank == True)
5398N/A+ else /* blanking of screen failed reset lock flag */
5559N/A@@ -616,14 +648,30 @@ dispatch_event (saver_info *si, XEvent *event)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ if (!si->typeahead_events)
5398N/A+ /* Allocate enough space for 10 keys to be queued - if we get more
5398N/A+ than that before the dialog is ready, it's most likely the user
5398N/A+ left something sitting on the keyboard, and won't want them. */
5398N/A+ si->typeahead_events = calloc(10, sizeof(XKeyEvent));
5398N/A+ if (si->typeahead_events == NULL)
5398N/A memset (buf, 0, sizeof(buf));
5559N/A@@ -636,10 +684,12 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK /* Let these be queued with the rest */
5398N/A case '\010': case '\177': /* Backspace */
5398N/A case '\025': case '\030': /* Erase line */
5398N/A case '\012': case '\015': /* Enter */
5559N/A@@ -649,7 +699,17 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
5398N/A break; /* ignore space at beginning of line */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Queue events to replay once dialog is ready */
5398N/A+ if (si->num_typeahead_events < 10)
5398N/A+ memcpy (&si->typeahead_events[si->num_typeahead_events++],
5398N/A+ &event, sizeof(XKeyEvent));
5398N/A+ i = 1; /* so that spaces are accepted after the beginning */
5559N/A@@ -657,6 +717,7 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
5398N/A } while (i < sizeof(buf)-1 &&
5398N/A XCheckMaskEvent (si->dpy, KeyPressMask, &event));
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK
5559N/A@@ -671,6 +732,7 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
5398N/A memset (buf, 0, sizeof(buf));
5398N/A+#endif /* HAVE_XSCREENSAVER_LOCK */
5559N/A@@ -854,6 +916,7 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
5398N/A+ si->emergency_lock_p = True;
5559N/A@@ -868,6 +931,47 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
5398N/A+ "************************************\n"
5398N/A+ "-->sleep_until_idle() event:VisibilityNotify\n"
5398N/A+ "\t Window of VisibilityNotify:%x\n"
5398N/A+ "\t until_idle_p=%d g_passwd_dialog_created=%d\n",
5398N/A+ until_idle_p, g_passwd_dialog_created);
5398N/A+ /* Don't raise root window when passwd dialog wants to come up */
5398N/A+ if (g_passwd_dialog_created == 0 && !until_idle_p)
5398N/A+ for (k = 0; k < si->nscreens; k++)
5398N/A+ saver_screen_info *ssi = &si->screens[k];
5398N/A+ XClearWindow (si->dpy, ssi->screensaver_window);
5398N/A+ XMapRaised (si->dpy, ssi->screensaver_window);
5398N/A+ "A window is trying to popup.\n"
5398N/A+ "Raising saver root Window.\n"
5398N/A+ "************************************\n");
5398N/A /* Ignore release events so that hitting ESC at the password dialog
5559N/A@@ -1565,7 +1669,11 @@ watchdog_timer (XtPointer closure, XtIntervalId *id)
5398N/A Bool running_p = screenhack_running_p (si);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A fprintf (stderr, "%s: dialog box is up: not raising screen.\n",
5559N/A@@ -275,12 +275,30 @@ struct saver_info {
5398N/A int unlock_failures; /* Counts failed login attempts while the
5559N/A time_t unlock_failure_time; /* Time of first failed login attempt. */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ Window *raise_wins; /* List of windows to raise above the */
5398N/A+ int max_raise_wins; /* accessibility helpers */
5398N/A+ Window *override_wins; /* Windows we had to unset the */
5398N/A+ int num_override_wins; /* override_redirect attribute on and */
5398N/A+ int max_override_wins; /* need to restore it on after unlock. */
5398N/A+ pid_t passwd_pid; /* The pid of the password dialog child if we
5398N/A+ are running an external process for it. */
5398N/A+ XKeyEvent *typeahead_events; /* Like unlock_typeahead, but as raw events */
5398N/A char *unlock_typeahead; /* If the screen is locked, and the user types
5398N/A a character, we assume that it is the first
5398N/A character of the password. It's stored here
5398N/A for the password dialog to use to populate
5398N/A+#endif /* HAVE_XSCREENSAVER_LOCK */
5398N/A char *user; /* The user whose session is locked. */
5398N/A char *cached_passwd; /* Cached password, used to avoid multiple
5559N/Aindex 6acaddb..51e4c6a 100644
5559N/A@@ -1082,8 +1082,12 @@ safe_XConfigureWindow (Display *dpy, Window window,
5398N/A return (!error_handler_hit_p);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A /* This might not be necessary, but just in case. */
5398N/A safe_XDestroyWindow (Display *dpy, Window window)
5559N/A@@ -1097,6 +1101,14 @@ safe_XDestroyWindow (Display *dpy, Window window)
5398N/A XSetErrorHandler (old_handler);
5398N/A+ /* clear any queued VisibilityNotify events so we don't cause XErrors
5398N/A+ later when we try to process them and find the windowid is invalid */
5398N/A+ while (XCheckWindowEvent(dpy, window, VisibilityChangeMask, &event))
5398N/A return (!error_handler_hit_p);
5559N/A@@ -1211,6 +1223,7 @@ initialize_screensaver_window_1 (saver_screen_info *ssi)
5398N/A ButtonPressMask | ButtonReleaseMask |
5559N/A@@ -1482,6 +1495,9 @@ raise_window (saver_info *si,
5398N/A saver_preferences *p = &si->prefs;
5398N/A+ fprintf(stderr,"-->raise_window()\n");
5559N/A@@ -1696,6 +1712,9 @@ unblank_screen (saver_info *si)
5398N/A Bool unfade_p = (si->fading_possible_p && p->unfade_p);
5398N/A+ fprintf(stderr,"-->unblank_screen()\n");
5398N/A monitor_power_on (si, True);
5398N/A reset_watchdog_timer (si, False);
5559N/A@@ -1984,7 +2003,7 @@ select_visual (saver_screen_info *ssi, const char *visual_name)
5398N/A maybe_transfer_grabs (ssi, old_w, ssi->screensaver_window, ssi->number);
5398N/A /* Now we can destroy the old window without horking our grabs. */
5398N/A- XDestroyWindow (si->dpy, old_w);
5398N/A+ safe_XDestroyWindow (si->dpy, old_w);
5398N/A fprintf (stderr, "%s: %d: destroyed old saver window 0x%lx.\n",
5559N/Aindex 06f5c13..33d357a 100644
5398N/A saver_info *global_si_kludge = 0; /* I hate C so much... */
5398N/A+Bool ok_to_unblank = False;
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+/* Global storage for gtk passwd lock dialog
5398N/A+ * we assign this to si->pw_data and this is needed
5398N/A+passwd_dialog_data mygtkpwd;
5398N/A+passwd_dialog_data *ptr_mygtkpwd = &mygtkpwd;
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A static XrmOptionDescRec options [] = {
5559N/A@@ -670,6 +690,9 @@ connect_to_server (saver_info *si, int *argc, char **argv)
5398N/A { &XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID" },
5398N/A { &XA_XROOTPMAP_ID, "_XROOTPMAP_ID" },
5559N/A { &XA_NET_WM_USER_TIME, "_NET_WM_USER_TIME" },
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ { &XA_UNLOCK_RATIO, "UNLOCK_RATIO" },
5398N/A { NULL, NULL } /* Must be last to terminate list */
5398N/A const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
5559N/A@@ -1164,8 +1187,36 @@ static void
5398N/A saver_preferences *p = &si->prefs;
5398N/A+ /* Bool ok_to_unblank; made this a global flag, gets set in
timers.c */
5398N/A+ const char *modulesptr = NULL;
5398N/A+** CR4784055(P1)locked-screen dialog is inaccessible to Gnopernicus
5398N/A+** voice for each type-in char in the password field of
5398N/A+ ** g_type_init should be done before calling gconf_client routines
5398N/A+ ** so that xscreensaver does not dump core if gconf daemon is not running.
5398N/A+ ** 6395649 at-spi-registryd starts when screen is locked even
5398N/A+ ** when accessible device support is off(SR)
5398N/A+ ** per AT core gp suggestion
5398N/A+ ** GTK_MODULES is set only if at support is enabled
5398N/A+ if (gconf_client_get_bool(gconf_client_get_default(),
5398N/A+ modulesptr = getenv ("GTK_MODULES");
5398N/A+ if (!modulesptr || modulesptr [0] == '\0')
5398N/A+ putenv ("GTK_MODULES=gail:atk-bridge");
5559N/A@@ -1196,6 +1247,17 @@ main_loop (saver_info *si)
5398N/A fprintf (stderr, "%s: idle with blanking disabled at %s.\n",
5398N/A+ /* 6221109 Changing mode from disable to anything else,
5398N/A+ This is Disable Screen Saver mode, in this mode we dont lock
5398N/A+ screen, but si->locked_p is already set to True, since someone
5398N/A+ tried to lock screen, reset it to False, else when we change
5398N/A+ mode from disable and try to lock screen, xscreensaver thinks
5398N/A+ screen is already locked and doesnt lock screen anymore.
5398N/A /* Go around the loop and wait for the next bout of idleness,
5398N/A or for the init file to change, or for a remote command to
5559N/A@@ -1267,6 +1329,7 @@ main_loop (saver_info *si)
5398N/A schedule_wakeup_event (si, retry, p->debug_p);
5559N/A@@ -1329,7 +1392,17 @@ main_loop (saver_info *si)
5398N/A p->lock_p && /* and locking is enabled */
5398N/A !si->locking_disabled_p && /* and locking is possible */
5398N/A lock_timeout == 0) /* and locking is not timer-deferred */
5398N/A- set_locked_p (si, True); /* then lock right now. */
5398N/A+ fprintf(stderr, "going to lock screen B\n");
5398N/A+ set_locked_p (si, True); /* then lock right now. */
5398N/A+ ok_to_unblank = unlock_p(si);
5398N/A+ if (ok_to_unblank == True)
5398N/A /* locked_p might be true already because of the above, or because of
5398N/A the LOCK ClientMessage. But if not, and if we're supposed to lock
5559N/A@@ -1344,10 +1417,7 @@ main_loop (saver_info *si)
5398N/A check_for_leaks ("blanked A");
5398N/A sleep_until_idle (si, False); /* until not idle */
5398N/A check_for_leaks ("blanked B");
5559N/A@@ -1357,6 +1427,13 @@ main_loop (saver_info *si)
5398N/A /* Maybe unlock the screen.
5398N/A+ if (si->demoing_p) goto DONE; /* in demoing mode and user wants out
5398N/A+ /* This is when blank timeout has happened but lock timeout hasnt
5398N/A+ and user gets active. Simply get him out of the blank screen. */
5398N/A+ if (si->screen_blanked_p && !si->locked_p) goto DONE;
5398N/A saver_screen_info *ssi = si->default_screen;
5559N/A@@ -1368,7 +1445,20 @@ main_loop (saver_info *si)
5398N/A suspend_screenhack (&si->screens[i], True); /* suspend */
5398N/A XUndefineCursor (si->dpy, ssi->screensaver_window);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ /* Prevents lock dialog posting on non blanked screen */
5398N/A+ if (!si->screen_blanked_p) /* locked_p is true, so blank now */
5398N/A+ if (si->screen_blanked_p) /* if blanking successful, call PAM */
5398N/A+ ok_to_unblank = unlock_p(si);
5398N/A ok_to_unblank = unlock_p (si);
5398N/A XDefineCursor (si->dpy, ssi->screensaver_window, ssi->cursor);
5559N/A@@ -1393,6 +1483,7 @@ main_loop (saver_info *si)
5398N/A fprintf (stderr, "%s: unblanking screen at %s.\n",
5559N/A@@ -1477,7 +1568,19 @@ main (int argc, char **argv)
5398N/A textdomain (GETTEXT_PACKAGE);
5398N/A+#if defined(ENABLE_NLS) && defined(HAVE_XSCREENSAVER_LOCK)
5398N/A+ /* Gtk unlock dialog needs to be sent UTF-8 text to display */
5398N/A+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
5398N/A memset(si, 0, sizeof(*si));
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+/* Initialize and point si to pw_data
i.e. the lock dialog struct */
5398N/A+ memset(ptr_mygtkpwd, 0, sizeof(*ptr_mygtkpwd));
5398N/A+ si->pw_data = ptr_mygtkpwd;
5398N/A global_si_kludge = si; /* I hate C so much... */
5559N/A@@ -1487,7 +1590,9 @@ main (int argc, char **argv)
5398N/A set_version_string (si, &argc, argv);
5398N/A+#ifndef HAVE_XSCREENSAVER_LOCK /* moved below for external lock */
5398N/A privileged_initialization (si, &argc, argv);
5398N/A spasswd = getpwuid(getuid());
5559N/A@@ -1510,6 +1615,10 @@ main (int argc, char **argv)
5398N/A load_init_file(si->dpy, p); /* must be before initialize_per_screen_info() */
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+ privileged_initialization (si, &argc, argv);
5398N/A blurb_timestamp_p = p->timestamp_p; /* kludge */
5398N/A initialize_per_screen_info (si, shell); /* also sets si->fading_possible_p */
5559N/A@@ -1762,8 +1871,12 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
5398N/A+ fprintf(stderr, "handle_clientmessage\n");
5398N/A /* Preferences might affect our handling of client messages. */
5398N/A maybe_reload_init_file (si);
5559N/A@@ -2055,10 +2168,14 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
5398N/A sprintf (buf, "LOCK ClientMessage received; %s", response);
5398N/A clientmessage_response (si, window, False, buf, response);
5398N/A+ fprintf(stderr, "going to lock screen A\n");
5559N/A /* Note that this leaves things in a slightly inconsistent state:
5559N/A we are blanked but not locked. And blanking might actually
5559N/A fail if we can't get the grab. */
5398N/A+ si->emergency_lock_p = True;
5559N/A /* Have to set the time or xscreensaver-command doesn't
5559N/A report the LOCK state change. */
5559N/A@@ -2067,6 +2184,9 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
5398N/A+ return True; /* dont set lock_id to 0,
5398N/A+ causes to go in lock in main_loop above */
5398N/A if (si->lock_id) /* we're doing it now, so lose the timeout */
5398N/A XtRemoveTimeOut (si->lock_id);
5398N/A@@ -164,6 +164,12 @@ extern Bool select_visual (saver_screen_info *ssi, const char *visual_name);
5398N/A extern void store_saver_status (saver_info *si);
5398N/A extern const char *signal_name (int signal);
5398N/A+#ifdef HAVE_XSCREENSAVER_LOCK
5398N/A+extern int kill_job (saver_info *si, pid_t pid, int signal);
5398N/A+extern struct screenhack_job *make_job (pid_t pid, int screen,
5398N/A /* =======================================================================
5398N/A ======================================================================= */