xscreensaver-06-gtk-lock.diff revision 20829
/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5077993
http://bugzilla.gnome.org/show_bug.cgi?id=147639
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5083155
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5059445
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5039878
via 'alt-tab'
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6573182
---
@@ -405,6 +405,9 @@
+/* Define this to build the external lock dialog */
+
/* Define this if you have the X Shared Memory Extension. */
have_gtk="$ok"
ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
+ ALL_LOCK_PROGRAMS="$PREFERRED_LOCK_PROGRAM $ALL_LOCK_PROGRAMS"
+fi
PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
echo ""
AC_MSG_ERROR([\"--with-hackdir=${bindir}/${bad_choice}\" won't work.
@@ -29,6 +29,7 @@ GTK_APPDIR = $(GTK_DATADIR)/applications
GTK_ICONDIR = $(GTK_DATADIR)/pixmaps
GTK_GLADEDIR = $(prefix)/lib/xscreensaver/config
HACK_CONF_DIR = @HACK_CONF_DIR@
+LOCK_DIR = $(libexecdir)
CC = @CC@
OBJCC = @OBJCC@
+LOCK_DEFS = $(DEFS) -DLOCKDIR=\"$(LOCK_DIR)\"
LIBS = @LIBS@
INTL_LIBS = @INTLLIBS@
@@ -100,6 +102,8 @@ GTK_SRCS = demo-Gtk.c demo-Gtk-conf.c \
demo-Gtk-widgets.c demo-Gtk-support.c
GTK_EXTRA_OBJS = demo-Gtk-widgets.o demo-Gtk-support.o
GTK_OBJS = demo-Gtk.o demo-Gtk-conf.o @GTK_EXTRA_OBJS@
+GTK_LOCK_SRCS = lock-Gtk.c atoms.c remote.c
+GTK_LOCK_OBJS = lock-Gtk.o atoms.o remote.o
PWENT_SRCS = passwd-pwent.c
PWENT_OBJS = passwd-pwent.o
@@ -219,8 +223,8 @@ GETIMG_LIBS = $(LIBS) $(X_LIBS) $(XPM_LIBS) $(JPEG_LIBS) \
$(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS)
EXES = xscreensaver xscreensaver-command xscreensaver-demo \
- xscreensaver-getimage @EXES_OSX@
-EXES2 = @ALL_DEMO_PROGRAMS@
+ xscreensaver-getimage @EXES_OSX@ @LOCK_PROGRAM@
+EXES2 = @ALL_DEMO_PROGRAMS@ @ALL_LOCK_PROGRAMS@
EXES_OSX = pdf2jpeg
SCRIPTS_1 = xscreensaver-getimage-file xscreensaver-getimage-video \
@@ -250,7 +254,7 @@ VMSFILES = compile_axp.com compile_decc.com link_axp.com link_decc.com \
vms-getpwnam.c vms-pwd.h vms-hpwd.c vms-validate.c \
vms_axp.opt vms_axp_12.opt vms_decc.opt vms_decc_12.opt
-TARFILES = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) \
+TARFILES = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) $(GTK_LOCK_SRCS) \
$(MOTIF_SRCS) $(GTK_SRCS) $(PWENT_SRCS) $(PWHELPER_SRCS) \
$(KERBEROS_SRCS) $(PAM_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) \
$(CMD_SRCS) $(GETIMG_SRCS_1) $(PDF2JPEG_SRCS) $(HDRS) \
@@ -263,7 +267,7 @@ all: $(EXES) $(EXES2)
tests: $(TEST_EXES)
install: install-program install-ad install-scripts \
- install-gnome install-man install-xml install-pam
+ install-gnome install-man install-xml
uninstall: uninstall-program uninstall-ad \
uninstall-gnome uninstall-man uninstall-xml
@@ -275,6 +279,9 @@ install-program: $(EXES)
@if [ ! -d $(install_prefix)$(bindir) ]; then \
$(INSTALL_DIRS) $(install_prefix)$(bindir) ; \
fi
+ $(INSTALL_DIRS) $(install_prefix)$(LOCK_DIR) ; \
+ fi
if [ @NEED_SETUID@ = yes ]; then \
@@ -303,6 +310,12 @@ install-program: $(EXES)
echo $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
$(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
done
+ echo $(INSTALL_PROGRAM) xscreensaver-lock \
+ $(install_prefix)$(LOCK_DIR)/xscreensaver-lock ; \
+ $(INSTALL_PROGRAM) xscreensaver-lock \
+ $(install_prefix)$(LOCK_DIR)/xscreensaver-lock ; \
+ fi
install-ad: XScreenSaver.ad
@if [ ! -d $(install_prefix)$(AD_DIR) ]; then \
@@ -738,7 +751,7 @@ $(SAVER_UTIL_OBJS):
# How we build object files in this directory.
.c.o:
- $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(X_CFLAGS) $<
+ $(CC) -c $(INCLUDES) $(DEFS) $(INTL_DEFS) $(CFLAGS) $(X_CFLAGS) $<
.m.o:
$(OBJCC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(X_CFLAGS) $<
@@ -764,6 +777,16 @@ demo-Gtk-conf.o: demo-Gtk-conf.c
$(CC) -c $(INCLUDES) $(CONF_DEFS) $(GTK_DEFS) $(CFLAGS) $(X_CFLAGS) \
$(srcdir)/demo-Gtk-conf.c
+# lock takes an extra -D option.
+lock.o:
+ $(CC) -c $(INCLUDES) $(LOCK_DEFS) $(CFLAGS) $(X_CFLAGS) \
+ $(srcdir)/lock.c
+
+# lock-Gtk takes extra -D and -I options.
+lock-Gtk.o: lock-Gtk.c
+ $(CC) -c $(INCLUDES) -I$(ICON_SRC) $(GTK_DEFS) \
+ $(CFLAGS) $(X_CFLAGS) $(INTL_DEFS) \
+ $(srcdir)/lock-Gtk.c
# How we build the default app-defaults file into the program.
#
@@ -778,7 +801,8 @@ XScreenSaver_Xm_ad.h: XScreenSaver-Xm.ad
# The executables linked in this directory.
#
xscreensaver: $(SAVER_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS)
+ $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS) \
+ -lgconf-2 -lgobject-2.0
xscreensaver-command: $(CMD_OBJS)
$(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS)
@@ -794,6 +818,15 @@ xscreensaver-demo: @PREFERRED_DEMO_PROGRAM@
cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@ ; \
fi
+xscreensaver-lock: @PREFERRED_LOCK_PROGRAM@
+ $(INSTALL_PROGRAM) @PREFERRED_LOCK_PROGRAM@ $@
+
+xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(GTK_LOCK_OBJS) $(LIBS) $(X_LIBS) \
+ $(GTK_LIBS) $(XML_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
+ $(XDPMS_LIBS) -lXext \
+ $(X_EXTRA_LIBS)
+
xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS)
$(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(MOTIF_OBJS) $(LIBS) $(X_LIBS) \
$(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
@@ -817,7 +850,7 @@ pdf2jpeg: $(PDF2JPEG_OBJS)
TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PASSWD_OBJS) \
- subprocs.o setuid.o splash.o prefs.o mlstring.o exec.o \
+ subprocs.o setuid.o splash.o prefs.o mlstring.o \
$(SAVER_UTIL_OBJS)
test-passwd.o: XScreenSaver_ad.h
@@ -907,8 +940,14 @@ dpms.o: $(srcdir)/types.h
dpms.o: $(srcdir)/xscreensaver.h
exec.o: ../config.h
exec.o: $(srcdir)/exec.h
+lock-Gtk.o: $(srcdir)/atoms.h
+lock-Gtk.o: ../config.h
+lock-Gtk.o: $(srcdir)/remote.h
+lock-Gtk.o: $(UTILS_SRC)/xscreensaver-intl.h
lock.o: $(srcdir)/auth.h
lock.o: ../config.h
+lock.o: $(srcdir)/dialog-data.h
+lock.o: $(srcdir)/exec.h
lock.o: $(srcdir)/mlstring.h
lock.o: $(srcdir)/prefs.h
lock.o: $(srcdir)/types.h
@@ -917,6 +956,8 @@ lock.o: $(srcdir)/xscreensaver.h
mlstring.o: $(srcdir)/mlstring.h
passwd.o: $(srcdir)/auth.h
passwd.o: ../config.h
+passwd.o: $(srcdir)/dialog-data.h
+passwd.o: $(srcdir)/mlstring.h
passwd.o: $(srcdir)/prefs.h
passwd.o: $(srcdir)/types.h
passwd.o: $(srcdir)/xscreensaver.h
@@ -984,6 +1025,8 @@ test-vp.o: ../config.h
test-xdpms.o: ../config.h
test-xinerama.o: ../config.h
timers.o: ../config.h
+timers.o: $(srcdir)/dialog-data.h
+timers.o: $(srcdir)/mlstring.h
timers.o: $(srcdir)/prefs.h
timers.o: $(srcdir)/types.h
timers.o: $(srcdir)/xscreensaver.h
@@ -1011,6 +1054,8 @@ xscreensaver-getimage.o: $(UTILS_SRC)/yarandom.h
xscreensaver.o: XScreenSaver_ad.h
xscreensaver.o: $(srcdir)/auth.h
xscreensaver.o: ../config.h
+xscreensaver.o: $(srcdir)/dialog-data.h
+xscreensaver.o: $(srcdir)/mlstring.h
xscreensaver.o: $(srcdir)/prefs.h
xscreensaver.o: $(srcdir)/types.h
xscreensaver.o: $(UTILS_SRC)/resources.h
diff --git xscreensaver-5.12/driver/auth.h xscreensaver-5.12/driver/auth.h
@@ -51,4 +51,8 @@ xss_authenticate(saver_info *si, Bool verbose_p);
void
auth_finished_cb (saver_info *si);
+#ifdef HAVE_XSCREENSAVER_LOCK
+extern int write_to_child (saver_info* si, const char* cmd, const char *msg);
+#endif
+
#endif
@@ -98,6 +98,8 @@
# define G_MODULE_EXPORT /**/
#endif /* !HAVE_GTK2 */
+#include <gconf/gconf-client.h>
+
#if defined(DEFAULT_ICONDIR) && !defined(GLADE_DIR)
# define GLADE_DIR DEFAULT_ICONDIR
#endif
@@ -5006,6 +5008,22 @@ main (int argc, char **argv)
load_init_file (dpy, p);
initialize_sort_map (s);
+ /* Bug 147639: Gok cant automatically UI grab screensaver preferences */
+ {
+ GConfClient *client = gconf_client_get_default ();
+
+
+ /* check if accessibilty mode is enabled */
+ if (gconf_client_get_bool (client, KEY, NULL))
+ {
+ /* GTK Accessibility Module initialized */
+ if (!modulesptr || (modulesptr [0] == '\0'))
+ }
+ }
+
/* Now that Xt has been initialized, and the resources have been read,
we can set our `progname' variable to something more in line with
reality.
new file mode 100644
@@ -0,0 +1,122 @@
+/* xscreensaver, Copyright (c) 1993-2008 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. No representations are made about the suitability of this
+ * implied warranty.
+ */
+
+#ifndef __DIALOG_DATA_H__
+#define __DIALOG_DATA_H__
+
+#include <stdio.h>
+
+struct passwd_dialog_data {
+
+ saver_screen_info *prompt_screen;
+ int previous_mouse_x, previous_mouse_y;
+
+ char typed_passwd [80];
+
+ XtIntervalId timer;
+ int i_beam;
+
+ float ratio;
+ Position x, y;
+ Dimension width;
+ Dimension height;
+ Dimension border_width;
+
+ Bool echo_input;
+ -- Nathan Hale, 1776. */
+
+ char *heading_label;
+ char *body_label;
+ char *user_label;
+ mlstring *info_label;
+ /* The entry field shall only be displayed if prompt_label is not NULL */
+ mlstring *prompt_label;
+ char *date_label;
+ char *passwd_string;
+ Bool passwd_changed_p; /* Whether the user entry field needs redrawing */
+ Bool caps_p; /* Whether we saw a keypress with caps-lock on */
+ char *unlock_label;
+ char *login_label;
+ char *uname_label;
+
+ Bool show_uname_p;
+
+#ifndef HAVE_XSCREENSAVER_LOCK
+ XFontStruct *heading_font;
+ XFontStruct *body_font;
+ XFontStruct *label_font;
+ XFontStruct *passwd_font;
+ XFontStruct *date_font;
+ XFontStruct *button_font;
+ XFontStruct *uname_font;
+
+ Pixel foreground;
+ Pixel background;
+ Pixel passwd_foreground;
+ Pixel passwd_background;
+ Pixel thermo_foreground;
+ Pixel thermo_background;
+ Pixel shadow_top;
+ Pixel shadow_bottom;
+ Pixel button_foreground;
+ Pixel button_background;
+
+ Dimension preferred_logo_width, logo_width;
+ Dimension preferred_logo_height, logo_height;
+ Dimension thermo_width;
+ Dimension internal_border;
+ Dimension shadow_width;
+
+ Dimension passwd_field_x, passwd_field_y;
+ Dimension passwd_field_width, passwd_field_height;
+
+ Dimension unlock_button_x, unlock_button_y;
+ Dimension unlock_button_width, unlock_button_height;
+
+ Dimension login_button_x, login_button_y;
+ Dimension login_button_width, login_button_height;
+
+ Dimension thermo_field_x, thermo_field_y;
+ Dimension thermo_field_height;
+
+ Pixmap logo_pixmap;
+ Pixmap logo_clipmask;
+ int logo_npixels;
+ unsigned long *logo_pixels;
+#endif /* ! HAVE_XSCREENSAVER_LOCK */
+
+ Cursor passwd_cursor;
+ Bool unlock_button_down_p;
+ Bool login_button_down_p;
+ Bool login_button_p;
+ Bool login_button_enabled_p;
+ Bool button_state_changed_p; /* Refers to both buttons */
+
+ Pixmap save_under;
+ Pixmap user_entry_pixmap;
+
+#ifdef HAVE_XSCREENSAVER_LOCK
+ /* extern passwd dialog stuff */
+ XtInputId stdout_input_id;
+ int stdin_fd; /* child's stdin - parent writes to this */
+ int stdout_fd; /* child's stdout - parent reads from this */
+ FILE *stdin_file; /* child's stdin - parent writes to this */
+ FILE *stdout_file; /* child's stdout - parent reads from this */
+ Bool got_windowid;
+ Bool got_passwd;
+#endif
+};
+
+#endif /* __DIALOG_DATA_H__ */
+
new file mode 100644
@@ -0,0 +1,956 @@
+/* lock-Gtk.c -- a GTK+ password dialog for xscreensaver
+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. No representations are made about the suitability of this
+ * implied warranty.
+ */
+
+/* GTK+ locking code written by Jacob Berkman <jacob@ximian.com> for
+ * Sun Microsystems.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#endif
+
+#ifdef HAVE_GTK2 /* whole file */
+
+#include <xscreensaver-intl.h>
+
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+
+/* AT-enabled */
+#include <stdio.h>
+#include <ctype.h>
+
+#include <gconf/gconf-client.h>
+#include <libbonobo.h>
+#include <login-helper/Accessibility_LoginHelper.h>
+#include <atk/atkobject.h>
+
+
+#if GTK_CHECK_VERSION(2,14,0)
+# define GET_WINDOW(w) gtk_widget_get_window (w)
+#else
+# define GET_WINDOW(w) ((w)->window)
+#endif
+
+static Atom XA_UNLOCK_RATIO;
+
+typedef struct {
+ GtkWidget *dialog;
+ GtkWidget *user_prompt_label;
+ GtkWidget *user_input_entry;
+ GtkWidget *progress;
+ GtkWidget *button;
+ GtkWidget *msg_label;
+ GtkWidget *pam_message_label;
+} PasswdDialog;
+
+/*Global info */
+#define MAXRAISEDWINS 2
+
+char *progname = 0;
+FILE *parent_file = NULL; /* child writes to parent on this */
+
+#define FD_TO_PARENT 9
+
+/* Send a command to the xscreensaver parent daemon
+ Arguments:
+ - data - data for message
+ - flush - whether to flush now or allow stdio to buffer
+ Message format sent to parent:
+
+ Can be used to flush previously buffered messages by calling
+ with NULL msg & data, and TRUE for flush.
+ */
+static int
+write_to_parent (const char* msg, const char *data, gboolean flush)
+{
+ int len = 0;
+
+ /*
+ fflush (stderr);
+ */
+
+ if (msg)
+ {
+ if (data)
+ len = fprintf (parent_file, "%s=%s\n", msg, data);
+ else
+ len = fprintf (parent_file, "%s\n", msg);
+ }
+
+ if (flush)
+ fflush (parent_file);
+
+ return len;
+}
+
+/* Send parent a message with a window id as the data */
+static void
+write_windowid (const char* msg, Window w)
+{
+ char s[16]; /* more than long enough to hold a 32-bit integer + '\0' */
+
+ write_to_parent(msg, s, FALSE);
+}
+
+static GtkWidget *
+load_unlock_logo_image (void)
+{
+ const char *logofile;
+ struct stat statbuf;
+
+
+ if (stat (logofile, &statbuf) != 0)
+ {
+ }
+
+ return gtk_image_new_from_file (logofile);
+}
+
+/* Create unlock dialog */
+static PasswdDialog *
+make_dialog (gboolean center_pos)
+{
+ GtkWidget *dialog;
+ AtkObject *atk_dialog;
+ GtkWidget *frame1, *frame2;
+ GtkWidget *vbox;
+ GtkWidget *hbox1, *hbox2;
+ GtkWidget *bbox;
+ GtkWidget *vbox2;
+ GtkWidget *entry;
+ AtkObject *atk_entry;
+ GtkWidget *title_label, *msg_label, *prompt_label,
+ *user_label, *date_label, *pam_msg_label;
+ AtkObject *atk_title_label, *atk_prompt_label;
+ GtkWidget *button;
+ GtkWidget *image;
+ GtkWidget *progress;
+ char *version;
+ char *user;
+ char *host;
+ char *s;
+ gchar *format_string_locale, *format_string_utf8;
+ PasswdDialog *pwd;
+
+ /* taken from lock.c */
+ char buf[256];
+ gchar *utf8_format;
+ time_t now = time (NULL);
+ struct tm* tm;
+
+ server_xscreensaver_version (GDK_DISPLAY (), &version, &user, &host);
+
+ if (!version)
+ {
+ progname, gdk_get_display ());
+ exit (1);
+ }
+
+ /* PUSH */
+ gtk_widget_push_colormap (gdk_rgb_get_cmap ());
+
+ pwd = g_new0 (PasswdDialog, 1);
+
+ dialog = gtk_window_new (GTK_WINDOW_POPUP);
+ pwd->dialog = dialog;
+
+ /*
+ ** bugid: 5077989(P2)Bug 147580: password input dialogue obscures GOK
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
+ bugid: 5002244: scr unlock dialog incompatible with MAG technique
+ ** 6182506: scr dialog is obscured by MAG window
+ */
+ if (center_pos)
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
+ else
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); /*mali99 irritating*/
+
+ /* AT-enabled dialog role = frame */
+ atk_dialog = gtk_widget_get_accessible (dialog);
+
+ /* frame */
+ frame1 = g_object_new (GTK_TYPE_FRAME,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (dialog), frame1);
+ /* AT role = panel */
+
+ /* vbox */
+ vbox = gtk_vbox_new (FALSE, 10);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+ gtk_container_add (GTK_CONTAINER (frame1), vbox);
+ /* AT role= filler(default) */
+
+ /* hbox */
+ hbox1 = gtk_hbox_new (FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox1,
+ TRUE, TRUE, 0);
+
+ /* image frame */
+ frame2 = g_object_new (GTK_TYPE_FRAME,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (hbox1), frame2,
+ TRUE, TRUE, 0);
+ /* AT role= filler(default) */
+
+ /* image */
+ image = load_unlock_logo_image ();
+ /* AT role = icon */
+ gtk_container_add (GTK_CONTAINER (frame2), image);
+
+ /* progress thingie */
+ progress = g_object_new (GTK_TYPE_PROGRESS_BAR,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (hbox1), progress,
+ FALSE, FALSE, 0);
+ pwd->progress = progress;
+ atk_object_set_description (gtk_widget_get_accessible (progress),
+
+ /* text fields */
+ vbox2 = gtk_vbox_new (FALSE, 20);
+ gtk_box_pack_start (GTK_BOX (hbox1), vbox2,
+ TRUE, TRUE, 0);
+ /* AT role =filler */
+
+ _("Screensaver"));
+ /* XScreenSaver foo label */
+ "use-markup", TRUE,
+ "label", s,
+ NULL);
+ g_free (s);
+ /* AT role = label prog name */
+ atk_dialog);
+ atk_title_label);
+
+ /* This display is locked. */
+ "use-markup", TRUE,
+ "label", _("<b>This display is locked.</b>"),
+ NULL);
+
+ /* User information */
+ "label", s,
+ "use_underline", TRUE,
+ NULL);
+ g_free(s);
+
+ /* User input */
+ "border_width", 5,
+ "visible", TRUE,
+ "homogeneous", FALSE,
+ "spacing", 1,
+ NULL);
+
+ /* PAM prompt */
+ /* blank space for prompt */
+ "label", _(" "),
+ "use_underline", TRUE,
+ "use_markup", FALSE,
+ "justify", GTK_JUSTIFY_CENTER,
+ "wrap", FALSE,
+ "selectable", FALSE,
+ "xalign", 1.0,
+ "xpad", 0,
+ "ypad", 0,
+ "visible", FALSE,
+ NULL);
+
+ "activates-default", TRUE,
+ "visible", TRUE,
+ "editable", TRUE,
+ "visibility", FALSE,
+ "can_focus", TRUE,
+ NULL);
+ /* gtk_widget_grab_focus (entry); */
+
+ /* AT role = label for input widget */
+ atk_entry);
+ atk_prompt_label);
+
+
+ NULL);
+
+
+ /* date string */
+ format_string_utf8 = _("%d-%b-%y (%a); %I:%M %p");
+
+ g_free (utf8_format);
+
+ "use-markup", TRUE,
+ "label", s,
+ NULL);
+ g_free (s);
+
+ /* button box */
+ "layout-style", GTK_BUTTONBOX_END,
+ "spacing", 10,
+ NULL);
+
+ /* Ok button */
+
+
+
+ /* POP */
+ gtk_widget_pop_colormap ();
+
+ return pwd;
+}
+
+/* Callback for when user has finished entering input, even though
+ we don't display an "OK" button for them to click on */
+static void
+{
+ const char *s;
+
+
+
+ /* Reset password field to blank, else passwd field shows old passwd *'s,
+ visible when passwd is expired, and pam is walking the user to change
+ old passwd.
+ */
+}
+
+static void
+{
+ G_CALLBACK (ok_clicked_cb),
+ pwd);
+
+ G_CALLBACK (ok_clicked_cb),
+ pwd);
+
+ G_CALLBACK (gtk_main_quit),
+ NULL);
+}
+
+static GdkFilterReturn
+{
+
+ return GDK_FILTER_CONTINUE;
+
+
+ /* CR 6176524 passwdTimeoutEnable for disabled user */
+
+ return GDK_FILTER_REMOVE;
+}
+
+static gboolean
+{
+ char *str;
+ char *label;
+
+ gtk_main_quit ();
+
+ do
+ {
+ }
+ while (status == G_IO_STATUS_AGAIN);
+
+/* debug only
+ if (status == G_IO_STATUS_ERROR)
+ g_message ("handle input() status_error %s\n",str);
+ if (status == G_IO_STATUS_EOF)
+ g_message ("handle input() status_eof %s\n",str);
+ if (status == G_IO_STATUS_NORMAL)
+ g_message ("handle input() status_normal %s\n",str);
+ Most likely, the returned error msg of g_io_channel_read_line(),
+ i.e str will not be translated into other locales ...
+*/
+
+ if (str)
+ {
+ /* strip trailing newline */
+ if (nl)
+ *nl = 0;
+
+ /*
+ fprintf (stderr,">>>>>Child..in handle_input..string is:%s\n",str);
+ fflush (stderr);
+ */
+
+ /* Handle commands from parent daemon */
+
+ {
+ /* search for =, and if found, split into two strings there */
+ if (msgstr)
+ *msgstr++ = 0;
+
+ {
+ hmsg = _("Authentication Successful!");
+ }
+ {
+ hmsg = _("PAM Account Management Also Successful!");
+ }
+ {
+ hmsg = _("Just a Warning PAM Set Credential Failed!");
+ }
+ {
+ hmsg = _("PAM Set Credential Also Successful!");
+ }
+ {
+ hmsg = _("Your Password has expired.");
+ }
+ {
+ hmsg = _("Sorry!");
+ }
+ {
+ hmsg = _("Waiting for user input!");
+ }
+ {
+ hmsg = _("Timed Out!");
+ }
+ {
+ hmsg = _("Still Checking!");
+ }
+ {
+ hmsg = _("Authentication Cancelled!");
+ }
+ {
+ }
+ {
+ {
+ }
+ else
+ {
+ /* reset to default display of "*" or bullet */
+ else
+ /* set to no display */
+
+ }
+ /* Show the entry field */
+ }
+ {
+ }
+ else
+ {
+ /* Should not be others, but if so just show it */
+ }
+
+ if (hmsg)
+ {
+ }
+
+ if (msgstr)
+ {
+ }
+ }
+ {
+ gtk_main_quit ();
+ }
+ else /* something came through that didn't start with ul_ */
+ {
+ }
+
+ }
+
+ return (status != G_IO_STATUS_EOF);
+}
+
+int
+{
+ GIOChannel *ioc;
+ PasswdDialog *pwd;
+ char *s;
+ GConfClient *client;
+ const char *modulesptr = NULL;
+ int i;
+
+
+
+#else /* ! HAVE_GTK2 */
+#endif /* ! HAVE_GTK2 */
+#endif /* ENABLE_NLS */
+
+ if (s) real_progname = s+1;
+ progname = real_progname;
+
+ if (!parent_file)
+ {
+ progname);
+ exit (1);
+ }
+
+
+ /* Intern the atoms that xscreensaver_command() needs.
+ */
+ {
+
+ {
+ { &XA_UNLOCK_RATIO, "UNLOCK_RATIO" },
+ };
+
+ }
+
+ /* bugid 6346056(P1):
+ ATOK pallet sometimes appears in screensave/lock-screen mode
+ */
+ putenv ("GTK_IM_MODULE=gtk-im-context-simple");
+
+
+ /* accessibility mode enabled ? */
+ client = gconf_client_get_default ();
+ "/desktop/gnome/interface/accessibility",
+ NULL);
+ if (at_enable)
+ {
+
+ /* GTK Accessibility Module initialized */
+ putenv ("GTK_MODULES=gail:atk-bridge");
+
+ CORBA_exception_init (&ev);
+ {
+ g_error ("Can't initialize Bonobo");
+ }
+
+ /* bonobo-activation query lists existing instances */
+ "(repo_ids.has('IDL:Accessibility/LoginHelper:1.0')) AND _active",
+
+ {
+ bonobo_debug_shutdown ();
+ g_error ("LoginHelper query failed : %s",
+ bonobo_exception_get_text (&ev));
+ /* not reached (below) because g_error exits */
+ CORBA_exception_free (&ev);
+ }
+
+ /*
+ * 6182506: unlock dialog can be obscured by the magnifier window
+ * if it's always centered, so don't force that if any accessibility
+ * helpers are present
+ */
+ center_position = FALSE;
+ } /* accessibility enabled */
+
+ connect_signals (pwd);
+
+
+
+
+ {
+ /* debug only
+ g_message ("%d LoginHelpers are running.",
+ server_list ? server_list->_length : 0);
+ */
+
+
+ /* for each instance... */
+ {
+
+
+ {
+ g_warning ("Error activating server %d: %s", i,
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ continue;
+ }
+ else if (server == CORBA_OBJECT_NIL)
+ {
+ g_warning ("Activated server %d is NIL!", i);
+ continue;
+ }
+
+ bonobo_activate ();
+
+
+ {
+ g_warning ("Error performing interface query: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ continue;
+ }
+ else if (helper == CORBA_OBJECT_NIL)
+ {
+ g_warning ("Activated an object which advertised LoginHelper but does not implement it!");
+ continue;
+ }
+
+ helper_list[i] = helper;
+
+ {
+ /* ask the helper to go into safe mode */
+ {
+ g_warning ("setSafe(TRUE) failed: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+
+ /* get the raise window list (if the program went into safe mode) */
+ if (safe)
+ {
+ int j;
+
+ g_debug ("safe");
+
+ /* does this helper need to have windows raised? */
+
+ {
+ g_warning ("Bonobo exception getting Device Requirements: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+ else
+ {
+ g_debug ("LoginHelper device requirements: ");
+ g_debug (" - None.");
+
+ {
+ {
+ g_debug (" - Needs access to the GUI event subsystem (e.g. Xserver)");
+ break;
+ g_debug (" - Needs access to core keyboard device");
+ break;
+ g_debug (" - Needs access to core pointer device");
+ break;
+ g_debug (" - Reads XInput extended input devices");
+ break;
+ g_debug (" - Posts windows");
+ needs_windows_raised = TRUE;
+ break;
+ g_debug (" - Writes to audio device");
+ break;
+ g_debug (" - Reads from audio device");
+ break;
+ g_debug (" - Needs LOCALHOST network connection");
+ break;
+ g_debug (" - Needs to write to one or more serial ports");
+ break;
+ default:
+ break;
+ }
+ }
+ CORBA_free (list);
+ }
+
+ if (needs_windows_raised)
+ {
+
+ {
+ g_warning ("getRaiseWindows failed: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+
+ {
+ if (wid)
+ }
+ }
+ }
+ else
+ {
+ g_warning ("LoginHelper %d did not go into safe mode", i);
+ }
+ }
+ else
+ {
+ {
+ g_warning ("Error activating %s: %s",
+ CORBA_exception_free (&ev);
+ }
+ else
+ {
+ }
+ }
+ }
+ } /* accessibility helpers active */
+
+ /* Flush dialog window ids & any messages about login helpers to parent */
+
+
+
+ gtk_main ();
+
+ /* Reset accessibility helpers back to non-safe mode now that we're done */
+ if (server_list)
+ {
+ {
+ helper = helper_list[i];
+ /* really no need to check the return value this time */
+ {
+ g_warning ("setSafe(FALSE) failed: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+ }
+ CORBA_free (server_list);
+ bonobo_debug_shutdown ();
+ }
+
+ return 0;
+}
+#endif /* HAVE_GTK2 */
+
@@ -21,8 +21,13 @@
+#include <X11/Xatom.h>
+#include "exec.h"
+#include "dialog-data.h"
#include "xscreensaver.h"
#include "resources.h"
#include "mlstring.h"
-
- int previous_mouse_x, previous_mouse_y;
-
- char typed_passwd [80];
- int i_beam;
-
- float ratio;
- Position x, y;
-
- Bool echo_input;
- -- Nathan Hale, 1776. */
-
- char *heading_label;
- char *body_label;
- char *user_label;
- mlstring *info_label;
- /* The entry field shall only be displayed if prompt_label is not NULL */
- mlstring *prompt_label;
- char *date_label;
- char *passwd_string;
- char *unlock_label;
- char *login_label;
- char *uname_label;
-
- Bool show_uname_p;
-
- XFontStruct *body_font;
- XFontStruct *date_font;
-
- Pixel foreground;
- Pixel background;
- Pixel shadow_top;
-
-
-
-
-
-
- int logo_npixels;
- unsigned long *logo_pixels;
-
-
- Pixmap save_under;
-};
+/* struct passwd_dialog_data moved to dialog-data.h */
+#endif
float ratio);
+#endif
+
+ increments of 8 at a time for fewer
+ reallocs and less chance of malloc error
+ at the wrong time */
+ raise_wins to allow calling XRestackWindows
+ when a window pops up without having to
+ realloc or copy to a new list.
+ These slots would be used by:
+ - passwd_dialog
+ - stderr_overlay_window
+ - xscreensaver virtual root
+ - an interloper popup we need to hide
+ */
+
+
+
+
+static const char *switch_windows_gconf_key
+ = "/apps/metacity/global_keybindings/switch_windows";
+static char *global_switch_key = NULL;
+
+static const char *main_menu_gconf_key
+static char *global_menu_key = NULL;
+
+
+
+static saver_screen_info *
+{
+ saver_screen_info *ssi;
+
+
+ return NULL;
+
+
+ {
+
+ return ssi;
+ }
+
+ return NULL; /* Didn't match the root on any screen we know of - PUNT! */
+}
+
+/*
+ 5083155 Unable to unlock screen when running dual-head MAG
+ adding dual or multiple heads for magnifier support
+
+ screen 0: loginhelp can pass the raisedWid of GOK or MAG or both
+ found: return its parent Wid (child of root)
+ not found: 0
+
+ other screen: MAG only if the target screen no > 0 is selected
+ found: restack on that screen
+ return 0
+ not-found : return 0
+
+ */
+
+static Window
+{
+ saver_screen_info *ssi;
+
+
+ return 0;
+
+
+ {
+
+ break;
+ }
+
+ return 0; /* we know of - PUNT! */
+
+ /* Climb the tree until we find an ancestor that's a child of root */
+ while ( root_ret != parent_ret )
+ {
+ wid = parent_ret;
+
+
+ return 0;
+
+ }
+
+ {
+ /* found in other screen (not the one with the unlock dialog),
+ implies MAG target screen, invoke XRestackWindow() there
+ */
+ return 0; /* no need to do the restack on prompt screen */
+ }
+
+ return wid;
+}
+
+/* Enforce window stacking order when a new window arrives.
+ Only allow raising windows the unlock dialog has told us to raise
+ (including itself).
+ */
+static void
+{
+ int n = 0;
+ Window *restack_list;
+
+ /* If window is on another screen than the unlock dialog,
+ or we have list of no windows to raise */
+ {
+ restack_list = short_stack;
+ }
+ else
+ {
+ {
+ }
+ }
+
+ {
+ }
+
+ if (ssi->stderr_overlay_window)
+ {
+ }
+
+ if (ssi->screensaver_window)
+ {
+ }
+
+ /* If it's not in the allowed list, it goes behind
+ the screensaver_window. */
+ restack_list[n++] = newWin;
+
+ if (n > 1)
+}
+
+/* Send a command to the xscreensaver-lock child process
+ Arguments:
+ - msg - message to send, such as ul_ok
+ - data - additional data, such as string to display for this message,
+ if any, otherwise NULL
+ Message format sent to child:
+ "msg\n" if no data, otherwise "msg=data\n"
+ */
+int
+{
+ {
+ return -1;
+ }
+
+ {
+ int len;
+
+ {
+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
+ "HAVE_SCRSVR_LOCK writing to fd:%d message is:\n%s=%s\n"
+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n",
+ }
+
+ if (data)
+ else
+
+ return len;
+ }
+
+ return (0); /* if we didn't write anything return 0 */
+}
+
+static int
+{
+ int ret;
+
+ do
+ {
+ }
+
+ return ret;
+}
+
+static int
+close_and_invalidate (int *fd)
+{
+ int ret;
+
+ *fd = -1;
+
+ return ret;
+}
+
+void
+{
+ char buffer[1024];
+
+ if (p->verbose_p)
+
+ if (!msg) /* child closed pipe */
+ {
+ if (p->verbose_p)
+ {
+ }
+ XtRemoveInput (*id);
+
+ if (p->verbose_p)
+
+ return;
+ }
+
+ if (p->verbose_p)
+
+ /* search for =, and if found, split msg & data into two strings there */
+ if (data)
+ {
+ char *nl;
+
+ *data++ = 0;
+
+ /* strip trailing newline */
+ if (nl)
+ *nl = '\0';
+ }
+ else
+ {
+ /* All the messages we currently expect require data! */
+ if (p->verbose_p)
+
+ return;
+ }
+
+ {
+ }
+ {
+ /* An accessibility helper needs to access the keyboard, so we have
+ to release our grab - unfortunately this risks other apps acting
+ on keys they shouldn't, so first we disable metacity keys that
+ could allow getting back to the locked session windows, and hope
+ we don't crash or die before restoring them later.
+
+ Other window managers are likely to be risky to use in this case.
+ */
+
+ client = gconf_client_get_default();
+
+ if (global_switch_key == NULL)
+ {
+
+ "disabled", NULL);
+ }
+
+ if (global_menu_key == NULL)
+ {
+ global_menu_key =
+
+ "disabled", NULL);
+ }
+
+ }
+ {
+ /* An accessibility helper needs to access the mouse, so we have
+ to release our grab - this is simpler, since we don't worry about
+ mouse gestures that may get through, though maybe we should...
+ */
+
+ }
+ else /* Get a window id of an interesting window from the child */
+ {
+ int status;
+
+ {
+ /* The unlock dialog itself */
+
+ undo_vp_motion (si);
+
+ /* Flush queue of captured typeahead events */
+ {
+ int i;
+
+ {
+ }
+ }
+ }
+ {
+ /* Accessibility helpers that need to be raised above the
+ full-screen blanking window hiding the user's desktop */
+
+ >= si->max_raise_wins)
+ {
+
+ return;
+
+ }
+
+ if (overwin)
+ {
+
+ {
+
+ valuemask, &setwinattr);
+
+ {
+ int over_alloc
+
+ return;
+
+ }
+
+ }
+ }
+ else
+ } /* "raise_win" */
+
+ }
+}
+
+Bool
+{
+
+
+
+ {
+ si->passwd_pid);
+ }
+
+ {
+ perror ("pipe(stdin_pipe) failed!");
+ return False;
+ }
+
+ {
+ perror ("pipe(stdout_pipe) failed!");
+ return False;
+ }
+ {
+ case -1:
+ perror ("couldn't fork");
+
+
+ return False;
+
+ case 0:
+ /* limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); */
+ /* hack_subproc_environment (ssi); */ /* FIX $DISPLAY */
+
+ /* Inside Child Process */
+ if (p->verbose_p)
+
+
+
+ /* Make sure we have relinquished setuid privs or lock dialog gtk
+ * program will not run as libgtk is not setuid safe.
+ */
+
+ /* print_path_error (command); */
+ abort ();
+
+ default:
+ /* In Parent */
+
+
+
+
+
+ (XtPointer) XtInputReadMask,
+ handle_passwd_input, si);
+
+ /* Set global flag to indicate that lock dialog is visible */
+ return True;
+ }
+
+ /* shouldn't reach */
+ abort ();
+ return False;
+}
+#endif /* HAVE_XSCREENSAVER_LOCK */
+
static int
{
char *f;
+#endif
+ /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
+ return -1;
+#else
if (!pw)
return -1;
*/
+#endif
+#endif
"Boolean");
"Dialog.Label.Label");
+#endif /* ! HAVE_XSCREENSAVER_LOCK */
/* We need to remember the mouse position and restore it afterward, or
sometimes (perhaps only with Xinerama?) the mouse gets warped to
@@ -422,12 +944,16 @@ make_passwd_window (saver_info *si,
const char *prompt,
Bool echo)
{
+#ifndef HAVE_XSCREENSAVER_LOCK
XSetWindowAttributes attrs;
unsigned long attrmask = 0;
+#endif
passwd_dialog_data *pw;
+#ifndef HAVE_XSCREENSAVER_LOCK
Screen *screen;
Colormap cmap;
Dimension max_string_width_px;
+#endif
saver_screen_info *ssi = &si->screens [mouse_screen (si)];
cleanup_passwd_window (si);
@@ -435,7 +961,12 @@ make_passwd_window (saver_info *si,
if (! ssi) /* WTF? Trying to prompt while no screens connected? */
return -1;
+ /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
+#else
+#endif
return -1;
+ /* Wipe the old password, so we get prompted to enter new password. */
+ if (pw->passwd_string)
+ {
+ }
+
+ if (info_msg)
+ if (prompt)
+ {
+
+ if (echo)
+ else if (pw->show_stars_p)
+ else
+ }
+#else
if (cmap)
+#endif /* ! HAVE_XSCREENSAVER_LOCK */
return 0;
}
static void
{
}
+#endif /* !HAVE_XSCREENSAVER_LOCK */
static void
{
int x, y;
+#endif
+
+ /* Send countdown timer ratio to child lock dialog */
+ if (si->passwd_dialog)
+ {
+
+
+ }
+ else
+ {
+ "-->update_passwd_window() lockdialog not created, returning!!\n");
+ return;
+ }
+#else
@@ -1187,6 +1774,7 @@ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio)
+#endif /* !HAVE_XSCREENSAVER_LOCK */
}
{
+
return;
}
+ if (pw->passwd_string)
+ {
+ }
{
+#endif
}
+ /* reset global flag to indicate passwd dialog is no longer there */
+
+ if (si->external_passwd)
+ {
+ /* kill the child etc. */
+
+ if (pw->stdin_file)
+ if (pw->stdout_input_id)
+ if (pw->stdout_file)
+
+ if (si->passwd_pid)
+ {
+ }
+
+
+ if (si->override_wins)
+ {
+ int n;
+
+
+ {
+ valuemask, &setwinattr);
+ }
+ }
+
+
+ /* restore any metacity keys we temporarily disabled */
+ if (client)
+ {
+ if (global_switch_key)
+ {
+ global_switch_key, NULL);
+ global_switch_key = NULL;
+ }
+
+ if (global_menu_key)
+ {
+ global_menu_key, NULL);
+ global_menu_key = NULL;
+ }
+ }
+ }
+#endif /* HAVE_XSCREENSAVER_LOCK */
+
+ /* Ignore X error if window was already closed by the child,
+ and make sure any VisibilityNotify events are removed
+ from the event queue before we forget the window id. */
+#else
+#endif
}
}
}
+#endif /* ! HAVE_XSCREENSAVER_LOCK */
if (pw->save_under)
if (cmap)
+ /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
+#endif
}
return 0;
}
+/* Catch errors from XRestackWindows, since there's an inherent race
+ condition in which other clients can destroy windows between when
+ we get the notification event and when we send the RestackWindows
+ response to it. */
+static Bool
+{
+ error_handler_hit_p = False;
+
+
+
+ return (!error_handler_hit_p);
+}
+
+static Bool
+{
+ error_handler_hit_p = False;
+
+
+
+ return (!error_handler_hit_p && status);
+}
+
+#endif
+
/* This function enables and disables the C-Sh-Reset hot-key, which
@@ -1592,6 +2320,17 @@ passwd_animate_timer (XtPointer closure, XtIntervalId *id)
if (!pw) return;
+#ifdef HAVE_XSCREENSAVER_LOCK
+ /* We want to make sure dialog is up before we update countdown timer */
+ if (!si->passwd_dialog)
+ {
+ "-->passwd_animate_timer() returning..no dialog yet\n");
+ return;
+ }
+#endif
+
{
}
static XComposeStatus *compose_status;
}
}
+#endif /* !HAVE_XSCREENSAVER_LOCK */
static void
{
char s[2];
s[1] = 0;
+#endif /* !HAVE_XSCREENSAVER_LOCK */
/* Add 10% to the time remaining every time a key is pressed. */
+ {
+
+
+
+
+ {
+ if (status)
+ else
+ }
+ }
+ else
+ {
+ }
+
+#else /* !HAVE_XSCREENSAVER_LOCK */
+
switch (*s)
{
case '\010': case '\177': /* Backspace */
{
}
+#endif /* !HAVE_XSCREENSAVER_LOCK */
}
+
{
+#else
+#endif /* !HAVE_XSCREENSAVER_LOCK */
{
}
{
}
+#endif /* !HAVE_XSCREENSAVER_LOCK */
+
+ /*
+ 5077974 P1 "Bug 147583: Screen Lock unlocks because of GOK dwell movement in
+ core pointer mode"
+
+ ScreenLock did not unlock the screen, but WM's XRestackWindow() did.
+ The problem:
+ repositioning the Wids in the wrong positions when
+ 1. the window type is changed from NORMAL to DOCK or vice versa
+ 2. the Wid is managed
+ within the X window stack with or without screen-lock in a mixed Wids
+ there are two temp. get-around solutions:
+ 1. non-managed GOK or MAG Wid
+ or
+ 2. screensaver picks up the WM's restacking task and fixes the prevous
+ restacking problem.
+ the cons: there is a flashing screen when corepointer is touching
+ GOK or MAG and mouse is moved in a fast way
+ when GOK or MAG window type is DOCK only.
+ and it is not a good temp. get-around solution.
+ This is the only choice if WM did not want to fix the problem now
+ and AT group did not want to use non-managed Wids.
+ not to be used, and GOK cannot disable it
+ */
+/*
+ bugid 6769901,6839026: popup windows appearing through xscreensaver
+*/
+ && (si->passwd_dialog))
+ {
+ /* Find the handle of popup window
+ * Note: we can not get handle of popup window with
+ * event.xany.window, thats why we have switch cases.
+ */
+
+ {
+ case ConfigureNotify:
+ break;
+ case CreateNotify:
+ break;
+ case VisibilityNotify:
+ break;
+ default:
+ break;
+ }
+
+ if (wPopWin)
+ {
+
+ /* This if case is for safety, it prevent screensaver stuck in
+ * loop of ConfigureNotify
+ */
+ {
+ }
+ }
+ }
+ /* the above new code for restacking under the condition */
else
}
if (msg)
{
+#else
+#endif
/* Swallow all pending KeyPress/KeyRelease events. */
static void
{
+/* HAVE_XSCREENSAVER_LOCK: typeahead events are flushed to the external
+ dialog program in handle_passwd_input when we get the dialog_win notice
+ that it has created the window */
int i;
if (!si->unlock_typeahead)
+#endif
}
}
if (!compose_status)
goto fail;
+#endif
goto fail;
+ else
+ goto fail;
+#else
+#endif
/* Cache the first response to a PROMPT_NOECHO to save prompting for
* each auth mechanism. */
compose_status = 0;
+#endif
}
fail:
if (compose_status)
+#endif
if (responses)
{
{
+ else
+#endif
break;
}
@@ -39,10 +39,16 @@
+
+#endif
+
+#include "dialog-data.h"
#include "auth.h"
static int pam_conversation (int nmsgs,
+ const
+#endif
void *closure);
+ int pam_flags = 0;
+
`closure' argument to pc.conv always comes in as random garbage. */
suns_pam_implementation_blows = (void *) si;
+#ifdef __sun
+ if (verbose_p)
+ fprintf (stderr, "Before uid=%d euid=%d \n\n", getuid(), geteuid());
+
+ if (seteuid (0) != 0)
+ {
+ if (verbose_p)
+ perror("Could not change euid to root, pam may not work!\n");
+ }
+
+ if (verbose_p)
+ {
+ fprintf (stderr, "After seteuid(0) uid=%d euid=%d \n\n",
+ getuid(), geteuid());
+ fprintf (stderr, "PAM is using SERVICE_NAME=\"%s\"\n\n", service);
+ }
+#endif
/* Initialize PAM.
*/
@@ -201,11 +233,35 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
status, PAM_STRERROR (pamh, status));
if (status != PAM_SUCCESS) goto DONE;
+#ifdef __sun
+ PAM_DISALLOW_NULL_AUTHTOK to pam_flags */
+ char *ptr;
+ int flags = defcntl(DC_GETFLAGS, 0);
+
+ TURNOFF(flags, DC_CASE);
+ (void) defcntl(DC_SETFLAGS, flags);
+ if ((ptr = defread("PASSREQ=")) != NULL &&
+ strcasecmp("YES", ptr) == 0)
+ {
+ pam_flags |= PAM_DISALLOW_NULL_AUTHTOK;
+ }
+
+ (void) defopen((char *)NULL); /* close current file */
+ }
+#endif
+
don't have that handy from here. So set it to :0.0, which is a
good guess (and has the bonus of counting as a "secure tty" as
far as PAM is concerned...)
*/
+
+/* From the pam trace and log file, it is found out that the
+ Sun pam modules can drive itself.
+*/
+#ifndef __sun
{
char *tty = strdup (":0.0");
status = pam_set_item (pamh, PAM_TTY, tty);
@@ -214,6 +270,7 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
blurb(), tty, status, PAM_STRERROR(pamh, status));
free (tty);
}
+#endif
/* Try to authenticate as the current user.
We must turn off our SIGCHLD handler for the duration of the call to
@@ -243,43 +300,101 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
timeout.tv_sec = 0;
timeout.tv_nsec = 1;
set = block_sigchld();
- status = pam_authenticate (pamh, 0);
+ pam_auth_status = pam_authenticate (pamh, pam_flags);
# ifdef HAVE_SIGTIMEDWAIT
sigtimedwait (&set, NULL, &timeout);
# endif /* HAVE_SIGTIMEDWAIT */
+ /* Send status message to unlock dialog */
+ if (pam_auth_status == PAM_SUCCESS)
+ {
+ if (verbose_p)
+ }
+ {
+ }
+ if (verbose_p)
+ sleep (1);
+#endif
+
+ if (verbose_p)
+
if (verbose_p)
{
- int status2;
+ /* perform PAM account validation procedures for login user only */
- /* We don't actually care if the account modules fail or succeed,
- * but we need to run them anyway because certain pam modules
- * depend on side effects of the account modules getting run.
- */
+ /******************************************************************
+ ignore other cases for the time being
+ PAM_USER_UNKNOWN, PAM_AUTH_ERR, PAM_ACCT_EXPIRED
+ (password mgn service module)
+ same as pam_setcred(), focus on auth. service module only
+ *****************************************************************/
if (verbose_p)
+
+ /* Send status message to unlock dialog ***/
+ if (acct_rc == PAM_SUCCESS)
+ {
+ if (verbose_p)
+ }
+ else
+ if (verbose_p)
+ sleep (1);
+#endif
/* HPUX for some reason likes to make PAM defines different from
* everyone else's. */
- if (status2 == PAM_AUTHTOKEN_REQD)
+ if (acct_rc == PAM_AUTHTOKEN_REQD)
#else
- if (status2 == PAM_NEW_AUTHTOK_REQD)
+ if (acct_rc == PAM_NEW_AUTHTOK_REQD)
{
+ for (int i = 0; i < 3; i++)
+ {
+ if (chauth_rc == PAM_AUTHTOK_ERR ||
+ chauth_rc == PAM_TRY_AGAIN )
+ {
+ i = 0;
+ }
+ else break; /* get out of the loop */
+ }
+
if (verbose_p)
+
+ if (chauth_rc != PAM_SUCCESS)
+ {
+ pam_auth_status = chauth_rc;
+ goto DONE;
+ }
+ }
+ else if (acct_rc != PAM_SUCCESS)
+ {
+ pam_auth_status = acct_rc;
+ sleep (3);
+ goto DONE;
}
/* Each time we successfully authenticate, refresh credentials,
@@ -291,24 +406,57 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
says that the Linux PAM library ignores that one, and only refreshes
credentials when using PAM_REINITIALIZE_CRED.
*/
if (verbose_p)
+
+ /* Send status message to unlock dialog ***/
+ if (setcred_rc == PAM_SUCCESS)
+ {
+ if (verbose_p)
+ }
+ else
+ if (verbose_p)
+ sleep (1);
+#endif
}
DONE:
if (pamh)
{
- pamh = 0;
if (verbose_p)
}
- if (status == PAM_SUCCESS)
+ {
+ if (verbose_p)
+ perror("Error pam could not revert euid to user running as euid root,"
+ " locking may not work now\n");
+ }
+
+ if (verbose_p)
+ "<--end of pam_authenticate() returning ok_to_unblank = %d\n",
+
+ {
+ }
+
+ if (pam_auth_status == PAM_SUCCESS)
+ if (! verbose_p) /* SUN addition: only print warnings in verbose mode */
+ { /* since they are rarely useful and mostly just */
+ return True; /* cause confusion when users see them. */
+ }
+#endif
+
# endif
break;
}
fclose (f);
+
if (!ok)
{
"%s: password authentication via PAM is unlikely to work.\n",
}
+#endif
}
/* else warn about file2 existing but being unreadable? */
}
else
{
"%s: password authentication via PAM is unlikely to work.\n",
}
+#endif
/* Return true anyway, just in case. */
return True;
}
-static int
+int
pam_conversation (int nmsgs,
+ const
+#endif
void *vsaver_info)
{
@@ -35,6 +35,7 @@
+#include "dialog-data.h"
#include "xscreensaver.h"
#include "auth.h"
errno = 0;
+/*mali if (setuid (uid) != 0)**we need root privs back at pam_authenticate
+ this is causing to loose root priv for good, not good **/
+
static void clean_job_list (void);
+#else
static struct screenhack_job *
+#endif
{
}
+int
+#else
static int
+#endif
{
if they happen on their own.
*/
- if (!job ||
- (exit_status != 0 &&
- (p->verbose_p || job->status != job_killed)))
+
+ if ((!job
+#ifdef HAVE_XSCREENSAVER_LOCK
+ && kid != si->passwd_pid
+#endif /* HAVE_XSCREENSAVER_LOCK */
+ ) ||
+ (exit_status != 0 &&
+ (p->verbose_p || (job && job->status != job_killed))))
{
else if (WIFSIGNALED (wait_status))
{
if (p->verbose_p ||
- !job ||
+ (!job
+#endif /* HAVE_XSCREENSAVER_LOCK */
+ ) ||
{
/* Don't call fprintf() from signal handlers, as it might malloc.
@@ -701,12 +718,20 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
/* Clear out the pid so that screenhack_running_p() knows it's dead.
*/
+ {
{
}
+ {
+ }
+#endif
+ }
}
#else /* VMS */
@@ -47,6 +47,8 @@
#endif /* HAVE_RANDR */
#include "xscreensaver.h"
+#include "types.h"
+#include "dialog-data.h"
#endif /* HAVE_PROC_INTERRUPTS */
+#endif
void
+ if (si->external_passwd)
+#else
+#endif
{
if (p->verbose_p)
if (p->verbose_p)
+
+ {
+ if (p->verbose_p)
+ "-->activate_lock_timer returning because screen already locked\n");
+ return;
+ }
+
+ /* Make sure screen is blanked before posting dialog box */
+ if (si->screen_blanked_p)
+ {
+ if (ok_to_unblank == True)
+ {
+ unblank_screen(si);
+ }
+ }
+ else /* blanking of screen failed reset lock flag */
}
}
+void /* called from lock.c */
+#else
static void
+#endif
{
char buf [100];
int i = 0;
+ if (!si->typeahead_events)
+ {
+ /* Allocate enough space for 10 keys to be queued - if we get more
+ than that before the dialog is ready, it's most likely the user
+ left something sitting on the keyboard, and won't want them. */
+ return;
+ }
+#else
+#endif
event = *e;
if (size != 1) continue;
switch (*s)
{
case '\010': case '\177': /* Backspace */
if (i > 0) i--;
break;
case '\025': case '\030': /* Erase line */
+#endif
case '\012': case '\015': /* Enter */
case '\033': /* ESC */
i = 0;
break; /* ignore space at beginning of line */
/* else, fall through */
default:
+ /* Queue events to replay once dialog is ready */
+ else
+ i = 1; /* so that spaces are accepted after the beginning */
+#else
buf [i++] = *s;
+#endif
break;
}
}
buf[i] = 0;
if (si->unlock_typeahead)
+#endif /* HAVE_XSCREENSAVER_LOCK */
}
case ClientMessage:
- goto DONE;
+ {
+ goto DONE;
+ }
break;
case CreateNotify:
}
break;
+ case VisibilityNotify:
+ {
+ int k;
+
+ if (p->debug_p)
+ {
+ "************************************\n"
+ "-->sleep_until_idle() event:VisibilityNotify\n"
+ "\t Window of VisibilityNotify:%x\n"
+ "\t until_idle_p=%d g_passwd_dialog_created=%d\n",
+ }
+
+ /* Don't raise root window when passwd dialog wants to come up */
+ {
+ {
+ {
+ clear_stderr (ssi);
+ }
+ if (p->debug_p)
+ {
+ "A window is trying to popup.\n"
+ "Raising saver root Window.\n"
+ "************************************\n");
+ }
+ }
+ }
+ break;
+ }
+
case KeyPress:
case ButtonPress:
/* Ignore release events so that hitting ESC at the password dialog
@@ -1419,7 +1525,11 @@ watchdog_timer (XtPointer closure, XtIntervalId *id)
{
Bool running_p = screenhack_running_p (si);
+#ifdef HAVE_XSCREENSAVER_LOCK
+ if (si->external_passwd)
+#else
if (si->dbox_up_p)
+#endif
{
if (si->prefs.debug_p)
fprintf (stderr, "%s: dialog box is up: not raising screen.\n",
diff --git xscreensaver-5.12/driver/types.h xscreensaver-5.12/driver/types.h
@@ -248,12 +248,30 @@ struct saver_info {
int unlock_failures; /* Counts failed login attempts while the
screen is locked. */
+ int num_raise_wins; /* virtual root/hack display, such as */
+ int max_raise_wins; /* accessibility helpers */
+
+ int num_override_wins; /* override_redirect attribute on and */
+ int max_override_wins; /* need to restore it on after unlock. */
+
+
+ are running an external process for it. */
+
+ int num_typeahead_events;
+#else
char *unlock_typeahead; /* If the screen is locked, and the user types
a character, we assume that it is the first
character of the password. It's stored here
for the password dialog to use to populate
itself. */
+#endif /* HAVE_XSCREENSAVER_LOCK */
char *user; /* The user whose session is locked. */
char *cached_passwd; /* Cached password, used to avoid multiple
diff --git xscreensaver-5.12/driver/windows.c xscreensaver-5.12/driver/windows.c
@@ -1081,8 +1081,12 @@ safe_XConfigureWindow (Display *dpy, Window window,
return (!error_handler_hit_p);
}
+#ifdef HAVE_XSCREENSAVER_LOCK
+Bool
+#else
/* This might not be necessary, but just in case. */
static Bool
+#endif
{
+ /* clear any queued VisibilityNotify events so we don't cause XErrors
+ later when we try to process them and find the windowid is invalid */
+ {
+ /* discard event */ ;
+ }
+
return (!error_handler_hit_p);
}
*/
int i;
+ if (p->verbose_p)
+
inhibit_fade = True;
int i;
+ if (p->verbose_p)
+
/* Now we can destroy the old window without horking our grabs. */
if (p->verbose_p)
@@ -156,6 +156,8 @@
@@ -217,6 +219,7 @@
#endif /* HAVE_RANDR */
+#include "dialog-data.h"
#include "xscreensaver.h"
#include "version.h"
#include "yarandom.h"
@@ -228,11 +231,28 @@
+/* Globals */
+
+/* Global storage for gtk passwd lock dialog
+ * we assign this to si->pw_data and this is needed
+ * pam conv function.
+ */
+#endif
+
char *progname = 0;
char *progclass = 0;
+#endif
+
static XrmOptionDescRec options [] = {
{ &XA_XSETROOT_ID, "_XSETROOT_ID" },
{ &XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID" },
{ &XA_XROOTPMAP_ID, "_XROOTPMAP_ID" },
+ { &XA_UNLOCK_RATIO, "UNLOCK_RATIO" },
+#endif
};
@@ -1105,8 +1128,36 @@ static void
{
+ /* Bool ok_to_unblank; made this a global flag, gets set in timers.c */
int i;
+ const char *modulesptr = NULL;
+
+/*
+** CR4784055(P1)locked-screen dialog is inaccessible to Gnopernicus
+** voice for each type-in char in the password field of
+** pop-up dialog
+*/
+
+ /* BUG #6573182
+ ** g_type_init should be done before calling gconf_client routines
+ ** so that xscreensaver does not dump core if gconf daemon is not running.
+ */
+ g_type_init ();
+
+ /*
+ ** 6395649 at-spi-registryd starts when screen is locked even
+ ** when accessible device support is off(SR)
+ ** per AT core gp suggestion
+ ** GTK_MODULES is set only if at support is enabled
+ */
+
+ "/desktop/gnome/interface/accessibility", NULL))
+ {
+ putenv ("GTK_MODULES=gail:atk-bridge");
+ }
while (1)
{
blurb(), timestring());
+ /* 6221109 Changing mode from disable to anything else,
+ doesn't lock screen.
+
+ This is Disable Screen Saver mode, in this mode we dont lock
+ screen, but si->locked_p is already set to True, since someone
+ tried to lock screen, reset it to False, else when we change
+ mode from disable and try to lock screen, xscreensaver thinks
+ screen is already locked and doesnt lock screen anymore.
+ */
+
/* Go around the loop and wait for the next bout of idleness,
or for the init file to change, or for a remote command to
come in, or something.
@@ -1198,6 +1260,7 @@ main_loop (saver_info *si)
blurb());
schedule_wakeup_event (si, retry, p->debug_p);
+ set_locked_p(si, False);
continue;
}
}
@@ -1246,7 +1309,17 @@ main_loop (saver_info *si)
p->lock_p && /* and locking is enabled */
+ {
+ if (p->debug_p)
+ if (ok_to_unblank == True)
+ {
+ goto DONE;
+ }
+ }
/* locked_p might be true already because of the above, or because of
the LOCK ClientMessage. But if not, and if we're supposed to lock
@@ -1261,10 +1334,7 @@ main_loop (saver_info *si)
}
#endif /* !NO_LOCKING */
-
- ok_to_unblank = True;
do {
-
check_for_leaks ("blanked A");
check_for_leaks ("blanked B");
/* Maybe unlock the screen.
*/
+ unblank screen */
+
+ /* This is when blank timeout has happened but lock timeout hasnt
+ and user gets active. Simply get him out of the blank screen. */
+
{
+ /* Prevents lock dialog posting on non blanked screen */
+ blank_screen (si);
+ {
+ }
+#else
+#endif
} while (!ok_to_unblank);
+DONE:
if (p->verbose_p)
#endif /* ENABLE_NLS */
+ /* Gtk unlock dialog needs to be sent UTF-8 text to display */
+#endif
+
+
+/* Initialize and point si to pw_data i.e. the lock dialog struct */
+#endif
+
fix_fds();
+#endif
print_banner (si);
+#endif
+
+ if (p->verbose_p)
+
/* Preferences might affect our handling of client messages. */
: "locking.");
+
+ if (p->verbose_p)
+
+ return True; /* dont set lock_id to 0,
+ causes to go in lock in main_loop above */
+
{
+ const char *cmd);
+#endif
+
/* =======================================================================
subprocs diagnostics
======================================================================= */