--- a/open-src/Makefile Fri May 05 00:00:00 2006 -0700
+++ b/open-src/Makefile Wed May 10 18:06:31 2006 -0700
@@ -28,7 +28,7 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.
#
-# @(#)Makefile 1.2 06/04/11
+# @(#)Makefile 1.4 06/05/26
#
###############################################################################
#
@@ -39,11 +39,13 @@
BEFOREX = \
proto \
+ util/lndir \
lib/freetype \
lib/fontconfig \
lib/Xft
AFTERX = \
+ app/xscreensaver \
font/bitstream-vera
ALL = $(BEFOREX) $(AFTERX)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/GNOME-desktop.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Changes needed for integration into Sun's GNOME desktop menus.
+Localized name & tooltips (Sun bug 5103358)
+
+diff -urp -x '*~' driver/screensaver-properties.desktop.in driver/screensaver-properties.desktop.in
+--- driver/screensaver-properties.desktop.in 2002-05-28 17:42:12.000000000 -0700
++++ driver/screensaver-properties.desktop.in 2006-05-10 08:48:12.224912000 -0700
+@@ -1,9 +1,36 @@
+ [Desktop Entry]
+ Exec=xscreensaver-demo --crapplet
+ TryExec=xscreensaver-demo
+-Icon=xscreensaver.xpm
++Icon=gnome-ccscreensaver.png
+ Terminal=0
+-_Name=Screensaver
+-_Comment=Configure the settings of the screensaver.
++Name=Screensaver
++Name[cs]=Spořič obrazovky
++Name[de]=Bildschirmschoner
++Name[es]=Salvapantallas
++Name[fr]=Économiseur d'écran
++Name[hu]=Képernyővédő
++Name[it]=Salvaschermo
++Name[ja]=スクリーンセーバー
++Name[ko]=화면 보호기
++Name[pt_BR]=Protetor de tela
++Name[sv]=Skärmsläckare
++Name[zh_CN]=屏幕保护程序
++Name[zh_HK]=螢幕保護程式
++Name[zh_TW]=螢幕保護程式
++
++Comment=Configure the settings of the screensaver.
++Comment[cs]=Konfigurace nastavení spořiče obrazovky.
++Comment[de]=Bildschirmschonereinstellungen konfigurieren
++Comment[es]=Configura los valores del salvapantallas.
++Comment[fr]=Configurer les paramètres de l'économiseur d'écran.
++Comment[hu]=A képernyővédő beállításainak megváltoztatása
++Comment[it]=Configura le impostazioni del salvaschermo.
++Comment[ja]=スクリーンセーバーを設定
++Comment[ko]=화면 보호기 설정 구성
++Comment[pt_BR]=Definir as configurações do protetor de tela.
++Comment[sv]=Konfigurera inställningarna för skärmsläckaren.
++Comment[zh_CN]=配置屏幕保护程序的设置。
++Comment[zh_HK]=配置螢幕保護程式設定。
++Comment[zh_TW]=配置螢幕保護程式設定。
+ Type=Application
+-Categories=Applications;Settings;
++Categories=GNOME;Settings;Appearance;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/IPv6.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+4802743 - xscreensaver mangles IPv6 numeric addresses in $DISPLAY
+
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2006-05-10 08:49:17.229068000 -0700
++++ driver/subprocs.c 2006-05-10 08:49:23.643545000 -0700
+@@ -994,14 +994,17 @@ hack_subproc_environment (saver_screen_i
+ saver_info *si = ssi->global;
+ const char *odpy = DisplayString (si->dpy);
+ char *ndpy = (char *) malloc(strlen(odpy) + 20);
+- char *s;
++ char *s, *c;
+
+ strcpy (ndpy, "DISPLAY=");
+ s = ndpy + strlen(ndpy);
+ strcpy (s, odpy);
+
+- while (*s && *s != ':') s++; /* skip to colon */
+- while (*s == ':') s++; /* skip over colons */
++ /* We have to find the last colon since it is the boundary between
++ hostname & screen - IPv6 numeric format addresses may have many
++ colons before that point, and DECnet addresses always have two colons */
++ c = strrchr(s,':'); /* skip to last colon */
++ if (c != NULL) s = c+1;
+ while (isdigit(*s)) s++; /* skip over dpy number */
+ while (*s == '.') s++; /* skip over dot */
+ if (s[-1] != '.') *s++ = '.'; /* put on a dot */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/Makefile Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,177 @@
+###############################################################################
+#
+# Xscreensaver Makefile
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# 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, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# 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
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.61 06/05/10
+#
+
+PWD:sh=pwd
+TOP=$(PWD)/../..
+BUILD_TYPES=32
+
+# Version number (used in path names)
+XSCREENSAVER_VERS=4.05
+
+# Source tarball
+SOURCE_TARBALL_NAME=xscreensaver-$(XSCREENSAVER_VERS).tar.gz
+
+# Download site for source
+#SOURCE_URL=http://www.jwz.org/xscreensaver/$(SOURCE_TARBALL_NAME)
+SOURCE_URL=http://slackware.osuosl.org/unsupported/source/gnome-1.4.1/xscreensaver/$(SOURCE_TARBALL_NAME)
+
+SOURCE_UNCOMPRESS=gzcat
+
+# Patches to apply to source after unpacking, in order
+SOURCE_PATCHES = \
+ solaris-suncc-fixes.patch \
+ s_isdir.patch \
+ Sun.app-defaults.patch \
+ GNOME-desktop.patch \
+ solaris-paths.patch \
+ dont-bug-jwz.patch \
+ gtk-lock.patch \
+ allow-root.patch \
+ scf-smartcard.patch \
+ passwdTimeout-pref.patch \
+ xinput.patch \
+ i18n.patch \
+ debug-msgs.patch \
+ tooltips.patch \
+ dpms.patch \
+ IPv6.patch \
+ gl-error-capture.patch \
+ blurb.patch \
+ accessibility.patch \
+ misc.patch \
+ trusted.patch
+
+# Directory created by unpacking source
+SOURCE_DIR=$(BUILD_DIR)/xscreensaver-$(XSCREENSAVER_VERS)
+
+# Merge in additional sources from sun-src directory
+LNDIR=$(PROTODIR)/usr/X11/bin/lndir
+
+default: all
+
+source_gen:: $(LNDIR)
+ mkdir -p $(SOURCE_DIR)
+ (cd $(SOURCE_DIR) && $(LNDIR) ../../sun-src)
+ if [ -d closed-src ] ; then \
+ (cd $(SOURCE_DIR) && $(LNDIR) ../../closed-src) \
+ fi
+
+$(LNDIR):
+ (cd ../../util/lndir && $(MAKE) $(MFLAGS) install)
+
+
+include $(TOP)/common/Makefile.inc
+
+# Where to find OpenGL headers/libraries
+OPENGL_DIR_sun4=/usr/openwin
+OPENGL_DIR_i86pc=/usr/X11
+OPENGL_DIR:sh=arch | sed 's/^\(.*\)$/\$\(OPENGL_DIR_\1\)/'
+
+# Command line options to GNU autoconf configure script
+XS_CFG=--prefix=/usr/openwin/ --enable-maintainer-mode --enable-gtk-doc --with-shadow --with-dpms --enable-locking --disable-screengrab --enable-dpms --with-gtk2=/usr --with-gl=$(OPENGL_DIR) --with-pixbuf=/usr --with-pam=/usr --without-motif --with-jpeg=/usr/sfw --mandir='$${prefix}/share/man' --libexecdir='$${prefix}/lib/xscreensaver/bin' --datadir='$${prefix}/share' --with-hackdir=lib/xscreensaver/hacks --with-configdir=lib/xscreensaver/config/control-center-2.0 --with-gnome --with-scf-smartcard
+
+# BINARY built in tree
+XS_BIN=$(SOURCE_DIR)/xscreensaver
+
+# Messages for translation
+XS_POT=$(SOURCE_DIR)/po/xscreensaver.pot
+POT_DEST=$(PROTODIR)/usr/openwin/share/locale/C/LC_MESSAGES
+
+# Man pages
+XS_MAN=$(SOURCE_DIR)/driver/xscreensaver.man.orig
+
+# Include Paths
+INCLUDES=-I/usr/X11/include
+
+# Additional optimization flags, to make the hacks show off the hardware
+# better and we can get away with optimizations not allowed in the core X code
+XS_CFLAGS=$(CFLAGS) -fsimple=2 -nofstore -xprefetch $(XS_ARCH_FLAGS) -xstrconst
+XS_ARCH_FLAGS:sh=arch | sed 's/^\(.*\)$/\$\(XS_\1_ARCH_FLAGS\)/'
+XS_sun4_ARCH_FLAGS=-xtarget=ultra2
+
+# Configure/Make variables to override
+# Set PERL to /usr/perl5/bin so it uses that path to perl for scripts
+# as required by Sun rules for using the bundled version of perl
+# /opt/sfw/bin must be ahead of /usr/bin to make sure we get GNU xgettext
+# since intltool-update doesn't work with Solaris xgettext (see bugs
+# 4812320 & 4826523)
+XS_CNFG_ENV=CC=$(CC) CFLAGS="$(XS_CFLAGS) $(INCLUDES)" CPPFLAGS="$(INCLUDES)" \
+ PATH=/usr/perl5/bin:/usr/sfw/bin:/opt/sfw/bin:$(PATH) \
+ GNOME_DATADIR='$${prefix}/lib/xscreensaver/config' \
+ GLADE_DATADIR='$${prefix}/lib/xscreensaver/config' \
+ LDFLAGS="$(PROG_LDFLAGS) -L/usr/X11/lib -R/usr/X11/lib" \
+ PERL=/usr/perl5/bin/perl
+XS_MAKE_ENV=install_prefix=$(PROTODIR)
+
+build_gen: $(XS_BIN) $(XS_MAN) $(XS_POT)
+
+# Run configure script
+$(SOURCE_DIR)/Makefile: $(UNPACK_TARGET)
+ (cd $(SOURCE_DIR) ; \
+ chmod a+x autogen.sh ; \
+ $(XS_CNFG_ENV) ./autogen.sh $(XS_CFG) )
+
+$(XS_BIN): $(SOURCE_DIR)/Makefile
+ (cd $(SOURCE_DIR) ; chmod a+x install-sh ; \
+ $(MAKE) $(MFLAGS) -e $(XS_MAKE_ENV))
+
+$(XS_POT): $(SOURCE_DIR)/Makefile
+ (cd $(SOURCE_DIR)/po ; \
+ PATH=/opt/sfw/bin:$(PATH) $(MAKE) -e $(XS_MAKE_ENV) generate_potfiles_in ; \
+ PATH=/opt/sfw/bin:$(PATH) $(MAKE) -e $(XS_MAKE_ENV) POTFILES ; \
+ PATH=/opt/sfw/bin:$(PATH) $(MAKE) -e $(XS_MAKE_ENV) xscreensaver.pot )
+
+# Add Sun attributes section to man pages
+$(XS_MAN):
+ for f in $(SOURCE_DIR)/driver/*.man ; do \
+ if [ ! -f $$f.orig ] ; then \
+ mv $$f $$f.orig ; \
+ fi ; \
+ cat $(TOP)/common/table-prepend \
+ $$f.orig \
+ $(TOP)/common/sunman-stability \
+ | sed 's/__package__/SUNWxscreensaver/g' > $$f ; \
+ done
+
+install_gen: $(XS_BIN) $(XS_MAN) $(XS_POT)
+ chmod +w $(SOURCE_DIR)/hacks/vidwhacker \
+ $(SOURCE_DIR)/hacks/webcollage \
+ $(SOURCE_DIR)/driver/xscreensaver-getimage-file \
+ $(SOURCE_DIR)/driver/xscreensaver-getimage-video
+ (cd $(SOURCE_DIR) ; chmod a+x install-sh intltool-*; \
+ $(MAKE) -e $(XS_MAKE_ENV) install )
+ mkdir -p $(POT_DEST)
+ cp -p $(XS_POT) $(POT_DEST)/xscreensaver.pot
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/Sun.app-defaults.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Various settings to meet Sun/Solaris policies/customizations, including:
+
+ - enable screen lock by default, disable splash screen
+ - disable using screen grabs in hacks to avoid security leaks
+ - set default mode to screen blank
+ - disable bsod by default to avoid confusion in shops with real NT boxes
+4871833 DPMS settings should be consistent between CDE and Gnome
+6368607 increase unlock dialog box timeout to 2 minutes
+
+
+diff -urp -x '*~' driver/XScreenSaver.ad.in driver/XScreenSaver.ad.in
+--- driver/XScreenSaver.ad.in 2002-06-11 02:09:05.000000000 -0700
++++ driver/XScreenSaver.ad.in 2006-05-10 08:48:06.305863000 -0700
+@@ -28,21 +28,21 @@
+
+ ! /* (xrdb prevention kludge: whole file)
+
+-*timeout: 0:10:00
++*timeout: 0:15:00
+ *cycle: 0:10:00
+-*lockTimeout: 0:00:00
+-*passwdTimeout: 0:00:30
+-*dpmsEnabled: False
+-*dpmsStandby: 2:00:00
+-*dpmsSuspend: 2:00:00
+-*dpmsOff: 4:00:00
+-*grabDesktopImages: True
++*lockTimeout: 0:30:00
++*passwdTimeout: 0:02:00
++*dpmsEnabled: True
++*dpmsStandby: 0:24:00
++*dpmsSuspend: 0:27:00
++*dpmsOff: 0:30:00
++*grabDesktopImages: False
+ *grabVideoFrames: False
+ *chooseRandomImages: False
+ *imageDirectory:
+-*nice: 10
++*nice: 19
+ *memoryLimit: 0
+-*lock: False
++*lock: True
+ *lockVTs: True
+ *verbose: False
+ *timestamp: True
+@@ -50,11 +50,11 @@
+ *unfade: False
+ *fadeSeconds: 0:00:03
+ *fadeTicks: 20
+-*splash: True
++*splash: False
+ *splashDuration: 0:00:05
+ *visualID: default
+
+-*captureStderr: True
++*captureStderr: False
+ *overlayTextForeground: #FFFF00
+ *overlayTextBackground: #000000
+ *overlayStderr: True
+@@ -102,6 +102,8 @@
+ !
+ *installColormap: True
+
++! We want the default mode to be just blank the screen
++*mode: blank
+
+ ! Any program which can draw on the root window will work as a screensaver.
+ ! The following resource enumerates them.
+@@ -227,7 +229,7 @@
+ epicycle -root \n\
+ interference -root \n\
+ truchet -root -randomize \n\
+- bsod -root \n\
++- bsod -root \n\
+ crystal -root \n\
+ discrete -root \n\
+ kumppa -root \n\
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/accessibility.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,571 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Sun bug 5077993/GNOME Bug 147639:
+ Gok cant automatically UI grab screensaver preferences
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5077993
+ http://bugzilla.gnome.org/show_bug.cgi?id=147639
+
+Sun bug 5083155:
+ Unable to unlock screen when running dual-head magnification
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5083155
+
+Sun bug 5059445:
+ screen kb and screen reader support
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5059445
+
+Sun bug 5039878:
+ "Password:" field should be focused / have flashing caret
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5039878
+
+Sun bug 6176524:
+ passwdTimeoutEnable for disabled user (xscreensaver-lock)
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6176524
+
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2006-05-10 08:49:37.280822000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:49:43.010409000 -0700
+@@ -84,6 +84,8 @@
+ #include <glade/glade-xml.h>
+ #endif /* HAVE_GTK2 */
+
++#include <gconf/gconf-client.h>
++
+ #if defined(DEFAULT_ICONDIR) && !defined(GLADE_DIR)
+ # define GLADE_DIR DEFAULT_ICONDIR
+ #endif
+@@ -3826,6 +3828,10 @@ create_xscreensaver_settings_dialog (voi
+
+ #endif /* HAVE_GTK2 */
+
++/* AT-enabled */
++#define KEY "/desktop/gnome/interface/accessibility"
++gboolean at_enable = FALSE;
++
+ int
+ main (int argc, char **argv)
+ {
+@@ -3840,6 +3846,12 @@ main (int argc, char **argv)
+ char window_title[255];
+ Bool crapplet_p = False;
+ char *str;
++/*
++** 5077993(P2)147639: Gok cant automatically UI grab screensaver preference
++*/
++ GConfClient *client;
++ const char *modulesptr = NULL;
++
+
+ #ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+@@ -4067,6 +4079,15 @@ main (int argc, char **argv)
+ p->db = db;
+ load_init_file (p);
+ initialize_sort_map (s);
++ /* Bug 147639:Gok cant automatically UI grab screensaver preferences
++ */
++ /* AT-enable mode ? */
++ client = gconf_client_get_default ();
++ at_enable = gconf_client_get_bool (client, KEY, NULL);
++ /* GTK Accessibility Module initialized */
++ modulesptr = g_getenv ("GTK_MODULES");
++ if (at_enable && (!modulesptr || modulesptr [0] == '\0'))
++ putenv ("GTK_MODULES=gail:atk-bridge");
+
+ /* Now that Xt has been initialized, and the resources have been read,
+ we can set our `progname' variable to something more in line with
+diff -urp -x '*~' driver/lock.c driver/lock.c
+--- driver/lock.c 2006-05-10 08:49:37.437773000 -0700
++++ driver/lock.c 2006-05-10 08:49:43.058171000 -0700
+@@ -25,6 +25,7 @@
+
+ #include <X11/Intrinsic.h>
+ #include <X11/Xos.h> /* for time() */
++#include <X11/Xatom.h>
+ #include <time.h>
+ #include <sys/time.h>
+ #include <errno.h>
+@@ -77,6 +78,10 @@ vms_passwd_valid_p(char *pw, Bool verbos
+
+ #endif /* VMS */
+
++/* 5059445(p3) screen kb and reader support */
++extern
++int grab_mouse (saver_info *si, Window window, Cursor cursor, int screen_no);
++extern int grab_kbd (saver_info *si, Window window, int screen_no);
+ extern void await_dying_children (saver_info *si);
+ void hack_uid (saver_info *si);
+
+@@ -181,8 +186,106 @@ void update_passwd_window (saver_info *s
+ float ratio);
+ void destroy_passwd_window (saver_info *si);
+ static void undo_vp_motion (saver_info *si);
++/* GOK bug */
+
+ extern Atom XA_UNLOCK_RATIO;
++Window at_win[4] = {0,0,0,0}; /* wIds for XRestackWindows() */
++ /* dialog, GOK, or MAG or screenSaver */
++
++int no_atserv = 0; /* GOK or MAG or Both on def. screen 0 */
++
++Bool at_enabled = False; /* Ass. Tech support? def. no */
++ /* for restoring the origin setting
++ override_redirect setting of MAG/GOK
++ */
++Bool winatt_reset[2] = {FALSE,FALSE};
++
++/*
++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 : rturn 0
++
++*/
++Atom atom_type[1], atom_window_type;
++
++Window
++check_raisedWid(saver_info *si,Window wid)
++{
++int screen_no,status;
++Bool loop, found = FALSE;
++Window root_ret, parent_ret, *children = NULL,root;
++unsigned int nchildren = 0;
++
++Screen *screen;
++saver_screen_info *ssi;
++Display *dpy;
++Window screen_win[2] = {0,0};
++
++
++for (screen_no = 0; screen_no < si->nscreens; screen_no++)
++ {
++ loop = TRUE;
++ ssi = &si->screens[screen_no];
++ screen = ssi->screen;
++ root = RootWindowOfScreen (screen);
++ if (screen_no == 0)
++ dpy = DisplayOfScreen(screen);
++ else
++ dpy = ssi->other_dpy;
++ if (dpy)
++ {
++ while (loop)
++ {
++ status =
++ XQueryTree (dpy, wid ,&root_ret,&parent_ret, &children, &nchildren);
++/* AT_LOCK_DEBUG
++fprintf(stderr, " ==>screen(%x) root(%x) wid(%x) root_ret(%x) parent_ret(%x)\n", screen, root, wid, root_ret, parent_ret);
++fprintf(stderr, " screen_no(%d) ==>dpy(%x)\n", screen_no,dpy);
++*/
++
++ if (parent_ret == 0 || root != root_ret) /* not found */
++ loop = FALSE;
++ else if ( root_ret != parent_ret)
++ wid = parent_ret;
++ else
++ {
++
++ loop = FALSE;
++ found = TRUE;
++/* AT_LOCK_DEBUG
++fprintf(stderr,"==> found wid is 0x%x screen_no(%d)\n", wid, screen_no);
++*/
++ if (screen_no)
++ {
++/*
++** found in other screen(not scn 0), implies MAG target scn,
++** invoke XRestackWindow()
++*/
++ screen_win[0] = wid;
++ screen_win[1] = ssi->screensaver_window;
++ XRestackWindows(dpy, screen_win, 2);
++ XSync (dpy, False);
++ wid = 0; /* no need to do the restack on screen 0 */
++ }
++ screen_no = si->nscreens;
++ }
++ } /* while loop */
++ } /*dpy check */
++
++ } /* for loop */
++ if (found)
++ return wid;
++ else
++ return 0;
++}
+
+ #if defined (HAVE_XF86VMODE) || defined (HAVE_XSCREENSAVER_LOCK)
+ static Bool vp_got_error = False;
+@@ -258,6 +361,7 @@ handle_passwd_input (XtPointer data, int
+ saver_preferences *p = &si->prefs;
+ char buffer[1024];
+ char *s;
++ int status;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "passwd input handler() fd=%d\n",*fd);
+@@ -300,9 +404,100 @@ handle_passwd_input (XtPointer data, int
+ else /* Get the window id of lock dialog from Child ***/
+ {
+ Window window = strtoul (s, NULL, 0);
+- /* FIXME: what to revert to? */
+- XSetInputFocus (si->dpy, window, RevertToParent, CurrentTime);
++
++ XSetWindowAttributes setwinattr;
++ unsigned long valuemask = CWOverrideRedirect;
++ XWindowChanges changes;
++ setwinattr.override_redirect = True;
++ XWindowAttributes window_attributes_return;
++
++ Window window1 = 0, passwd_win = 0,wintemp = 0; int j;
++/*CR 5039878 2 3 "Password:" field should be focused / have flashing caret */
++ s = fgets (buffer, sizeof (buffer), si->pw_data->input_file);
++ passwd_win = strtoul (s, NULL, 0);
++ no_atserv = 0;
++ at_win[no_atserv] = window;
++
++ /* There is no need to reset the timer for Normal user
++ for each pop-up dialog
++ */
++ at_enabled = False;
++
++
++ for (j= 0; j < 2; j++)
++ {
++ s = fgets (buffer, sizeof (buffer), si->pw_data->input_file);
++ window1 = strtoul (s, NULL, 0);
++/* GOK, MAG, not running, Ass. Tech support is still selected
++ not enough interface info from loginhelper to cover all
++ possible conditions, ungrab kb/mouse now
++ */
++ if (window1 == 0x1)
++ at_enabled = True;
++ else
++ if (window1 != 0x0 ) {
++/*
++5083155 Unable to unlock screen when running dual-head MAG
++*adding dual or multiple heads for magnifier support
++*/
++
++ at_enabled = True;
++ wintemp = check_raisedWid(si, window1);
++ if (wintemp) {
++ status =
++ XGetWindowAttributes(si->dpy,wintemp,&window_attributes_return);
++
++ if ((status) && (!window_attributes_return.override_redirect))
++ {
++ XFlush(si->dpy);
++ XChangeWindowAttributes(si->dpy,wintemp,valuemask,&setwinattr);
++ winatt_reset[j] = TRUE;
++/* AT_LOCK_DEBUG
++fprintf(stderr,"Debug: ==> winatt_reset[%d] override_redirect needs to be reset\n",j);
++*/
++ }
++ XMapSubwindows(si->dpy, wintemp);
++ no_atserv++;
++ at_win[no_atserv] = wintemp;
++ } /* wintemp != 0 */
++ }
++ }
++ /* common parent, i.e root win */
++
++/* cases for running GOK , or MAG or GOK+MAG */
++
++ if (no_atserv > 0) {
++ /* pop-up dialog in dock mode */
++/* AT_LOCK_DEBUG
++fprintf(stderr,"==> found dialog wid 0x%x\n", window);
++*/
++ XRestackWindows(si->dpy, at_win, no_atserv+1);
++ XUngrabKeyboard(si->dpy, CurrentTime);
++ XUngrabPointer(si->dpy, CurrentTime);
++ si->at_external_passwd = True;
++ XFlush(si->dpy);
++ }
++ /* no MAG or GOK, only SPEECH is running
++ just Ass. Tech support is selected
++ */
++ else if ((no_atserv == 0) && (at_enabled))
++ {
++ XUngrabKeyboard(si->dpy, CurrentTime);
++ XUngrabPointer(si->dpy, CurrentTime);
++ si->at_external_passwd = True;
++ XFlush(si->dpy);
++ }
++
++/* AT_LOCK_DEBUG
++ fprintf(stderr,"debug no_atserv 0x%x\n", no_atserv);
++ fprintf(stderr,"debug passwd win 0x%x\n", passwd_win);
++ fprintf(stderr,"debug window 0x%x\n", window);
++*/
++
++ XSelectInput(si->dpy, passwd_win,KeyPressMask);
++ XSetInputFocus (si->dpy, passwd_win,RevertToPointerRoot, CurrentTime);
+ XSync (si->dpy, False);
++
+ si->pw_data->got_windowid = True;
+ si->passwd_dialog = window;
+ /**g_passwd_dialog_created = True;**/ /*set global flag to check in timers.c*/
+@@ -469,7 +664,9 @@ make_window (saver_info *si, enum window
+ si->external_passwd = True;
+ return;
+ }
++ }
+ si->external_passwd = False;
++ si->at_external_passwd = False;
+ /* FIXME: don't abort() */
+ /*abort ();*/
+ #endif /* HAVE_XSCREENSAVER_LOCK */
+@@ -1129,6 +1326,13 @@ destroy_passwd_window (saver_info *si)
+ Colormap cmap;
+ Pixel black, white;
+ XEvent event;
++/* CR5083155 [Cinn Solaris]Unable to unlock screen when running dual-head MAG
++*/
++ int j;
++ XSetWindowAttributes setwinattr;
++ unsigned long valuemask = CWOverrideRedirect;
++ XWindowChanges changes;
++ setwinattr.override_redirect = FALSE;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "destroy_passwd_window\n");
+@@ -1186,6 +1390,7 @@ destroy_passwd_window (saver_info *si)
+ unblock_sigchld ();
+
+ si->external_passwd = False;
++ si->at_external_passwd = False;
+ }
+ else
+ #endif /* HAVE_XSCREENSAVER_LOCK */
+@@ -1324,6 +1529,19 @@ destroy_passwd_window (saver_info *si)
+ free (pw);
+ si->pw_data = 0;
+ ************/
++
++ for (j= 1; j < 3 ; j++)
++ {
++ if (winatt_reset[j-1] && at_win[j] )
++ {
++ XChangeWindowAttributes(si->dpy,at_win[j],valuemask,&setwinattr);
++ winatt_reset[j-1] = FALSE;
++ at_win[j] = 0;
++/*fprintf(stderr, "DEBUG: at(%d) override_redirect set to FALSE\n", j);
++*/
++ }
++ }
++
+ }
+
+
+@@ -1574,6 +1792,10 @@ passwd_animate_timer (XtPointer closure,
+ event.xclient.data.l[1] = 0;
+ event.xclient.data.l[2] = 0;
+
++/* CR 6176524 passwdTimeoutEnable for disabled user */
++ if (!si->prefs.pwd_p)
++ event.xclient.data.l[1] = 1;
++
+ XSync (si->dpy, False);
+ old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
+
+@@ -1687,8 +1909,13 @@ passwd_event_loop (saver_info *si)
+ saver_preferences *p = &si->prefs;
+ char *msg = 0;
+ XEvent event;
++/* bugid 6176524 passwdTimeout and reset timer for each key press */
++ passwd_dialog_data *pw = si->pw_data;
++ int ii;
++
+ passwd_animate_timer ((XtPointer) si, 0);
+
++
+ while (si->pw_data && si->pw_data->state == pw_read)
+ {
+ XtAppNextEvent (si->app, &event);
+@@ -1697,7 +1924,7 @@ passwd_event_loop (saver_info *si)
+ {
+ if (si->pw_data->got_windowid)
+ {
+- Bool status;
++ Bool status,pwd_status;
+ XErrorHandler old_handler;
+
+ if(p->verbose_p)
+@@ -1713,6 +1940,22 @@ passwd_event_loop (saver_info *si)
+ XSync (si->dpy, False);
+ XSetErrorHandler (old_handler);
+
++/* CR 6176524 passwdTimeoutEnable for disabled user
++ timer will be reset if 4 conditions art true (for each char of pwd)
++ (status) && (p->pwd_p) && (at_enabled) && (pw->timer)
++ However AT group wants to remove at_enabled
++ i.e reset the password timer for each key for all users
++ * 6240938 screensaver-lock's password timer needs to to be reset
++ for each key (all users) and enabling AT support
++*/
++
++ if ((status) && (p->pwd_p) && (pw->timer)) {
++ XtRemoveTimeOut (pw->timer);
++ pw->ratio = 1.0;
++ pw->timer = XtAppAddTimeOut (si->app, 166, passwd_animate_timer,
++ (XtPointer) si);
++ }
++
+ if (p->verbose_p)
+ {
+ if (status)
+@@ -1758,8 +2001,61 @@ passwd_event_loop (saver_info *si)
+ si->pw_data->state = pw_read;
+ }
+
++ /*
++* 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.
++* Once WM/metacity fixes the problem, the code can be removed.
++ 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.
++ Now, GOK only supports 2nd USB/mouse/Dwell, corepointer is supposed
++ not to be used, and GOK cannot disable it
++*/
++ else if (((event.type == UnmapNotify)
++ || (event.type == MapNotify )
++ || (event.type == ConfigureNotify)
++ || (event.type == PropertyNotify )
++ || (event.type == ReparentNotify ))
++ && (si->passwd_dialog) && (no_atserv))
++ {
++/* AT_LOCK_DEBUG
++fprintf (stderr, "client window(0x%x) %s\n", event.xclient.window,blurb());
++fprintf (stderr, "dialog window 0x%x:\n", si->passwd_dialog);
++fprintf(stderr, "** no_atserv: %d \n", no_atserv);
++for (ii = 0; ii < 4; ii++)
++ fprintf(stderr, "** win : 0x%x \n", at_win[ii]);
++*/
++ at_win[no_atserv+1] = si->screens[0].screensaver_window;
++/* 2 => screensaver and dialog Wids */
++ XRestackWindows(si->dpy, at_win, no_atserv+2);
++ XFlush(si->dpy);
++ }
++/* the above new code for restacking under the conidtion
++*/
+ else
+- XtDispatchEvent (&event);
++ {
++/*
++ if ((si->passwd_dialog) && (no_atserv) && (event.type != 0))
++ fprintf(stderr, "** DEbug other event %d\n", event.type);
++*/
++ XtDispatchEvent (&event);
++ }
++
+ }
+
+ switch (si->pw_data->state)
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:49:37.424123000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:49:43.046876000 -0700
+@@ -808,6 +808,21 @@ initialize_per_screen_info (saver_info *
+ get_visual (ssi->screen, "GrayScale", True, False))
+ found_any_writable_cells = True;
+ }
++/*
++** 5083155 unable to unlock scr when runing dual-head MAG
++*/
++ if (i > 0) /* other screens */
++ {
++ char other_dpyname[20];
++ char *pdpy;
++ sprintf(other_dpyname,":0.%d\0",i);
++ pdpy = strdup(other_dpyname);
++ ssi->other_dpy = XOpenDisplay(pdpy);
++ free(pdpy);
++/*
++fprintf(stderr,"==>other dpy i(%d) dpy(%s) 0x%x\n",i,other_dpyname, ssi->other_dpy);
++*/
++ }
+ }
+
+ si->fading_possible_p = found_any_writable_cells;
+@@ -1026,6 +1041,18 @@ main_loop (saver_info *si)
+ {
+ saver_preferences *p = &si->prefs;
+ /* Bool ok_to_unblank; made this a global flag, gets set in timers.c */
++ 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 diaglog
++*/
++
++ /* GTK Accessibility Module initialized */
++ modulesptr = getenv ("GTK_MODULES");
++ if (!modulesptr || modulesptr [0] == '\0')
++ putenv ("GTK_MODULES=gail:atk-bridge");
+
+ while (1)
+ {
+diff -urp -x '*~' driver/xscreensaver.h driver/xscreensaver.h
+--- driver/xscreensaver.h 2006-05-10 08:49:37.266733000 -0700
++++ driver/xscreensaver.h 2006-05-10 08:49:43.045439000 -0700
+@@ -286,6 +286,8 @@ struct saver_screen_info {
+ GC stderr_gc;
+ Window stderr_overlay_window; /* Used if the server has overlay planes */
+ Colormap stderr_cmap;
++ Display *other_dpy; /* used by AT's MAG XRestackWindow() */
++ /* 5083155 mag dual-heads */
+ };
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/allow-root.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Fix for: 4849641: xscreensaver won't run as root
+
+Let root lock the screen, but don't launch the hacks for root.
+
+(Upstream maintainer argues instead that users should not login as root,
+ which is correct, but not something we can force our customers to stop
+ doing. See http://www.jwz.org/xscreensaver/faq.html#root-lock for his side.)
+
+
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2006-05-10 08:48:29.898310000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:48:35.790594000 -0700
+@@ -533,6 +533,14 @@ run_cmd (state *s, Atom command, int arg
+ char *err = 0;
+ int status;
+
++ if (getuid() == 0)
++ {
++ char buf [255];
++ strcpy (buf, _("Cant run hacks if logged in as root!"));
++ warning_dialog (s->toplevel_widget, buf, False, 100);
++ return;
++ }
++
+ flush_dialog_changes_and_save (s);
+ status = xscreensaver_command (GDK_DISPLAY(), command, arg, False, &err);
+ if (status < 0)
+@@ -552,6 +560,15 @@ static void
+ run_hack (state *s, int list_elt, Bool report_errors_p)
+ {
+ int hack_number;
++
++ if (getuid() == 0)
++ {
++ char buf [255];
++ strcpy (buf, _("Cant run hacks if logged in as root!"));
++ warning_dialog (s->toplevel_widget, buf, False, 100);
++ return;
++ }
++
+ if (list_elt < 0) return;
+ hack_number = s->list_elt_to_hack_number[list_elt];
+
+@@ -4131,11 +4148,21 @@ main (int argc, char **argv)
+ GtkOptionMenu *opt = GTK_OPTION_MENU (name_to_widget (s, "mode_menu"));
+ GtkMenu *menu = GTK_MENU (gtk_option_menu_get_menu (opt));
+ GList *kids = gtk_container_children (GTK_CONTAINER (menu));
++
++ if (getuid() == 0)
++ {
++ /*mali if logged in as root disable menu so user cant activate a hack...*/
++ gtk_widget_set_sensitive (opt, False);
++ gtk_widget_set_sensitive (menu, False);
++ }
++ else
++ {
+ for (; kids; kids = kids->next)
+ gtk_signal_connect (GTK_OBJECT (kids->data), "activate",
+ GTK_SIGNAL_FUNC (mode_menu_item_cb),
+ (gpointer) s);
+ }
++ }
+
+
+ /* Handle the -prefs command-line argument. */
+diff -urp -x '*~' driver/exec.c driver/exec.c
+--- driver/exec.c 2002-01-17 00:34:43.000000000 -0800
++++ driver/exec.c 2006-05-10 08:48:35.753517000 -0700
+@@ -185,6 +185,7 @@ exec_command (const char *shell, const c
+ hairy_p = !!strpbrk (command, "*?$&!<>[];`'\\\"=");
+ /* note: = is in the above because of the sh syntax "FOO=bar cmd". */
+
++#ifdef DONT_ALLOW_ROOT_LOGIN
+ if (getuid() == (uid_t) 0 || geteuid() == (uid_t) 0)
+ {
+ /* If you're thinking of commenting this out, think again.
+@@ -195,6 +196,7 @@ exec_command (const char *shell, const c
+ blurb());
+ exit (-1);
+ }
++#endif /*DONT_ALLOW_ROOT_LOGIN*/
+
+ if (hairy_p)
+ /* If it contains any shell metacharacters, do it the hard way,
+diff -urp -x '*~' driver/setuid.c driver/setuid.c
+--- driver/setuid.c 2006-05-10 08:48:29.941707000 -0700
++++ driver/setuid.c 2006-05-10 08:48:35.755829000 -0700
+@@ -83,6 +83,10 @@ set_ids_by_number (uid_t uid, gid_t gid,
+ struct passwd *p = getpwuid (uid);
+ struct group *g = getgrgid (gid);
+
++ /* if we are logged in as root i.e. uid==0 then dont do anything*/
++ if (getuid() == 0)
++ return;
++
+ if (message_ret)
+ *message_ret = 0;
+
+@@ -192,6 +196,9 @@ hack_uid (saver_info *si)
+ of the xscreensaver manual titled "LOCKING AND ROOT LOGINS",
+ and "USING XDM".
+ */
++
++/* We are letting root login to fix a P1 bug, i.e. root should lock screen*/
++#ifdef DONT_ALLOW_ROOT_LOGIN
+ if (getuid() == (uid_t) 0)
+ {
+ si->locking_disabled_p = True;
+@@ -229,6 +236,7 @@ hack_uid (saver_info *si)
+ if (set_ids_by_number (p->pw_uid, p->pw_gid, &si->uid_message) != 0)
+ saver_exit (si, -1, 0);
+ }
++#endif /*DONT_ALLOW_ROOT_LOGIN*/
+
+
+ /* If there's anything even remotely funny looking about the passwd struct,
+@@ -271,7 +279,10 @@ hack_uid (saver_info *si)
+ (p && p->pw_name && *p->pw_name
+ ? p->pw_name : "<unknown>"));
+ si->nolock_reason = buf;
++
++#ifdef DONT_ALLOW_ROOT_LOGIN
+ si->locking_disabled_p = True;
++#endif
+ si->dangerous_uid_p = True;
+ }
+ }
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2006-05-10 08:48:29.955074000 -0700
++++ driver/subprocs.c 2006-05-10 08:48:35.788404000 -0700
+@@ -849,6 +849,9 @@ check_if_hacks_dir_exists(void)
+ void
+ spawn_screenhack (saver_info *si, Bool first_time_p)
+ {
++ if (getuid() == 0)
++ return; /* Dont let hacks run if logged in as root*/
++
+ if (si->prefs.verbose_p)
+ fprintf(stderr, "--> spawn_screenhack()\n");
+
+diff -urp -x '*~' driver/timers.c driver/timers.c
+--- driver/timers.c 2006-05-10 08:48:29.940928000 -0700
++++ driver/timers.c 2006-05-10 08:48:35.781471000 -0700
+@@ -248,7 +248,8 @@ cycle_timer (XtPointer closure, XtInterv
+ maybe_reload_init_file (si);
+ kill_screenhack (si);
+
+- if (!si->throttled_p)
++ /* if we are root then dont run hacks*/
++ if (!si->throttled_p && getuid() !=0)
+ spawn_screenhack (si, False);
+ else
+ {
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:48:29.979552000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:48:35.764178000 -0700
+@@ -399,6 +399,7 @@ startup_ehandler (String name, String ty
+
+ describe_uids (si, stderr);
+
++#ifdef DONT_ALLOW_ROOT_LOGIN
+ if (si->orig_uid && !strncmp (si->orig_uid, "root/", 5))
+ {
+ fprintf (stderr, "\n"
+@@ -412,11 +413,11 @@ startup_ehandler (String name, String ty
+ blurb());
+ }
+ else
++#endif /*DONT_ALLOW_ROOT_LOGIN*/
+ {
+ fprintf (stderr, "\n"
+ "%s: Errors at startup are usually authorization problems.\n"
+-" But you're not logging in as root (good!) so something\n"
+-" else must be wrong. Did you read the manual and the FAQ?\n",
++" Did you read the manual and the FAQ?\n",
+ blurb());
+ }
+
+@@ -1034,7 +1035,7 @@ main_loop (saver_info *si)
+
+ kill_screenhack (si);
+
+- if (!si->throttled_p)
++ if (!si->throttled_p && getuid() != 0)
+ spawn_screenhack (si, True);
+ else if (p->verbose_p)
+ fprintf (stderr, "%s: not launching hack (throttled.)\n", blurb());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/blurb.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,356 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Removed unsafe calls to blurb from signal handlers and other places.
+
+diff -urp -x '*~' driver/lock.c driver/lock.c
+--- driver/lock.c 2006-05-10 08:49:29.423263000 -0700
++++ driver/lock.c 2006-05-10 08:49:37.437773000 -0700
+@@ -1841,12 +1841,11 @@ passwd_event_loop (saver_info *si)
+ {
+ if (si->unlock_failures == 1)
+ fprintf (real_stderr,
+- "%s: WARNING: 1 failed attempt to unlock the screen.\n",
+- blurb());
++ "WARNING: 1 failed attempt to unlock the screen.\n");
+ else
+ fprintf (real_stderr,
+- "%s: WARNING: %d failed attempts to unlock the screen.\n",
+- blurb(), si->unlock_failures);
++ "WARNING: %d failed attempts to unlock the screen.\n",
++ si->unlock_failures);
+
+ si->unlock_failures = 0;
+ }
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2006-05-10 08:49:29.616989000 -0700
++++ driver/subprocs.c 2006-05-10 08:49:37.422733000 -0700
+@@ -104,7 +104,7 @@ limit_subproc_memory (int address_space_
+ if (getrlimit (RLIMIT_AS, &r) != 0)
+ {
+ char buf [512];
+- sprintf (buf, "%s: getrlimit(RLIMIT_AS) failed", blurb());
++ sprintf (buf, "getrlimit(RLIMIT_AS) failed");
+ perror (buf);
+ return;
+ }
+@@ -114,8 +114,8 @@ limit_subproc_memory (int address_space_
+ if (setrlimit (RLIMIT_AS, &r) != 0)
+ {
+ char buf [512];
+- sprintf (buf, "%s: setrlimit(RLIMIT_AS, {%lu, %lu}) failed",
+- blurb(), r.rlim_cur, r.rlim_max);
++ sprintf (buf, "setrlimit(RLIMIT_AS, {%lu, %lu}) failed",
++ r.rlim_cur, r.rlim_max);
+ perror (buf);
+ return;
+ }
+@@ -133,8 +133,8 @@ limit_subproc_memory (int address_space_
+ else
+ sprintf(buf, "%d bytes", i);
+
+- fprintf (stderr, "%s: limited pid %lu address space to %s.\n",
+- blurb(), (unsigned long) getpid (), buf);
++ fprintf (stderr, "limited pid %lu address space to %s.\n",
++ (unsigned long) getpid (), buf);
+ }
+
+ #endif /* HAVE_SETRLIMIT && RLIMIT_AS */
+@@ -169,7 +169,7 @@ void
+ show_job_list (void)
+ {
+ struct screenhack_job *job;
+- fprintf(stderr, "%s: job list:\n", blurb());
++ fprintf(stderr, "job list:\n");
+ for (job = jobs; job; job = job->next)
+ fprintf (stderr, " %5ld: %2d: (%s) %s\n",
+ (long) job->pid,
+@@ -342,8 +342,8 @@ kill_job (saver_info *si, pid_t pid, int
+ job->status == job_killed)
+ {
+ if (p->verbose_p)
+- fprintf (stderr, "%s: no child %ld to signal!\n",
+- blurb(), (long) pid);
++ fprintf (stderr, " no child %ld to signal!\n",
++ (long) pid);
+ goto DONE;
+ }
+
+@@ -358,8 +358,8 @@ kill_job (saver_info *si, pid_t pid, int
+ }
+
+ if (p->verbose_p)
+- fprintf (stderr, "%s: %d: %s pid %lu (%s)\n",
+- blurb(), job->screen,
++ fprintf (stderr, "%d: %s pid %lu (%s)\n",
++ job->screen,
+ (job->status == job_killed ? "killing" :
+ job->status == job_stopped ? "suspending" : "resuming"),
+ (unsigned long) job->pid,
+@@ -371,13 +371,13 @@ kill_job (saver_info *si, pid_t pid, int
+ {
+ if (errno == ESRCH)
+ fprintf (stderr,
+- "%s: %d: child process %lu (%s) was already dead.\n",
+- blurb(), job->screen, job->pid, job->name);
++ " %d: child process %lu (%s) was already dead.\n",
++ job->screen, job->pid, job->name);
+ else
+ {
+ char buf [1024];
+- sprintf (buf, "%s: %d: couldn't kill child process %lu (%s)",
+- blurb(), job->screen, job->pid, job->name);
++ sprintf (buf, "%d: couldn't kill child process %lu (%s)",
++ job->screen, job->pid, job->name);
+ perror (buf);
+ }
+ }
+@@ -401,7 +401,7 @@ sigchld_handler (int sig)
+ saver_info *si = global_si_kludge; /* I hate C so much... */
+
+ if (si->prefs.debug_p)
+- fprintf(stderr, "%s: got SIGCHLD%s\n", blurb(),
++ fprintf(stderr, " got SIGCHLD%s\n",
+ (block_sigchld_handler ? " (blocked)" : ""));
+
+ if (block_sigchld_handler < 0)
+@@ -433,10 +433,10 @@ await_dying_children (saver_info *si)
+ if (si->prefs.debug_p)
+ {
+ if (kid < 0 && errno)
+- fprintf (stderr, "%s: waitpid(-1) ==> %ld (%d)\n", blurb(),
++ fprintf (stderr, " waitpid(-1) ==> %ld (%d)\n",
+ (long) kid, errno);
+ else
+- fprintf (stderr, "%s: waitpid(-1) ==> %ld\n", blurb(),
++ fprintf (stderr, " waitpid(-1) ==> %ld\n",
+ (long) kid);
+ }
+
+@@ -475,6 +475,7 @@ describe_dead_child (saver_info *si, pid
+ if they happen on their own.
+ */
+
++#if UNSAFE_CALLS_REMOVE_THESE
+ if ((!job
+ #ifdef HAVE_XSCREENSAVER_LOCK
+ && kid != si->passwd_pid
+@@ -489,12 +490,15 @@ describe_dead_child (saver_info *si, pid
+ else if (p->verbose_p)
+ fprintf (stderr, "%s: %d: child pid %lu (%s) exited normally.\n",
+ blurb(), screen_no, (unsigned long) kid, name);
++#endif /*UNSAFE_CALLS_REMOVE_THESE**/
+
+ if (job)
+ job->status = job_dead;
+ }
+ else if (WIFSIGNALED (wait_status))
+ {
++
++#if UNSAFE_CALLS_REMOVE_THESE
+ if (p->verbose_p ||
+ (!job
+ #ifdef HAVE_XSCREENSAVER_LOCK
+@@ -506,24 +510,29 @@ describe_dead_child (saver_info *si, pid
+ fprintf (stderr, "%s: %d: child pid %lu (%s) terminated with %s.\n",
+ blurb(), screen_no, (unsigned long) kid, name,
+ signal_name (WTERMSIG(wait_status)));
++#endif /*UNSAFE_CALLS_REMOVE_THESE*/
+
+ if (job)
+ job->status = job_dead;
+ }
+ else if (WIFSTOPPED (wait_status))
+ {
++#if UNSAFE_CALLS_REMOVE_THESE
+ if (p->verbose_p)
+ fprintf (stderr, "%s: child pid %lu (%s) stopped with %s.\n",
+ blurb(), (unsigned long) kid, name,
+ signal_name (WSTOPSIG (wait_status)));
++#endif /*UNSAFE_CALLS_REMOVE_THESE*/
+
+ if (job)
+ job->status = job_stopped;
+ }
+ else
+ {
++#if UNSAFE_CALLS_REMOVE_THESE
+ fprintf (stderr, "%s: child pid %lu (%s) died in a mysterious way!",
+ blurb(), (unsigned long) kid, name);
++#endif /*UNSAFE_CALLS_REMOVE_THESE*/
+ if (job)
+ job->status = job_dead;
+ }
+@@ -574,7 +583,7 @@ init_sigchld (void)
+ if (sigaction(SIGCHLD, &action, &old) < 0)
+ {
+ char buf [255];
+- sprintf (buf, "%s: couldn't catch SIGCHLD", blurb());
++ sprintf (buf, "couldn't catch SIGCHLD");
+ perror (buf);
+ }
+ sigchld_initialized_p = True;
+@@ -585,7 +594,7 @@ init_sigchld (void)
+ if (((long) signal (SIGCHLD, sigchld_handler)) == -1L)
+ {
+ char buf [255];
+- sprintf (buf, "%s: couldn't catch SIGCHLD", blurb());
++ sprintf (buf, "couldn't catch SIGCHLD");
+ perror (buf);
+ }
+ # endif /* !HAVE_SIGACTION */
+@@ -629,7 +638,7 @@ print_path_error (const char *program)
+ char *token = strchr (cmd, ' ');
+
+ if (token) *token = 0;
+- sprintf (buf, "%s: could not execute \"%.100s\"", blurb(), cmd);
++ sprintf (buf, "could not execute \"%.100s\"", cmd);
+ free (cmd);
+ perror (buf);
+
+@@ -768,8 +777,8 @@ spawn_screenhack_1 (saver_screen_info *s
+ */
+ if (p->verbose_p)
+ fprintf(stderr,
+- "%s: %d: no programs enabled, or no suitable visuals.\n",
+- blurb(), ssi->number);
++ "%d: no programs enabled, or no suitable visuals.\n",
++ ssi->number);
+ return;
+ }
+ else
+@@ -785,7 +794,7 @@ spawn_screenhack_1 (saver_screen_info *s
+ switch ((int) (forked = fork ()))
+ {
+ case -1:
+- sprintf (buf, "%s: couldn't fork", blurb());
++ sprintf (buf, "couldn't fork");
+ perror (buf);
+ restore_real_vroot (si);
+ saver_exit (si, 1, 0);
+@@ -807,9 +816,9 @@ spawn_screenhack_1 (saver_screen_info *s
+ hack->command);
+
+ if (p->verbose_p)
+- fprintf (stderr, "%s: %d: spawning \"%s\" in pid %lu.\n",
+- blurb(), ssi->number, hack->command,
+- (unsigned long) getpid ());
++ fprintf (stderr, "%d: spawning \"%s\" in pid %lu nice=%d.\n",
++ ssi->number, complete_hack_command,
++ (unsigned long) getpid (), p->nice_inferior);
+
+ exec_command (p->shell, complete_hack_command, p->nice_inferior);
+
+@@ -877,8 +886,8 @@ spawn_screenhack (saver_info *si, Bool f
+ }
+ else if (si->prefs.verbose_p)
+ fprintf (stderr,
+- "%s: X says monitor has powered down; "
+- "not launching a hack.\n", blurb());
++ "X says monitor has powered down; "
++ "not launching a hack.\n");
+
+ store_saver_status (si); /* store current hack numbers */
+ }
+@@ -1068,7 +1077,7 @@ get_best_gl_visual (saver_screen_info *s
+ {
+ case -1:
+ {
+- sprintf (buf, "%s: couldn't fork", blurb());
++ sprintf (buf, "couldn't fork");
+ perror (buf);
+ saver_exit (si, 1, 0);
+ }
+@@ -1103,7 +1112,7 @@ get_best_gl_visual (saver_screen_info *s
+ {
+ /* Ignore "no such file or directory" errors, unless verbose.
+ Issue all other exec errors, though. */
+- sprintf (buf, "%s: running %s", blurb(), av[0]);
++ sprintf (buf, "running %s", av[0]);
+ perror (buf);
+ }
+ exit (1); /* exits fork */
+@@ -1141,16 +1150,16 @@ get_best_gl_visual (saver_screen_info *s
+ if (result == 0)
+ {
+ if (si->prefs.verbose_p)
+- fprintf (stderr, "%s: %s did not report a GL visual!\n",
+- blurb(), av[0]);
++ fprintf (stderr, "%s did not report a GL visual!\n",
++ av[0]);
+ return 0;
+ }
+ else
+ {
+ Visual *v = id_to_visual (ssi->screen, result);
+ if (si->prefs.verbose_p)
+- fprintf (stderr, "%s: %d: %s: GL visual is 0x%X%s.\n",
+- blurb(), ssi->number,
++ fprintf (stderr, "%d: %s: GL visual is 0x%X%s.\n",
++ ssi->number,
+ av[0], result,
+ (v == ssi->default_visual ? " (default)" : ""));
+ return v;
+@@ -1192,7 +1201,7 @@ restart_process (saver_info *si)
+ if (si->prefs.verbose_p)
+ {
+ int i;
+- fprintf (stderr, "%s: re-executing", blurb());
++ fprintf (stderr, "re-executing");
+ for (i = 0; saved_argv[i]; i++)
+ fprintf (stderr, " %s", saved_argv[i]);
+ fprintf (stderr, "\n");
+@@ -1205,7 +1214,7 @@ restart_process (saver_info *si)
+ execvp (saved_argv [0], saved_argv); /* shouldn't return */
+ {
+ char buf [512];
+- sprintf (buf, "%s: could not restart process", blurb());
++ sprintf (buf, "could not restart process");
+ perror(buf);
+ fflush(stderr);
+ abort();
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:49:29.603987000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:49:37.424123000 -0700
+@@ -298,6 +298,14 @@ static Bool blurb_timestamp_p = False;
+ const char *
+ blurb (void)
+ {
++ /* A alot of functions call blurb and calling blurb from a
++ signal handler is not safe. Causes a hang as timestring is not
++ a safe call to make from a signal handler.
++ So, just returning as timestamp in error msgs is not important.
++ */
++
++ return progname;
++
+ if (!blurb_timestamp_p)
+ return progname;
+ else
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/debug-msgs.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Various tidbits found to aid debugging over the years.
+
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2006-05-10 08:48:56.250032000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:49:02.885168000 -0700
+@@ -2327,9 +2327,23 @@ populate_prefs_page (state *s)
+
+ #ifdef HAVE_DPMS_EXTENSION
+ {
++ char buf [300];
+ int op = 0, event = 0, error = 0;
++
+ if (XQueryExtension (dpy, "DPMS", &op, &event, &error))
++ {
+ dpms_supported = True;
++ if (s->debug_p)
++ {
++ sprintf (buf, "XQueryExtension() says DPMS is supported.");
++ perror (buf);
++ }
++ }
++ else if (s->debug_p)
++ {
++ sprintf (buf, "XQueryExtension() says DPMS not supported.");
++ perror (buf);
++ }
+ }
+ #endif /* HAVE_DPMS_EXTENSION */
+
+diff -urp -x '*~' driver/prefs.c driver/prefs.c
+--- driver/prefs.c 2006-05-10 08:48:56.328495000 -0700
++++ driver/prefs.c 2006-05-10 08:49:02.873669000 -0700
+@@ -458,6 +458,12 @@ init_file_changed_p (saver_preferences *
+ const char *name = init_file_name();
+ struct stat st;
+
++ if (p->verbose_p)
++ {
++ fprintf(stderr, "--> init_file_changed()\n");
++ fflush (stderr);
++ }
++
+ if (!name) return False;
+
+ if (stat(name, &st) != 0)
+@@ -466,6 +472,12 @@ init_file_changed_p (saver_preferences *
+ if (p->init_file_date == st.st_mtime)
+ return False;
+
++ if (p->verbose_p)
++ {
++ fprintf(stderr, "<-- init_file_has changed should reload init file\n");
++ fflush (stderr);
++ }
++
+ return True;
+ }
+
+diff -urp -x '*~' driver/timers.c driver/timers.c
+--- driver/timers.c 2006-05-10 08:48:56.343046000 -0700
++++ driver/timers.c 2006-05-10 08:49:02.882875000 -0700
+@@ -152,7 +152,7 @@ notice_events (saver_info *si, Window wi
+ */
+ XSelectInput (si->dpy, window, SubstructureNotifyMask | events);
+
+- if (top_p && p->debug_p && (events & KeyPressMask))
++ if (top_p && p->verbose_p && (events & KeyPressMask))
+ {
+ /* Only mention one window per tree (hack hack). */
+ fprintf (stderr, "%s: %d: selected KeyPress on 0x%lX\n",
+@@ -235,6 +235,9 @@ cycle_timer (XtPointer closure, XtInterv
+ saver_preferences *p = &si->prefs;
+ Time how_long = p->cycle;
+
++ if (p->verbose_p)
++ fprintf (stderr,"-->cycle_timer()\n");
++
+ if (si->selection_mode > 0 &&
+ screenhack_running_p (si))
+ /* If we're in "SELECT n" mode, the cycle timer going off will just
+@@ -254,7 +257,14 @@ cycle_timer (XtPointer closure, XtInterv
+ }
+ else
+ {
++ if (p->verbose_p)
++ {
++ fprintf (stderr,"-->cycle_timer()..in else..i.e. no lock dialog present...");
++ fprintf (stderr,"...calling maybe_relaod_init_file\n");
++ }
++
+ maybe_reload_init_file (si);
++
+ kill_screenhack (si);
+
+ /* if we are root then dont run hacks*/
+@@ -274,13 +284,13 @@ cycle_timer (XtPointer closure, XtInterv
+ si->cycle_id = XtAppAddTimeOut (si->app, how_long, cycle_timer,
+ (XtPointer) si);
+
+- if (p->debug_p)
++ if (p->verbose_p)
+ fprintf (stderr, "%s: starting cycle_timer (%ld, %ld)\n",
+ blurb(), how_long, si->cycle_id);
+ }
+ else
+ {
+- if (p->debug_p)
++ if (p->verbose_p)
+ fprintf (stderr, "%s: not starting cycle_timer: how_long == %d\n",
+ blurb(), how_long);
+ }
+@@ -322,7 +332,7 @@ reset_timers (saver_info *si)
+
+ if (si->timer_id)
+ {
+- if (p->debug_p)
++ if (p->verbose_p)
+ fprintf (stderr, "%s: killing idle_timer (%ld, %ld)\n",
+ blurb(), p->timeout, si->timer_id);
+ XtRemoveTimeOut (si->timer_id);
+@@ -640,6 +650,9 @@ sleep_until_idle (saver_info *si, Bool u
+ }
+ #endif /* HAVE_SCF_SMARTCARD */
+
++ if (si->prefs.debug_p)
++ fprintf(stderr,"--> sleep_until_idle()\n");
++
+ if (until_idle_p)
+ {
+ if (polling_for_idleness)
+@@ -729,6 +742,9 @@ sleep_until_idle (saver_info *si, Bool u
+ an event (again, user activity.)
+ */
+ idle = 1000 * (si->last_activity_time - time ((time_t *) 0));
++ if (si->prefs.verbose_p)
++ fprintf(stderr,"No idle extension in use (sleep_until_idle), idle=%d\n", idle);
++
+ }
+
+ #ifdef HAVE_SCF_SMARTCARD
+@@ -756,12 +772,16 @@ sleep_until_idle (saver_info *si, Bool u
+ if (idle >= p->timeout)
+ {
+ /* Look, we've been idle long enough. We're done. */
++ if (si->prefs.verbose_p)
++ fprintf(stderr,"idle long enough..DONE (sleep_until_idle)\n");
+ goto DONE;
+ }
+ else if (si->emergency_lock_p)
+ {
+ /* Oops, the wall clock has jumped far into the future, so
+ we need to lock down in a hurry! */
++ if (si->prefs.verbose_p)
++ fprintf(stderr,"emergency_lock_p..DONE (sleep_until_idle)\n");
+ goto DONE;
+ }
+ else
+@@ -769,6 +789,9 @@ sleep_until_idle (saver_info *si, Bool u
+ /* The event went off, but it turns out that the user has not
+ yet been idle for long enough. So re-signal the event.
+ */
++ if (si->prefs.verbose_p)
++ fprintf(stderr,"polling_for_idleness (sleep_until_idle)\n");
++
+ if (polling_for_idleness)
+ schedule_wakeup_event (si, p->timeout - idle, p->debug_p);
+ }
+@@ -857,7 +880,7 @@ sleep_until_idle (saver_info *si, Bool u
+ case ButtonRelease:
+ case MotionNotify:
+
+- if (p->debug_p)
++ if (p->debug_p || p->verbose_p)
+ {
+ Window root=0, window=0;
+ int x=-1, y=-1;
+@@ -877,6 +900,13 @@ sleep_until_idle (saver_info *si, Bool u
+ window = event.xkey.window;
+ x = y = -1;
+ }
++ else if (event.xany.type == KeyRelease)
++ {
++ type = "KeyRelease";
++ root = event.xkey.root;
++ window = event.xkey.window;
++ x = y = -1;
++ }
+ else if (event.xany.type == ButtonPress)
+ {
+ type = "ButtonPress";
+@@ -885,6 +915,14 @@ sleep_until_idle (saver_info *si, Bool u
+ x = event.xmotion.x_root;
+ y = event.xmotion.y_root;
+ }
++ else if (event.xany.type == ButtonRelease)
++ {
++ type = "ButtonRelease";
++ root = event.xkey.root;
++ window = event.xkey.window;
++ x = event.xmotion.x_root;
++ y = event.xmotion.y_root;
++ }
+
+ if (type)
+ {
+@@ -899,6 +937,14 @@ sleep_until_idle (saver_info *si, Bool u
+ else
+ fprintf (stderr, " at %d,%d.\n", x, y);
+ }
++
++ fprintf(stderr,"************************************\n");
++ fprintf(stderr,"-->sleep_until_idle() event: Motion or Key Press\n");
++ fprintf(stderr,"\t Window of Motion or KeyPress:%x\n",
++ window);
++ fprintf(stderr,"\t until_idle_p=%d g_passwd_dialog_created=%d\n",
++ until_idle_p, g_passwd_dialog_created);
++ fflush(stderr);
+ }
+
+ /* If any widgets want to handle this event, let them. */
+@@ -920,7 +966,11 @@ sleep_until_idle (saver_info *si, Bool u
+ else
+ /* If we're not demoing, then any activity causes deactivation.
+ */
++ {
++ if (si->prefs.verbose_p)
++ fprintf(stderr, "===> timers.c goto DONE user activity detected\n");
+ goto DONE;
++ }
+ }
+ else
+ reset_timers (si);
+@@ -1345,6 +1395,9 @@ watchdog_timer (XtPointer closure, XtInt
+ p->dpms_off / 1000,
+ False);
+
++ if (p->verbose_p)
++ fprintf (stderr, "--->watchdog_timer()\n");
++
+ if (si->screen_blanked_p)
+ {
+ Bool running_p = screenhack_running_p (si);
+@@ -1358,7 +1411,7 @@ watchdog_timer (XtPointer closure, XtInt
+ }
+ else
+ {
+- if (si->prefs.debug_p)
++ if (si->prefs.verbose_p)
+ fprintf (stderr, "%s: watchdog timer raising %sscreen.\n",
+ blurb(), (running_p ? "" : "and clearing "));
+
+@@ -1370,7 +1423,8 @@ watchdog_timer (XtPointer closure, XtInt
+ {
+ if (si->prefs.verbose_p)
+ fprintf (stderr,
+- "%s: X says monitor has powered down; "
++ /*mali "%s: X says monitor has powered down; "**/
++ "%s: X says dpms is disabled; "
+ "killing running hacks.\n", blurb());
+ kill_screenhack (si);
+ }
+@@ -1400,7 +1454,7 @@ reset_watchdog_timer (saver_info *si, Bo
+ si->watchdog_id = XtAppAddTimeOut (si->app, p->watchdog_timeout,
+ watchdog_timer, (XtPointer) si);
+
+- if (p->debug_p)
++ if (p->verbose_p)
+ fprintf (stderr, "%s: restarting watchdog_timer (%ld, %ld)\n",
+ blurb(), p->watchdog_timeout, si->watchdog_id);
+ }
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:48:56.397896000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:49:02.886459000 -0700
+@@ -692,7 +692,7 @@ print_banner (saver_info *si)
+
+ if (p->debug_p)
+ fprintf (stderr, "\n"
+- "%s: Warning: running in DEBUG MODE. Be afraid.\n"
++ "%s: Warning: running in DEBUG MODE.\n"
+ "\n"
+ "\tNote that in debug mode, the xscreensaver window will only\n"
+ "\tcover the left half of the screen. (The idea is that you\n"
+@@ -1306,7 +1306,12 @@ main (int argc, char **argv)
+ saver_info the_si;
+ saver_info *si = &the_si;
+ saver_preferences *p = &si->prefs;
+- int i;
++ int i,debug_flag;
++
++/*Wait till we can attach debugger to the process*/
++debug_flag=0;
++while (debug_flag)
++ sleep(1);
+
+ #ifdef ENABLE_NLS
+ if (!setlocale (LC_ALL, ""))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/dont-bug-jwz.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Since we've forked, folded, mangled, and multilated greatly from jwz's
+original, change help links to not point to his docs to avoid user confusion
+in the places we've chosen to differ and to avoid our users asking him to
+fix things that aren't his fault.
+
+diff -urp -x '*~' driver/XScreenSaver.ad.in driver/XScreenSaver.ad.in
+--- driver/XScreenSaver.ad.in 2006-05-10 08:48:17.084393000 -0700
++++ driver/XScreenSaver.ad.in 2006-05-10 08:48:24.193863000 -0700
+@@ -73,11 +73,11 @@
+ *prefsCommand: xscreensaver-demo -prefs
+
+ ! This is the URL that the "Help" button on the splash screen loads.
+-*helpURL: http://www.jwz.org/xscreensaver/man.html
++*helpURL:
+
+ ! This is how the "Help" button loads URLs (/bin/sh syntax.)
+ ! The "helpURL" will be substituted for up to two occurrences of "%s".
+-*loadURL: netscape -remote 'openURL(%s)' || netscape '%s'
++*loadURL:
+
+ ! This is what the "Manual" button in xscreensaver-demo runs (/bin/sh syntax.)
+ @GNOMEHELP_N@*manualCommand: xterm +sb -fg black -bg gray75 -T '%s manual' \
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2006-05-10 08:48:17.094156000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:48:24.196159000 -0700
+@@ -716,6 +716,10 @@ about_menu_cb (GtkMenuItem *menuitem, gp
+ void
+ doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data)
+ {
++
++ const char *sun_help_command = "xterm -T 'Screensaver Help' -e /bin/sh -c 'man xscreensaver || read foo' &";
++
++#ifdef JWZ_HELP /* We do not want to point to jwz website for help instead open man page in xterm window */
+ state *s = global_state_kludge; /* I hate C so much... */
+ saver_preferences *p = &s->prefs;
+ char *help_command;
+@@ -736,6 +740,9 @@ doc_menu_cb (GtkMenuItem *menuitem, gpoi
+ strcat (help_command, " ) &");
+ system (help_command);
+ free (help_command);
++#endif /*JWZ_HELP*/
++
++ system (sun_help_command);
+ }
+
+
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2002-04-13 03:27:02.000000000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:48:24.232166000 -0700
+@@ -240,9 +240,9 @@ xscreensaver %s, copyright (c) 1991-2002
+ xscreensaver &\n\
+ xscreensaver-demo\n\
+ \n\
+- For updates, online manual, and FAQ, please see the web page:\n\
++ Please read the man page on xscreensaver:\n\
+ \n\
+- http://www.jwz.org/xscreensaver/\n\
++ man xscreensaver/\n\
+ \n",
+ si->version);
+ fflush (stdout);
+@@ -340,9 +340,6 @@ saver_ehandler (Display *dpy, XErrorEven
+ " file in your bug report. *DO NOT* mail the core file itself!\n"
+ " That won't work.\n"
+ "\n"
+- " http://www.jwz.org/xscreensaver/bugs.html explains how to create\n"
+- " the most useful bug reports, and how to examine core files.\n"
+- "\n"
+ " The more information you can provide, the better. But please\n"
+ " report this bug, regardless!\n"
+ "\n");
+@@ -409,11 +406,6 @@ startup_ehandler (String name, String ty
+ blurb());
+ }
+
+- fprintf (stderr, "\n"
+- " http://www.jwz.org/xscreensaver/faq.html\n"
+- " http://www.jwz.org/xscreensaver/man.html\n"
+- "\n");
+-
+ fflush (stderr);
+ fflush (stdout);
+ exit (1);
+@@ -619,8 +611,7 @@ process_command_line (saver_info *si, in
+ The `xscreensaver' program is a daemon that runs in the background.\n\
+ You control a running xscreensaver process by sending it messages\n\
+ with `xscreensaver-demo' or `xscreensaver-command'.\n\
+-. See the man pages for details, or check the web page:\n\
+- http://www.jwz.org/xscreensaver/\n\n");
++. See the man pages for details.\n\n");
+
+ /* Since version 1.21 renamed the "-lock" option to "-lock-mode",
+ suggest that explicitly. */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/dpms.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Miscellaneous DPMS fixes, including:
+- Allow xset dpms settings to override .xscreensaver.
+- Changed dpms hack of not allowing to run a hack if system did not support
+ DPMS, for sunray performance issues. Now, we check if hack dir exists and
+ not use DPMS support before running a hack.
+
+
+diff -urp -x '*~' driver/timers.c driver/timers.c
+--- driver/timers.c 2006-05-10 08:49:10.952391000 -0700
++++ driver/timers.c 2006-05-10 08:49:17.369181000 -0700
+@@ -1387,13 +1387,17 @@ watchdog_timer (XtPointer closure, XtInt
+
+ /* If the DPMS settings on the server have changed, change them back to
+ what ~/.xscreensaver says they should be. */
+- sync_server_dpms_settings (si->dpy,
++ /* mali- No!! if someone uses xset then let the changes be picked by
++ * xscreensaver...do not have to regulate everything from .xscreensaver.
++ ***/
++ /**sync_server_dpms_settings (si->dpy,
+ (p->dpms_enabled_p &&
+ p->mode != DONT_BLANK),
+ p->dpms_standby / 1000,
+ p->dpms_suspend / 1000,
+ p->dpms_off / 1000,
+ False);
++ **/
+
+ if (p->verbose_p)
+ fprintf (stderr, "--->watchdog_timer()\n");
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:49:10.960069000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:49:17.373784000 -0700
+@@ -1380,6 +1380,11 @@ while (debug_flag)
+ init_sigchld ();
+
+ disable_builtin_screensaver (si, True);
++
++/*****
++ mali- this may need to be taken out in future if it hinders user
++ setting dpms values through xset.
++ *****/
+ sync_server_dpms_settings (si->dpy,
+ (p->dpms_enabled_p &&
+ p->mode != DONT_BLANK),
+diff -urp -x '*~' driver/xset.c driver/xset.c
+--- driver/xset.c 2006-05-10 08:49:10.891006000 -0700
++++ driver/xset.c 2006-05-10 08:49:17.372412000 -0700
+@@ -491,15 +491,33 @@ monitor_powered_on_p (saver_info *si)
+ result = True;
+
+ else if (!DPMSCapable(si->dpy))
++ {
+ /* Server says the monitor doesn't do power management -- so it's on. */
+- result = True;
++ /* mali- No, for sunrays if dpms is not working we dont want hacks to run */
++ if (si->prefs.verbose_p)
++ {
++ fprintf(stderr, "Monitor is not DPMSCapable!!\n");
++ fflush(stderr);
++ }
++ result = True;
++ }
+
+ else
+ {
++
+ DPMSInfo(si->dpy, &state, &onoff);
++ if (si->prefs.verbose_p)
++ {
++ fprintf(stderr, "DPMSInfo returned onoff=%d and state=%d\n", onoff, state);
++ fflush(stderr);
++ }
++
+ if (!onoff)
++ {
+ /* Server says DPMS is disabled -- so the monitor is on. */
+- result = True;
++ /*mali no if DPMS is diabled then still run hacks **/
++ result = True;
++ }
+ else
+ switch (state) {
+ case DPMSModeOn: result = True; break; /* really on */
+@@ -516,14 +534,17 @@ monitor_powered_on_p (saver_info *si)
+ void
+ monitor_power_on (saver_info *si)
+ {
+- if (!monitor_powered_on_p (si))
++ if (!monitor_powered_on_p (si) && si->prefs.dpms_enabled_p)
+ {
++return;
++/***mali causing BadMatch X Error
+ DPMSForceLevel(si->dpy, DPMSModeOn);
+ XSync(si->dpy, False);
+ if (!monitor_powered_on_p (si))
+ fprintf (stderr,
+ "%s: DPMSForceLevel(dpy, DPMSModeOn) did not power the monitor on?\n",
+ blurb());
++****/
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/gl-error-capture.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+4832530 - xscreensaver shows improper message if no libGL installed
+Capture stderr from subproc in get_best_gl_visual
+
+
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2006-05-10 08:49:23.643545000 -0700
++++ driver/subprocs.c 2006-05-10 08:49:29.616989000 -0700
+@@ -1029,6 +1029,10 @@ get_best_gl_visual (saver_screen_info *s
+ pid_t forked;
+ int fds [2];
+ int in, out;
++/* Begin: SUN addition: capture stderr as well */
++ int errfds[2];
++ int errin, errout;
++/* End: SUN addition: capture stderr as well */
+ char buf[1024];
+
+ char *av[10];
+@@ -1046,6 +1050,20 @@ get_best_gl_visual (saver_screen_info *s
+ in = fds [0];
+ out = fds [1];
+
++/* Begin: SUN addition: capture stderr as well */
++ if (!si->prefs.verbose_p)
++ {
++ if (pipe (errfds))
++ {
++ perror ("error creating pipe:");
++ return 0;
++ }
++
++ errin = errfds [0];
++ errout = errfds [1];
++ }
++/* End: SUN addition: capture stderr as well */
++
+ switch ((int) (forked = fork ()))
+ {
+ case -1:
+@@ -1066,6 +1084,17 @@ get_best_gl_visual (saver_screen_info *s
+ perror ("could not dup() a new stdout:");
+ return 0;
+ }
++/* Begin: SUN addition: capture stderr as well */
++ if (! si->prefs.verbose_p)
++ {
++ close(errin);
++ if (dup2 (errout, STDERR_FILENO) < 0)
++ {
++ perror ("could not dup() a new stderr:");
++ return 0;
++ }
++ }
++/* End: SUN addition: capture stderr as well */
+ hack_subproc_environment (ssi); /* set $DISPLAY */
+
+ execvp (av[0], av); /* shouldn't return. */
+@@ -1095,6 +1124,14 @@ get_best_gl_visual (saver_screen_info *s
+ fgets (buf, sizeof(buf)-1, f);
+ fclose (f);
+
++/* Begin: SUN addition: capture stderr as well */
++ if (! si->prefs.verbose_p)
++ {
++ close (errout);
++ close (errin);
++ }
++/* End: SUN addition: capture stderr as well */
++
+ /* Wait for the child to die. */
+ waitpid (-1, &wait_status, 0);
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/gtk-lock.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,2999 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Solaris uses the gtk unlock dialog program originally written by
+Ximian & Wipro, in order to provide a dialog box that works with
+the GNOME accessibility framework. This was done as a fork of
+the original xscreensaver because the maintainer would not allow
+use of a toolkit in the lock dialog - he has since softened his
+stance a bit, but this has not been presented to him to see if it
+meets his requirements as spelled out at:
+ http://www.jwz.org/xscreensaver/toolkits.html
+
+This file contains changes to the existing xscreensaver source to
+enable that - the lock dialog itself is contained in the separate
+file sun-src/driver/lock-Gtk.c.
+
+This file also contains changes to make the pam code in xscreensaver
+act more like a correct pam client, allowing different interaction
+models than just a single password for authentication.
+
+diff -urp -x '*~' config.h.in config.h.in
+--- config.h.in 2002-05-28 17:44:37.000000000 -0700
++++ config.h.in 2006-05-10 08:48:29.922847000 -0700
+@@ -147,6 +147,10 @@
+ */
+ #undef HAVE_GTK2
+
++/* Define this to build the external lock dialog
++ */
++#undef HAVE_XSCREENSAVER_LOCK
++
+ /* Define this if you have Gnome and want to build support for the
+ xscreensaver control panel in the Gnome Control Center (gnomecc).
+ (This is needed only with Gtk 1.x.)
+diff -urp -x '*~' configure.in configure.in
+--- configure.in 2006-05-10 08:48:24.125209000 -0700
++++ configure.in 2006-05-10 08:48:29.922219000 -0700
+@@ -1462,7 +1462,7 @@ if test "$enable_locking" = yes -a "$wit
+ if test "$ac_cv_pam" = yes ; then
+ have_pam=yes
+ AC_DEFINE(HAVE_PAM)
+- PASSWD_LIBS="${PASSWD_LIBS} -lpam"
++ PASSWD_LIBS="${PASSWD_LIBS} -lcmd -lpam"
+
+ # libpam typically requires dlopen and dlsym. On FreeBSD,
+ # those are in libc. On Linux and Solaris, they're in libdl.
+@@ -1943,11 +1943,16 @@ if test "$with_gtk" = yes; then
+ pkg_check_version gmodule-2.0 2.0.0
+ pkg_check_version libxml-2.0 2.4.6
+ pkg_check_version libglade-2.0 1.99.0
++ pkg_check_version gconf-2.0 2.6.1
++ pkg_check_version libloginhelper-1.0 1.0
+ have_gtk="$ok"
+
+ if test "$have_gtk" = yes; then
+ have_gtk2=yes
+ AC_DEFINE(HAVE_GTK2)
++#--- Begin SUNW addition
++ AC_DEFINE(HAVE_XSCREENSAVER_LOCK)
++#--- End SUNW addition
+ else
+ if test -n "$ac_gtk_version_string" ; then
+ gtk2_halfassed="$ac_gtk_version_string"
+@@ -3256,6 +3261,28 @@ if test "$have_gtk" = yes; then
+ ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
+ fi
+
++#--- Begin SUNW addition
++PREFERRED_LOCK_PROGRAM=
++ALL_LOCK_PROGRAMS=
++LOCK_PROGRAM=
++if test "$have_gtk2" = yes; then
++ PREFERRED_LOCK_PROGRAM=xscreensaver-lock-Gtk
++ ALL_LOCK_PROGRAMS="$PREFERRED_LOCK_PROGRAM $ALL_LOCK_PROGRAMS"
++ LOCK_PROGRAM=xscreensaver-lock
++fi
++
++if test -r driver/sunlogo.xpm ; then
++ XPM_LOGO_FILE=sunlogo.xpm
++ XPM_LOGO_NAME=sunlogo_xpm
++else
++ XPM_LOGO_FILE=../utils/images/logo-180.xpm
++ XPM_LOGO_NAME=logo_180_xpm
++fi
++
++AC_SUBST([XPM_LOGO_FILE])
++AC_SUBST([XPM_LOGO_NAME])
++
++#--- End SUNW addition
+
+ if test "$have_kerberos" = yes; then
+ PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
+@@ -3387,6 +3414,11 @@ AC_SUBST(INCLUDES)
+
+ AC_SUBST(PREFERRED_DEMO_PROGRAM)
+ AC_SUBST(ALL_DEMO_PROGRAMS)
++#--- Begin SUNW addition
++AC_SUBST(PREFERRED_LOCK_PROGRAM)
++AC_SUBST(ALL_LOCK_PROGRAMS)
++AC_SUBST(LOCK_PROGRAM)
++#--- End SUNW addition
+ AC_SUBST(SAVER_LIBS)
+ AC_SUBST(MOTIF_LIBS)
+ AC_SUBST(GTK_LIBS)
+@@ -3855,7 +3887,8 @@ HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" |
+
+
+ # Sanity check the hackdir
+-for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do
++# SUNW addition: added xscreensaver-lock to list on next line
++for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command xscreensaver-lock ; do
+ if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then
+ echo ""
+ AC_MSG_ERROR([\"--with-hackdir=${bindir}/${bad_choice}\" won't work.
+diff -urp -x '*~' driver/Makefile.in driver/Makefile.in
+--- driver/Makefile.in 2002-06-11 02:09:07.000000000 -0700
++++ driver/Makefile.in 2006-05-10 08:48:29.938067000 -0700
+@@ -14,6 +14,7 @@ install_prefix =
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+ bindir = @bindir@
++libexecdir = @libexecdir@
+ mandir = @mandir@
+ man1dir = $(mandir)/man1
+ mansuffix = 1
+@@ -30,6 +31,7 @@ GNOME_PANELDIR = @GNOME_PANELDIR@
+ GLADE_DATADIR = @GLADE_DATADIR@
+ GNOME_BINDIR = $(bindir)
+ HACK_CONF_DIR = @HACK_CONF_DIR@
++LOCK_DIR = $(libexecdir)
+
+ CC = @CC@
+ CFLAGS = @CFLAGS@
+@@ -39,6 +41,7 @@ INTL_DEFS = -DLOCALEDIR=\"$(localedir)\"
+ SUBP_DEFS = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"'
+ GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GLADE_DATADIR)"'
+ CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"'
++LOCK_DEFS = $(DEFS) -DLOCKDIR=\"$(LOCK_DIR)\"
+
+ LIBS = @LIBS@
+ INTL_LIBS = @INTLLIBS@
+@@ -95,6 +98,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 remote.c
++GTK_LOCK_OBJS = lock-Gtk.o remote.o
+
+ PWENT_SRCS = passwd-pwent.c
+ PWENT_OBJS = passwd-pwent.o
+@@ -199,8 +204,8 @@ GETIMG_LIBS = $(LIBS) $(X_LIBS) $(XPM_LI
+ $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS)
+
+ EXES = xscreensaver xscreensaver-command xscreensaver-demo \
+- xscreensaver-getimage
+-EXES2 = @ALL_DEMO_PROGRAMS@
++ xscreensaver-getimage @LOCK_PROGRAM@
++EXES2 = @ALL_DEMO_PROGRAMS@ @ALL_LOCK_PROGRAMS@
+ SCRIPTS = xscreensaver-getimage-file xscreensaver-getimage-video
+
+ HDRS = XScreenSaver_ad.h xscreensaver.h prefs.h remote.h \
+@@ -222,7 +227,7 @@ VMSFILES = compile_axp.com compile_decc.
+ vms_axp.opt vms_axp_12.opt vms_decc.opt vms_decc_12.opt
+
+ TARFILES = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) \
+- $(MOTIF_SRCS) $(GTK_SRCS) $(PWENT_SRCS) \
++ $(MOTIF_SRCS) $(GTK_SRCS) $(GTK_LOCK_SRCS) $(PWENT_SRCS) \
+ $(KERBEROS_SRCS) $(PAM_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) \
+ $(CMD_SRCS) $(GETIMG_SRCS_1) $(HDRS) $(SCRIPTS) \
+ $(TEST_SRCS) $(MEN)
+@@ -245,6 +250,9 @@ install-program: $(EXES)
+ @if [ ! -d $(install_prefix)$(bindir) ]; then \
+ $(INSTALL_DIRS) $(install_prefix)$(bindir) ; \
+ fi
++ @if [ -n "@LOCK_PROGRAM@" -a ! -d $(install_prefix)$(LOCK_DIR) ]; then \
++ $(INSTALL_DIRS) $(install_prefix)$(LOCK_DIR) ; \
++ fi
+ @inst="$(INSTALL_PROGRAM)" ; \
+ if [ @NEED_SETUID@ = yes ]; then \
+ me=`PATH="$$PATH:/usr/ucb" whoami` ; \
+@@ -280,6 +288,12 @@ install-program: $(EXES)
+ $(install_prefix)$(bindir)/xscreensaver-getimage ; \
+ $(INSTALL_PROGRAM) xscreensaver-getimage \
+ $(install_prefix)$(bindir)/xscreensaver-getimage
++ @if [ -n "@LOCK_PROGRAM@" ]; then \
++ 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 \
+@@ -767,13 +781,18 @@ $(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) $<
+
+ # subprocs takes an extra -D option.
+ subprocs.o: subprocs.c
+ $(CC) -c $(INCLUDES) $(SUBP_DEFS) $(CFLAGS) $(X_CFLAGS) \
+ $(srcdir)/subprocs.c
+
++# lock takes an extra -D option.
++lock.o:
++ $(CC) -c $(INCLUDES) $(LOCK_DEFS) $(CFLAGS) $(X_CFLAGS) \
++ $(srcdir)/lock.c
++
+ # demo-Gtk takes extra -D options, and an extra -I option.
+ demo-Gtk.o: demo-Gtk.c
+ $(CC) -c $(INCLUDES) $(SUBP_DEFS) -I$(ICON_SRC) \
+@@ -785,6 +804,14 @@ demo-Gtk-conf.o: demo-Gtk-conf.c
+ $(CC) -c $(INCLUDES) $(CONF_DEFS) $(GTK_DEFS) $(CFLAGS) $(X_CFLAGS) \
+ $(srcdir)/demo-Gtk-conf.c
+
++# lock-Gtk takes extra -D and -I options.
++GTK_LOCK_LOGO_DEFS=-DXPM_LOGO_FILE=\"@XPM_LOGO_FILE@\" \
++ -DXPM_LOGO_NAME=@XPM_LOGO_NAME@
++
++lock-Gtk.o: lock-Gtk.c
++ $(CC) -c $(INCLUDES) -I$(ICON_SRC) $(GTK_DEFS) \
++ $(CFLAGS) $(X_CFLAGS) $(INTL_DEFS) $(GTK_LOCK_LOGO_DEFS) \
++ $(srcdir)/lock-Gtk.c
+
+ # How we build the default app-defaults file into the program.
+ #
+@@ -806,6 +833,15 @@ xscreensaver-demo: @PREFERRED_DEMO_PROGR
+ cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@
+ # $(INSTALL_PROGRAM) @PREFERRED_DEMO_PROGRAM@ $@
+
++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 \
+@@ -821,7 +857,7 @@ xscreensaver-getimage: $(GETIMG_OBJS)
+
+
+ TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PASSWD_OBJS) \
+- subprocs.o setuid.o splash.o prefs.o \
++ subprocs.o setuid.o splash.o prefs.o exec.o stderr.o \
+ $(SAVER_UTIL_OBJS)
+ test-passwd.o: XScreenSaver_ad.h
+
+diff -urp -x '*~' driver/dpms.c driver/dpms.c
+--- driver/dpms.c 2001-03-22 10:10:53.000000000 -0800
++++ driver/dpms.c 2006-05-10 08:48:29.971953000 -0700
+@@ -16,6 +16,7 @@
+
+ #include <stdio.h>
+ #include <X11/Xlib.h>
++# include <X11/Intrinsic.h>
+
+ #ifdef HAVE_DPMS_EXTENSION
+
+diff -urp -x '*~' driver/lock.c driver/lock.c
+--- driver/lock.c 2002-03-05 18:15:03.000000000 -0800
++++ driver/lock.c 2006-05-10 08:48:29.981598000 -0700
+@@ -21,6 +21,8 @@
+ #include <X11/Xos.h> /* for time() */
+ #include <time.h>
+ #include <sys/time.h>
++#include <errno.h>
++#include <signal.h>
+ #include "xscreensaver.h"
+ #include "resources.h"
+
+@@ -68,281 +70,428 @@ vms_passwd_valid_p(char *pw, Bool verbos
+ # define passwd_valid_p vms_passwd_valid_p
+
+ #endif /* VMS */
++
++extern void await_dying_children (saver_info *si);
++void hack_uid (saver_info *si);
+
++Bool g_passwd_dialog_created = 0;
+
+ #undef MAX
+ #define MAX(a,b) ((a)>(b)?(a):(b))
+
+ enum passwd_state { pw_read, pw_ok, pw_null, pw_fail, pw_cancel, pw_time };
+
+-struct passwd_dialog_data {
+
+- saver_screen_info *prompt_screen;
+- int previous_mouse_x, previous_mouse_y;
+
+- enum passwd_state state;
+- char typed_passwd [80];
+- XtIntervalId timer;
+- int i_beam;
+-
+- float ratio;
+- Position x, y;
+- Dimension width;
+- Dimension height;
+- Dimension border_width;
+-
+- char *heading_label;
+- char *body_label;
+- char *user_label;
+- char *passwd_label;
+- char *date_label;
+- char *user_string;
+- char *passwd_string;
+-
+- XFontStruct *heading_font;
+- XFontStruct *body_font;
+- XFontStruct *label_font;
+- XFontStruct *passwd_font;
+- XFontStruct *date_font;
+-
+- Pixel foreground;
+- Pixel background;
+- Pixel passwd_foreground;
+- Pixel passwd_background;
+- Pixel thermo_foreground;
+- Pixel thermo_background;
+- Pixel shadow_top;
+- Pixel shadow_bottom;
+-
+- Dimension logo_width;
+- Dimension 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 thermo_field_x, thermo_field_y;
+- Dimension thermo_field_height;
+-
+- Pixmap logo_pixmap;
+- int logo_npixels;
+- unsigned long *logo_pixels;
+
+- Pixmap save_under;
+-};
+
++
++
++
++
++
++static void make_window (saver_info *si, enum window_type w_type);
+ static void draw_passwd_window (saver_info *si);
+-static void update_passwd_window (saver_info *si, const char *printed_passwd,
++void update_passwd_window (saver_info *si, const char *printed_passwd,
+ float ratio);
+-static void destroy_passwd_window (saver_info *si);
++void destroy_passwd_window (saver_info *si);
+ static void undo_vp_motion (saver_info *si);
+
++extern Atom XA_UNLOCK_RATIO;
+
+-static void
++#if defined (HAVE_XF86VMODE) || defined (HAVE_XSCREENSAVER_LOCK)
++static Bool vp_got_error = False;
++
++static int
++ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error)
++{
++ vp_got_error = True;
++ return 0;
++}
++#endif /* defined (HAVE_XF86VMODE) || defined (HAVE_XSCREENSAVER_LOCK) */
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++
++int
++write_to_child (saver_info* si, char* msg)
++{
++ if (si->external_passwd && g_passwd_dialog_created && si->pw_data->stdin_fd != -1)
++ {
++ ssize_t len;
++ char *nlmsg;
++
++ nlmsg = (char *)malloc (strlen (msg) + 2);
++ sprintf (nlmsg, "%s\n", msg);
++
++ if (si->prefs.verbose_p)
++ {
++ fprintf (stderr, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
++ fprintf (stderr, "HAVE_SCRSVR_LOCK message is:%s writing to fd:%d\n",
++ msg, si->pw_data->stdin_fd);
++ fprintf (stderr, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
++ }
++
++ write_msg:
++ len = write (si->pw_data->stdin_fd, nlmsg, strlen (nlmsg));
++ if (len < 0 && errno == EINTR)
++ goto write_msg;
++
++ free (nlmsg);
++ return (1);
++ }
++ return (0); /* if we didnt write anything return 0*/
++}
++
++static int
++sane_dup2 (int fd1, int fd2)
++{
++ int ret;
++
++ retry:
++ ret = dup2 (fd1, fd2);
++ if (ret < 0 && errno == EINTR)
++ goto retry;
++
++ return ret;
++}
++
++static int
++close_and_invalidate (int *fd)
++{
++ int ret;
++
++ ret = close (*fd);
++ *fd = -1;
++
++ return ret;
++}
++
++void
++handle_passwd_input (XtPointer data, int *fd, XtInputId *id)
++{
++ saver_info *si = (saver_info *)data;
++ saver_preferences *p = &si->prefs;
++ char buffer[1024];
++ char *s;
++
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "passwd input handler() fd=%d\n",*fd);
++
++ s = fgets (buffer, sizeof (buffer), si->pw_data->input_file);
++ if (!s)
++ {
++ if (si->prefs.verbose_p)
++ {
++ fprintf (stderr, "done reading...\n");
++ fprintf (stderr, "removing input handler...\n");
++ }
++ XtRemoveInput (*id);
++ si->pw_data->stdout_input_id = 0;
++
++ if (si->pw_data->state == pw_read)
++ si->pw_data->state = pw_null;
++
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "passwd input handler() returning...done reading\n");
++
++ return;
++ }
++
++ if (si->pw_data->got_windowid)
++ {
++ char *nl;
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "got a password\n");
++ nl = strchr (s, '\n');
++ if (nl)
++ *nl = '\0';
++ si->pw_data->passwd_string = strdup (s);
++ if (si->prefs.verbose_p)
++ fprintf(stderr,"Dude got password and saving it in passwd_string:%s\n", s);
++
++ /* We want to send null to lock dialog to say we are working on authentication*/
++ si->pw_data->state = pw_null;
++ }
++ else /* Get the window id of lock dialog from Child ***/
++ {
++ Window window = strtoul (s, NULL, 0);
++ /* FIXME: what to revert to? */
++ XSetInputFocus (si->dpy, window, RevertToParent, CurrentTime);
++ XSync (si->dpy, False);
++ si->pw_data->got_windowid = True;
++ si->passwd_dialog = window;
++ /**g_passwd_dialog_created = True;**/ /*set global flag to check in timers.c*/
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "<---handle_passwd_input(): gotwindowid:0x%x\n", passwd_win);
++ }
++}
++
++/* returns successful fork/exec */
++Bool
++spawn_external_passwd_process (saver_info *si, passwd_dialog_data *pw)
++{
++ saver_preferences *p = &si->prefs;
++ pid_t forked;
++ const char *command = LOCKDIR "/xscreensaver-lock";
++ int stdin_pipe[2] = { -1, -1 };
++ int stdout_pipe[2] = { -1, -1 };
++
++ si->passwd_pid = 0;
++ pw->stdin_fd = pw->stdout_fd = -1;
++ pw->got_windowid = False;
++
++ if (si->prefs.verbose_p)
++ fprintf(stderr, "-->spawn_external_passwd()\n");
++
++ if (pipe (stdin_pipe) < 0)
++ {
++ perror ("pipe(stdin_pipe) failed!");
++ return False;
++ }
++
++ if (pipe (stdout_pipe) < 0)
++ {
++ perror ("pipe(stdout_pipe) failed!");
++ close_and_invalidate (&stdin_pipe[0]);
++ close_and_invalidate (&stdin_pipe[1]);
++ return False;
++ }
++ switch ((int) (forked = fork ()))
++ {
++ case -1:
++ fprintf (stderr, "%s: ", blurb ());
++ perror ("couldn't fork");
++
++ close_and_invalidate (&stdin_pipe[0]);
++ close_and_invalidate (&stdin_pipe[1]);
++ close_and_invalidate (&stdout_pipe[0]);
++ close_and_invalidate (&stdout_pipe[1]);
++
++ return False;
++
++ case 0:
++ close (ConnectionNumber (si->dpy)); /* close display fd */
++ /* limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); */
++ /* hack_subproc_environment (ssi); */ /* FIX $DISPLAY */
++
++ /* Inside Child Process */
++ if (p->verbose_p)
++ fprintf (stderr, "%s: spawning \"%s\" in pid %lu.\n",
++ blurb(), command, (unsigned long) getpid ());
++
++ close_and_invalidate (&stdin_pipe[1]);
++ close_and_invalidate (&stdout_pipe[0]);
++
++ sane_dup2 (stdin_pipe[0], 0); /* Listen to Parent from here */
++ sane_dup2 (stdout_pipe[1], 9); /* Talk to Parent from here */
++
++ /* Make sure we have relinquished setuid privs or lock dialog gtk
++ * program will not run as libgtk is not setuid safe.
++ */
++ hack_uid (si);
++
++ exec_command (p->shell, command, 0);
++ /* print_path_error (command); */
++ fprintf (stderr, "%s: couldn't exec: %s\n",
++ blurb (), command);
++ abort ();
++
++ default:
++
++ /* In Parent */
++ close_and_invalidate (&stdin_pipe[0]);
++ close_and_invalidate (&stdout_pipe[1]);
++
++ sane_dup2 (stdin_pipe[0], 0); /* Listen to Child from here */
++ sane_dup2 (stdout_pipe[1], 13); /* Talk to Child from here */
++
++ pw->stdin_fd = stdin_pipe[1]; /* Talk to child from here */
++ pw->stdout_fd = stdout_pipe[0]; /* Listen to Child from here */
++ si->passwd_pid = forked;
++
++ write_to_child (si, "Hello There"); /* Send a test message to Child */
++
++ /* Password from child dialog comes through this pipe/fd */
++ pw->input_file = fdopen (pw->stdout_fd, "r");
++
++ pw->stdout_input_id = XtAppAddInput (si->app, pw->stdout_fd,
++ (XtPointer) XtInputReadMask,
++ handle_passwd_input,
++ si);
++
++ /* Set global flag to indicate that lock dialog is visible */
++ g_passwd_dialog_created = True;
++ return True;
++ }
++
++ /* shouldn't reach */
++ abort ();
++ return False;
++}
++#endif /* HAVE_XSCREENSAVER_LOCK */
++
++void
+ make_passwd_window (saver_info *si)
+ {
++ make_window(si, w_dialog);
++}
++
++
++static void
++make_window (saver_info *si, enum window_type w_type)
++{
+ struct passwd *p = getpwuid (getuid ());
+ XSetWindowAttributes attrs;
+ unsigned long attrmask = 0;
+- passwd_dialog_data *pw = (passwd_dialog_data *) calloc (1, sizeof(*pw));
+ Screen *screen;
+ Colormap cmap;
+ char *f;
+
+- pw->prompt_screen = &si->screens [mouse_screen (si)];
+ if (si->prefs.verbose_p)
+- fprintf (stderr, "%s: %d: creating password dialog.\n",
+- blurb(), pw->prompt_screen->number);
++ fprintf(stderr, "-->make_window()\n");
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++ if (spawn_external_passwd_process (si, si->pw_data))
++ {
++/***************
++ if (si->prefs.verbose_p)
++ fprintf(stderr, "spawning external passwd process in make_window()\n");
++*******************/
++
++/****************mali blank_fails remove this...
++ if(!blank_screen(si))
++ fprintf(stderr, "Failed to blank the screen\n");
++*******************/
++
++ si->pw_data->ratio = 1.0;
++ si->pw_data->w_type = w_type;
++ /*si->pw_data = pw;*/
++ si->external_passwd = True;
++ return;
++ }
++ si->external_passwd = False;
++ /* FIXME: don't abort() */
++ /*abort ();*/
++#endif /* HAVE_XSCREENSAVER_LOCK */
++
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "creating message window\n");
+
+- screen = pw->prompt_screen->screen;
++ si->pw_data->prompt_screen = &si->screens [mouse_screen (si)];
++ /*mali pw->prompt_screen = &si->screens[0]; hardwired for now */
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "%s: %d: creating message window.\n",
++ blurb(), si->pw_data->prompt_screen->number);
++
++ screen = si->pw_data->prompt_screen->screen;
+ cmap = DefaultColormapOfScreen (screen);
+
+- pw->ratio = 1.0;
++ si->pw_data->w_type = w_type;
++ si->pw_data->state = pw_read;
++ si->pw_data->ratio = 1.0;
+
+- pw->heading_label = get_string_resource ("passwd.heading.label",
++ si->pw_data->heading_label = get_string_resource ("passwd.heading.label",
+ "Dialog.Label.Label");
+- pw->body_label = get_string_resource ("passwd.body.label",
+- "Dialog.Label.Label");
+- pw->user_label = get_string_resource ("passwd.user.label",
+- "Dialog.Label.Label");
+- pw->passwd_label = get_string_resource ("passwd.passwd.label",
+- "Dialog.Label.Label");
+- pw->date_label = get_string_resource ("dateFormat", "DateFormat");
+-
+- if (!pw->heading_label)
+- pw->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
+- if (!pw->body_label)
+- pw->body_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
+- if (!pw->user_label) pw->user_label = strdup("ERROR");
+- if (!pw->passwd_label) pw->passwd_label = strdup("ERROR");
+- if (!pw->date_label) pw->date_label = strdup("ERROR");
++ si->pw_data->date_label = get_string_resource ("dateFormat", "DateFormat");
++
++ if (!si->pw_data->heading_label)
++ si->pw_data->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
++ if (!si->pw_data->date_label) si->pw_data->date_label = strdup("ERROR");
+
+ /* Put the version number in the label. */
+ {
+- char *s = (char *) malloc (strlen(pw->heading_label) + 20);
+- sprintf(s, pw->heading_label, si->version);
+- free (pw->heading_label);
+- pw->heading_label = s;
++ char *s = (char *) malloc (strlen(si->pw_data->heading_label) + 20);
++ sprintf(s, si->pw_data->heading_label, si->version);
++ free (si->pw_data->heading_label);
++ si->pw_data->heading_label = s;
+ }
+
+- pw->user_string = strdup (p && p->pw_name ? p->pw_name : "???");
+- pw->passwd_string = strdup("");
+-
+ f = get_string_resource ("passwd.headingFont", "Dialog.Font");
+- pw->heading_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+- if (!pw->heading_font) pw->heading_font = XLoadQueryFont (si->dpy, "fixed");
++ si->pw_data->heading_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
++ if (!si->pw_data->heading_font) si->pw_data->heading_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("passwd.bodyFont", "Dialog.Font");
+- pw->body_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+- if (!pw->body_font) pw->body_font = XLoadQueryFont (si->dpy, "fixed");
+- if (f) free (f);
+-
+- f = get_string_resource("passwd.labelFont", "Dialog.Font");
+- pw->label_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+- if (!pw->label_font) pw->label_font = XLoadQueryFont (si->dpy, "fixed");
+- if (f) free (f);
+-
+- f = get_string_resource("passwd.passwdFont", "Dialog.Font");
+- pw->passwd_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+- if (!pw->passwd_font) pw->passwd_font = XLoadQueryFont (si->dpy, "fixed");
++ si->pw_data->body_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
++ if (!si->pw_data->body_font) si->pw_data->body_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("passwd.dateFont", "Dialog.Font");
+- pw->date_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+- if (!pw->date_font) pw->date_font = XLoadQueryFont (si->dpy, "fixed");
++ si->pw_data->date_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
++ if (!si->pw_data->date_font) si->pw_data->date_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+- pw->foreground = get_pixel_resource ("passwd.foreground",
++ si->pw_data->foreground = get_pixel_resource ("passwd.foreground",
+ "Dialog.Foreground",
+ si->dpy, cmap);
+- pw->background = get_pixel_resource ("passwd.background",
++ si->pw_data->background = get_pixel_resource ("passwd.background",
+ "Dialog.Background",
+ si->dpy, cmap);
+
+- if (pw->foreground == pw->background)
++ if (si->pw_data->foreground == si->pw_data->background)
+ {
+ /* Make sure the error messages show up. */
+- pw->foreground = BlackPixelOfScreen (screen);
+- pw->background = WhitePixelOfScreen (screen);
++ si->pw_data->foreground = BlackPixelOfScreen (screen);
++ si->pw_data->background = WhitePixelOfScreen (screen);
+ }
+
+- pw->passwd_foreground = get_pixel_resource ("passwd.text.foreground",
+- "Dialog.Text.Foreground",
+- si->dpy, cmap);
+- pw->passwd_background = get_pixel_resource ("passwd.text.background",
+- "Dialog.Text.Background",
+- si->dpy, cmap);
+- pw->thermo_foreground = get_pixel_resource ("passwd.thermometer.foreground",
++ si->pw_data->thermo_foreground = get_pixel_resource ("passwd.thermometer.foreground",
+ "Dialog.Thermometer.Foreground",
+ si->dpy, cmap);
+- pw->thermo_background = get_pixel_resource ("passwd.thermometer.background",
++ si->pw_data->thermo_background = get_pixel_resource ("passwd.thermometer.background",
+ "Dialog.Thermometer.Background",
+ si->dpy, cmap);
+- pw->shadow_top = get_pixel_resource ("passwd.topShadowColor",
++ si->pw_data->shadow_top = get_pixel_resource ("passwd.topShadowColor",
+ "Dialog.Foreground",
+ si->dpy, cmap);
+- pw->shadow_bottom = get_pixel_resource ("passwd.bottomShadowColor",
++ si->pw_data->shadow_bottom = get_pixel_resource ("passwd.bottomShadowColor",
+ "Dialog.Background",
+ si->dpy, cmap);
+
+- pw->logo_width = get_integer_resource ("passwd.logo.width",
++ si->pw_data->logo_width = get_integer_resource ("passwd.logo.width",
+ "Dialog.Logo.Width");
+- pw->logo_height = get_integer_resource ("passwd.logo.height",
++ si->pw_data->logo_height = get_integer_resource ("passwd.logo.height",
+ "Dialog.Logo.Height");
+- pw->thermo_width = get_integer_resource ("passwd.thermometer.width",
++ si->pw_data->thermo_width = get_integer_resource ("passwd.thermometer.width",
+ "Dialog.Thermometer.Width");
+- pw->internal_border = get_integer_resource ("passwd.internalBorderWidth",
++ si->pw_data->internal_border = get_integer_resource ("passwd.internalBorderWidth",
+ "Dialog.InternalBorderWidth");
+- pw->shadow_width = get_integer_resource ("passwd.shadowThickness",
++ si->pw_data->shadow_width = get_integer_resource ("passwd.shadowThickness",
+ "Dialog.ShadowThickness");
+
+- if (pw->logo_width == 0) pw->logo_width = 150;
+- if (pw->logo_height == 0) pw->logo_height = 150;
+- if (pw->internal_border == 0) pw->internal_border = 15;
+- if (pw->shadow_width == 0) pw->shadow_width = 4;
+- if (pw->thermo_width == 0) pw->thermo_width = pw->shadow_width;
++ if (si->pw_data->logo_width == 0) si->pw_data->logo_width = 150;
++ if (si->pw_data->logo_height == 0) si->pw_data->logo_height = 150;
++ if (si->pw_data->internal_border == 0) si->pw_data->internal_border = 15;
++ if (si->pw_data->shadow_width == 0) si->pw_data->shadow_width = 4;
++ if (si->pw_data->thermo_width == 0) si->pw_data->thermo_width = si->pw_data->shadow_width;
+
+ {
+ int direction, ascent, descent;
+ XCharStruct overall;
+
+- pw->width = 0;
+- pw->height = 0;
++ si->pw_data->width = 0;
++ si->pw_data->height = 0;
+
+ /* Measure the heading_label. */
+- XTextExtents (pw->heading_font,
+- pw->heading_label, strlen(pw->heading_label),
++ XTextExtents (si->pw_data->heading_font,
++ si->pw_data->heading_label, strlen(si->pw_data->heading_label),
+ &direction, &ascent, &descent, &overall);
+- if (overall.width > pw->width) pw->width = overall.width;
+- pw->height += ascent + descent;
++ if (overall.width > si->pw_data->width) si->pw_data->width = overall.width;
++ si->pw_data->height += ascent + descent;
+
+- /* Measure the body_label. */
+- XTextExtents (pw->body_font,
+- pw->body_label, strlen(pw->body_label),
+- &direction, &ascent, &descent, &overall);
+- if (overall.width > pw->width) pw->width = overall.width;
+- pw->height += ascent + descent;
++ si->pw_data->width += (si->pw_data->internal_border * 2);
++ si->pw_data->height += (si->pw_data->internal_border * 4);
+
+- {
+- Dimension w2 = 0, w3 = 0;
+- Dimension h2 = 0, h3 = 0;
+- const char *passwd_string = "MMMMMMMMMMMM";
+-
+- /* Measure the user_label. */
+- XTextExtents (pw->label_font,
+- pw->user_label, strlen(pw->user_label),
+- &direction, &ascent, &descent, &overall);
+- if (overall.width > w2) w2 = overall.width;
+- h2 += ascent + descent;
+-
+- /* Measure the passwd_label. */
+- XTextExtents (pw->label_font,
+- pw->passwd_label, strlen(pw->passwd_label),
+- &direction, &ascent, &descent, &overall);
+- if (overall.width > w2) w2 = overall.width;
+- h2 += ascent + descent;
+-
+- /* Measure the user_string. */
+- XTextExtents (pw->passwd_font,
+- pw->user_string, strlen(pw->user_string),
+- &direction, &ascent, &descent, &overall);
+- overall.width += (pw->shadow_width * 4);
+- ascent += (pw->shadow_width * 4);
+- if (overall.width > w3) w3 = overall.width;
+- h3 += ascent + descent;
+-
+- /* Measure the (maximally-sized, dummy) passwd_string. */
+- XTextExtents (pw->passwd_font,
+- passwd_string, strlen(passwd_string),
+- &direction, &ascent, &descent, &overall);
+- overall.width += (pw->shadow_width * 4);
+- ascent += (pw->shadow_width * 4);
+- if (overall.width > w3) w3 = overall.width;
+- h3 += ascent + descent;
+-
+- w2 = w2 + w3 + (pw->shadow_width * 2);
+- h2 = MAX (h2, h3);
+-
+- if (w2 > pw->width) pw->width = w2;
+- pw->height += h2;
+- }
+-
+- pw->width += (pw->internal_border * 2);
+- pw->height += (pw->internal_border * 4);
+-
+- pw->width += pw->thermo_width + (pw->shadow_width * 3);
+-
+- if (pw->logo_height > pw->height)
+- pw->height = pw->logo_height;
+- else if (pw->height > pw->logo_height)
+- pw->logo_height = pw->height;
++ si->pw_data->width += si->pw_data->thermo_width + (si->pw_data->shadow_width * 3);
++
++ if (si->pw_data->logo_height > si->pw_data->height)
++ si->pw_data->height = si->pw_data->logo_height;
++ else if (si->pw_data->height > si->pw_data->logo_height)
++ si->pw_data->logo_height = si->pw_data->height;
+
+- pw->logo_width = pw->logo_height;
++ si->pw_data->logo_width = si->pw_data->logo_height;
+
+- pw->width += pw->logo_width;
++ si->pw_data->width += si->pw_data->logo_width;
+ }
+
+ attrmask |= CWOverrideRedirect; attrs.override_redirect = True;
+@@ -356,22 +505,22 @@ make_passwd_window (saver_info *si)
+ Window pointer_root, pointer_child;
+ int root_x, root_y, win_x, win_y;
+ unsigned int mask;
+- pw->previous_mouse_x = 0;
+- pw->previous_mouse_y = 0;
+- if (XQueryPointer (si->dpy, RootWindowOfScreen (pw->prompt_screen->screen),
++ si->pw_data->previous_mouse_x = 0;
++ si->pw_data->previous_mouse_y = 0;
++ if (XQueryPointer (si->dpy, RootWindowOfScreen (si->pw_data->prompt_screen->screen),
+ &pointer_root, &pointer_child,
+ &root_x, &root_y, &win_x, &win_y, &mask))
+ {
+- pw->previous_mouse_x = root_x;
+- pw->previous_mouse_y = root_y;
++ si->pw_data->previous_mouse_x = root_x;
++ si->pw_data->previous_mouse_y = root_y;
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "%s: %d: mouse is at %d,%d.\n",
+- blurb(), pw->prompt_screen->number,
+- pw->previous_mouse_x, pw->previous_mouse_y);
++ blurb(), si->pw_data->prompt_screen->number,
++ si->pw_data->previous_mouse_x, si->pw_data->previous_mouse_y);
+ }
+ else if (si->prefs.verbose_p)
+ fprintf (stderr, "%s: %d: unable to determine mouse position?\n",
+- blurb(), pw->prompt_screen->number);
++ blurb(), si->pw_data->prompt_screen->number);
+ }
+
+ /* Figure out where on the desktop to place the window so that it will
+@@ -379,31 +528,31 @@ make_passwd_window (saver_info *si)
+ well as Xinerama. */
+ {
+ int x, y, w, h;
+- get_screen_viewport (pw->prompt_screen, &x, &y, &w, &h,
+- pw->previous_mouse_x, pw->previous_mouse_y,
++ get_screen_viewport (si->pw_data->prompt_screen, &x, &y, &w, &h,
++ si->pw_data->previous_mouse_x, si->pw_data->previous_mouse_y,
+ si->prefs.verbose_p);
+ if (si->prefs.debug_p) w /= 2;
+- pw->x = x + ((w + pw->width) / 2) - pw->width;
+- pw->y = y + ((h + pw->height) / 2) - pw->height;
+- if (pw->x < x) pw->x = x;
+- if (pw->y < y) pw->y = y;
++ si->pw_data->x = x + ((w + si->pw_data->width) / 2) - si->pw_data->width;
++ si->pw_data->y = y + ((h + si->pw_data->height) / 2) - si->pw_data->height;
++ if (si->pw_data->x < x) si->pw_data->x = x;
++ if (si->pw_data->y < y) si->pw_data->y = y;
+ }
+
+- pw->border_width = get_integer_resource ("passwd.borderWidth",
++ si->pw_data->border_width = get_integer_resource ("passwd.borderWidth",
+ "Dialog.BorderWidth");
+
+ si->passwd_dialog =
+ XCreateWindow (si->dpy,
+ RootWindowOfScreen(screen),
+- pw->x, pw->y, pw->width, pw->height, pw->border_width,
++ si->pw_data->x, si->pw_data->y, si->pw_data->width, si->pw_data->height, si->pw_data->border_width,
+ DefaultDepthOfScreen (screen), InputOutput,
+ DefaultVisualOfScreen(screen),
+ attrmask, &attrs);
+- XSetWindowBackground (si->dpy, si->passwd_dialog, pw->background);
++ XSetWindowBackground (si->dpy, si->passwd_dialog, si->pw_data->background);
+
+- pw->logo_pixmap = xscreensaver_logo (si->dpy, si->passwd_dialog, cmap,
+- pw->background,
+- &pw->logo_pixels, &pw->logo_npixels,
++ si->pw_data->logo_pixmap = xscreensaver_logo (si->dpy, si->passwd_dialog, cmap,
++ si->pw_data->background,
++ &si->pw_data->logo_pixels, &si->pw_data->logo_npixels,
+ 0, True);
+
+ /* Before mapping the window, save the bits that are underneath the
+@@ -414,18 +563,18 @@ make_passwd_window (saver_info *si)
+ {
+ XGCValues gcv;
+ GC gc;
+- pw->save_under = XCreatePixmap (si->dpy,
+- pw->prompt_screen->screensaver_window,
+- pw->width + (pw->border_width*2) + 1,
+- pw->height + (pw->border_width*2) + 1,
+- pw->prompt_screen->current_depth);
++ si->pw_data->save_under = XCreatePixmap (si->dpy,
++ si->pw_data->prompt_screen->screensaver_window,
++ si->pw_data->width + (si->pw_data->border_width*2) + 1,
++ si->pw_data->height + (si->pw_data->border_width*2) + 1,
++ si->pw_data->prompt_screen->current_depth);
+ gcv.function = GXcopy;
+- gc = XCreateGC (si->dpy, pw->save_under, GCFunction, &gcv);
+- XCopyArea (si->dpy, pw->prompt_screen->screensaver_window,
+- pw->save_under, gc,
+- pw->x - pw->border_width, pw->y - pw->border_width,
+- pw->width + (pw->border_width*2) + 1,
+- pw->height + (pw->border_width*2) + 1,
++ gc = XCreateGC (si->dpy, si->pw_data->save_under, GCFunction, &gcv);
++ XCopyArea (si->dpy, si->pw_data->prompt_screen->screensaver_window,
++ si->pw_data->save_under, gc,
++ si->pw_data->x - si->pw_data->border_width, si->pw_data->y - si->pw_data->border_width,
++ si->pw_data->width + (si->pw_data->border_width*2) + 1,
++ si->pw_data->height + (si->pw_data->border_width*2) + 1,
+ 0, 0);
+ XFreeGC (si->dpy, gc);
+ }
+@@ -434,11 +583,11 @@ make_passwd_window (saver_info *si)
+ XSync (si->dpy, False);
+
+ move_mouse_grab (si, si->passwd_dialog,
+- pw->prompt_screen->cursor,
+- pw->prompt_screen->number);
++ si->pw_data->prompt_screen->cursor,
++ si->pw_data->prompt_screen->number);
+ undo_vp_motion (si);
+
+- si->pw_data = pw;
++ /*mali si->pw_data_data = si->pw_data;***/
+
+ if (cmap)
+ XInstallColormap (si->dpy, cmap);
+@@ -458,6 +607,10 @@ draw_passwd_window (saver_info *si)
+ int sw;
+ int tb_height;
+
++
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "-->draw_passwd_window() case w_dialog!!\n");
++
+ height = (pw->heading_font->ascent + pw->heading_font->descent +
+ pw->body_font->ascent + pw->body_font->descent +
+ (2 * MAX ((pw->label_font->ascent + pw->label_font->descent),
+@@ -676,7 +829,7 @@ draw_passwd_window (saver_info *si)
+ }
+
+
+-static void
++void
+ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio)
+ {
+ passwd_dialog_data *pw = si->pw_data;
+@@ -686,8 +839,20 @@ update_passwd_window (saver_info *si, co
+ XRectangle rects[1];
+
+ pw->ratio = ratio;
++
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "-->update_passwd_window() w_dialog !!\n");
++
++ if (!si->pw_data->got_windowid )
++ {
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "-->update_passwd_window() lockdialog not created returning.. !!\n");
++ return;
++ }
++
+ gcv.foreground = pw->passwd_foreground;
+- gcv.font = pw->passwd_font->fid;
++ if (pw->passwd_font)
++ gcv.font = pw->passwd_font->fid;
+ gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground|GCFont, &gcv);
+ gcv.foreground = pw->passwd_background;
+ gc2 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv);
+@@ -760,114 +925,186 @@ update_passwd_window (saver_info *si, co
+ }
+
+
+-static void
++void
+ destroy_passwd_window (saver_info *si)
+ {
+ saver_preferences *p = &si->prefs;
+ passwd_dialog_data *pw = si->pw_data;
+- saver_screen_info *ssi = pw->prompt_screen;
+- Colormap cmap = DefaultColormapOfScreen (ssi->screen);
+- Pixel black = BlackPixelOfScreen (ssi->screen);
+- Pixel white = WhitePixelOfScreen (ssi->screen);
++ saver_screen_info *ssi;
++ Colormap cmap;
++ Pixel black, white;
+ XEvent event;
+
+- memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd));
+- memset (pw->passwd_string, 0, strlen(pw->passwd_string));
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "destroy_passwd_window\n");
++
++ if (pw == NULL || pw->got_windowid == 0 || si->external_passwd == 0)
++ return;
+
+ if (pw->timer)
+ XtRemoveTimeOut (pw->timer);
+
+- move_mouse_grab (si, RootWindowOfScreen (ssi->screen),
+- ssi->cursor, ssi->number);
+-
+- if (p->verbose_p)
+- fprintf (stderr, "%s: %d: moving mouse back to %d,%d.\n",
+- blurb(), ssi->number,
+- pw->previous_mouse_x, pw->previous_mouse_y);
+-
+- XWarpPointer (si->dpy, None, RootWindowOfScreen (ssi->screen),
+- 0, 0, 0, 0,
+- pw->previous_mouse_x, pw->previous_mouse_y);
+-
+- XSync (si->dpy, False);
+- while (XCheckMaskEvent (si->dpy, PointerMotionMask, &event))
+- if (p->verbose_p)
+- fprintf (stderr, "%s: discarding MotionNotify event.\n", blurb());
++ /*reset global flag to indicate passwd dialog is no longer there*/
++ g_passwd_dialog_created = 0;
+
+- if (si->passwd_dialog)
++#ifdef HAVE_XSCREENSAVER_LOCK
++ if (si->external_passwd)
+ {
+- XDestroyWindow (si->dpy, si->passwd_dialog);
+- si->passwd_dialog = 0;
++ /* kill the child etc. */
++
++ if (si->passwd_dialog)
++ {
++ XErrorHandler old_handler;
++
++ XSync (si->dpy, False);
++ old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
++
++ XDestroyWindow (si->dpy, si->passwd_dialog);
++ XSync (si->dpy, False);
++ XSetErrorHandler (old_handler);
++
++ si->passwd_dialog = 0;
++ }
++
++ if (pw->stdout_input_id)
++ XtRemoveInput (pw->stdout_input_id);
++ if (pw->stdin_fd != -1)
++ close_and_invalidate (&pw->stdin_fd);
++ if (pw->input_file)
++ fclose (pw->input_file);
++ else if (pw->stdout_fd != -1)
++ close_and_invalidate (&pw->stdout_fd);
++
++ block_sigchld ();
++
++ if (si->passwd_pid)
++ {
++ int status = -1;
++
++ status = kill (si->passwd_pid, SIGTERM);
++
++ await_dying_children (si);
++
++ si->passwd_pid = 0;
++ }
++
++ unblock_sigchld ();
++
++ si->external_passwd = False;
+ }
+-
+- if (pw->save_under)
++ else
++#endif /* HAVE_XSCREENSAVER_LOCK */
+ {
+- XGCValues gcv;
+- GC gc;
+- gcv.function = GXcopy;
+- gc = XCreateGC (si->dpy, ssi->screensaver_window, GCFunction, &gcv);
+- XCopyArea (si->dpy, pw->save_under,
+- ssi->screensaver_window, gc,
+- 0, 0,
+- pw->width + (pw->border_width*2) + 1,
+- pw->height + (pw->border_width*2) + 1,
+- pw->x - pw->border_width, pw->y - pw->border_width);
+- XFreePixmap (si->dpy, pw->save_under);
+- pw->save_under = 0;
+- XFreeGC (si->dpy, gc);
+- }
+-
+- if (pw->heading_label) free (pw->heading_label);
+- if (pw->body_label) free (pw->body_label);
+- if (pw->user_label) free (pw->user_label);
+- if (pw->passwd_label) free (pw->passwd_label);
+- if (pw->date_label) free (pw->date_label);
+- if (pw->user_string) free (pw->user_string);
+- if (pw->passwd_string) free (pw->passwd_string);
+-
+- if (pw->heading_font) XFreeFont (si->dpy, pw->heading_font);
+- if (pw->body_font) XFreeFont (si->dpy, pw->body_font);
+- if (pw->label_font) XFreeFont (si->dpy, pw->label_font);
+- if (pw->passwd_font) XFreeFont (si->dpy, pw->passwd_font);
+- if (pw->date_font) XFreeFont (si->dpy, pw->date_font);
+-
+- if (pw->foreground != black && pw->foreground != white)
+- XFreeColors (si->dpy, cmap, &pw->foreground, 1, 0L);
+- if (pw->background != black && pw->background != white)
+- XFreeColors (si->dpy, cmap, &pw->background, 1, 0L);
+- if (pw->passwd_foreground != black && pw->passwd_foreground != white)
+- XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L);
+- if (pw->passwd_background != black && pw->passwd_background != white)
+- XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L);
+- if (pw->thermo_foreground != black && pw->thermo_foreground != white)
+- XFreeColors (si->dpy, cmap, &pw->thermo_foreground, 1, 0L);
+- if (pw->thermo_background != black && pw->thermo_background != white)
+- XFreeColors (si->dpy, cmap, &pw->thermo_background, 1, 0L);
+- if (pw->shadow_top != black && pw->shadow_top != white)
+- XFreeColors (si->dpy, cmap, &pw->shadow_top, 1, 0L);
+- if (pw->shadow_bottom != black && pw->shadow_bottom != white)
+- XFreeColors (si->dpy, cmap, &pw->shadow_bottom, 1, 0L);
++ if (p->verbose_p)
++ fprintf (stderr, "In destroy_passwd else case..i.e. si->external-passwd is False already\n");
+
+- if (pw->logo_pixmap)
+- XFreePixmap (si->dpy, pw->logo_pixmap);
+- if (pw->logo_pixels)
+- {
+- if (pw->logo_npixels)
+- XFreeColors (si->dpy, cmap, pw->logo_pixels, pw->logo_npixels, 0L);
+- free (pw->logo_pixels);
+- pw->logo_pixels = 0;
+- pw->logo_npixels = 0;
+- }
++ if (pw->passwd_string == NULL)
++ pw->passwd_string = 0;
+
+- if (pw->save_under)
+- XFreePixmap (si->dpy, pw->save_under);
++ memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd));
++ memset (pw->passwd_string, 0, strlen(pw->passwd_string));
+
+- if (cmap)
+- XInstallColormap (si->dpy, cmap);
++ ssi = pw->prompt_screen;
++ cmap = DefaultColormapOfScreen (ssi->screen);
++ black = BlackPixelOfScreen (ssi->screen);
++ white = WhitePixelOfScreen (ssi->screen);
++
++ move_mouse_grab (si, RootWindowOfScreen (ssi->screen),
++ ssi->cursor, ssi->number);
++
++ if (p->verbose_p)
++ fprintf (stderr, "%s: %d: moving mouse back to %d,%d.\n",
++ blurb(), ssi->number,
++ pw->previous_mouse_x, pw->previous_mouse_y);
++
++ XWarpPointer (si->dpy, None, RootWindowOfScreen (ssi->screen),
++ 0, 0, 0, 0,
++ pw->previous_mouse_x, pw->previous_mouse_y);
++
++ XSync (si->dpy, False);
++ while (XCheckMaskEvent (si->dpy, PointerMotionMask, &event))
++ if (p->verbose_p)
++ fprintf (stderr, "%s: discarding MotionNotify event.\n", blurb());
++
++ if (si->passwd_dialog)
++ {
++ XDestroyWindow (si->dpy, si->passwd_dialog);
++ si->passwd_dialog = 0;
++ }
++
++ if (pw->save_under)
++ {
++ XGCValues gcv;
++ GC gc;
++ gcv.function = GXcopy;
++ gc = XCreateGC (si->dpy, ssi->screensaver_window, GCFunction, &gcv);
++ XCopyArea (si->dpy, pw->save_under,
++ ssi->screensaver_window, gc,
++ 0, 0,
++ pw->width + (pw->border_width*2) + 1,
++ pw->height + (pw->border_width*2) + 1,
++ pw->x - pw->border_width, pw->y - pw->border_width);
++ XFreePixmap (si->dpy, pw->save_under);
++ pw->save_under = 0;
++ XFreeGC (si->dpy, gc);
++ }
++
++ if (pw->heading_label) free (pw->heading_label);
++ if (pw->body_label) free (pw->body_label);
++ if (pw->user_label) free (pw->user_label);
++ if (pw->passwd_label) free (pw->passwd_label);
++ if (pw->date_label) free (pw->date_label);
++ if (pw->user_string) free (pw->user_string);
++ if (pw->passwd_string) free (pw->passwd_string);
++
++ if (pw->heading_font) XFreeFont (si->dpy, pw->heading_font);
++ if (pw->body_font) XFreeFont (si->dpy, pw->body_font);
++ if (pw->label_font) XFreeFont (si->dpy, pw->label_font);
++ if (pw->passwd_font) XFreeFont (si->dpy, pw->passwd_font);
++ if (pw->date_font) XFreeFont (si->dpy, pw->date_font);
++
++ if (pw->foreground != black && pw->foreground != white)
++ XFreeColors (si->dpy, cmap, &pw->foreground, 1, 0L);
++ if (pw->background != black && pw->background != white)
++ XFreeColors (si->dpy, cmap, &pw->background, 1, 0L);
++
++ if (pw->passwd_foreground != black && pw->passwd_foreground != white)
++ XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L);
++ if (pw->passwd_background != black && pw->passwd_background != white)
++ XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L);
++ if (pw->thermo_foreground != black && pw->thermo_foreground != white)
++ XFreeColors (si->dpy, cmap, &pw->thermo_foreground, 1, 0L);
++ if (pw->thermo_background != black && pw->thermo_background != white)
++ XFreeColors (si->dpy, cmap, &pw->thermo_background, 1, 0L);
++ if (pw->shadow_top != black && pw->shadow_top != white)
++ XFreeColors (si->dpy, cmap, &pw->shadow_top, 1, 0L);
++ if (pw->shadow_bottom != black && pw->shadow_bottom != white)
++ XFreeColors (si->dpy, cmap, &pw->shadow_bottom, 1, 0L);
++
++ if (pw->logo_pixmap)
++ XFreePixmap (si->dpy, pw->logo_pixmap);
++ if (pw->logo_pixels)
++ {
++ if (pw->logo_npixels)
++ XFreeColors (si->dpy, cmap, pw->logo_pixels, pw->logo_npixels, 0L);
++ free (pw->logo_pixels);
++ pw->logo_pixels = 0;
++ pw->logo_npixels = 0;
++ }
++
++ if (pw->save_under)
++ XFreePixmap (si->dpy, pw->save_under);
++
++ if (cmap)
++ XInstallColormap (si->dpy, cmap);
++ }
+
+ memset (pw, 0, sizeof(*pw));
+- free (pw);
+- si->pw_data = 0;
++ /*** NO mali99 we only create a copy of pw in main and keep it
++ so dont free it.
++ free (pw);
++ si->pw_data = 0;
++ ************/
+ }
+
+
+@@ -968,9 +1205,6 @@ linux_lock_vt_switch (saver_info *si, Bo
+ */
+ #ifdef HAVE_XF86VMODE
+
+-static int ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error);
+-static Bool vp_got_error = False;
+-
+ static void
+ xfree_lock_mode_switch (saver_info *si, Bool lock_p)
+ {
+@@ -1010,13 +1244,6 @@ xfree_lock_mode_switch (saver_info *si,
+ }
+ }
+
+-static int
+-ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error)
+-{
+- vp_got_error = True;
+- return 0;
+-}
+-
+ #endif /* HAVE_XF86VMODE */
+
+
+@@ -1085,17 +1312,64 @@ passwd_animate_timer (XtPointer closure,
+ int tick = 166;
+ passwd_dialog_data *pw = si->pw_data;
+
+- if (!pw) return;
++/* if (si->prefs.verbose_p)
++ fprintf (stderr,"-->passwd_animate_timer()\n");
++**/
++
++ /*We want to make sure dialog isup before we try to animate**/
++ if (!si->external_passwd || !g_passwd_dialog_created)
++ {
++ if (si->prefs.verbose_p)
++ fprintf (stderr,"-->passwd_animate_timer() returning..no dialog yet\n");
++ return;
++ }
+
+ pw->ratio -= (1.0 / ((double) si->prefs.passwd_timeout / (double) tick));
+ if (pw->ratio < 0)
+ {
+ pw->ratio = 0;
+- if (pw->state == pw_read)
++ if (pw->state == pw_read || pw->state == pw_null)
++ {
+ pw->state = pw_time;
++ }
+ }
+
++/*** Communicating with the Child lock dialog...sending ratio back... mali99***/
++#ifdef HAVE_XSCREENSAVER_LOCK
++ if (si->passwd_dialog)
++ {
++ XEvent event;
++ Bool status;
++ XErrorHandler old_handler;
++
++/* fprintf (stderr,"-->passwd_animate_timer() sending ratio to child\n");
++**/
++
++ event.xany.type = ClientMessage;
++ event.xclient.display = si->dpy;
++ event.xclient.window = si->passwd_dialog;
++ event.xclient.message_type = XA_UNLOCK_RATIO;
++ event.xclient.format = 32;
++ memset (&event.xclient.data, 0, sizeof (event.xclient.data));
++ event.xclient.data.l[0] = (long)(pw->ratio * 100);
++ event.xclient.data.l[1] = 0;
++ event.xclient.data.l[2] = 0;
++
++ XSync (si->dpy, False);
++ old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
++
++ status = XSendEvent (si->dpy, si->passwd_dialog, False, 0L, &event);
++
++ XSync (si->dpy, False);
++ XSetErrorHandler (old_handler);
++
++ if (!status)
++ fprintf (stderr, "%s: error sending ratio to lock dialog\n", blurb ());
++
++ }
++#else /* !HAVE_XSCREENSAVER_LOCK */
+ update_passwd_window (si, 0, pw->ratio);
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+
+ if (pw->state == pw_read)
+ pw->timer = XtAppAddTimeOut (si->app, tick, passwd_animate_timer,
+@@ -1147,11 +1421,15 @@ handle_passwd_key (saver_info *si, XKeyE
+ {
+ update_passwd_window (si, "Checking...", pw->ratio);
+ XSync (si->dpy, False);
+- if (passwd_valid_p (typed_passwd, p->verbose_p))
++
++/***************mali99************************************************
++ if (passwd_valid_p (typed_passwd, p->verbose_p, PAM_SERVICE))
+ pw->state = pw_ok;
+ else
+ pw->state = pw_fail;
+ update_passwd_window (si, "", pw->ratio);
++****************************************************************************/
++ pw->state = pw_ok;
+ }
+ break;
+
+@@ -1176,7 +1454,7 @@ handle_passwd_key (saver_info *si, XKeyE
+ }
+
+
+-static void
++void
+ passwd_event_loop (saver_info *si)
+ {
+ saver_preferences *p = &si->prefs;
+@@ -1187,20 +1465,75 @@ passwd_event_loop (saver_info *si)
+ while (si->pw_data && si->pw_data->state == pw_read)
+ {
+ XtAppNextEvent (si->app, &event);
++#ifdef HAVE_XSCREENSAVER_LOCK
++ if (event.xany.type == KeyPress)
++ {
++ if (si->pw_data->got_windowid)
++ {
++ Bool status;
++ XErrorHandler old_handler;
++
++ if(p->verbose_p)
++ fprintf (stderr, "event loop..gotwindowid..and keypress event...\n");
++
++ event.xany.window = si->passwd_dialog;
++
++ XSync (si->dpy, False);
++ old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
++
++ status =
++ XSendEvent (si->dpy, si->passwd_dialog, False, KeyPressMask, &event);
++ XSync (si->dpy, False);
++ XSetErrorHandler (old_handler);
++
++ if (p->verbose_p)
++ {
++ if (status)
++ fprintf (stderr, "sent key...\n");
++ else
++ fprintf (stderr, "error sending key...\n");
++ }
++ }
++ else
++ {
++ if (p->verbose_p)
++ fprintf (stderr, "got keypress but no window id yet :(\n");
++ XtDispatchEvent (&event);
++ }
++ }
++#else /* !HAVE_XSCREENSAVER_LOCK */
+ if (event.xany.window == si->passwd_dialog && event.xany.type == Expose)
+ draw_passwd_window (si);
+ else if (event.xany.type == KeyPress)
+ handle_passwd_key (si, &event.xkey);
++#endif /* !HAVE_XSCREENSAVER_LOCK */
++ else if (event.xany.window == si->passwd_dialog && event.xany.type == Expose &&
++ si->pw_data->passwd_label != NULL)
++ {
++ if(p->verbose_p)
++ fprintf (stderr, "event loop...and expose event.should update lock with new label...\n");
++ /***if (si->pw_data->passwd_label)**/
++ update_passwd_window (si, si->pw_data->passwd_label, pw->ratio);
++ free (si->pw_data->passwd_label);
++ si->pw_data->passwd_label = 0;
++ si->pw_data->state = pw_read;
++ }
++
+ else
+ XtDispatchEvent (&event);
+ }
+
+ switch (si->pw_data->state)
+ {
+- case pw_ok: msg = 0; break;
+- case pw_null: msg = ""; break;
+- case pw_time: msg = "Timed out!"; break;
+- default: msg = "Sorry!"; break;
++ case pw_ok: msg = strdup("pw_ok"); break;
++ case pw_null: msg = strdup("pw_null"); break;
++ case pw_time: msg = strdup("pw_time"); break;
++ case pw_read: msg = strdup("pw_read"); break;
++ case pw_fail: msg = strdup("pw_fail"); break;
++ case pw_cancel: msg = strdup("pw_cancel"); break;
++ default: msg = 0;
++ fprintf(stderr, "si->pw_data->state is bad, serious error\n");
++ break;
+ }
+
+ if (si->pw_data->state == pw_fail)
+@@ -1210,7 +1543,12 @@ passwd_event_loop (saver_info *si)
+ switch (si->pw_data->state)
+ {
+ case pw_ok:
+- fprintf (stderr, "%s: password correct.\n", blurb()); break;
++ {
++ fprintf (stderr, "%s: password correct.\n", blurb());
++ fprintf (stderr, "%s: setting state to be null.\n", blurb());
++ si->pw_data->state = pw_null;
++ break;
++ }
+ case pw_fail:
+ fprintf (stderr, "%s: password incorrect!\n", blurb()); break;
+ case pw_null:
+@@ -1218,7 +1556,8 @@ passwd_event_loop (saver_info *si)
+ fprintf (stderr, "%s: password entry cancelled.\n", blurb()); break;
+ case pw_time:
+ fprintf (stderr, "%s: password entry timed out.\n", blurb()); break;
+- default: break;
++ default:
++ break;
+ }
+
+ #ifdef HAVE_SYSLOG
+@@ -1266,17 +1605,57 @@ passwd_event_loop (saver_info *si)
+ fprintf (real_stderr,
+ "%s: WARNING: %d failed attempts to unlock the screen.\n",
+ blurb(), si->unlock_failures);
+- fflush (real_stderr);
+
+ si->unlock_failures = 0;
+ }
+
+ if (msg)
+ {
++ if (p->verbose_p)
++ {
++ fprintf (stderr, "..eventloop...msg is:%s\n",msg);
++ }
++#ifdef HAVE_XSCREENSAVER_LOCK
++ /* DONT NEED TO SEND ANY INFO TO CHILD AT THIS STAGE */
++ /* if (write_to_child (si, msg));**/ /*if write is successful do nothing*/
++ free(msg);
++
++ /*********************************************************
++ if (si->external_passwd && si->pw_data->stdin_fd != -1)
++ {
++ ssize_t len;
++ char *nlmsg;
++
++ nlmsg = (char *)malloc (strlen (msg) + 2);
++ sprintf (nlmsg, "%s\n", msg);
++
++ if (p->verbose_p)
++ {
++ fprintf (stderr, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
++ fprintf (stderr, "HAVE_SCRSVR_LOCK message is:%s writing to fd:%d\n",
++ msg, si->pw_data->stdin_fd);
++ fprintf (stderr, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
++ }
++
++ write_msg:
++ len = write (si->pw_data->stdin_fd, nlmsg, strlen (nlmsg));
++ if (len < 0 && errno == EINTR)
++ goto write_msg;
++
++ free (nlmsg);
++ }
++ else
++ ******************************************************************************/
++#endif /* HAVE_XSCREENSAVER_LOCK */
++/************
++ {
+ si->pw_data->i_beam = 0;
+ update_passwd_window (si, msg, 0.0);
++ }
++************/
++
+ XSync (si->dpy, False);
+- sleep (1);
++ usleep (250000); /* 1/4 second */
+
+ /* Swallow all pending KeyPress/KeyRelease events. */
+ {
+@@ -1288,7 +1667,7 @@ passwd_event_loop (saver_info *si)
+ }
+
+
+-static void
++void
+ handle_typeahead (saver_info *si)
+ {
+ passwd_dialog_data *pw = si->pw_data;
+@@ -1305,7 +1684,13 @@ handle_typeahead (saver_info *si)
+
+ memset (si->unlock_typeahead, '*', strlen(si->unlock_typeahead));
+ si->unlock_typeahead[i] = 0;
++#ifdef HAVE_XSCREENSAVER_LOCK
++ /* FIXME: bugzilla.gnome.org #77077 */
++ /* need to handle this in the external dialog case */
++
++#else
+ update_passwd_window (si, si->unlock_typeahead, pw->ratio);
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+
+ free (si->unlock_typeahead);
+ si->unlock_typeahead = 0;
+@@ -1321,12 +1706,14 @@ unlock_p (saver_info *si)
+ raise_window (si, True, True, True);
+
+ if (p->verbose_p)
+- fprintf (stderr, "%s: prompting for password.\n", blurb());
++ fprintf (stderr, "%s: -->unlock_p()\n", blurb());
+
++/*******mali99**/
+ if (si->pw_data || si->passwd_dialog)
+ destroy_passwd_window (si);
+
+ make_passwd_window (si);
++/****mali99*********/
+
+ compose_status = calloc (1, sizeof (*compose_status));
+
+@@ -1334,7 +1721,8 @@ unlock_p (saver_info *si)
+ passwd_event_loop (si);
+
+ status = (si->pw_data->state == pw_ok);
++
+ destroy_passwd_window (si);
+
+ free (compose_status);
+
+--- driver/passwd-kerberos.c 2000-02-27 14:21:41.000000000 -0800
++++ driver/passwd-kerberos.c 2006-04-10 13:48:06.182897000 -0700
+@@ -143,7 +143,7 @@ key_to_key(char *user, char *instance, c
+ some sites. So, we do a quick, painful hack with a tmpfile.
+ */
+ Bool
+-kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p)
++kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p, int whichService)
+ {
+ C_Block mitkey;
+ Bool success;
+
+diff -urp -x '*~' driver/passwd-pam.c driver/passwd-pam.c
+--- driver/passwd-pam.c 2006-05-10 08:48:24.113115000 -0700
++++ driver/passwd-pam.c 2006-05-10 08:48:29.973056000 -0700
+@@ -39,11 +39,18 @@
+ #ifndef NO_LOCKING /* whole file */
+
+ #include <stdlib.h>
++#include <xscreensaver-intl.h>
++
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+
+-extern char *blurb(void);
++# ifdef sun
++# include <deflt.h>
++# endif
++
++
++/*extern char *blurb(void);*/
+
+
+ #include <stdio.h>
+@@ -55,8 +62,26 @@ extern char *blurb(void);
+
+ #include <sys/stat.h>
+
++#include <X11/Intrinsic.h>
++#include <X11/Xos.h> /* for time() */
++#include <time.h>
++#include <sys/time.h>
++#include <errno.h>
++#include <signal.h>
++#include "xscreensaver.h"
++
++extern int write_to_child (saver_info* si, char* msg);
++extern void make_passwd_window (saver_info* si);
++extern void destroy_passwd_window (saver_info* si);
++extern void handle_typeahead (saver_info* si);
++extern void update_passwd_window (saver_info *si, const char *printed_passwd, float ratio);
+ extern void block_sigchld (void);
+ extern void unblock_sigchld (void);
++extern void passwd_event_loop(saver_info* si);
++extern passwd_dialog_data* ptr_mygtkpwd;
++
++extern saver_info *global_si_kludge;
++extern Bool g_passwd_dialog_created;
+
+ /* blargh */
+ #undef Bool
+@@ -66,6 +91,9 @@ extern void unblock_sigchld (void);
+ #define True 1
+ #define False 0
+
++
++Bool we_have_pam;
++
+ #undef countof
+ #define countof(x) (sizeof((x))/sizeof(*(x)))
+
+@@ -76,14 +104,14 @@ extern void unblock_sigchld (void);
+ # define PAM_REFRESH_CRED PAM_CRED_REFRESH
+ #endif
+
+-static int pam_conversation (int nmsgs,
+- const struct pam_message **msg,
++int pam_conversation (int nmsgs,
++ struct pam_message **msg,
+ struct pam_response **resp,
+ void *closure);
+
+ struct pam_closure {
+ const char *user;
+- const char *typed_passwd;
++/* const char *typed_passwd; No need for this, pam_conv should get this*/
+ Bool verbose_p;
+ };
+
+@@ -171,22 +199,34 @@ static void *suns_pam_implementation_blo
+ to root.
+ */
+ Bool
+-pam_passwd_valid_p (const char *typed_passwd, Bool verbose_p)
++pam_passwd_valid_p ()
+ {
+ const char *service = PAM_SERVICE_NAME;
++ uid_t euid;
+ pam_handle_t *pamh = 0;
+- int status = -1;
++ int pam_auth_status = 0; /* Specific for pam_authenticate() status*/
++ int status,acct_rc,setcred_rc,chauth_rc;
+ struct pam_conv pc;
+ struct pam_closure c;
+ char *user = 0;
++ char* tmp_buf;
++ int pam_flags = 0;
++ saver_info *si = global_si_kludge;
+
+ struct passwd *p = getpwuid (getuid ());
++ Bool verbose_p = si->prefs.verbose_p;
++
++ if (verbose_p)
++ fprintf (stderr, "-->pam_passwd_valid_p()\n");
++
+ if (!p) return False;
+
++ euid = geteuid();
++
+ user = strdup (p->pw_name);
+
+ c.user = user;
+- c.typed_passwd = typed_passwd;
++/** c.typed_passwd = NULL; **/
+ c.verbose_p = verbose_p;
+
+ pc.conv = &pam_conversation;
+@@ -196,6 +236,20 @@ pam_passwd_valid_p (const char *typed_pa
+ `closure' argument to pc.conv always comes in as random garbage. */
+ suns_pam_implementation_blows = (void *) &c;
+
++ if (si->prefs.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());
++
++ if (verbose_p)
++ fprintf (stderr, "PAM is using SERVICE_NAME=\"%s\"\n\n", service);
+
+ /* Initialize PAM.
+ */
+@@ -204,21 +258,61 @@ pam_passwd_valid_p (const char *typed_pa
+ fprintf (stderr, "%s: pam_start (\"%s\", \"%s\", ...) ==> %d (%s)\n",
+ blurb(), service, c.user,
+ status, PAM_STRERROR (pamh, status));
+- if (status != PAM_SUCCESS) goto DONE;
++ if (status != PAM_SUCCESS)
++ {
++ we_have_pam = False;
++ goto DONE;
++ }
++ else
++ we_have_pam = True; /* if this flag is set we dont want to try shadow
++ * passwords, i.e. method pwent, so if pam fails
++ * screen remains locked.
++ ***/
++
++/* copying from xlock */
++
++#ifdef sun
++ /* Check /etc/default/login to see if we should add
++ PAM_DISALLOW_NULL_AUTHTOK to pam_flags */
++ if (defopen("/etc/default/login") == 0) {
++ 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
+
+ /* #### We should set PAM_TTY to the display we're using, but we
+ 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.
++*/
++
++#if 0
++
+ {
+- char *tty = strdup (":0.0");
++ char *tty,*displayname;
++ if ((displayname = getenv ("DISPLAY")) != NULL)
++ tty = strdup(displayname);
++ else
++ tty = strdup (":0.0");
+ status = pam_set_item (pamh, PAM_TTY, tty);
+ if (verbose_p)
+ fprintf (stderr, "%s: pam_set_item (p, PAM_TTY, \"%s\") ==> %d (%s)\n",
+ 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
+@@ -242,31 +336,132 @@ pam_passwd_valid_p (const char *typed_pa
+
+ PAM_NO_DELAY(pamh);
+
++/************* no need
++ fprintf(stderr,"before calling pam_authenticate passwd_string: %s\n",si->pw_data->passwd_string);
++ if (si->pw_data->passwd_string)
++****************************/
++ {
++
+ block_sigchld();
+- status = pam_authenticate (pamh, 0);
++ pam_auth_status = pam_authenticate (pamh, pam_flags);
+ unblock_sigchld();
++ /* Send status message to unlock dialog ***/
++ if (pam_auth_status == PAM_SUCCESS)
++ {
++ write_to_child (si, "pw_ok");
++ tmp_buf = (char*)PAM_STRERROR(pamh, pam_auth_status);
++ write_to_child (si, tmp_buf);
++ if (verbose_p)
++ sleep (1);
++ }
++ else
++ {
++ write_to_child (si, "pw_fail");
++ tmp_buf = (char*)PAM_STRERROR(pamh, pam_auth_status);
++ write_to_child (si, tmp_buf);
++ if (verbose_p)
++ sleep (1);
++ else
++ usleep (500000); /*sleep for 1/2 of sec */
++ }
++
++ /* PAM_SUCCESS defined to be 0 in /usr/include/security/pam_appl.h */
++ si->pw_data->state = (pam_auth_status == PAM_SUCCESS ? pw_ok : pw_fail);
++ if (verbose_p)
++ fprintf(stderr,"after calling pam_authenticate status is:%d state is:%d\n",
++ pam_auth_status,si->pw_data->state);
++
++ /* We get here implies regardless of success/failure nuke lock dialog */
++ /* no..wait till pam_end..to display error msgs...destroy_passwd_window (si);**/
++ }
+
+ if (verbose_p)
+ fprintf (stderr, "%s: pam_authenticate (...) ==> %d (%s)\n",
+- blurb(), status, PAM_STRERROR(pamh, status));
+- if (status == PAM_SUCCESS) /* Win! */
++ blurb(), pam_auth_status, PAM_STRERROR(pamh, pam_auth_status));
++ if (pam_auth_status == PAM_SUCCESS) /* Win! */
+ {
++ /* perform PAM account validation procedures for login user only */
++ acct_rc = pam_acct_mgmt(pamh, pam_flags);
++
++ /******************************************************************
++ 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 (acct_rc == PAM_NEW_AUTHTOK_REQD) {
++ do {
++ chauth_rc = pam_chauthtok(pamh, 0);
++ } while (chauth_rc == PAM_AUTHTOK_ERR ||
++ chauth_rc == PAM_TRY_AGAIN);
++ if (verbose_p)
++ fprintf (stderr, "%s: pam_chauthtok (...) ==> %d (%s)\n",
++ blurb(), chauth_rc, PAM_STRERROR(pamh, chauth_rc));
++ }
++ if (verbose_p)
++ fprintf (stderr, "%s: pam_acct_mgmt (...) ==> %d (%s)\n",
++ blurb(), acct_rc, PAM_STRERROR(pamh, acct_rc));
++
++ /* Send status message to unlock dialog ***/
++ if (acct_rc == PAM_SUCCESS)
++ {
++ write_to_child (si, "pw_acct_ok");
++ tmp_buf = (char*)PAM_STRERROR(pamh, acct_rc);
++ write_to_child (si, tmp_buf);
++ if (verbose_p)
++ sleep (1);
++ }
++ else
++ {
++ write_to_child (si, "pw_acct_fail");
++ tmp_buf = (char*)PAM_STRERROR(pamh, acct_rc);
++ write_to_child (si, tmp_buf);
++ if (verbose_p)
++ sleep (1);
++ }
++
+ /* Each time we successfully authenticate, refresh credentials,
+ for Kerberos/AFS/DCE/etc. If this fails, just ignore that
+ failure and blunder along; it shouldn't matter.
+ */
+- int status2 = pam_setcred (pamh, PAM_REFRESH_CRED);
++ setcred_rc = pam_setcred (pamh, PAM_REFRESH_CRED);
+ if (verbose_p)
+ fprintf (stderr, "%s: pam_setcred (...) ==> %d (%s)\n",
+- blurb(), status2, PAM_STRERROR(pamh, status2));
++ blurb(), setcred_rc , PAM_STRERROR(pamh, setcred_rc));
++
++ /* Send status message to unlock dialog ***/
++ if (setcred_rc == PAM_SUCCESS)
++ {
++ write_to_child (si, "pw_setcred_ok");
++ tmp_buf = (char*)PAM_STRERROR(pamh, setcred_rc);
++ write_to_child (si, tmp_buf);
++ if (verbose_p)
++ sleep (1);
++ }
++ else
++ {
++ write_to_child (si, "pw_setcred_fail");
++ tmp_buf = (char*)PAM_STRERROR(pamh, setcred_rc);
++ write_to_child (si, tmp_buf);
++ if (verbose_p)
++ sleep (1);
++ }
++
+ goto DONE;
+ }
+
++/* security hole if root pwd is not set (or CR)
++ cannot delete it and is user function spec.
++*/
++
+ /* If that didn't work, set the user to root, and try to authenticate again.
+ */
+ if (user) free (user);
+ user = strdup ("root");
+ c.user = user;
++
++ status = -1; /* Reset status */
+ status = pam_set_item (pamh, PAM_USER, c.user);
+ if (verbose_p)
+ fprintf (stderr, "%s: pam_set_item(p, PAM_USER, \"%s\") ==> %d (%s)\n",
+@@ -274,23 +469,72 @@ pam_passwd_valid_p (const char *typed_pa
+ if (status != PAM_SUCCESS) goto DONE;
+
+ PAM_NO_DELAY(pamh);
+- status = pam_authenticate (pamh, 0);
++ pam_auth_status = -1; /* Reset status */
++
++ block_sigchld();
++ pam_auth_status = pam_authenticate (pamh, 0);
++ unblock_sigchld();
++
++/* Send status message to unlock dialog ***/
++ if (pam_auth_status == PAM_SUCCESS)
++ {
++ write_to_child (si, "pw_ok");
++ tmp_buf = strdup (_("Letting you in as ROOT!!"));
++ write_to_child (si, tmp_buf);
++ free (tmp_buf);
+ if (verbose_p)
+- fprintf (stderr, "%s: pam_authenticate (...) ==> %d (%s)\n",
+- blurb(), status, PAM_STRERROR(pamh, status));
++ sleep (1);
++ }
++
++ /* PAM_SUCCESS defined to be 0 in /usr/include/security/pam_appl.h */
++ si->pw_data->state = (pam_auth_status == PAM_SUCCESS ? pw_ok : pw_fail);
++
++ if (verbose_p)
++ fprintf (stderr, "%s: pam_authenticate as root user (...) ==> %d (%s)\n",
++ blurb(), pam_auth_status, PAM_STRERROR(pamh, pam_auth_status));
++
++
+
+ DONE:
+ if (user) free (user);
+ if (pamh)
+ {
+- int status2 = pam_end (pamh, status);
++ int status2 = pam_end (pamh, pam_auth_status);
+ pamh = 0;
+ if (verbose_p)
+ fprintf (stderr, "%s: pam_end (...) ==> %d (%s)\n",
+ blurb(), status2,
+ (status2 == PAM_SUCCESS ? "Success" : "Failure"));
+ }
+- return (status == PAM_SUCCESS ? True : False);
++
++ if (seteuid (euid) != 0)
++ {
++ 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)
++ fprintf (stderr, "<--end of pam_authenticate() returning ok_to_unblank = %d\n",
++ (int) ((pam_auth_status == PAM_SUCCESS) ? True:False));
++
++ /* Now destroy unlock dialog window created in pam_conv func ***/
++
++ destroy_passwd_window (si);
++ usleep (250000); /* if repeatedly tried to unlock dialog with bad passwd, old dialog
++ * doesnt get completely unmapped before new one posts, this should
++ * help the unmapping to go through before new one is posted */
++ XSync (si->dpy, False);
++
++ if (si->pw_data->passwd_string)
++ {
++ free (si->pw_data->passwd_string);
++ si->pw_data->passwd_string = 0;
++ }
++
++ if(pam_auth_status == PAM_SUCCESS)
++ return (True);
++ else
++ return (False);
+ }
+
+
+@@ -308,8 +552,14 @@ pam_priv_init (int argc, char **argv, Bo
+ const char dir[] = "/etc/pam.d";
+ const char file[] = "/etc/pam.d/" PAM_SERVICE_NAME;
+ const char file2[] = "/etc/pam.conf";
++
+ struct stat st;
+
++ 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. */
++ }
++
+ #ifndef S_ISDIR
+ # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+ #endif
+@@ -336,6 +586,9 @@ pam_priv_init (int argc, char **argv, Bo
+ break;
+ }
+ fclose (f);
++
++/*
++** comment out the misleading message
+ if (!ok)
+ {
+ fprintf (stderr,
+@@ -343,9 +596,12 @@ pam_priv_init (int argc, char **argv, Bo
+ "%s: password authentication via PAM is unlikely to work.\n",
+ blurb(), file2, PAM_SERVICE_NAME, blurb());
+ }
++*/
+ }
+ /* else warn about file2 existing but being unreadable? */
+ }
++/*
++** comment out the misleading message
+ else
+ {
+ fprintf (stderr,
+@@ -353,6 +609,7 @@ pam_priv_init (int argc, char **argv, Bo
+ "%s: password authentication via PAM is unlikely to work.\n",
+ blurb(), file2, file, blurb());
+ }
++*/
+
+ /* Return true anyway, just in case. */
+ return True;
+@@ -373,67 +630,144 @@ pam_priv_init (int argc, char **argv, Bo
+ would never see this string, and the prompted-for password would be
+ ignored.
+ */
+-static int
++int
+ pam_conversation (int nmsgs,
+- const struct pam_message **msg,
++ struct pam_message **msg,
+ struct pam_response **resp,
+ void *closure)
+ {
+ int replies = 0;
+ struct pam_response *reply = 0;
+ struct pam_closure *c = (struct pam_closure *) closure;
++ saver_info *si = global_si_kludge;
+
+ /* On SunOS 5.6, the `closure' argument always comes in as random garbage. */
+ c = (struct pam_closure *) suns_pam_implementation_blows;
+
++ if (c->verbose_p)
++ fprintf(stderr, "-->pam_conv() \n");
+
+ reply = (struct pam_response *) calloc (nmsgs, sizeof (*reply));
+ if (!reply) return PAM_CONV_ERR;
+
+ for (replies = 0; replies < nmsgs; replies++)
+ {
++ /* Means pam requires interaction..spawn dialog dont use unlock_p() here
++ * Another issue is pam conv can be called many times by pam, for pam_auth
++ * and then again for pam_setcred etc.. so make sure we dont keep creating
++ * multiple copies of dialog.
++ */
++ if (!g_passwd_dialog_created)
++ {
++ make_passwd_window (si);
++ }
++
++/**fprintf(stderr, "top of switch %d\n", replies);**/
+ switch (msg[replies]->msg_style)
+ {
+ case PAM_PROMPT_ECHO_ON:
+- reply[replies].resp_retcode = PAM_SUCCESS;
+- reply[replies].resp = strdup (c->user); /* freed by PAM */
+- if (c->verbose_p)
+- fprintf (stderr, "%s: PAM ECHO_ON(\"%s\") ==> \"%s\"\n",
+- blurb(), msg[replies]->msg,
+- reply[replies].resp);
+- break;
+ case PAM_PROMPT_ECHO_OFF:
+- reply[replies].resp_retcode = PAM_SUCCESS;
+- reply[replies].resp = strdup (c->typed_passwd); /* freed by PAM */
++ {
+ if (c->verbose_p)
+ fprintf (stderr, "%s: PAM ECHO_OFF(\"%s\") ==> password\n",
+ blurb(), msg[replies]->msg);
+- break;
+- case PAM_TEXT_INFO:
+- /* ignore it... */
++
++ /**fprintf(stderr, "PAM_ECHO_OFF/ECHO_ON nmsgs=%d\n",nmsgs);**/
++
++ write_to_child (si, msg[replies]->msg);
++ if (c->verbose_p)
++ sleep (1); /* let user see these */
++
++ if (c->verbose_p)
++ fprintf(stderr, "PAM_ECHO_OFF/ECHO_ON msg[replies]-> %s\n",
++ msg[replies]->msg);
++
++ si->pw_data->state = pw_read;
++ while (!si->pw_data->got_windowid && si->pw_data->state == pw_read)
++ {
++ if (c->verbose_p)
++ fprintf(stderr,"WAiting for window id from lock dialog\n");
++ handle_typeahead (si);
++ passwd_event_loop (si);
++ if (c->verbose_p)
++ fprintf(stderr,"<---passwd_event_loop() state =%d\n",si->pw_data->state);
++ }
++
+ reply[replies].resp_retcode = PAM_SUCCESS;
+- reply[replies].resp = 0;
++
++ /*Make sure user inputs a response..and dialog is not timiing out **/
++ if (si->pw_data->state != pw_time && si->pw_data->passwd_string != NULL)
++ {
++ reply[replies].resp = strdup (si->pw_data->passwd_string);/*freed by PAM*/
+ if (c->verbose_p)
+- fprintf (stderr, "%s: PAM TEXT_INFO(\"%s\") ==> ignored\n",
+- blurb(), msg[replies]->msg);
++ fprintf(stderr, "in ECHO OFF and got a passwd..:%s\n",
++ si->pw_data->passwd_string);
++ }
++ else /* Perhaps user does not want to enter input, dialog times out */
++ {
++ /* this shouldnt happen...perhaps sending null passwd to pam is
++ * best for now**/
++ /* reply[replies].resp = 0;Dont send any resp*/ /* freed by PAM */
++ /* Reset state to fail */
++ si->pw_data->state = pw_fail;
++
++ if (c->verbose_p)
++ {
++ fprintf(stderr, "Dude sending null password to pam..\n");
++ fprintf(stderr,"We didnt receive any input from user!!!\n");
++ }
++ }
+ break;
++ }
++ case PAM_TEXT_INFO:
+ case PAM_ERROR_MSG:
+- /* ignore it... */
+- reply[replies].resp_retcode = PAM_SUCCESS;
+- reply[replies].resp = 0;
++ {
++ char* tmp_msg;
++
++ /* display messages coming from pam... */
++ /* we should have dialog up still to show this */
+ if (c->verbose_p)
+- fprintf (stderr, "%s: PAM ERROR_MSG(\"%s\") ==> ignored\n",
+- blurb(), msg[replies]->msg);
++ fprintf(stderr, "PAM_ERROR/PAM_TEXT_INFO nmsgs=%d\n",nmsgs);
++ if (!g_passwd_dialog_created)
++ {
++ make_passwd_window (si);
++ /*sleep (1);*/ /*make sure window is created by now **/
++ }
++ tmp_msg = strdup (msg[replies]->msg);
++ write_to_child (si, tmp_msg);
++ sleep(1);
++
++ if (c->verbose_p)
++ fprintf(stderr, "PAM_ERROR/PAM_TEXT_INFO msg[%d]-> %s\n",
++ replies,msg[replies]->msg);
++
++ reply[replies].resp_retcode = PAM_CONV_ERR;
++ /*reply[replies].resp = 0;*/
++ /* Reset state to read */
++ si->pw_data->state = pw_read;
++
++ free(tmp_msg);
+ break;
++ }
++
+ default:
+- /* Must be an error of some sort... */
+- free (reply);
++
++ {
++ int i;
+ if (c->verbose_p)
+- fprintf (stderr, "%s: PAM unknown %d(\"%s\") ==> ignored\n",
++ fprintf (stderr, "%s: PAM unknown %d(\"%s\") ==> ERROR..default case:\n",
+ blurb(), msg[replies]->msg_style, msg[replies]->msg);
++ /* Must be an error of some sort... */
++ for (i = 0; i < replies; i++)
++ if (reply[replies].resp != NULL)
++ free (reply[replies].resp);
++ free (reply);
++ reply = NULL;
+ return PAM_CONV_ERR;
+- }
+- }
++
++ } /* end default */
++ } /* end switch */
++ } /* end for loop */
+ *resp = reply;
+ return PAM_SUCCESS;
+ }
+diff -urp -x '*~' driver/passwd.c driver/passwd.c
+--- driver/passwd.c 2002-03-05 18:15:47.000000000 -0800
++++ driver/passwd.c 2006-05-10 08:48:29.955519000 -0700
+@@ -49,15 +49,15 @@ struct auth_methods {
+
+ #ifdef HAVE_KERBEROS
+ extern Bool kerberos_lock_init (int argc, char **argv, Bool verbose_p);
+-extern Bool kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
++extern Bool kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p, int whichService);
+ #endif
+ #ifdef HAVE_PAM
+ extern Bool pam_priv_init (int argc, char **argv, Bool verbose_p);
+-extern Bool pam_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
++extern Bool pam_passwd_valid_p (void);
+ #endif
+ extern Bool pwent_lock_init (int argc, char **argv, Bool verbose_p);
+ extern Bool pwent_priv_init (int argc, char **argv, Bool verbose_p);
+-extern Bool pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
++extern Bool pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p, int whichService);
+
+
+ /* The authorization methods to try, in order.
+@@ -73,9 +73,10 @@ struct auth_methods methods[] = {
+ # ifdef HAVE_PAM
+ { "PAM", 0, pam_priv_init, pam_passwd_valid_p,
+ False, False },
+-# endif
++# else /* If we dont have PAM only then fall back to shadow passwords authentication */
+ { "normal", pwent_lock_init, pwent_priv_init, pwent_passwd_valid_p,
+ False, False }
++# endif /* HAVE_PAM */
+ };
+
+
+diff -urp -x '*~' driver/setuid.c driver/setuid.c
+--- driver/setuid.c 2000-11-08 05:13:18.000000000 -0800
++++ driver/setuid.c 2006-05-10 08:48:29.941707000 -0700
+@@ -15,6 +15,7 @@
+ #endif
+
+ #include <X11/Xlib.h> /* not used for much... */
++#include <X11/Intrinsic.h> /* not used for much... */
+
+ /* This file doesn't need the Xt headers, so stub these types out... */
+ #undef XtPointer
+@@ -101,7 +102,10 @@ set_ids_by_number (uid_t uid, gid_t gid,
+ gid_errno = errno ? errno : -1;
+
+ errno = 0;
+- if (setuid (uid) != 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 **/
++
++ if (seteuid (uid) != 0)
+ uid_errno = errno ? errno : -1;
+
+ if (uid_errno == 0 && gid_errno == 0)
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2006-05-10 08:48:24.156389000 -0700
++++ driver/subprocs.c 2006-05-10 08:48:29.955074000 -0700
+@@ -20,6 +20,7 @@
+ #include <string.h>
+
+ #include <X11/Xlib.h> /* not used for much... */
++#include <X11/Intrinsic.h> /* not used for much... */
+
+ #ifndef ESRCH
+ # include <errno.h>
+@@ -277,7 +278,7 @@ find_job (pid_t pid)
+ return 0;
+ }
+
+-static void await_dying_children (saver_info *si);
++void await_dying_children (saver_info *si);
+ #ifndef VMS
+ static void describe_dead_child (saver_info *, pid_t, int wait_status);
+ #endif
+@@ -413,7 +414,7 @@ sigchld_handler (int sig)
+
+
+ #ifndef VMS
+-static void
++void
+ await_dying_children (saver_info *si)
+ {
+ while (1)
+@@ -468,9 +469,15 @@ describe_dead_child (saver_info *si, pid
+ mention them) if we've just killed the subprocess. But mention them
+ if they happen on their own.
+ */
+- if (!job ||
++
++ if ((!job
++#ifdef HAVE_XSCREENSAVER_LOCK
++ && kid != si->passwd_pid
++#endif /* HAVE_XSCREENSAVER_LOCK */
++ ) ||
+ (exit_status != 0 &&
+- (p->verbose_p || job->status != job_killed)))
++ (p->verbose_p || (job && job->status != job_killed))))
++
+ fprintf (stderr,
+ "%s: %d: child pid %lu (%s) exited abnormally (code %d).\n",
+ blurb(), screen_no, (unsigned long) kid, name, exit_status);
+@@ -484,8 +491,12 @@ describe_dead_child (saver_info *si, pid
+ else if (WIFSIGNALED (wait_status))
+ {
+ if (p->verbose_p ||
+- !job ||
+- job->status != job_killed ||
++ (!job
++#ifdef HAVE_XSCREENSAVER_LOCK
++ && kid != si->passwd_pid
++#endif /* HAVE_XSCREENSAVER_LOCK */
++ ) ||
++ (job && job->status != job_killed) ||
+ WTERMSIG (wait_status) != SIGTERM)
+ fprintf (stderr, "%s: %d: child pid %lu (%s) terminated with %s.\n",
+ blurb(), screen_no, (unsigned long) kid, name,
+@@ -515,12 +526,23 @@ describe_dead_child (saver_info *si, pid
+ /* Clear out the pid so that screenhack_running_p() knows it's dead.
+ */
+ if (!job || job->status == job_dead)
++ {
+ for (i = 0; i < si->nscreens; i++)
+ {
+ saver_screen_info *ssi = &si->screens[i];
+ if (kid == ssi->pid)
+ ssi->pid = 0;
+ }
++#ifdef HAVE_XSCREENSAVER_LOCK
++ if (kid == si->passwd_pid)
++ {
++/*unsafe if (p->verbose_p)
++ fprintf (stderr, "passwd dialog died!\n");
++**/
++ si->passwd_pid = 0;
++ }
++#endif
++ }
+ }
+
+ #else /* VMS */
+diff -urp -x '*~' driver/timers.c driver/timers.c
+--- driver/timers.c 2002-05-10 03:40:32.000000000 -0700
++++ driver/timers.c 2006-05-10 08:48:29.940928000 -0700
+@@ -49,6 +49,12 @@ static Bool proc_interrupts_activity_p (
+ #endif /* HAVE_PROC_INTERRUPTS */
+
+ static void check_for_clock_skew (saver_info *si);
++static void watchdog_timer (XtPointer closure, XtIntervalId *id);
++extern Bool g_passwd_dialog_created;
++extern Bool ok_to_unblank;
++extern Bool pam_passwd_valid_p(void);
++extern Bool blank_screen (saver_info *si);
++extern void unblank_screen (saver_info *si);
+
+
+ void
+@@ -229,7 +235,8 @@ cycle_timer (XtPointer closure, XtInterv
+ crash. So, restart the thing once an hour. */
+ how_long = 1000 * 60 * 60;
+
+- if (si->dbox_up_p)
++/**mali99 if (si->dbox_up_p)*/
++ if (si->external_passwd)
+ {
+ if (p->verbose_p)
+ fprintf (stderr, "%s: dialog box up; delaying hack change.\n",
+@@ -277,8 +284,20 @@ activate_lock_timer (XtPointer closure,
+ saver_preferences *p = &si->prefs;
+
+ if (p->verbose_p)
+- fprintf (stderr, "%s: timed out; activating lock.\n", blurb());
++ fprintf (stderr, "-->activate_lock_timer() %s: timed out; activating lock.\n",
++ blurb());
++ if (si->screen_blanked_p) /* Make sure screen is blanked before posting dialogbox*/
++ {
+ set_locked_p (si, True);
++ ok_to_unblank = pam_passwd_valid_p();
++ if (ok_to_unblank == True)
++ {
++ set_locked_p(si,False);
++ unblank_screen(si);
++}
++ }
++ else /* blanking of screen failed reset lock flag */
++ set_locked_p (si, False);
+ }
+
+
+@@ -684,7 +703,10 @@ sleep_until_idle (saver_info *si, Bool u
+
+ case ClientMessage:
+ if (handle_clientmessage (si, &event, until_idle_p))
++ {
++ si->emergency_lock_p = True;
+ goto DONE;
++ }
+ break;
+
+ case CreateNotify:
+@@ -697,8 +719,47 @@ sleep_until_idle (saver_info *si, Bool u
+ }
+ break;
+
++ case VisibilityNotify:
++ {
++ int k;
++
++ if (p->debug_p)
++ {
++ fprintf(stderr,"************************************\n");
++ fprintf(stderr,"-->sleep_until_idle() event:VisibilityNotify\n");
++ fprintf(stderr,"\t Window of VisibilityNotify:%x\n",
++ event.xvisibility.window);
++ fprintf(stderr,"\t until_idle_p=%d g_passwd_dialog_created=%d\n",
++ until_idle_p, g_passwd_dialog_created);
++ fflush(stderr);
++ }
++
++ /*Dont raise root window when passwd dialog wants to come up */
++ if (g_passwd_dialog_created == 0 && !until_idle_p)
++ {
++ if (event.xvisibility.state != VisibilityUnobscured)
++ {
++ for (k = 0; k < si->nscreens; k++)
++ {
++ saver_screen_info *ssi = &si->screens[k];
++ XClearWindow (si->dpy, ssi->screensaver_window);
++ clear_stderr (ssi);
++ XMapRaised (si->dpy, ssi->screensaver_window);
++ }
++ if (p->debug_p)
++ {
++ fprintf (stderr,"A window is trying to popup.\n");
++ fprintf(stderr, "Raising saver root Window.\n");
++ fprintf(stderr,"************************************\n");
++ fflush(stderr);
++ }
++ }
++ }
++ break;
++ }
++
+ case KeyPress:
+- case KeyRelease:
++/*mali99 case KeyRelease:**/
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+@@ -1152,7 +1213,8 @@ watchdog_timer (XtPointer closure, XtInt
+ {
+ Bool running_p = screenhack_running_p (si);
+
+- if (si->dbox_up_p)
++ /**mali9 if (si->dbox_up_p)****/
++ if (si->external_passwd)
+ {
+ if (si->prefs.debug_p)
+ fprintf (stderr, "%s: dialog box is up: not raising screen.\n",
+diff -urp -x '*~' driver/windows.c driver/windows.c
+--- driver/windows.c 2002-05-28 17:42:12.000000000 -0700
++++ driver/windows.c 2006-05-10 08:48:29.939107000 -0700
+@@ -35,6 +35,7 @@
+ #include <X11/Xutil.h> /* for XSetClassHint() */
+ #include <X11/Xatom.h>
+ #include <X11/Xos.h> /* for time() */
++#include <X11/Intrinsic.h>
+ #include <signal.h> /* for the signal names */
+ #include <time.h>
+ #include <sys/time.h>
+@@ -1230,6 +1231,7 @@ initialize_screensaver_window_1 (saver_s
+ */
+ attrs.event_mask = (KeyPressMask | KeyReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
++ VisibilityChangeMask |
+ PointerMotionMask);
+
+ attrs.backing_store = NotUseful;
+@@ -1397,6 +1399,9 @@ raise_window (saver_info *si,
+ saver_preferences *p = &si->prefs;
+ int i;
+
++ if (p->verbose_p)
++ fprintf(stderr,"-->raise_window()\n");
++
+ if (si->demoing_p)
+ inhibit_fade = True;
+
+@@ -1604,6 +1609,9 @@ unblank_screen (saver_info *si)
+ Bool unfade_p = (si->fading_possible_p && p->unfade_p);
+ int i;
+
++ if (p->verbose_p)
++ fprintf(stderr,"-->unblank_screen()\n");
++
+ monitor_power_on (si);
+ reset_watchdog_timer (si, False);
+
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:48:24.232166000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:48:29.979552000 -0700
+@@ -156,8 +156,21 @@
+ #include "visual.h"
+ #include "usleep.h"
+
++extern Bool pam_passwd_valid_p ();
++
+ saver_info *global_si_kludge = 0; /* I hate C so much... */
+
++/* Globals */
++Bool ok_to_unblank = False;
++
++/* Global storage for gtk passwd lock dialog
++ * we assign this to si->pw_data and this is needed
++ * to set user/passwd labels on gtk lock dialog by
++ * pam conv function.
++ */
++passwd_dialog_data mygtkpwd;
++passwd_dialog_data *ptr_mygtkpwd = &mygtkpwd;
++
+ char *progname = 0;
+ char *progclass = 0;
+ XrmDatabase db = 0;
+@@ -168,6 +181,7 @@ static Atom XA_ACTIVATE, XA_DEACTIVATE,
+ static Atom XA_RESTART, XA_SELECT;
+ static Atom XA_THROTTLE, XA_UNTHROTTLE;
+ Atom XA_DEMO, XA_PREFS, XA_EXIT, XA_LOCK, XA_BLANK;
++Atom XA_UNLOCK_RATIO;
+
+
+ static XrmOptionDescRec options [] = {
+@@ -555,6 +569,7 @@ connect_to_server (saver_info *si, int *
+ XA_BLANK = XInternAtom (si->dpy, "BLANK", False);
+ XA_THROTTLE = XInternAtom (si->dpy, "THROTTLE", False);
+ XA_UNTHROTTLE = XInternAtom (si->dpy, "UNTHROTTLE", False);
++ XA_UNLOCK_RATIO = XInternAtom (si->dpy, "UNLOCK_RATIO", False);
+
+ return toplevel_shell;
+ }
+@@ -951,7 +966,7 @@ static void
+ main_loop (saver_info *si)
+ {
+ saver_preferences *p = &si->prefs;
+- Bool ok_to_unblank;
++ /* Bool ok_to_unblank; made this a global flag, gets set in timers.c */
+
+ while (1)
+ {
+@@ -982,6 +997,14 @@ main_loop (saver_info *si)
+ fprintf (stderr, "%s: idle with blanking disabled at %s.\n",
+ blurb(), timestring());
+
++ /* mali Bug 6221109 Changing mode from disable to anything else,doesnt 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.
++ */
++ set_locked_p (si, False);
++
+ /* 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.
+@@ -1005,6 +1028,7 @@ main_loop (saver_info *si)
+ fprintf (stderr,
+ "%s: unable to grab keyboard or mouse! Blanking aborted.\n",
+ blurb());
++ set_locked_p(si, False);
+ continue;
+ }
+
+@@ -1049,7 +1073,17 @@ main_loop (saver_info *si)
+ p->lock_p && /* and locking is enabled */
+ !si->locking_disabled_p && /* and locking is possible */
+ lock_timeout == 0) /* and locking is not timer-deferred */
++ {
++ if (p->debug_p)
++ fprintf(stderr, "going to lock screen B\n");
+ set_locked_p (si, True); /* then lock right now. */
++ ok_to_unblank = pam_passwd_valid_p();
++ if (ok_to_unblank == True)
++ {
++ set_locked_p (si, False);
++ 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
+@@ -1064,10 +1098,7 @@ main_loop (saver_info *si)
+ }
+ #endif /* !NO_LOCKING */
+
+-
+- ok_to_unblank = True;
+ do {
+-
+ check_for_leaks ("blanked A");
+ sleep_until_idle (si, False); /* until not idle */
+ check_for_leaks ("blanked B");
+@@ -1077,6 +1108,12 @@ main_loop (saver_info *si)
+ #ifndef NO_LOCKING
+ /* Maybe unlock the screen.
+ */
++ if (si->demoing_p) goto DONE; /*in demoing mode and user wants out unblankscreen */
++
++ /* This is when blank timeout has happened but lock timeout hasnt and user
++ * gets active. Simply get him out of the blank screen */
++ if (si->screen_blanked_p && !si->locked_p) goto DONE;
++
+ if (si->locked_p)
+ {
+ saver_screen_info *ssi = si->default_screen;
+@@ -1087,7 +1124,21 @@ main_loop (saver_info *si)
+ suspend_screenhack (si, True);
+ XUndefineCursor (si->dpy, ssi->screensaver_window);
+
+- ok_to_unblank = unlock_p (si);
++ /*Prevents lock dialog posting on non blanked screen */
++ if (!si->screen_blanked_p) /*locked_p is true, so blank now*/
++ blank_screen (si);
++ if (si->screen_blanked_p) /* if blanking successful, call PAM*/
++ {
++ set_locked_p (si, True);
++ ok_to_unblank = pam_passwd_valid_p();
++ if (ok_to_unblank == True)
++ {
++ set_locked_p (si, False);
++ goto DONE;
++ }
++ }
++ else /* blanking failed, probably couldnt grab keyboard/mouse */
++ set_locked_p (si, False);
+
+ si->dbox_up_p = False;
+ XDefineCursor (si->dpy, ssi->screensaver_window, ssi->cursor);
+@@ -1111,6 +1162,7 @@ main_loop (saver_info *si)
+
+ } while (!ok_to_unblank);
+
++DONE:
+
+ if (p->verbose_p)
+ fprintf (stderr, "%s: unblanking screen at %s.\n",
+@@ -1120,8 +1172,6 @@ main_loop (saver_info *si)
+ kill_screenhack (si);
+ unblank_screen (si);
+
+- set_locked_p (si, False);
+- si->emergency_lock_p = False;
+ si->demoing_p = 0;
+ si->selection_mode = 0;
+
+@@ -1208,6 +1258,11 @@ main (int argc, char **argv)
+ int i;
+
+ memset(si, 0, sizeof(*si));
++
++/* Initialize and point si to pw_data i.e. the lock dialog struct */
++ memset(ptr_mygtkpwd, 0, sizeof(*ptr_mygtkpwd));
++ si->pw_data = ptr_mygtkpwd;
++
+ global_si_kludge = si; /* I hate C so much... */
+
+ # undef ya_rand_init
+@@ -1215,7 +1270,7 @@ main (int argc, char **argv)
+
+ save_argv (argc, argv);
+ set_version_string (si, &argc, argv);
+- privileged_initialization (si, &argc, argv);
++/*oldplace privileged_initialization (si, &argc, argv);*/
+ hack_environment (si);
+
+ shell = connect_to_server (si, &argc, argv);
+@@ -1223,6 +1278,8 @@ main (int argc, char **argv)
+ print_banner (si);
+
+ load_init_file (p); /* must be before initialize_per_screen_info() */
++ privileged_initialization (si, &argc, argv);
++
+ blurb_timestamp_p = p->timestamp_p; /* kludge */
+ initialize_per_screen_info (si, shell); /* also sets si->fading_possible_p */
+
+@@ -1263,6 +1320,7 @@ main (int argc, char **argv)
+ handle_signals (si);
+
+ make_splash_dialog (si);
++ /*spawn_external_passwd_process (si);*/
+
+ main_loop (si); /* doesn't return */
+ return 0;
+@@ -1413,13 +1471,18 @@ handle_clientmessage (saver_info *si, XE
+ Atom type = 0;
+ Window window = event->xclient.window;
+
++ if (p->verbose_p)
++ fprintf(stderr, "handle_clientmessage\n");
++
+ /* Preferences might affect our handling of client messages. */
+ maybe_reload_init_file (si);
++ XFlush (si->dpy);
++ XSync (si->dpy, False);
+
+ if (event->xclient.message_type != XA_SCREENSAVER ||
+ event->xclient.format != 32)
+ {
+- bogus_clientmessage_warning (si, event);
++ /*bogus_clientmessage_warning (si, event); mali */
+ return False;
+ }
+
+@@ -1667,10 +1730,17 @@ handle_clientmessage (saver_info *si, XE
+ : "locking.");
+ sprintf (buf, "LOCK ClientMessage received; %s", response);
+ clientmessage_response (si, window, False, buf, response);
++
++ if (p->verbose_p)
++ fprintf(stderr, "going to lock screen A\n");
++
+ set_locked_p (si, True);
++ si->emergency_lock_p = True;
+ si->selection_mode = 0;
+ si->demoing_p = False;
+
++ return True; /* dont set lock_id to 0, causes to go in lock in main_loop above */
++
+ if (si->lock_id) /* we're doing it now, so lose the timeout */
+ {
+ XtRemoveTimeOut (si->lock_id);
+diff -urp -x '*~' driver/xscreensaver.h driver/xscreensaver.h
+--- driver/xscreensaver.h 2002-03-04 13:16:20.000000000 -0800
++++ driver/xscreensaver.h 2006-05-10 08:48:29.939723000 -0700
+@@ -115,6 +115,15 @@ struct saver_info {
+ privileged user. */
+
+ Window passwd_dialog; /* The password dialog, if its up. */
++#ifdef HAVE_XSCREENSAVER_LOCK
++ pid_t passwd_pid; /* The pid of the password dialog if
++ we ran an external process for
++ it. */
++ Bool external_passwd;
++ Bool at_external_passwd; /* AT-enabled, bugid
++ 5059445(p3) screen kb and reader support
++ */
++#endif /* HAVE_XSCREENSAVER_LOCK */
+ passwd_dialog_data *pw_data; /* Other info necessary to draw it. */
+
+ int unlock_failures; /* Counts failed login attempts while the
+@@ -318,7 +327,7 @@ extern void get_screen_viewport (saver_s
+ extern Bool unlock_p (saver_info *si);
+ extern Bool lock_priv_init (int argc, char **argv, Bool verbose_p);
+ extern Bool lock_init (int argc, char **argv, Bool verbose_p);
+-extern Bool passwd_valid_p (const char *typed_passwd, Bool verbose_p);
++extern Bool passwd_valid_p (void);
+ #endif /* NO_LOCKING */
+
+ extern void set_locked_p (saver_info *si, Bool locked_p);
+@@ -326,6 +335,87 @@ extern int move_mouse_grab (saver_info *
+ int to_screen_no);
+ extern int mouse_screen (saver_info *si);
+
++/* =======================================================================
++ For lock.c
++ ======================================================================= */
++
++enum window_type { w_dialog, w_message };
++
++struct passwd_dialog_data {
++
++ saver_screen_info *prompt_screen;
++ int previous_mouse_x, previous_mouse_y;
++
++ enum passwd_state state;
++ char typed_passwd [80];
++
++ enum window_type w_type;
++
++ XtIntervalId timer;
++ int i_beam;
++
++ float ratio;
++ Position x, y;
++ Dimension width;
++ Dimension height;
++ Dimension border_width;
++
++ char *heading_label;
++ char *body_label;
++ /*
++ * For message dialog the body label may contain more than
++ * one line of text
++ */
++ char **message_body_label;
++
++ char *user_label;
++ char *passwd_label;
++ char *date_label;
++ char *user_string;
++ char *passwd_string;
++
++ XFontStruct *heading_font;
++ XFontStruct *body_font;
++ XFontStruct *label_font;
++ XFontStruct *passwd_font;
++ XFontStruct *date_font;
++
++ Pixel foreground;
++ Pixel background;
++ Pixel passwd_foreground;
++ Pixel passwd_background;
++ Pixel thermo_foreground;
++ Pixel thermo_background;
++ Pixel shadow_top;
++ Pixel shadow_bottom;
++
++ Dimension logo_width;
++ Dimension 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 thermo_field_x, thermo_field_y;
++ Dimension thermo_field_height;
++
++ Pixmap logo_pixmap;
++ int logo_npixels;
++ unsigned long *logo_pixels;
++
++ Pixmap save_under;
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++ /* extern passwd dialog stuff */
++ XtInputId stdout_input_id;
++ int stdin_fd;
++ int stdout_fd;
++ Bool got_windowid;
++ FILE *input_file;
++#endif
++};
+
+ /* =======================================================================
+ runtime privileges
+diff -urp -x '*~' driver/xset.c driver/xset.c
+--- driver/xset.c 2002-02-25 15:25:49.000000000 -0800
++++ driver/xset.c 2006-05-10 08:48:29.941372000 -0700
+@@ -19,6 +19,7 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xatom.h>
+ #include <X11/Xos.h>
++#include <X11/Intrinsic.h>
+
+ /* This file doesn't need the Xt headers, so stub these types out... */
+ #undef XtPointer
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/i18n.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Fixes for bugs that cause problems localizing xscreensaver:
+4806728 Dialognostics should be Diagnostics
+6203951 xscreensaver-lock was not properly l10ned
+
+diff -urp -x '*~' driver/xscreensaver-demo.glade2 driver/xscreensaver-demo.glade2
+--- driver/xscreensaver-demo.glade2 2006-05-10 08:48:52.368024000 -0700
++++ driver/xscreensaver-demo.glade2 2006-05-10 08:48:56.382041000 -0700
+@@ -1094,7 +1094,7 @@ Available</property>
+ <widget class="GtkCheckButton" id="verbose_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+- <property name="label" translatable="yes">_Verbose Dialognostics</property>
++ <property name="label" translatable="yes">_Verbose Diagnostics</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:48:52.422327000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:48:56.397896000 -0700
+@@ -127,6 +127,9 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <X11/Xlib.h>
++#include <locale.h>
++#include <libintl.h>
++#include <X11/Xlibint.h>
+ #include <X11/Xatom.h>
+ #include <X11/Intrinsic.h>
+ #include <X11/StringDefs.h>
+@@ -1305,6 +1308,15 @@ main (int argc, char **argv)
+ saver_preferences *p = &si->prefs;
+ int i;
+
++#ifdef ENABLE_NLS
++ if (!setlocale (LC_ALL, ""))
++ fprintf (stderr, "locale not supported by C library\n");
++
++ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
++ textdomain (GETTEXT_PACKAGE);
++ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
++#endif /* ENABLE_NLS */
++
+ memset(si, 0, sizeof(*si));
+
+ #ifdef HAVE_SCF_SMARTCARD
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/misc.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Changes made before the source was checked into Solaris SCCS/Teamware
+repositories that I couldn't find comments for nor guess why they were made.
+
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2006-05-10 08:49:43.010409000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:49:50.661964000 -0700
+@@ -601,12 +601,13 @@ exit_menu_cb (GtkMenuItem *menuitem, gpo
+ gtk_main_quit ();
+ }
+
+-static void
++static gboolean
+ wm_toplevel_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+ {
+ state *s = (state *) data;
+ flush_dialog_changes_and_save (s);
+ gtk_main_quit ();
++ return TRUE;
+ }
+
+
+@@ -922,7 +923,7 @@ manual_cb (GtkButton *button, gpointer u
+ {
+ state *s = global_state_kludge; /* I hate C so much... */
+ saver_preferences *p = &s->prefs;
+- GtkList *list_widget = GTK_LIST (name_to_widget (s, "list"));
++ GtkWidget *list_widget = name_to_widget (s, "list");
+ int list_elt = selected_list_element (s);
+ int hack_number;
+ char *name, *name2, *cmd, *str;
+@@ -930,7 +931,7 @@ manual_cb (GtkButton *button, gpointer u
+ hack_number = s->list_elt_to_hack_number[list_elt];
+
+ flush_dialog_changes_and_save (s);
+- ensure_selected_item_visible (GTK_WIDGET (list_widget));
++ ensure_selected_item_visible (list_widget);
+
+ name = strdup (p->screenhacks[hack_number]->command);
+ name2 = name;
+@@ -1974,11 +1975,12 @@ settings_ok_cb (GtkButton *button, gpoin
+ gtk_widget_hide (s->popup_widget);
+ }
+
+-static void
++static gboolean
+ wm_popup_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+ {
+ state *s = (state *) data;
+ settings_cancel_cb (0, (gpointer) s);
++ return TRUE;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/passwdTimeout-pref.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,367 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Sun bug 5077981/GNOME bug 147579:
+ There should be an option to extend/disable lockout timer
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5077981
+ http://bugzilla.gnome.org/show_bug.cgi?id=147579
+
+diff -urp -x '*~' driver/XScreenSaver.ad.in driver/XScreenSaver.ad.in
+--- driver/XScreenSaver.ad.in 2006-05-10 08:48:40.872445000 -0700
++++ driver/XScreenSaver.ad.in 2006-05-10 08:48:46.868803000 -0700
+@@ -32,6 +32,7 @@
+ *cycle: 0:10:00
+ *lockTimeout: 0:30:00
+ *passwdTimeout: 0:02:00
++*passwdTimeoutEnabled: True
+ *dpmsEnabled: True
+ *dpmsStandby: 0:24:00
+ *dpmsSuspend: 0:27:00
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2006-05-10 08:48:40.802432000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:48:46.905000000 -0700
+@@ -1313,6 +1313,9 @@ flush_dialog_changes_and_save (state *s)
+
+ MINUTES (&p2->timeout, "timeout_spinbutton");
+ MINUTES (&p2->cycle, "cycle_spinbutton");
++ /*bugid 5077981 pwd */
++ CHECKBOX (p2->pwd_p, "pwd_button");
++ MINUTES (&p2->passwd_timeout, "pwd_spinbutton");
+ CHECKBOX (p2->lock_p, "lock_button");
+ MINUTES (&p2->lock_timeout, "lock_spinbutton");
+
+@@ -1387,6 +1390,9 @@ flush_dialog_changes_and_save (state *s)
+ COPY(cycle, "cycle");
+ COPY(lock_p, "lock_p");
+ COPY(lock_timeout, "lock_timeout");
++/*bugid 5077981 pwd */
++ COPY(pwd_p, "pwd_p");
++ COPY(passwd_timeout, "passwd_timeout");
+
+ COPY(dpms_enabled_p, "dpms_enabled_p");
+ COPY(dpms_standby, "dpms_standby");
+@@ -2246,6 +2252,9 @@ populate_prefs_page (state *s)
+ FMT_MINUTES ("timeout_spinbutton", p->timeout);
+ FMT_MINUTES ("cycle_spinbutton", p->cycle);
+ FMT_MINUTES ("lock_spinbutton", p->lock_timeout);
++ /*bugid 5077981 pwd */
++ FMT_MINUTES ("pwd_spinbutton", p->passwd_timeout);
++ FMT_MINUTES ("lock_spinbutton", p->lock_timeout);
+ FMT_MINUTES ("dpms_standby_spinbutton", p->dpms_standby);
+ FMT_MINUTES ("dpms_suspend_spinbutton", p->dpms_suspend);
+ FMT_MINUTES ("dpms_off_spinbutton", p->dpms_off);
+@@ -2257,6 +2266,10 @@ populate_prefs_page (state *s)
+ # define TOGGLE_ACTIVE(NAME,ACTIVEP) \
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (name_to_widget (s,(NAME))),\
+ (ACTIVEP))
++/*bugid 5077981 pwd */
++
++
++ TOGGLE_ACTIVE ("pwd_button", p->pwd_p);
+
+ TOGGLE_ACTIVE ("lock_button", p->lock_p);
+ TOGGLE_ACTIVE ("verbose_button", p->verbose_p);
+@@ -2326,6 +2339,10 @@ populate_prefs_page (state *s)
+
+ /* Blanking and Locking
+ */
++ /*bugid 5077081 pwd */
++ SENSITIZE ("pwd_spinbutton", p->pwd_p);
++ SENSITIZE ("pwd_mlabel", p->pwd_p);
++
+ SENSITIZE ("lock_spinbutton", p->lock_p);
+ SENSITIZE ("lock_mlabel", p->lock_p);
+
+@@ -2433,10 +2450,12 @@ sensitize_demo_widgets (state *s, Bool s
+ static void
+ fix_text_entry_sizes (state *s)
+ {
++/*bugid 5077981 pwd */
++
+ #ifdef FIXME
+ const char * const spinbuttons[] = {
+ "timeout_spinbutton", "cycle_spinbutton", "lock_spinbutton",
+- "dpms_standby_spinbutton", "dpms_suspend_spinbutton",
++ "pwd_spinbutton", "dpms_standby_spinbutton", "dpms_suspend_spinbutton",
+ "dpms_off_spinbutton",
+ "-fade_spinbutton" };
+ int i;
+diff -urp -x '*~' driver/prefs.c driver/prefs.c
+--- driver/prefs.c 2002-03-07 15:41:07.000000000 -0800
++++ driver/prefs.c 2006-05-10 08:48:46.891011000 -0700
+@@ -230,6 +230,7 @@ get_byte_resource (char *name, char *cla
+ return n;
+ }
+
++/* *bugid 5077981 pwd timeout */
+
+ static const char * const prefs[] = {
+ "timeout",
+@@ -238,6 +239,7 @@ static const char * const prefs[] = {
+ "lockVTs",
+ "lockTimeout",
+ "passwdTimeout",
++ "passwdTimeoutEnabled",
+ "visualID",
+ "installColormap",
+ "verbose",
+@@ -753,6 +755,9 @@ write_init_file (saver_preferences *p, c
+ CHECK("timeout") type = pref_time, t = p->timeout;
+ CHECK("cycle") type = pref_time, t = p->cycle;
+ CHECK("lock") type = pref_bool, b = p->lock_p;
++
++/* *bugid 5077981 pwd timeout */
++ CHECK("passwdTimeoutEnabled") type = pref_bool, b = p->pwd_p;
+ # if 0 /* #### not ready yet */
+ CHECK("lockVTs") type = pref_bool, b = p->lock_vt_p;
+ # else
+@@ -989,6 +994,8 @@ load_init_file (saver_preferences *p)
+ p->verbose_p = get_boolean_resource ("verbose", "Boolean");
+ p->timestamp_p = get_boolean_resource ("timestamp", "Boolean");
+ p->lock_p = get_boolean_resource ("lock", "Boolean");
++ /* *bugid 5077981 pwd timeout */
++ p->pwd_p = get_boolean_resource ("passwdTimeoutEnabled", "Boolean");
+ p->lock_vt_p = get_boolean_resource ("lockVTs", "Boolean");
+ p->fade_p = get_boolean_resource ("fade", "Boolean");
+ p->unfade_p = get_boolean_resource ("unfade", "Boolean");
+diff -urp -x '*~' driver/prefs.h driver/prefs.h
+--- driver/prefs.h 2001-11-19 22:50:35.000000000 -0800
++++ driver/prefs.h 2006-05-10 08:48:46.902760000 -0700
+@@ -45,6 +45,8 @@ struct saver_preferences {
+ Bool xsync_p; /* whether XSynchronize has been called */
+
+ Bool lock_p; /* whether to lock as well as save */
++ Bool pwd_p; /* whether to disable/enable pwd timeout */
++ /* bugid 5077981 */
+ Bool lock_vt_p; /* whether to lock VTs too, if possible */
+
+ Bool fade_p; /* whether to fade to black, if possible */
+diff -urp -x '*~' driver/xscreensaver-demo.glade2 driver/xscreensaver-demo.glade2
+--- driver/xscreensaver-demo.glade2 2002-05-28 17:42:12.000000000 -0700
++++ driver/xscreensaver-demo.glade2 2006-05-10 08:48:46.868062000 -0700
+@@ -211,6 +211,34 @@
+ </packing>
+ </child>
+
++ <child>
++ <widget class="GtkEventBox" id="pwd_button_eventbox">
++ <property name="visible">True</property>
++ <property name="tooltip" translatable="yes">Whether the unlock dialog box should disappear after a timeout.</property>
++ <child>
++ <widget class="GtkCheckButton" id="pwd_button">
++ <property name="visible">True</property>
++ <property name="can_focus">True</property>
++ <property name="label" translatable="yes">Timeout _Unlock After</property>
++ <property name="use_underline">True</property>
++ <property name="relief">GTK_RELIEF_NORMAL</property>
++ <property name="active">False</property>
++ <property name="inconsistent">False</property>
++ <property name="draw_indicator">True</property>
++ <signal name="toggled" handler="pref_changed_cb"/>
++ </widget>
++ </child>
++ </widget>
++ <packing>
++ <property name="left_attach">0</property>
++ <property name="right_attach">2</property>
++ <property name="top_attach">3</property>
++ <property name="bottom_attach">4</property>
++ <property name="x_options">fill</property>
++ <property name="y_options"></property>
++ </packing>
++ </child>
++
+ <child>
+ <widget class="GtkLabel" id="timeout_label">
+ <property name="visible">True</property>
+@@ -331,6 +359,29 @@
+ </packing>
+ </child>
+
++ <child>
++ <widget class="GtkLabel" id="pwd_mlabel">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">minutes</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ </widget>
++ <packing>
++ <property name="left_attach">3</property>
++ <property name="right_attach">4</property>
++ <property name="top_attach">3</property>
++ <property name="bottom_attach">4</property>
++ <property name="y_options"></property>
++ </packing>
++ </child>
++
+ <child>
+ <widget class="GtkSpinButton" id="lock_spinbutton">
+ <property name="visible">True</property>
+@@ -358,6 +409,33 @@
+ </packing>
+ </child>
+
++ <child>
++ <widget class="GtkSpinButton" id="pwd_spinbutton">
++ <property name="visible">True</property>
++ <property name="tooltip" translatable="yes">How long the unlock dialog waits for input before disappearing.</property>
++ <property name="can_focus">True</property>
++ <property name="climb_rate">15</property>
++ <property name="digits">0</property>
++ <property name="numeric">True</property>
++ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
++ <property name="snap_to_ticks">True</property>
++ <property name="wrap">False</property>
++ <property name="adjustment">0 0 720 1 15 15</property>
++ <signal name="activate" handler="pref_changed_cb"/>
++ <signal name="focus_out_event" handler="pref_changed_event_cb"/>
++ <signal name="value_changed" handler="pref_changed_cb"/>
++ </widget>
++ <packing>
++ <property name="left_attach">2</property>
++ <property name="right_attach">3</property>
++ <property name="top_attach">3</property>
++ <property name="bottom_attach">4</property>
++ <property name="y_padding">10</property>
++ <property name="x_options">fill</property>
++ <property name="y_options"></property>
++ </packing>
++ </child>
++
+ <child>
+ <widget class="GtkSpinButton" id="cycle_spinbutton">
+ <property name="visible">True</property>
+
+--- driver/demo-Xm-widgets.c 2001-12-19 16:15:43.000000000 -0800
++++ driver/demo-Xm-widgets.c 2006-04-10 13:48:05.503904000 -0700
+@@ -567,6 +567,8 @@
+ int ac = 0;
+ Widget children[100];
+ Widget timeout_label, cycle_label, fade_seconds_label, fade_ticks_label;
++ /*bugid 5077981 passwd timeout */
++ Widget pwd_label,pwd_toggle;
+ Widget lock_label, passwd_label, hr;
+ Widget preferences_form;
+
+@@ -585,9 +587,13 @@
+ XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+ preferences_form = XmCreateForm (parent, "preferencesForm", av, ac);
+ XtManageChild (preferences_form);
+-
++ /*bugid 147579 */
+ ac = 0;
++ XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++;
++ pwd_label = XmCreateLabelGadget (preferences_form,
++ "passwd_Label", av, ac);
+
++ ac = 0;
+ XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++;
+ timeout_label = XmCreateLabelGadget (preferences_form, "timeoutLabel",
+ av, ac);
+@@ -638,7 +644,15 @@
+ XtSetArg(av[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ lock_toggle = XmCreateToggleButtonGadget (preferences_form, "lockToggle",
+ av, ac);
++
++/*bugid 5077981 pwd */
++ ac = 0;
++ XtSetArg(av[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
++ pwd_toggle = XmCreateToggleButtonGadget (preferences_form, "pwdToggle",
++ av, ac);
++
++
+ ac = 0;
+ hr = XmCreateSeparatorGadget (preferences_form, "separator", av, ac);
+
+ prefs_done = XmCreatePushButtonGadget (preferences_form, "OK", av, ac);
+@@ -846,6 +861,26 @@
+ XmNrightAttachment, XmATTACH_FORM,
+ XmNrightOffset, 20,
+ 0);
++/*bugid 5077981 pwd */
++ XtVaSetValues (pwd_toggle,
++ XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
++ XmNtopOffset, 0,
++ XmNtopWidget, passwd_timeout_text,
++ XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
++ XmNbottomOffset, 0,
++ XmNbottomWidget, passwd_timeout_text,
++ XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
++ XmNleftOffset, 0,
++ XmNleftWidget, unfade_toggle,
++ XmNrightAttachment, XmATTACH_FORM,
++ XmNrightOffset, 20,
++ 0);
++
++ XtVaSetValues (hr,
++ XmNtopWidget, passwd_timeout_text,
++ XmNbottomAttachment, XmATTACH_FORM,
++ XmNbottomOffset, 4,
++ XmNleftAttachment, XmATTACH_FORM,
+
+ XtVaSetValues (hr,
+ XmNtopWidget, passwd_timeout_text,
+@@ -886,6 +921,8 @@
+ children[ac++] = fade_toggle;
+ children[ac++] = unfade_toggle;
+ children[ac++] = lock_toggle;
++ /*bugid 5077981 pwd */
++ children[ac++] = pwd_toggle;
+ children[ac++] = hr;
+
+ XtManageChildren(children, ac);
+
+--- driver/demo-Xm.c 2002-04-13 03:27:38.000000000 -0700
++++ driver/demo-Xm.c 2006-04-10 13:48:05.506493000 -0700
+@@ -822,6 +822,7 @@ prefs_ok_cb (Widget button, XtPointer cl
+ CHECKBOX (p2->fade_p, "fadeToggle");
+ CHECKBOX (p2->unfade_p, "unfadeToggle");
+ CHECKBOX (p2->lock_p, "lockToggle");
++ CHECKBOX (p2->pwd_p, "pwdToggle");
+
+ # undef SECONDS
+ # undef MINUTES
+@@ -843,7 +844,9 @@ prefs_ok_cb (Widget button, XtPointer cl
+ COPY(fade_p);
+ COPY(unfade_p);
+ COPY(lock_p);
++ COPY(pwd_p);
+ # undef COPY
++/*above bugid 5077981: password enabled */
+
+ populate_prefs_page (button, pair);
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/s_isdir.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+6348365 - S_IFMT comparison abuse in X
+Submitted to jwz 11/9/2005 - accepted into xscreensaver 4.24
+
+
+diff -urp -x '*~' driver/passwd-pam.c driver/passwd-pam.c
+--- driver/passwd-pam.c 2002-03-03 19:57:17.000000000 -0800
++++ driver/passwd-pam.c 2006-05-10 08:48:01.063112000 -0700
+@@ -310,7 +310,11 @@ pam_priv_init (int argc, char **argv, Bo
+ const char file2[] = "/etc/pam.conf";
+ struct stat st;
+
+- if (stat (dir, &st) == 0 && st.st_mode & S_IFDIR)
++#ifndef S_ISDIR
++# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
++#endif
++
++ if (stat (dir, &st) == 0 && S_ISDIR(st.st_mode))
+ {
+ if (stat (file, &st) != 0)
+ fprintf (stderr,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/scf-smartcard.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,1330 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Support for the SCF smartcard framework in Solaris. SCF has been declared
+obsolete by Sun and is being removed from the Solaris "Nevada" release, so
+this code will be removed as well soon.
+
+diff -urp -x '*~' config.h.in config.h.in
+--- config.h.in 2006-05-10 08:48:35.644044000 -0700
++++ config.h.in 2006-05-10 08:48:40.856997000 -0700
+@@ -269,6 +269,24 @@
+ */
+ #define PAM_SERVICE_NAME "xscreensaver"
+
++/* Define this if using SCF to handle smart cards.
++ * bugid(4985708) xscreensaver uses its own pam stack and using
++ * "xscreensaver" as the pam service name when authenticating using
++ * smartcards, see bugid(4976405) fixing smartcard(im)
++ */
++
++#define HAVE_SCF_SMARTCARD
++
++/* If using smart cards for authentication use xscreensaver as pam service name
++ */
++#define SCF_PAM_SERVICE_NAME "xscreensaver"
++
++/* Define this if fork1 is defined; this should happen only on Solaris
++ * and only if HAVE_SCF_SMARTCARD is defined.
++ */
++
++#undef HAVE_FORK1
++
+ /* Define if you have PAM and pam_strerror() requires two arguments. */
+ #undef PAM_STRERROR_TWO_ARGS
+
+diff -urp -x '*~' configure.in configure.in
+--- configure.in 2006-05-10 08:48:35.646544000 -0700
++++ configure.in 2006-05-10 08:48:40.859304000 -0700
+@@ -1552,6 +1552,32 @@ if test "$enable_locking" = yes -a "$wit
+ fi
+ fi
+
++#--- Begin SUNW addition
++###############################################################################
++#
++# Check for SCF smartcard framework.
++#
++###############################################################################
++
++have_scf_smartcard=no
++with_scf_smartcard_req=unspecified
++
++AC_ARG_WITH(scf-smartcard,
++[ --with-scf-smartcard Include support for SCF smartcard authentication.],
++ [with_scf_smartcard="$withval"; with_scf_smartcard_req="$withval"],
++ [with_scf_smartcard=yes])
++
++HANDLE_X_PATH_ARG(with_scf_smartcard, --with-scf-smartcard, scf-smartcard)
++
++if test "$enable_locking" = yes -a "$with_scf_smartcard" = yes; then
++ AC_CHECK_LIB(smartcard, SCF_Session_getSession,
++ [PASSWD_LIBS="$PASSWD_LIBS -lsmartcard"
++ PASSWD_SRCS="$PASSWD_SRCS \$(SCF_SRCS)"
++ PASSWD_OBJS="$PASSWD_OBJS \$(SCF_OBJS)"])
++
++fi
++
++#--- End SUNW addition
+
+ ###############################################################################
+ #
+diff -urp -x '*~' driver/Makefile.in driver/Makefile.in
+--- driver/Makefile.in 2006-05-10 08:48:35.667263000 -0700
++++ driver/Makefile.in 2006-05-10 08:48:40.892557000 -0700
+@@ -110,6 +110,9 @@ KERBEROS_OBJS = passwd-kerberos.o
+ PAM_SRCS = passwd-pam.c
+ PAM_OBJS = passwd-pam.o
+
++SCF_SRCS = scf-smartcard.c
++SCF_OBJS = scf-smartcard.o
++
+ LOCK_SRCS_1 = lock.c passwd.c
+ LOCK_OBJS_1 = lock.o passwd.o
+ NOLOCK_SRCS_1 = lock.c
+diff -urp -x '*~' driver/XScreenSaver.ad.in driver/XScreenSaver.ad.in
+--- driver/XScreenSaver.ad.in 2006-05-10 08:48:35.580225000 -0700
++++ driver/XScreenSaver.ad.in 2006-05-10 08:48:40.872445000 -0700
+@@ -449,6 +449,37 @@ XScreenSaver.bourneShell: /bin/sh
+ *splash.demo.label: Settings
+ *splash.help.label: Help
+
++! Resources for smartcard OCF messages
++!
++*message.OCF.nouser: \
++The user name could not be obtained from the card. \n\
++Please remove and reinsert your card.
++
++*message.OCF.waitforcard: \
++There is no card in the reader.\n\
++Insert your card to unlock the display.\n\
++The display is locked by user %s.
++
++*message.OCF.waitremovallogoutwait: \
++There is no card in the reader.\n\
++Re-insert you card and authenticate yourself within %d seconds or you will \n\
++be automatically logged out. \n\
++The display is locked by user %s.
++
++*message.OCF.authrequired: \
++Smart Card detected. Authentication is required on this card .\n\
++Locking the display for user %s.
++
++*message.OCF.wronguser: \
++The card's owner is not permitted to unlock \n\
++this display. Please remove the card.\n\
++The display is locked by user %s.
++
++*message.OCF.default: \
++Unexpected card state: %x.\n\
++Try reinserting your card. If the problem persists, \n\
++contact your system administrator.\n\
++The display is locked by user %s.
+
+ ! Resources for the Motif dialog boxes of the "xscreensaver-demo" program.
+ !
+diff -urp -x '*~' driver/lock.c driver/lock.c
+--- driver/lock.c 2006-05-10 08:48:35.674843000 -0700
++++ driver/lock.c 2006-05-10 08:48:40.932264000 -0700
+@@ -17,6 +17,12 @@
+ # include "config.h"
+ #endif
+
++#ifdef HAVE_SCF_SMARTCARD
++#include <thread.h>
++#include <signal.h>
++#include <security/pam_appl.h>
++#endif /* HAVE_SCF_SMARTCARD */
++
+ #include <X11/Intrinsic.h>
+ #include <X11/Xos.h> /* for time() */
+ #include <time.h>
+@@ -74,12 +80,82 @@ vms_passwd_valid_p(char *pw, Bool verbos
+ extern void await_dying_children (saver_info *si);
+ void hack_uid (saver_info *si);
+
++
++#ifdef HAVE_SCF_SMARTCARD
++static void * smartcard_authenticate (void *);
++static void scfevent_handler (SCF_Event_t event,
++ SCF_Terminal_t eventTerminal, void *unused);
++static void card_removal_timeout (XtPointer, XtIntervalId *);
++static void card_removal_logout_wait (XtPointer, XtIntervalId *);
++static void start_wait_removal_timer (saver_info *);
++static void report_smartcard_init_error (saver_info*, char*, uint32_t);
++static void report_smartcard_error (char*, uint32_t);
++static char * get_message (saver_info *);
++static void set_smartcard_lock_state (saver_info *);
++static Bool is_valid_unlock_user(char *);
++static void force_exit (saver_info *si);
++
++static XtIntervalId card_removal_timeout_id;
++static XtIntervalId card_removal_logout_wait_id;
++/*
++** S10 SCF API did not use client_name and client_version
++static char *client_name = "dtsession";
++static char *client_version = "1";
++*/
++
++static cond_t c_event_processed = DEFAULTCV;
++static mutex_t m_event_processed = DEFAULTMUTEX;
++static Bool b_event_processed = 1;
++
++static char * get_username(void);
++static int run_PAMsession(char *, saver_info*);
++
++static cond_t c_got_message = DEFAULTCV;
++static mutex_t m_got_message;
++static Bool b_got_message = False;
++
++static cond_t c_got_response = DEFAULTCV;
++static mutex_t m_got_response;
++static Bool b_got_response = False;
++
++static cond_t c_got_username = DEFAULTCV;
++static mutex_t m_got_username;
++static Bool b_got_username = False;
++
++static cond_t c_validated_response = DEFAULTCV;
++static mutex_t m_validated_response;
++static Bool b_validated_response = False;
++
++static Bool b_validation_succeeded;
++static Bool b_validation_finished;
++static Bool b_PAM_prompted;
++static Bool b_got_PAM_message;
++static Bool b_first_prompt;
++
++static thread_t pam_thread = (thread_t) NULL;
++
++static void wait_for_got_message (void);
++
++static char *saved_user_input = NULL;
++static struct pam_message safe_pam_message;
++static struct pam_message *saved_pam_message = &safe_pam_message;
++static int conversation_function(int, const struct pam_message**,
++ struct pam_response **, void *);
++#endif /* HAVE_SCF_SMARTCARD */
++
+ Bool g_passwd_dialog_created = 0;
+
+ #undef MAX
+ #define MAX(a,b) ((a)>(b)?(a):(b))
+
++#ifdef HAVE_SCF_SMARTCARD
++#include "scf-smartcard.h"
++/*
++ * enum passwd_state is defined in scf-smartcard.h
++ */
++#else
+ enum passwd_state { pw_read, pw_ok, pw_null, pw_fail, pw_cancel, pw_time };
++#endif
+
+
+
+@@ -91,6 +167,15 @@ enum passwd_state { pw_read, pw_ok, pw_n
+
+
+ static void make_window (saver_info *si, enum window_type w_type);
++
++#ifdef HAVE_SCF_SMARTCARD
++void make_passwd_window (saver_info *si);
++static void make_message_window (saver_info *si);
++static void message_animate_timer (XtPointer closure, XtIntervalId *id);
++static void message_event_loop (saver_info *si);
++
++#endif /* HAVE_SCF_SMARTCARD */
++
+ static void draw_passwd_window (saver_info *si);
+ void update_passwd_window (saver_info *si, const char *printed_passwd,
+ float ratio);
+@@ -290,6 +375,17 @@ spawn_external_passwd_process (saver_inf
+ */
+ hack_uid (si);
+
++#ifdef HAVE_SCF_SMARTCARD
++ if (si->scf_si && si->scf_si->use_smartcard)
++ {
++ char* command_with_arg = malloc (strlen(command) +
++ strlen("+use_smartcard"));
++ sprintf(command_with_arg, "%s +use_smartcard", command);
++ exec_command (p->shell, command_with_arg, 0);
++ }
++ else
++#endif /*HAVE_SCF_SMARTCARD*/
++
+ exec_command (p->shell, command, 0);
+ /* print_path_error (command); */
+ fprintf (stderr, "%s: couldn't exec: %s\n",
+@@ -351,6 +447,10 @@ make_window (saver_info *si, enum window
+ fprintf(stderr, "-->make_window()\n");
+
+ #ifdef HAVE_XSCREENSAVER_LOCK
++#ifdef HAVE_SCF_SMARTCARD
++ if (w_type == w_dialog) /*if it is message then dont create the lock dialog*/
++#endif /*HAVE_SCF_SMARTCARD*/
++ {
+ if (spawn_external_passwd_process (si, si->pw_data))
+ {
+ /***************
+@@ -392,6 +492,18 @@ make_window (saver_info *si, enum window
+
+ si->pw_data->heading_label = get_string_resource ("passwd.heading.label",
+ "Dialog.Label.Label");
++#ifdef HAVE_SCF_SMARTCARD
++ /* we never create dialog window; only pw_data->w_type == w_message */
++ {
++ si->pw_data->message_body_label = get_scf_message (si);
++ if (si->prefs.verbose_p)
++ {
++ fprintf (stderr, "**SCF: calling get_scf_message() msg = %s*** \n",si->pw_data->message_body_label);
++ fflush (stderr);
++ }
++ }
++#endif /* HAVE_SCF_SMARTCARD */
++
+ si->pw_data->date_label = get_string_resource ("dateFormat", "DateFormat");
+
+ if (!si->pw_data->heading_label)
+@@ -479,6 +591,26 @@ make_window (saver_info *si, enum window
+ if (overall.width > si->pw_data->width) si->pw_data->width = overall.width;
+ si->pw_data->height += ascent + descent;
+
++#ifdef HAVE_SCF_SMARTCARD
++ /* else si->pw_data->w_type == w_message */
++ {
++ char **label_lines = si->pw_data->message_body_label;
++
++ while (*label_lines && **label_lines)
++ {
++ XTextExtents (si->pw_data->body_font,
++ *label_lines, strlen(*label_lines),
++ &direction, &ascent, &descent, &overall);
++ if (overall.width > si->pw_data->width) si->pw_data->width = overall.width;
++ si->pw_data->height += ascent + descent;
++ if (*label_lines && **label_lines)
++ label_lines++;
++ else
++ break;
++ }
++ }
++#endif /* HAVE_SCF_SMARTCARD */
++
+ si->pw_data->width += (si->pw_data->internal_border * 2);
+ si->pw_data->height += (si->pw_data->internal_border * 4);
+
+@@ -607,17 +739,35 @@ draw_passwd_window (saver_info *si)
+ int sw;
+ int tb_height;
+
++#ifdef HAVE_SCF_SMARTCARD
++ if (pw->w_type == w_dialog)
++#endif /* HAVE_SCF_SMARTCARD */
++ {
+
+- if (si->prefs.verbose_p)
+- fprintf (stderr, "-->draw_passwd_window() case w_dialog!!\n");
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "-->draw_passwd_window() case w_dialog!!\n");
++
++ height = (pw->heading_font->ascent + pw->heading_font->descent +
++ pw->body_font->ascent + pw->body_font->descent +
++ (2 * MAX ((pw->label_font->ascent + pw->label_font->descent),
++ (pw->passwd_font->ascent + pw->passwd_font->descent +
++ (pw->shadow_width * 4)))) +
++ pw->date_font->ascent + pw->date_font->descent
++ );
++ }
++#ifdef HAVE_SCF_SMARTCARD
++ else /* pw->w_type == w_message */
++ {
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "--> SCF::draw_passwd_window() case w_message!!\n");
++
++ height = (pw->heading_font->ascent + pw->heading_font->descent +
++ pw->body_font->ascent + pw->body_font->descent +
++ pw->date_font->ascent + pw->date_font->descent
++ );
++ }
++#endif /* HAVE_SCF_SMARTCARD */
+
+- height = (pw->heading_font->ascent + pw->heading_font->descent +
+- pw->body_font->ascent + pw->body_font->descent +
+- (2 * MAX ((pw->label_font->ascent + pw->label_font->descent),
+- (pw->passwd_font->ascent + pw->passwd_font->descent +
+- (pw->shadow_width * 4)))) +
+- pw->date_font->ascent + pw->date_font->descent
+- );
+ spacing = ((pw->height - (2 * pw->shadow_width) -
+ pw->internal_border - height)) / 8;
+ if (spacing < 0) spacing = 0;
+@@ -641,90 +791,117 @@ draw_passwd_window (saver_info *si)
+ /* text below top heading
+ */
+ XSetFont (si->dpy, gc1, pw->body_font->fid);
+- y1 += spacing + pw->body_font->ascent + pw->body_font->descent;
+- sw = string_width (pw->body_font, pw->body_label);
+- x2 = (x1 + ((x3 - x1 - sw) / 2));
+- XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1,
+- pw->body_label, strlen(pw->body_label));
+
++#ifdef HAVE_SCF_SMARTCARD
++ if (pw->w_type == w_dialog)
++#endif /* HAVE_SCF_SMARTCARD */
++ {
++ y1 += spacing + pw->body_font->ascent + pw->body_font->descent;
++ sw = string_width (pw->body_font, pw->body_label);
++ x2 = (x1 + ((x3 - x1 - sw) / 2));
++ XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1,
++ pw->body_label, strlen(pw->body_label));
+
+- tb_height = (pw->passwd_font->ascent + pw->passwd_font->descent +
+- (pw->shadow_width * 4));
+
+- /* the "User:" prompt
+- */
+- y1 += spacing;
+- y2 = y1;
+- XSetForeground (si->dpy, gc1, pw->foreground);
+- XSetFont (si->dpy, gc1, pw->label_font->fid);
+- y1 += (spacing + tb_height);
+- x2 = (x1 + pw->internal_border +
+- MAX(string_width (pw->label_font, pw->user_label),
+- string_width (pw->label_font, pw->passwd_label)));
+- XDrawString (si->dpy, si->passwd_dialog, gc1,
+- x2 - string_width (pw->label_font, pw->user_label),
+- y1,
+- pw->user_label, strlen(pw->user_label));
++ tb_height = (pw->passwd_font->ascent + pw->passwd_font->descent +
++ (pw->shadow_width * 4));
+
+- /* the "Password:" prompt
+- */
+- y1 += (spacing + tb_height);
+- XDrawString (si->dpy, si->passwd_dialog, gc1,
+- x2 - string_width (pw->label_font, pw->passwd_label),
+- y1,
+- pw->passwd_label, strlen(pw->passwd_label));
++ /* the "User:" prompt
++ */
++ y1 += spacing;
++ y2 = y1;
++ XSetForeground (si->dpy, gc1, pw->foreground);
++ XSetFont (si->dpy, gc1, pw->label_font->fid);
++ y1 += (spacing + tb_height);
++ x2 = (x1 + pw->internal_border +
++ MAX(string_width (pw->label_font, pw->user_label),
++ string_width (pw->label_font, pw->passwd_label)));
++ XDrawString (si->dpy, si->passwd_dialog, gc1,
++ x2 - string_width (pw->label_font, pw->user_label),
++ y1,
++ pw->user_label, strlen(pw->user_label));
+
++ /* the "Password:" prompt
++ */
++ y1 += (spacing + tb_height);
++ XDrawString (si->dpy, si->passwd_dialog, gc1,
++ x2 - string_width (pw->label_font, pw->passwd_label),
++ y1,
++ pw->passwd_label, strlen(pw->passwd_label));
+
+- XSetForeground (si->dpy, gc2, pw->passwd_background);
++ XSetForeground (si->dpy, gc2, pw->passwd_background);
+
+- /* the "user name" text field
+- */
+- y1 = y2;
+- XSetForeground (si->dpy, gc1, pw->passwd_foreground);
+- XSetFont (si->dpy, gc1, pw->passwd_font->fid);
+- y1 += (spacing + tb_height);
+- x2 += (pw->shadow_width * 4);
+-
+- pw->passwd_field_width = x3 - x2 - pw->internal_border;
+- pw->passwd_field_height = (pw->passwd_font->ascent +
+- pw->passwd_font->descent +
+- pw->shadow_width);
+-
+- XFillRectangle (si->dpy, si->passwd_dialog, gc2,
+- x2 - pw->shadow_width,
+- y1 - (pw->passwd_font->ascent + pw->passwd_font->descent),
+- pw->passwd_field_width, pw->passwd_field_height);
+- XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1,
+- pw->user_string, strlen(pw->user_string));
++ /* the "user name" text field
++ */
++ y1 = y2;
++ XSetForeground (si->dpy, gc1, pw->passwd_foreground);
++ XSetFont (si->dpy, gc1, pw->passwd_font->fid);
++ y1 += (spacing + tb_height);
++ x2 += (pw->shadow_width * 4);
++
++ pw->passwd_field_width = x3 - x2 - pw->internal_border;
++ pw->passwd_field_height = (pw->passwd_font->ascent +
++ pw->passwd_font->descent +
++ pw->shadow_width);
+
+- /* the "password" text field
+- */
+- y1 += (spacing + tb_height);
++ XFillRectangle (si->dpy, si->passwd_dialog, gc2,
++ x2 - pw->shadow_width,
++ y1 - (pw->passwd_font->ascent + pw->passwd_font->descent),
++ pw->passwd_field_width, pw->passwd_field_height);
++ XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1,
++ pw->user_string, strlen(pw->user_string));
+
+- pw->passwd_field_x = x2 - pw->shadow_width;
+- pw->passwd_field_y = y1 - (pw->passwd_font->ascent +
+- pw->passwd_font->descent);
++ /* the "password" text field
++ */
++ y1 += (spacing + tb_height);
+
+- /* The shadow around the text fields
+- */
+- y1 = y2;
+- y1 += (spacing + (pw->shadow_width * 3));
+- x1 = x2 - (pw->shadow_width * 2);
+- x2 = pw->passwd_field_width + (pw->shadow_width * 2);
+- y2 = pw->passwd_field_height + (pw->shadow_width * 2);
++ pw->passwd_field_x = x2 - pw->shadow_width;
++ pw->passwd_field_y = y1 - (pw->passwd_font->ascent +
++ pw->passwd_font->descent);
+
+- draw_shaded_rectangle (si->dpy, si->passwd_dialog,
+- x1, y1, x2, y2,
+- pw->shadow_width,
+- pw->shadow_bottom, pw->shadow_top);
++ /* The shadow around the text fields
++ */
++ y1 = y2;
++ y1 += (spacing + (pw->shadow_width * 3));
++ x1 = x2 - (pw->shadow_width * 2);
++ x2 = pw->passwd_field_width + (pw->shadow_width * 2);
++ y2 = pw->passwd_field_height + (pw->shadow_width * 2);
++
++ draw_shaded_rectangle (si->dpy, si->passwd_dialog,
++ x1, y1, x2, y2,
++ pw->shadow_width,
++ pw->shadow_bottom, pw->shadow_top);
++
++ y1 += (spacing + pw->passwd_font->ascent + pw->passwd_font->descent +
++ (pw->shadow_width * 4));
++ draw_shaded_rectangle (si->dpy, si->passwd_dialog,
++ x1, y1, x2, y2,
++ pw->shadow_width,
++ pw->shadow_bottom, pw->shadow_top);
++ }
++#ifdef HAVE_SCF_SMARTCARD
++ else /* pw->w_type == w_message */
++ {
++ char ** label_lines = pw->message_body_label;
++
++ y1 += spacing;
++ while (*label_lines && **label_lines)
++ {
++ y1 += pw->body_font->ascent + pw->body_font->descent;
++ sw = string_width (pw->body_font, *label_lines);
++ x2 = (x1 + ((x3 - x1 - sw) / 2));
++ XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1,
++ *label_lines, strlen(*label_lines));
++ if (*label_lines && **label_lines)
++ label_lines++;
++ else
++ break;
++ }
+
+- y1 += (spacing + pw->passwd_font->ascent + pw->passwd_font->descent +
+- (pw->shadow_width * 4));
+- draw_shaded_rectangle (si->dpy, si->passwd_dialog,
+- x1, y1, x2, y2,
+- pw->shadow_width,
+- pw->shadow_bottom, pw->shadow_top);
++ tb_height = 0;
+
++ }
++#endif /* HAVE_SCF_SMARTCARD */
+
+ /* The date, below the text fields
+ */
+@@ -839,68 +1016,86 @@ update_passwd_window (saver_info *si, co
+ XRectangle rects[1];
+
+ pw->ratio = ratio;
+-
+- if (si->prefs.verbose_p)
+- fprintf (stderr, "-->update_passwd_window() w_dialog !!\n");
+-
+- if (!si->pw_data->got_windowid )
++#ifdef HAVE_SCF_SMARTCARD
++ if (pw->w_type == w_dialog)
++#endif /* HAVE_SCF_SMARTCARD */
+ {
++
+ if (si->prefs.verbose_p)
+- fprintf (stderr, "-->update_passwd_window() lockdialog not created returning.. !!\n");
+- return;
++ fprintf (stderr, "-->update_passwd_window() w_dialog !!\n");
++
++ if (!si->pw_data->got_windowid )
++ {
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "-->update_passwd_window() lockdialog not created returning.. !!\n");
++ return;
++ }
++
++ gcv.foreground = pw->passwd_foreground;
++ if (pw->passwd_font)
++ gcv.font = pw->passwd_font->fid;
++ gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground|GCFont, &gcv);
++ gcv.foreground = pw->passwd_background;
++ }
++#ifdef HAVE_SCF_SMARTCARD
++ else /* pw->w_type == w_message */
++ {
++ gcv.foreground = pw->foreground;
++ gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv);
++ gcv.foreground = pw->background;
+ }
+-
+- gcv.foreground = pw->passwd_foreground;
+- if (pw->passwd_font)
+- gcv.font = pw->passwd_font->fid;
+- gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground|GCFont, &gcv);
+- gcv.foreground = pw->passwd_background;
++#endif /* HAVE_SCF_SMARTCARD */
++
+ gc2 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv);
+
+- if (printed_passwd)
++#ifdef HAVE_SCF_SMARTCARD
++ if (pw->w_type == w_dialog)
++#endif /* HAVE_SCF_SMARTCARD */
+ {
+- char *s = strdup (printed_passwd);
+- if (pw->passwd_string) free (pw->passwd_string);
+- pw->passwd_string = s;
+- }
++ if (printed_passwd)
++ {
++ char *s = strdup (printed_passwd);
++ if (pw->passwd_string) free (pw->passwd_string);
++ pw->passwd_string = s;
++ }
+
+- /* the "password" text field
+- */
+- rects[0].x = pw->passwd_field_x;
+- rects[0].y = pw->passwd_field_y;
+- rects[0].width = pw->passwd_field_width;
+- rects[0].height = pw->passwd_field_height;
++ /* the "password" text field
++ */
++ rects[0].x = pw->passwd_field_x;
++ rects[0].y = pw->passwd_field_y;
++ rects[0].width = pw->passwd_field_width;
++ rects[0].height = pw->passwd_field_height;
+
+- XFillRectangle (si->dpy, si->passwd_dialog, gc2,
+- rects[0].x, rects[0].y, rects[0].width, rects[0].height);
++ XFillRectangle (si->dpy, si->passwd_dialog, gc2,
++ rects[0].x, rects[0].y, rects[0].width, rects[0].height);
+
+- XSetClipRectangles (si->dpy, gc1, 0, 0, rects, 1, Unsorted);
++ XSetClipRectangles (si->dpy, gc1, 0, 0, rects, 1, Unsorted);
+
+- XDrawString (si->dpy, si->passwd_dialog, gc1,
+- rects[0].x + pw->shadow_width,
+- rects[0].y + (pw->passwd_font->ascent +
+- pw->passwd_font->descent),
+- pw->passwd_string, strlen(pw->passwd_string));
++ XDrawString (si->dpy, si->passwd_dialog, gc1,
++ rects[0].x + pw->shadow_width,
++ rects[0].y + (pw->passwd_font->ascent +
++ pw->passwd_font->descent),
++ pw->passwd_string, strlen(pw->passwd_string));
+
+- XSetClipMask (si->dpy, gc1, None);
++ XSetClipMask (si->dpy, gc1, None);
+
+- /* The I-beam
+- */
+- if (pw->i_beam != 0)
+- {
+- x = (rects[0].x + pw->shadow_width +
+- string_width (pw->passwd_font, pw->passwd_string));
+- y = rects[0].y + pw->shadow_width;
++ /* The I-beam
++ */
++ if (pw->i_beam != 0)
++ {
++ x = (rects[0].x + pw->shadow_width +
++ string_width (pw->passwd_font, pw->passwd_string));
++ y = rects[0].y + pw->shadow_width;
++
++ if (x > rects[0].x + rects[0].width - 1)
++ x = rects[0].x + rects[0].width - 1;
++ XDrawLine (si->dpy, si->passwd_dialog, gc1,
++ x, y, x, y + pw->passwd_font->ascent);
++ }
+
+- if (x > rects[0].x + rects[0].width - 1)
+- x = rects[0].x + rects[0].width - 1;
+- XDrawLine (si->dpy, si->passwd_dialog, gc1,
+- x, y, x, y + pw->passwd_font->ascent);
++ pw->i_beam = (pw->i_beam + 1) % 4;
+ }
+
+- pw->i_beam = (pw->i_beam + 1) % 4;
+-
+-
+ /* the thermometer
+ */
+ y = (pw->thermo_field_height - 2) * (1.0 - pw->ratio);
+@@ -1051,6 +1246,25 @@ destroy_passwd_window (saver_info *si)
+
+ if (pw->heading_label) free (pw->heading_label);
+ if (pw->body_label) free (pw->body_label);
++
++#ifdef HAVE_SCF_SMARTCARD
++ if (pw->message_body_label)
++ {
++ char ** label_lines = pw->message_body_label;
++
++ /*
++ * The array of character strings was originally one character
++ * string before each line was split into a different string
++ * so just one free is required.
++ */
++ if (*label_lines)
++ {
++ free (*label_lines);
++ }
++ free (pw->message_body_label);
++ }
++#endif /* HAVE_SCF_SMARTCARD */
++
+ if (pw->user_label) free (pw->user_label);
+ if (pw->passwd_label) free (pw->passwd_label);
+ if (pw->date_label) free (pw->date_label);
+@@ -1068,10 +1282,15 @@ destroy_passwd_window (saver_info *si)
+ if (pw->background != black && pw->background != white)
+ XFreeColors (si->dpy, cmap, &pw->background, 1, 0L);
+
+- if (pw->passwd_foreground != black && pw->passwd_foreground != white)
+- XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L);
+- if (pw->passwd_background != black && pw->passwd_background != white)
+- XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L);
++#ifdef HAVE_SCF_SMARTCARD
++ if (pw->w_type == w_dialog)
++#endif /* HAVE_SCF_SMARTCARD */
++ {
++ if (pw->passwd_foreground != black && pw->passwd_foreground != white)
++ XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L);
++ if (pw->passwd_background != black && pw->passwd_background != white)
++ XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L);
++ }
+ if (pw->thermo_foreground != black && pw->thermo_foreground != white)
+ XFreeColors (si->dpy, cmap, &pw->thermo_foreground, 1, 0L);
+ if (pw->thermo_background != black && pw->thermo_background != white)
+@@ -1423,10 +1642,18 @@ handle_passwd_key (saver_info *si, XKeyE
+ XSync (si->dpy, False);
+
+ /***************mali99************************************************
++ **** No need to call scf_passwd_valid_p, only xscreensaver.c calls
++ **** pam_passwd_valid_p() which drives pam. *************************
++#ifdef HAVE_SCF_SMARTCARD
++ pw->state = scf_passwd_valid_p(si, typed_passwd);
++ if (si->prefs.verbose_p)
++ fprintf (stderr,"scf_passwd_valid_p() returns status = %d\n",pw->state);
++#else * ! HAVE_SCF_SMARTCARD *
+ if (passwd_valid_p (typed_passwd, p->verbose_p, PAM_SERVICE))
+ pw->state = pw_ok;
+ else
+ pw->state = pw_fail;
++#endif * HAVE_SCF_SMARTCARD *
+ update_passwd_window (si, "", pw->ratio);
+ ****************************************************************************/
+ pw->state = pw_ok;
+@@ -1507,6 +1734,18 @@ passwd_event_loop (saver_info *si)
+ else if (event.xany.type == KeyPress)
+ handle_passwd_key (si, &event.xkey);
+ #endif /* !HAVE_XSCREENSAVER_LOCK */
++#ifdef HAVE_SCF_SMARTCARD
++ else if ((event.xany.type == 0) && has_smartcard_event_occurred())
++ /* Synthethic event has been signalled because of card insertion
++ * or removal
++ */
++ {
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "**SCF: calling handle_scf_event() ***\n");
++ handle_scf_event (si);
++ si->pw_data->state = pw_cancel;
++ }
++#endif /* HAVE_SCF_SMARTCARD */
+ else if (event.xany.window == si->passwd_dialog && event.xany.type == Expose &&
+ si->pw_data->passwd_label != NULL)
+ {
+@@ -1531,6 +1770,9 @@ passwd_event_loop (saver_info *si)
+ case pw_read: msg = strdup("pw_read"); break;
+ case pw_fail: msg = strdup("pw_fail"); break;
+ case pw_cancel: msg = strdup("pw_cancel"); break;
++#ifdef HAVE_SCF_SMARTCARD
++ case pw_another: msg = strdup("pw_another"); break;
++#endif
+ default: msg = 0;
+ fprintf(stderr, "si->pw_data->state is bad, serious error\n");
+ break;
+@@ -1721,6 +1963,15 @@ unlock_p (saver_info *si)
+ passwd_event_loop (si);
+
+ status = (si->pw_data->state == pw_ok);
++#ifdef HAVE_SCF_SMARTCARD
++ if (si->pw_data->state == pw_another)
++ {
++ /*
++ * Generate synthetic event so that dialog is displayed
++ */
++ idle_timer ((XtPointer) si, 0);
++ }
++#endif /* HAVE_SCF_SMARTCARD */
+
+ destroy_passwd_window (si);
+
+@@ -1734,6 +1985,10 @@ unlock_p (saver_info *si)
+ void
+ set_locked_p (saver_info *si, Bool locked_p)
+ {
++#ifdef HAVE_SCF_SMARTCARD
++ scf_set_locked_p (si, locked_p);
++#endif /* HAVE_SCF_SMARTCARD */
++
+ si->locked_p = locked_p;
+
+ #ifdef HAVE_XHPDISABLERESET
+@@ -1749,6 +2004,116 @@ set_locked_p (saver_info *si, Bool locke
+ store_saver_status (si); /* store locked-p */
+ }
+
++#ifdef HAVE_SCF_SMARTCARD
++static void
++make_message_window (saver_info *si)
++{
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "**make_passwd_window() dialog should be message(1)!!\n");
++
++ make_window (si, w_message);
++}
++
++static void
++message_animate_timer (XtPointer closure, XtIntervalId *id)
++{
++ saver_info *si = (saver_info *) closure;
++ int tick = 166;
++ scf_saver_info *scf_si = si->scf_si;
++ passwd_dialog_data *pw = si->pw_data;
++
++ if (!pw|| !pw->prompt_screen) return;
++
++ if (si->scf_si->scdata->message_timeout)
++ pw->ratio -= (1.0 / ((double) scf_si->scdata->message_timeout / (double) tick));
++ if (pw->ratio < 0)
++ {
++ pw->ratio = 0;
++ if (pw->state == pw_read)
++ pw->state = pw_time;
++ }
++
++ update_passwd_window (si, NULL, pw->ratio);
++
++ if (pw->state == pw_read)
++ pw->timer = XtAppAddTimeOut (si->app, tick, message_animate_timer,
++ (XtPointer) si);
++ else
++ pw->timer = 0;
++
++ idle_timer ((XtPointer) si, id);
++}
++/*GOK BUG */
++
++
++static void
++message_event_loop (saver_info *si)
++{
++ saver_preferences *p = &si->prefs;
++ XEvent event;
++ message_animate_timer ((XtPointer) si, 0);
++
++ while (si->pw_data && si->pw_data->state == pw_read)
++ {
++ XtAppNextEvent (si->app, &event);
++ if (event.xany.window == si->passwd_dialog && event.xany.type == Expose)
++ draw_passwd_window (si);
++ else if (event.xany.type == KeyPress)
++ /* ignore KeyPress events */
++ continue;
++ else if ((event.xany.type == 0) && has_smartcard_event_occurred())
++ /* Synthethic event has been signalled */
++ {
++
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "**message_animate_timer() calling handle_scf_event()*** \n");
++ handle_scf_event (si);
++ si->pw_data->state = pw_cancel;
++ }
++ else
++ XtDispatchEvent (&event);
++ }
++
++ if (si->pw_data && p->verbose_p)
++ switch (si->pw_data->state)
++ {
++ case pw_null:
++ case pw_cancel:
++ fprintf (stderr, "%s: message entry cancelled.\n", blurb()); break;
++ case pw_time:
++ fprintf (stderr, "%s: message entry timed out.\n", blurb()); break;
++ default:
++ fprintf (stderr, "%s: unexpected message entry: %d\n", blurb(),
++ si->pw_data->state); break;
++ }
++}
++
++Bool
++display_message (saver_info *si)
++{
++ Screen *screen = si->default_screen->screen;
++ Colormap cmap = DefaultColormapOfScreen (screen);
++ Bool status = False;
++
++ raise_window (si, True, True, True);
++
++ if (si->pw_data || si->passwd_dialog)
++ destroy_passwd_window (si);
++
++ make_message_window (si);
++ if (cmap) XInstallColormap (si->dpy, cmap);
++
++ message_event_loop (si);
++
++ destroy_passwd_window (si);
++
++ cmap = si->default_screen->cmap;
++ if (cmap) XInstallColormap (si->dpy, cmap);
++
++ return status;
++}
++
++#endif /* HAVE_SCF_SMARTCARD */
+
+ #else /* NO_LOCKING -- whole file */
+
+diff -urp -x '*~' driver/passwd-pam.c driver/passwd-pam.c
+--- driver/passwd-pam.c 2006-05-10 08:48:35.676003000 -0700
++++ driver/passwd-pam.c 2006-05-10 08:48:40.893332000 -0700
+@@ -62,6 +62,12 @@
+
+ #include <sys/stat.h>
+
++#ifdef HAVE_SCF_SMARTCARD
++#include <thread.h>
++#include <signal.h>
++#include <security/pam_appl.h>
++#endif /* HAVE_SCF_SMARTCARD */
++
+ #include <X11/Intrinsic.h>
+ #include <X11/Xos.h> /* for time() */
+ #include <time.h>
+@@ -201,7 +207,7 @@ static void *suns_pam_implementation_blo
+ Bool
+ pam_passwd_valid_p ()
+ {
+- const char *service = PAM_SERVICE_NAME;
++ const char *service;
+ uid_t euid;
+ pam_handle_t *pamh = 0;
+ int pam_auth_status = 0; /* Specific for pam_authenticate() status*/
+@@ -220,6 +226,8 @@ pam_passwd_valid_p ()
+ fprintf (stderr, "-->pam_passwd_valid_p()\n");
+
+ if (!p) return False;
++ /* 4818344(P1) xscreensaver does not use PAM correctly */
++ service = strdup (SCF_PAM_SERVICE_NAME);
+
+ euid = geteuid();
+
+@@ -496,6 +504,7 @@ pam_passwd_valid_p ()
+
+
+ DONE:
++ if (service) free((void *)service);
+ if (user) free (user);
+ if (pamh)
+ {
+@@ -737,6 +746,27 @@ pam_conversation (int nmsgs,
+ write_to_child (si, tmp_msg);
+ sleep(1);
+
++ fprintf (stderr,"scf_scdata_state = %d\n",
++ si->scf_si->scdata->state);
++ /* The following need to change to some other variable which gets set
++ * when the user hits OK button in the dialog displaying the TEXT_INFO or
++ * ERROR_MSG. But we dont have buttons in dialog, and at the moment this
++ * case only happens for smartcards so the following will work.
++ */
++ while (si->scf_si->use_smartcard && si->scf_si->scdata->state == SCD_WAIT_FOR_CARD)
++ {
++ XEvent event;
++ XtAppNextEvent (si->app, &event);
++ XtDispatchEvent (&event);
++#if 0
++ /* handle_typeahead (si);**/
++ passwd_event_loop (si);
++ if (c->verbose_p)
++ fprintf (stderr,"scf_scdata_state = %d\n",
++ si->scf_si->scdata->state);
++#endif /*0*/
++ }
++
+ if (c->verbose_p)
+ fprintf(stderr, "PAM_ERROR/PAM_TEXT_INFO msg[%d]-> %s\n",
+ replies,msg[replies]->msg);
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2006-05-10 08:48:35.788404000 -0700
++++ driver/subprocs.c 2006-05-10 08:48:40.879329000 -0700
+@@ -44,6 +44,11 @@
+ # define fork vfork
+ #endif /* VMS */
+
++#ifdef sun
++#define fork fork1
++#endif
++
++
+ #include <signal.h> /* for the signal names */
+
+ #if !defined(SIGCHLD) && defined(SIGCLD)
+diff -urp -x '*~' driver/timers.c driver/timers.c
+--- driver/timers.c 2006-05-10 08:48:35.781471000 -0700
++++ driver/timers.c 2006-05-10 08:48:40.874330000 -0700
+@@ -56,6 +56,9 @@ extern Bool pam_passwd_valid_p(void);
+ extern Bool blank_screen (saver_info *si);
+ extern void unblank_screen (saver_info *si);
+
++#ifdef HAVE_SCF_SMARTCARD
++extern Bool Ignore_SmartCard;
++#endif /* HAVE_SCF_SMARTCARD */
+
+ void
+ idle_timer (XtPointer closure, XtIntervalId *id)
+@@ -580,6 +583,10 @@ sleep_until_idle (saver_info *si, Bool u
+ saver_preferences *p = &si->prefs;
+ XEvent event;
+
++#ifdef HAVE_SCF_SMARTCARD
++ scf_saver_info *scf_si = si->scf_si;
++#endif
++
+ /* We need to select events on all windows if we're not using any extensions.
+ Otherwise, we don't need to. */
+ Bool scanning_all_windows = !(si->using_xidle_extension ||
+@@ -607,6 +614,22 @@ sleep_until_idle (saver_info *si, Bool u
+ si->using_mit_saver_extension ||
+ si->using_sgi_saver_extension));
+
++#ifdef HAVE_SCF_SMARTCARD
++ static Bool display_required = False;
++
++ /*
++ * When a card event occurs when we are waiting for idleness
++ * we want to display the message immediately and not wait until
++ * the user presses a key or moves the mouse. The variable display_required
++ * is set to true to indicate this situation.
++ */
++ if (display_required)
++ {
++ display_required = False;
++ return;
++ }
++#endif /* HAVE_SCF_SMARTCARD */
++
+ if (until_idle_p)
+ {
+ if (polling_for_idleness)
+@@ -629,6 +652,24 @@ sleep_until_idle (saver_info *si, Bool u
+
+ switch (event.xany.type) {
+ case 0: /* our synthetic "timeout" event has been signalled */
++#ifdef HAVE_SCF_SMARTCARD
++ /*
++ * If the synthetic event has been signalled because of a
++ * smartcard event deal with it
++ */
++ if (scf_si->use_smartcard && !Ignore_SmartCard)
++ {
++ if (has_smartcard_event_occurred ())
++ {
++ handle_scf_event (si);
++ set_smartcard_event_occurred (False);
++ if (si->prefs.verbose_p)
++ fprintf(stderr,"case 0: (sleep_until_idle)\n");
++ continue;
++ }
++ }
++#endif /* HAVE_SCF_SMARTCARD */
++
+ if (until_idle_p)
+ {
+ Time idle;
+@@ -680,6 +721,28 @@ sleep_until_idle (saver_info *si, Bool u
+ idle = 1000 * (si->last_activity_time - time ((time_t *) 0));
+ }
+
++#ifdef HAVE_SCF_SMARTCARD
++ if (scf_si->use_smartcard && !Ignore_SmartCard)
++ {
++ if ((scf_si->scdata->state == SCD_WAIT_FOR_CARD) ||
++ (scf_si->scdata->state == SCD_WAIT_REMOVAL_LOGOUT_WAIT) ||
++ (scf_si->scdata->state == SCD_AUTH_REQUIRED))
++ {
++ /*
++ * The smart card was removed or inserted while waiting for
++ * idle timeout to occur. We set display_required so that the
++ * next time this function is called it will return
++ * immediately instead of waiting for mouse movement or
++ * key press.
++ */
++ display_required = True;
++ if (si->prefs.debug_p)
++ fprintf(stderr,"use_smartcard, setting display_required (sleep_until_idle)\n");
++ goto DONE;
++ }
++ }
++#endif /* HAVE_SCF_SMARTCARD */
++
+ if (idle >= p->timeout)
+ {
+ /* Look, we've been idle long enough. We're done. */
+@@ -700,6 +763,25 @@ sleep_until_idle (saver_info *si, Bool u
+ schedule_wakeup_event (si, p->timeout - idle, p->debug_p);
+ }
+ }
++#ifdef HAVE_SCF_SMARTCARD
++ else
++ {
++ /*
++ * A smart card was reinserted or the smart card was removed
++ * after locking the screen so we want to get the dialog displayed.
++ */
++ if (scf_si->use_smartcard && !Ignore_SmartCard)
++ {
++ if ((scf_si->scdata->state == SCD_WAIT_FOR_CARD) ||
++ (scf_si->scdata->state == SCD_AUTH_REQUIRED))
++ {
++ if (si->prefs.debug_p)
++ fprintf(stderr,"else(until_idle_p) (sleep_until_idle)\n");
++ goto DONE;
++ }
++ }
++ }
++#endif /* HAVE_SCF_SMARTCARD */
+ break;
+
+ case ClientMessage:
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:48:35.764178000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:48:40.913194000 -0700
+@@ -156,11 +156,23 @@
+ #include "visual.h"
+ #include "usleep.h"
+
++#ifdef HAVE_SCF_SMARTCARD
++#include "scf-smartcard.h"
++#endif /* HAVE_SCF_SMARTCARD */
++
+ extern Bool pam_passwd_valid_p ();
+
+ saver_info *global_si_kludge = 0; /* I hate C so much... */
+
+ /* Globals */
++#ifdef HAVE_SCF_SMARTCARD
++ scf_saver_info the_scf_si;
++ scf_saver_info *ptr_osi = &the_scf_si;
++ smartcard_info the_smi;
++ smartcard_info *ptr_smi = &the_smi;
++ Bool Ignore_SmartCard = True;
++#endif /* HAVE_SCF_SMARTCARD */
++
+ Bool ok_to_unblank = False;
+
+ /* Global storage for gtk passwd lock dialog
+@@ -182,6 +194,9 @@ static Atom XA_RESTART, XA_SELECT;
+ static Atom XA_THROTTLE, XA_UNTHROTTLE;
+ Atom XA_DEMO, XA_PREFS, XA_EXIT, XA_LOCK, XA_BLANK;
+ Atom XA_UNLOCK_RATIO;
++#ifdef HAVE_SCF_SMARTCARD
++Atom XA_SMARTCARD;
++#endif
+
+
+ static XrmOptionDescRec options [] = {
+@@ -470,6 +485,9 @@ privileged_initialization (saver_info *s
+ lock_priv_init (*argc, argv, si->prefs.verbose_p);
+ #endif /* NO_LOCKING */
+
++#ifdef HAVE_SCF_SMARTCARD
++ init_scf_properties (si);
++#endif /* HAVE_SCF_SMARTCARD */
+ hack_uid (si);
+ }
+
+@@ -571,6 +589,9 @@ connect_to_server (saver_info *si, int *
+ XA_THROTTLE = XInternAtom (si->dpy, "THROTTLE", False);
+ XA_UNTHROTTLE = XInternAtom (si->dpy, "UNTHROTTLE", False);
+ XA_UNLOCK_RATIO = XInternAtom (si->dpy, "UNLOCK_RATIO", False);
++#ifdef HAVE_SCF_SMARTCARD
++ XA_SMARTCARD = XInternAtom (si->dpy, "SMARTCARD", False);
++#endif
+
+ return toplevel_shell;
+ }
+@@ -1260,6 +1281,13 @@ main (int argc, char **argv)
+
+ memset(si, 0, sizeof(*si));
+
++#ifdef HAVE_SCF_SMARTCARD
++ memset(ptr_osi, 0, sizeof(*ptr_osi));
++ memset(ptr_smi, 0, sizeof(*ptr_smi));
++ si->scf_si = ptr_osi;
++ si->scf_si->scdata = ptr_smi;
++#endif /* HAVE_SCF_SMARTCARD */
++
+ /* Initialize and point si to pw_data i.e. the lock dialog struct */
+ memset(ptr_mygtkpwd, 0, sizeof(*ptr_mygtkpwd));
+ si->pw_data = ptr_mygtkpwd;
+@@ -1318,6 +1346,12 @@ main (int argc, char **argv)
+ False);
+
+ initialize_stderr (si);
++
++
++#ifdef HAVE_SCF_SMARTCARD
++ init_scf_handler(si);
++#endif
++
+ handle_signals (si);
+
+ make_splash_dialog (si);
+@@ -1816,6 +1850,14 @@ handle_clientmessage (saver_info *si, XE
+ }
+ }
+ }
++#ifdef HAVE_SCF_SMARTCARD
++ else if (type == XA_SMARTCARD)
++ {
++ handle_scf_event (si);
++ return False;
++ }
++#endif /*HAVE_SCF_SMARTCARD*/
++
+ else
+ {
+ char buf [1024];
+diff -urp -x '*~' driver/xscreensaver.h driver/xscreensaver.h
+--- driver/xscreensaver.h 2006-05-10 08:48:35.728700000 -0700
++++ driver/xscreensaver.h 2006-05-10 08:48:40.873132000 -0700
+@@ -20,6 +20,11 @@
+ #include <string.h>
+ #include <stdio.h>
+
++#ifdef HAVE_SCF_SMARTCARD
++#include <smartcard/scf.h>
++#include "scf-smartcard.h"
++#endif
++
+ #include "prefs.h"
+
+ extern char *progname;
+@@ -183,9 +188,14 @@ struct saver_info {
+
+ XtIntervalId stderr_popup_timer;
+
++ /* =======================================================================
++ SCF properties to support smart card use
++ ======================================================================= */
++#ifdef HAVE_SCF_SMARTCARD
++ scf_saver_info *scf_si;
++#endif /* HAVE_SCF_SMARTCARD */
+ };
+
+-
+ /* This structure holds all the data that applies to the screen-specific parts
+ of the display connection; if the display has multiple screens, there will
+ be one of these for each screen.
+@@ -335,6 +345,10 @@
+ int to_screen_no);
+ extern int mouse_screen (saver_info *si);
+
++#ifdef HAVE_SCF_SMARTCARD
++extern Bool display_message (saver_info *si);
++#endif /* HAVE_SCF_SMARTCARD */
++
+ /* =======================================================================
+ For lock.c
+ ======================================================================= */
+@@ -509,9 +524,28 @@ extern Bool display_is_on_console_p (sav
+ extern Visual *get_best_gl_visual (saver_screen_info *ssi);
+ extern void check_for_leaks (const char *where);
+
++/* ========================================================================
++ functions exported from scf-smartcard.c
++ ======================================================================== */
++#ifdef HAVE_SCF_SMARTCARD
++extern void scf_set_locked_p (saver_info *si, Bool locked_p);
++extern enum passwd_state scf_passwd_valid_p (saver_info *si, char *typed_passwd);
++extern Bool check_smartcard_dialog (saver_info *si);
++extern char ** get_scf_message (saver_info *);
++extern void init_scf_properties (saver_info *si);
++extern void init_scf_handler (saver_info *si);
++extern void handle_scf_event (saver_info *si);
++extern char * scf_set_passwd_label (saver_info *si);
++extern Bool has_smartcard_event_occurred (void);
++extern void set_smartcard_event_occurred (Bool);
++#endif /* HAVE_SCF_SMARTCARD */
++
+ extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
+ extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
+ extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
+ extern Atom XA_DEMO, XA_PREFS;
++#ifdef HAVE_SCF_SMARTCARD
++extern Atom XA_SMARTCARD;
++#endif /*HAVE_SCF_SMARTCARD*/
+
+ #endif /* __XSCREENSAVER_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/solaris-paths.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,234 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Various fixes to deal with where we install things on Solaris:
+
+- Allow variables passed in from Makefile to override the values configure
+ tries to determine for GNOME_DATADIR & GLADE_DATADIR, since we install
+ in a different place for historical reasons.
+
+- Only run hacks from the hacks dir, not $PATH
+
+- Find xscreensaver-gl-helper even though it's not in $PATH
+
+diff -urp -x '*~' configure.in configure.in
+--- configure.in 2006-05-10 08:48:12.212319000 -0700
++++ configure.in 2006-05-10 08:48:17.091582000 -0700
+@@ -2108,7 +2108,9 @@ if test "$with_gtk" = yes; then
+ $ac_gnome_config_libs)
+ fi
+
+-
++#--- Begin SUNW addition
++ if test -z "$GNOME_DATADIR" ; then
++#--- End SUNW addition
+ GNOME_DATADIR=""
+ if test "$have_gnome" = yes -a "$have_gtk" = yes; then
+ if test -n "$pkg_config"; then
+@@ -2122,6 +2124,9 @@ if test "$with_gtk" = yes; then
+ fi
+ GNOME_DATADIR="$GNOME_DATADIR/share"
+ fi
++#--- Begin SUNW addition
++ fi
++#--- End SUNW addition
+
+ # .desktop files go in different places in Gnome 1.x and Gnome 2.x...
+ if test "$have_gtk2" = yes; then
+@@ -3342,6 +3347,10 @@ fi
+ # "/usr/X11R6/share/pixmaps/", which is wrong. It needs to be the
+ # Gnome/Gtk prefix, not the overall prefix.
+ #
++
++#--- Begin SUNW addition
++if test -z "$GLADE_DATADIR" ; then
++#--- End SUNW addition
+ if test -n "$GNOME_DATADIR" ; then
+ GLADE_DATADIR='$(GNOME_DATADIR)/xscreensaver'
+ elif test "$have_gtk" = yes; then
+@@ -3358,6 +3367,9 @@ elif test "$have_gtk" = yes; then
+ else
+ GLADE_DATADIR=''
+ fi
++#--- Begin SUNW addition
++fi
++#--- End SUNW addition
+
+
+ # canonicalize slashes.
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2002-06-05 23:00:38.000000000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:48:17.094156000 -0700
+@@ -770,7 +770,7 @@ restart_menu_cb (GtkWidget *widget, gpoi
+ flush_dialog_changes_and_save (s);
+ xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL);
+ sleep (1);
+- system ("xscreensaver -nosplash &");
++ system ("/usr/openwin/bin/xscreensaver -nosplash &");
+
+ await_xscreensaver (s);
+ }
+@@ -3940,7 +3940,7 @@ main (int argc, char **argv)
+
+ if (init_results == 1)
+ {
+- system ("xscreensaver -nosplash &");
++ system ("/usr/openwin/bin/xscreensaver -nosplash &");
+ return 0;
+ }
+
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2002-03-05 18:10:17.000000000 -0800
++++ driver/subprocs.c 2006-05-10 08:48:17.092506000 -0700
+@@ -14,6 +14,7 @@
+ # include "config.h"
+ #endif
+
++#include <sys/stat.h>
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -605,6 +606,8 @@ print_path_error (const char *program)
+ free (cmd);
+ perror (buf);
+
++/* mali - security issue do not want to display user's path */
++#ifdef EXPOSE_USER_PATH
+ if (errno == ENOENT &&
+ (token = getenv("PATH")))
+ {
+@@ -634,6 +637,7 @@ print_path_error (const char *program)
+ }
+ fprintf (stderr, "\n");
+ }
++#endif
+ }
+
+
+@@ -661,6 +665,11 @@ spawn_screenhack_1 (saver_screen_info *s
+ /* No hacks at all */
+ new_hack = -1;
+ }
++ else if (p->screenhacks_count == 1)
++ {
++ /* Exactly one hack in the list */
++ new_hack = 0;
++ }
+ else if (si->selection_mode == -1)
+ {
+ /* Select the next hack, wrapping. */
+@@ -755,20 +764,34 @@ spawn_screenhack_1 (saver_screen_info *s
+ saver_exit (si, 1, 0);
+
+ case 0:
++ {
++ /* We need complete path to hack command else any executable
++ * with the same name in the path gets executed...and we should
++ * really be using DEFAULT_PATH_PREFIX for the path where hacks are.
++ */
++ char* complete_hack_command = malloc (strlen(hack->command) +
++ strlen ("/usr/openwin/lib/xscreensaver/hacks") + 10);
++
+ close (ConnectionNumber (si->dpy)); /* close display fd */
+ limit_subproc_memory (p->inferior_memory_limit, p->verbose_p);
+ hack_subproc_environment (ssi); /* set $DISPLAY */
++ sprintf(complete_hack_command,
++ "/usr/openwin/lib/xscreensaver/hacks/%s",
++ hack->command);
+
+ if (p->verbose_p)
+ fprintf (stderr, "%s: %d: spawning \"%s\" in pid %lu.\n",
+ blurb(), ssi->number, hack->command,
+ (unsigned long) getpid ());
+
+- exec_command (p->shell, hack->command, p->nice_inferior);
++ exec_command (p->shell, complete_hack_command, p->nice_inferior);
++
+ /* If that returned, we were unable to exec the subprocess. */
+- print_path_error (hack->command);
++ print_path_error (complete_hack_command);
++ free (complete_hack_command);
+ exit (1); /* exits child fork */
+ break;
++ }
+
+ default:
+ ssi->pid = forked;
+@@ -778,10 +801,41 @@ spawn_screenhack_1 (saver_screen_info *s
+ }
+ }
+
++Bool
++check_if_hacks_dir_exists(void)
++{
++ const char hackdir[] = "/usr/openwin/lib/xscreensaver/hacks";
++
++ int status;
++ struct stat st;
++
++ status = stat (hackdir, &st);
++
++ if (status == 0 && S_ISDIR(st.st_mode))
++ {
++ return True;
++ }
++ else
++ {
++ fprintf(stderr, "\t*** Warning: dir: %s missing. Will not run hacks\n",
++ hackdir);
++ return False;
++ }
++}
++
+
+ void
+ spawn_screenhack (saver_info *si, Bool first_time_p)
+ {
++ if (si->prefs.verbose_p)
++ fprintf(stderr, "--> spawn_screenhack()\n");
++
++ if (check_if_hacks_dir_exists() == False)
++ {
++ store_saver_status (si); /* store current hack numbers */
++ return;
++ }
++
+ if (monitor_powered_on_p (si))
+ {
+ int i;
+@@ -947,7 +1001,7 @@ get_best_gl_visual (saver_screen_info *s
+ char *av[10];
+ int ac = 0;
+
+- av[ac++] = "xscreensaver-gl-helper";
++ av[ac++] = "/usr/openwin/lib/xscreensaver/bin/xscreensaver-gl-helper";
+ av[ac] = 0;
+
+ if (pipe (fds))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/solaris-suncc-fixes.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Patches to fix build problems on Solaris using Sun Studio compilers.
+These were submitted to jwz, who incorporated them into xscreensaver 4.11,
+so are not needed once we upgrade to 4.11 or later.
+
+Fixes:
+
+1. Only add Motif library options to $MOTIF_LIBS, so they're not used if
+ building with gtk instead of Motif
+
+2. Allow configure to detect DPMS on Solaris (Solaris dpms.h requires
+ <X11/Xmd.h> - current XFree86 dpms.h includes that file directly).
+
+3. Use only pure-integral expressions in switch cases (our language lawyers
+ insist this is required by the C99 standard).
+
+diff -urp -x '*~' configure.in configure.in
+--- configure.in 2002-06-11 02:02:00.000000000 -0700
++++ configure.in 2006-05-10 08:47:54.754406000 -0700
+@@ -585,10 +585,10 @@ AC_DEFUN(AC_X_RANDOM_PATHS,
+ #
+ if test -f /usr/dt/include/Xm/Xm.h ; then
+ X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
+- X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
++ MOTIF_LIBS="$MOTIF_LIBS -L/usr/dt/lib -R/usr/dt/lib"
+
+ # Some versions of Slowlaris Motif require -lgen. But not all. Why?
+- AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
++ AC_CHECK_LIB(gen, regcmp, [MOTIF_LIBS="$MOTIF_LIBS -lgen"])
+ fi
+ ;;
+ esac])
+@@ -1139,7 +1139,8 @@ if test "$with_dpms" = yes; then
+
+ # first check for dpms.h
+ AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes],,
+- [#include <X11/Xlib.h>])
++ [#include <X11/Xlib.h>
++ #include <X11/Xmd.h>])
+
+ # if that succeeded, then check for the DPMS code in the libraries
+ if test "$have_dpms" = yes; then
+diff -urp -x '*~' hacks/glx/glsnake.c hacks/glx/glsnake.c
+--- hacks/glx/glsnake.c 2002-05-05 03:31:09.000000000 -0700
++++ hacks/glx/glsnake.c 2006-05-10 08:47:54.755187000 -0700
+@@ -457,15 +457,15 @@ void calc_snake_metrics(glsnake_configur
+ y += GETSCALAR(prev_dest_dir, Y_MASK);
+ z += GETSCALAR(prev_dest_dir, Z_MASK);
+
+- switch ((int) bp->node[i].dest_angle) {
+- case (int) (ZERO * 90.0):
++ switch ((int) (bp->node[i].dest_angle / 90.0)) {
++ case ZERO:
+ dest_dir = -prev_src_dir;
+ break;
+- case (int) (PIN * 90.0):
++ case PIN:
+ dest_dir = prev_src_dir;
+ break;
+- case (int) (RIGHT * 90.):
+- case (int) (LEFT * 90.0):
++ case RIGHT:
++ case LEFT:
+ dest_dir = cross_product(prev_src_dir, prev_dest_dir);
+ if (bp->node[i].dest_angle == (int) (RIGHT * 90.0))
+ dest_dir = -dest_dir;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/ChangeLog Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,273 @@
+2002-07-30 jacob berkman <[email protected]>
+
+ * driver/demo-Gtk.c (wm_popup_close_cb):
+ (wm_toplevel_close_cb): these should return a gboolean, not void
+
+ fixes #89320
+
+2002-07-23 jacob berkman <[email protected]>
+
+ * driver/demo-Gtk.c (manual_cb): fix some warnings (for bug
+ #80436)
+
+2002-06-17 jacob berkman <[email protected]>
+
+ * configure.in: fix lock dialog checks (Mahmood Ali
+ <[email protected]>)
+
+2002-06-04 jacob berkman <[email protected]>
+
+ * configure.in: fix xml 2 checks
+
+ -- merge 4.04.2 + HEAD --
+
+2002-06-03 jacob berkman <[email protected]>
+
+ * driver/Makefile.in (GLADE_DATADIR): fix tyop
+
+2002-05-29 jacob berkman <[email protected]>
+
+ * driver/subprocs.c (describe_dead_child): don't reference
+ si->passwd_pid unless we are buildng for the gtk lock dialog
+ (based on patch from HideToshi Tajima <[email protected]>)
+
+2002-05-28 jacob berkman <[email protected]>
+
+ * Makefile.in: merge fixes from HEAD
+
+2002-05-24 jacob berkman <[email protected]>
+
+ * driver/lock-Gtk.c (make_dialog): bail if xss isn't running, call
+ xss to get the version and user, and display the date
+ (main): setup remote atoms and init i18n
+
+ fixes bug #82141
+
+ * configure.in: only require autoconf 2.52
+
+ -- merge in 4.03 --
+
+ * driver/subprocs.c (describe_dead_child): check against our lock
+ dialog child
+
+ fixes #80932
+
+2002-05-06 Arvind Samptur <[email protected]>
+
+ * driver/lock.c (destroy_passwd_window) : variable passwd_string is not intialized
+ if HAVE_XSCREENSAVER_LOCK defined, hence moving memeset to the else part to avoid
+ crash.
+
+2002-04-18 jacob berkman <[email protected]>
+
+ -- merge in HEAD + 4.02 --
+
+2002-04-18 jacob berkman <[email protected]>
+
+ -- merge in 4.02 --
+
+ * driver/xscreensaver-demo.glade2: fix icons and bug #79022
+
+2002-04-05 jacob berkman <[email protected]>
+
+ * driver/subprocs.c (describe_dead_child):
+ * driver/lock.c (passwd_event_loop): kill more spew in terse mode
+
+2002-04-04 jacob berkman <[email protected]>
+
+ * driver/lock-Gtk.c (make_dialog): add atk description for
+ progress bar
+
+ * driver/lock.c: don't spew warnings in terse mode
+
+2002-04-04 jacob berkman <[email protected]>
+
+ * driver/Makefile.in (GTK_SRCS): fix tyop which i think breaks
+ makedepend on solaris
+
+2002-04-02 jacob berkman <[email protected]>
+
+ * configure.in: remove -export-dynamic, workaround pkg-config bug
+ by explicitely requiring gmodule. also require gtk 2.0.1 since
+ there were some bug fixes there we require
+
+ * driver/demo-Gtk.c (pref_changed_event_cb): call
+ pref_changed_cb(), return FALSE (fixes #77378)
+
+ * driver/xscreensaver-demo.glade2: change spinbutton "changed"
+ signals to use "value_changed" (fixes #76752) and make the handler
+ for focus_out_events pref_changed_event_cb (fixes #77378)
+
+ * hacks/xpm-pixmap.c (xpm_to_pixmap_1): only init gobject in the
+ gtk 2 version
+
+ * driver/windows.c (mouse_screen): kill warning
+
+2002-03-29 jacob berkman <[email protected]>
+
+ * driver/xscrensaver-demo.glade2: keynav + atk fixes
+
+ * driver/demo-Gtk.c (create_xscreensaver_demo): turn preview
+ notebook tabs off
+ (clear_preview_window): show the 'no preview available' label when
+ there was an error starting the hack
+
+2002-03-27 jacob berkman <[email protected]>
+
+ * driver/Makefile.in: name the .desktop
+ screensaver-properties.desktop in all cases
+
+ * driver/Makefile.in: install the .desktop file's icon in the
+ $gnomedatadir/pixmaps, and install the .desktop file in
+ $gnomedatadir/control-center-2.0 also
+
+ * driver/screensaver-properties.desktop.in (Categories): add some
+ categories
+
+ * driver/demo-Gtk.c (main): silently accept --crapplet for the
+ gtk2 version also
+
+2002-03-27 Duarte Loreto <[email protected]>
+
+ * configure.in: Added Portuguese (pt) to ALL_LINGUAS.
+
+2002-03-25 Stanislav Visnovsky <[email protected]>
+
+ * configure.in: Added "sk" to ALL_LINGUAS.
+
+2002-03-20 jacob berkman <[email protected]>
+
+ * driver/demo-Gtk.c (list_activated_cb): connect to row_activated
+ rather than looking for double clicks
+
+ * driver/xscreensaver-demo.glade2: turn off list titles
+
+ * hacks/glx/xpm-ximage.c (xpm_to_ximage_1): port to new pixbuf api
+
+2002-03-19 jacob berkman <[email protected]>
+
+ * hacks/glx/xpm-ximage.c: fix xlib-pixbuf header
+
+ * driver/xscreensaver-demo.glade2:
+ * driver/demo-Gtk.c: port to TreeView from GtkList, and fix a
+ couple of bugs
+
+ * hacks/xpm-pixmap.c: include path for gdk-pixbuf-xlib changed for
+ gtk 2
+ (xpm_to_pixmap_1): port to new pixbuf loading api, call
+ g_type_init()
+
+ * hacks/webcollage-helper.c (load_pixbuf): helper function to do
+ both gtk 2 and gtk 1 pixbuf loading apis
+ (paste): use new helper function
+ (write_pixbuf): fix warning
+ (main): call g_type_init()
+
+ * driver/xscreensaver-demo.glade2:
+ * driver/xscreensaver-demo.glade2p: use a real glade 2 file, not a
+ libglade-convert generated one.
+
+ * driver/demo-Gtk.c (name_to_widget): reformat warning string
+ (warning_dialog): set the string as selectable
+ (warning_dialog): set the ok/cancel buttons as defaultable stock
+ buttons and switch them
+ (warning_dialog): present the window rather than show/raise
+ (about_menu_cb): use the right UTF-8 codes for (C), use a stock ok
+ button
+ (store_image_directory): fix a warning
+ (populate_prefs_page): use gtk_spin_button_set_value()
+ (eschew_gtk_lossage): fix a warning
+ (create_xscreensaver_settings_dialog): set the advanced, standard
+ buttons as secondary
+ (main): don't do the pixmap hack for gtk 2 - use GtkArrow.
+
+ * configure.in: add/fix checks for gdk-pixbuf-xlib for gtk2 build
+
+2002-03-15 jacob berkman <[email protected]>
+
+ * configure.in: set GNOME_DATADIR to $(datadir) for gnome 2 build
+
+ * mkinstalldirs: add since we aaren't automake'd
+
+ * driver/demo-Gtk.c (main): only call bindtextdomain_codeset() for
+ the gtk 2 buidl
+
+ * Makefile.in (TARFILES): add some more files po/Makefile.in needs
+
+ * driver/Makefile.in (EXTRAS): add .glade2 file
+
+ * Makefile.in (TARFILES): add intltool and libtool files
+
+2002-03-12 jacob berkman <[email protected]>
+
+ * autogen.sh: add libtool and intltool stuff, and remove automake
+
+ * config.h.in: add HAVE_GTK2
+
+ * configure.in: add checks for GTK 2.0, libxml 2.4, and libglade
+ 1.99.x
+
+ * driver/Makefile.in: add intltool and glade vars, and fix for
+ building against gtk 2.
+
+ * driver/demo-Gtk-conf.c: (make_parameter):
+ (make_parameters_1):
+ (make_parameters):
+ (load_configurator_1): port to libxml1 / libxml2 compat api
+
+ * driver/demo-Gtk.c: (name_to_widget):
+ (warning_dialog):
+ (about_menu_cb):
+ (fix_text_entry_sizes):
+ (clear_preview_window):
+ (create_xscreensaver_demo):
+ (create_xscreensaver_settings_dialog):
+ (main): port to gtk 2 / libglade and conditionally compile the
+ non-libglade ui support for the gtk 1 version
+
+ * driver/xscreensaver-demo.glade: fix icon paths
+
+ * driver/xscreensaver-demo.glade2: libglade-converted file
+
+2002-03-08 jacob berkman <[email protected]>
+
+ < merge patch from Carlos Perell� Mar�n <[email protected]> >
+
+ * po/*: intl stuff
+
+ * utils/xscreensaver-intl.h: define our gettext macros
+
+ * utils/Makefile.in (HDRS): add xscreensaver-intl.h
+
+ * driver/screensaver-properties.desktop.in: remove translations
+ and use intltool
+
+ * driver/demo-Gtk.c:
+ * driver/demo-Gtk-conf.c: include xscreensaver-intl, mark some
+ strings for translation, initialize gettext
+
+ * driver/Makefile.in: add libintl things
+
+ * configure.in: add intltool / gettext macros
+ (AC_OUTPUT): add po/Makefile.in.in
+
+ * config.h.in: add GETTEXT_PACKAGE and ENABLE_NLS
+
+ * Makefile.in (SUBDIRS): add po
+
+ * HACKING: try to intimidate people
+
+ * ChangeLog: new file to track changes
+
+ * autogen.sh: stolen from glib
+
+ * configure.in (HANDLE_X_PATH_ARG): fixup some [] escaping that
+ breaks with autoconf 2.52
+
+ * configure:
+ * driver/XScreenSaver_ad.h: remove generated files
+
+ * .cvsignore:
+ * driver/.cvsignore:
+ * hacks/.cvsignore:
+ * utils/.cvsignore: quiet cvs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/HACKING Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,12 @@
+This CVS module is only for GTK 2 porting and gettext support.
+
+This module is being maintained by jacob berkman <[email protected]>
+(gnome cvs jberkman).
+
+all patches should be submitted to bugzilla in the xscreensaver
+module.
+
+When this stuff is merged upstream this module will be removed.
+
+jacob berkman <[email protected]>
+march 8 2002
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/autogen.sh Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+PROJECT=xscreensaver
+TEST_TYPE=-f
+FILE=driver/xscreensaver-command.c
+
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have autoconf installed to compile $PROJECT."
+ echo "libtool the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+test $TEST_TYPE $FILE || {
+ echo "You must run this script in the top-level $PROJECT directory"
+ exit 1
+}
+
+if test -z "$AUTOGEN_SUBDIR_MODE"; then
+ if test -z "$*"; then
+ echo "I am going to run ./configure with no arguments - if you wish "
+ echo "to pass any to it, please specify them on the $0 command line."
+ fi
+fi
+
+autoconf
+cd $ORIGDIR
+
+if test -z "$AUTOGEN_SUBDIR_MODE"; then
+ $srcdir/configure --enable-maintainer-mode --enable-gtk-doc "$@"
+
+ echo
+ echo "Now type 'make' to compile $PROJECT."
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/driver/lock-Gtk.c Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,1351 @@
+/* lock-Gtk.c -- a GTK+ password dialog for xscreensaver
+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <[email protected]>
+ *
+ * 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
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+/* GTK+ locking code written by Jacob Berkman <[email protected]> for
+ * Sun Microsystems.
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "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 <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+/* AT-enabled */
+#include <stdio.h>
+#include <ctype.h>
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/WinUtil.h>
+
+#include <gconf/gconf-client.h>
+#include <libbonobo.h>
+#include <login-helper/Accessibility_LoginHelper.h>
+#include <atk/atkobject.h>
+
+#include "remote.h"
+#include XPM_LOGO_FILE
+#ifdef TRUSTED_XPM_LOGO_FILE
+# include TRUSTED_XPM_LOGO_FILE
+#endif
+#include "trusted-utils.h"
+
+/* AT-enabled */
+void write_null(int n);
+
+
+static Atom XA_UNLOCK_RATIO;
+Atom XA_VROOT;
+Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
+Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
+Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
+
+typedef struct {
+ AtkObject *atk_dialog;
+ GtkWidget *dialog;
+ GtkWidget *passwd_entry;
+ GtkWidget *progress;
+ GtkWidget *button;
+ GtkWidget *msg_label;
+ GtkWidget *user_prompt_label;
+} PasswdDialog;
+
+static void ok_clicked_cb (GtkWidget *button, PasswdDialog *pwd);
+/*
+** 6182506: scr dialog is obscurred byg MAG window
+*/
+static PasswdDialog * atk_make_dialog (gboolean center_pos);
+/*Global info */
+#define MAXRAISEDWINS 2
+#define KEY "/desktop/gnome/interface/accessibility"
+gboolean at_enabled = FALSE;
+/*
+** 6182506: scr dialog is obscurred byg MAG window
+*/
+gboolean center_postion = FALSE;
+char *progname = 0;
+Bonobo_ServerInfoList *server_list = NULL;
+CORBA_Environment ev;
+Accessibility_LoginHelper helper;
+Accessibility_LoginHelper *helper_list = NULL;
+CORBA_boolean safe;
+
+#define FD_TO_PARENT 9
+
+static ssize_t
+write_string (const char *s)
+{
+ ssize_t len;
+
+/*****mali99 remove this ****
+ fprintf (stderr, "-->Child write_string() string to send parent is:%s\n",s);
+ fflush (stderr);
+**/
+
+ g_return_val_if_fail (s != NULL, -1);
+
+ do_write:
+ len = write (FD_TO_PARENT, s, strlen (s));
+ if (len < 0 && errno == EINTR)
+ goto do_write;
+
+ return len;
+}
+
+void
+write_null(int n)
+{
+Window w = 0;
+char *s;
+int i;
+
+if (n == 1 || n == 2)
+{
+ for (i =0; i < n; i++)
+ {
+ s = g_strdup_printf ("%lu\n", w);
+ write_string(s);
+ g_free(s);
+ }
+}
+else
+{
+ w = 1;
+ /* tell xscreensaver, MAG and GOK not running,
+ Ass. Tech support is still selected(SPEECH), reset timer for each
+ passwd char.
+ */
+ s = g_strdup_printf ("%lu\n", w);
+ write_string(s);
+ g_free(s);
+ w = 0;
+ s = g_strdup_printf ("%lu\n", w);
+ write_string(s);
+ g_free(s);
+
+}
+
+}
+
+/*
+** 6182506: scr dialog is obscurred byg MAG window
+*/
+
+static PasswdDialog *
+atk_make_dialog (gboolean center_pos)
+{
+ GtkWidget *dialog;
+ GtkWidget *frame1,*frame2;
+ GtkWidget *vbox;
+ GtkWidget *hbox,*hbox1,*hbox2;
+ GtkWidget *bbox;
+ GtkWidget *vbox2;
+ AtkObject *atk_frame1,*atk_frame2;
+ AtkObject *atk_vbox;
+ AtkObject *atk_hbox,*atk_hbox1,*atk_hbox2;
+ AtkObject *atk_vbox2;
+ AtkObject *atk_button,*atk_dialog;
+ GtkWidget *entry1,*entry2;
+ AtkObject *atk_entry1,*atk_entry2;
+ GtkWidget *label1,*label2,*label3,*label4,*label5;
+ AtkObject *atk_label1,*atk_label2,*atk_label3,*atk_label4,*atk_label5;
+ GtkWidget *button;
+ GtkWidget *image;
+ AtkObject *atk_image;
+ GtkWidget *progress;
+ GdkPixbuf *pb;
+ 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)
+ {
+ fprintf (stderr, "%s: no xscreensaver running on display %s, exiting.\n", 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);
+/*
+** 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 obscurred byg 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);
+/* AT-eabled dialog role = frame*/
+ atk_dialog = gtk_widget_get_accessible(dialog);
+ atk_object_set_description(atk_dialog, _("AT-enabled lock dialog"));
+ pwd->atk_dialog = atk_dialog;
+
+
+ /* frame */
+ frame1 = g_object_new (GTK_TYPE_FRAME,
+ "shadow", GTK_SHADOW_OUT,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (dialog), frame1);
+ pwd->dialog = dialog;
+
+
+ /*AT role = panel */
+
+ atk_frame1 = gtk_widget_get_accessible(frame1);
+
+
+ /* 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) */
+ atk_vbox = gtk_widget_get_accessible(vbox);
+
+
+ /* hbox */
+ hbox = gtk_hbox_new (FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox,
+ TRUE, TRUE, 0);
+
+
+ /* image frame */
+ frame2 = g_object_new (GTK_TYPE_FRAME,
+ "shadow", GTK_SHADOW_ETCHED_IN,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (hbox), frame2,
+ TRUE, TRUE, 0);
+
+ /* AT role= filler(default) */
+ atk_hbox = gtk_widget_get_accessible(hbox);
+
+
+
+ /* image */
+#ifdef TRUSTED_XPM_LOGO_NAME
+ if ( tsol_is_multi_label_session() )
+ pb = gdk_pixbuf_new_from_xpm_data ((const char **)TRUSTED_XPM_LOGO_NAME);
+ else
+#endif
+ pb = gdk_pixbuf_new_from_xpm_data ((const char **)XPM_LOGO_NAME);
+ image = gtk_image_new_from_pixbuf (pb);
+ g_object_unref (pb);
+
+
+ gtk_container_add (GTK_CONTAINER (frame2), image);
+
+ /* AT role=panel */
+
+ atk_frame2 = gtk_widget_get_accessible(frame2);
+
+
+ /* AT role = icon */
+
+ atk_image = gtk_widget_get_accessible(image);
+
+
+ /* progress thingie */
+ progress = g_object_new (GTK_TYPE_PROGRESS_BAR,
+ "orientation", GTK_PROGRESS_BOTTOM_TO_TOP,
+ "fraction", 1.0,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (hbox), progress,
+ FALSE, FALSE, 0);
+ pwd->progress = progress;
+ atk_object_set_description (gtk_widget_get_accessible (progress),
+ _("Percent of time you have to enter the password. "));
+
+
+ /* text fields */
+
+ vbox2 = gtk_vbox_new (TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox2,
+ TRUE, TRUE, 0);
+
+ s = g_strdup_printf ("<span size=\"xx-large\"><b>%s </b></span>", _("Screensaver"));
+ /* XScreenSaver foo label */
+ label1 = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", s,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox2), label1,
+ FALSE, FALSE, 0);
+
+ /*AT role =filler*/
+
+ atk_vbox2 = gtk_widget_get_accessible(vbox2);
+
+ /*AT role =label prog name */
+ atk_label1 = gtk_widget_get_accessible(label1);
+
+
+ g_free (s);
+
+ /* This display is locked. */
+ label2 = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", _("<b>This display is locked.</b>"),
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox2), label2,
+ FALSE, FALSE, 0);
+ /* AT role = label , msg */
+
+ atk_label2 = gtk_widget_get_accessible(label2);
+
+
+
+ /* table with password things */
+ hbox1 = gtk_widget_new (GTK_TYPE_HBOX,
+ "border_width", 3,
+ "visible",TRUE,
+ "homogeneous",FALSE,
+ "spacing",2,
+ NULL);
+
+
+ /* User: */
+ label3 = g_object_new (GTK_TYPE_LABEL,
+ "label", _(" User:"),
+ "use_underline", TRUE,
+ "justify",GTK_JUSTIFY_FILL,
+ "xalign", 1.0,
+ NULL);
+
+ /* name */
+ entry1 = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", user,
+ "justify",GTK_JUSTIFY_CENTER,
+ NULL);
+
+ gtk_box_pack_start ( GTK_BOX(hbox1), label3, FALSE, FALSE, 0);
+ gtk_box_pack_end ( GTK_BOX(hbox1), entry1, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox1,
+ FALSE, FALSE, 0);
+
+
+
+ /* Password or Pin */
+
+
+ hbox2 = gtk_widget_new (GTK_TYPE_HBOX,
+ "border_width", 5,
+ "visible",TRUE,
+ "homogeneous",FALSE,
+ "spacing",1,
+ NULL);
+
+ /* Password: */
+ label4 = g_object_new (GTK_TYPE_LABEL,
+ "label", _(" "), /*blank space for prompt*/
+ "use_underline", TRUE,
+ "use_markup",FALSE,
+ "justify",GTK_JUSTIFY_RIGHT,
+ "wrap", FALSE,
+ "selectable",TRUE,
+ "xalign", 1.0,
+ "yalign",0,
+ "xpad",0,
+ "ypad",0,
+ "visible", FALSE,
+ NULL);
+
+
+ entry2 = g_object_new (GTK_TYPE_ENTRY,
+ "activates-default", TRUE,
+ "visible", TRUE,
+ "editable", TRUE,
+ "visibility", FALSE,
+ "can_focus", TRUE,
+ NULL);
+
+
+ gtk_box_pack_start ( GTK_BOX(hbox2), label4, FALSE, FALSE, 0);
+ gtk_box_pack_end ( GTK_BOX(hbox2), entry2, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
+ pwd->user_prompt_label = label4;
+
+ pwd->passwd_entry = entry2;
+
+
+ /* AT role=panel */
+ atk_hbox1 = gtk_widget_get_accessible(hbox1);
+
+ /* AT role=label */
+ atk_label3= gtk_widget_get_accessible(label3);
+
+ /* AT role=label */
+ atk_label4= gtk_widget_get_accessible(label4);
+
+ /* AT role = text */
+ atk_entry1 = gtk_widget_get_accessible(entry1);
+
+ /* hbox1 for password/pin and text entry */
+
+ atk_hbox2 = gtk_widget_get_accessible(hbox2);
+
+
+/* AT role = password-text */
+ /* gtk_widget_grab_focus (entry2);
+ */
+ atk_entry2 = gtk_widget_get_accessible(entry2);
+
+ /* bugid 5079870 */
+ atk_object_set_role(atk_entry2, ATK_ROLE_PASSWORD_TEXT);
+
+ tm = localtime (&now);
+ memset (buf, 0, sizeof (buf));
+ format_string_utf8 = _("%d-%b-%y (%a); %I:%M %p");
+ format_string_locale = g_locale_from_utf8 (format_string_utf8, -1,
+ NULL, NULL, NULL);
+ strftime (buf, sizeof (buf) - 1, format_string_locale, tm);
+ g_free (format_string_locale);
+
+ /*bug 4783832 s = g_strdup_printf ("<small>%s</small>", buf);**/
+ utf8_format = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
+
+ s = g_strdup_printf ("<small>%s</small>", utf8_format);
+
+if (utf8_format)
+ g_free (utf8_format);
+
+ /* date string */
+ label5 = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", s,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox2), label5,
+ FALSE, FALSE, 0);
+ /* AT role=label */
+ atk_label5= gtk_widget_get_accessible(label5);
+
+
+if (s)
+ g_free (s);
+
+ /* button box */
+ bbox = g_object_new (GTK_TYPE_HBUTTON_BOX,
+ "layout-style", GTK_BUTTONBOX_END,
+ "spacing", 10,
+ NULL);
+
+ /* Ok button */
+ button = gtk_button_new_from_stock (GTK_STOCK_OK);
+ pwd->button = button;
+
+ gtk_box_pack_end (GTK_BOX (bbox), button,
+ FALSE, TRUE, 0);
+
+
+ atk_button = gtk_widget_get_accessible(button);
+
+
+
+
+ if (version);
+ free (user);
+ if (host);
+ free (version);
+ if (user);
+ free (host);
+
+ /* POP */
+ gtk_widget_pop_colormap ();
+
+ return pwd;
+}
+
+
+static PasswdDialog *
+make_dialog (void)
+{
+ GtkWidget *dialog;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *hbox,*hbox1,*hbox2;
+ GtkWidget *bbox;
+ GtkWidget *vbox2;
+ GtkWidget *entry;
+ GtkWidget *label;
+ GtkWidget *scrolled_text;
+ GtkWidget *button;
+ GtkWidget *image;
+ GtkWidget *progress;
+ GdkPixbuf *pb;
+ PasswdDialog *pwd;
+ char *version;
+ char *user;
+ char *host;
+ char *s;
+ gchar *format_string_locale, *format_string_utf8;
+
+
+ /* 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)
+ {
+ fprintf (stderr, "%s: no xscreensaver running on display %s, exiting.\n", progname, gdk_get_display ());
+ exit (1);
+ }
+
+/* PUSH */
+ gtk_widget_push_colormap (gdk_rgb_get_cmap ());
+
+ /**colormap = gtk_widget_get_colormap (parent);**/
+
+ pwd = g_new0 (PasswdDialog, 1);
+
+ dialog = gtk_window_new (GTK_WINDOW_POPUP);
+ pwd->dialog = dialog;
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
+
+ gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); /*mali99 irritating*/
+
+
+ /* frame */
+ frame = g_object_new (GTK_TYPE_FRAME,
+ "shadow", GTK_SHADOW_OUT,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (dialog), frame);
+
+ /* vbox */
+ vbox = gtk_vbox_new (FALSE, 10);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+
+ /* hbox */
+ hbox = gtk_hbox_new (FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox,
+ TRUE, TRUE, 0);
+
+ /* image frame */
+ frame = g_object_new (GTK_TYPE_FRAME,
+ "shadow", GTK_SHADOW_ETCHED_IN,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (hbox), frame,
+ TRUE, TRUE, 0);
+
+ /* image */
+#ifdef TRUSTED_XPM_LOGO_NAME
+ if ( tsol_is_multi_label_session() )
+ pb = gdk_pixbuf_new_from_xpm_data ((const char **)TRUSTED_XPM_LOGO_NAME);
+ else
+#endif
+ pb = gdk_pixbuf_new_from_xpm_data ((const char **)XPM_LOGO_NAME);
+ image = gtk_image_new_from_pixbuf (pb);
+ g_object_unref (pb);
+ gtk_container_add (GTK_CONTAINER (frame), image);
+
+ /* progress thing */
+ progress = g_object_new (GTK_TYPE_PROGRESS_BAR,
+ "orientation", GTK_PROGRESS_BOTTOM_TO_TOP,
+ "fraction", 1.0,
+ NULL);
+ pwd->progress = progress;
+ gtk_box_pack_start (GTK_BOX (hbox), progress,
+ FALSE, FALSE, 0);
+
+ /* text fields */
+ vbox2 = gtk_vbox_new (TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox2,
+ TRUE, TRUE, 0);
+
+ s = g_strdup_printf ("<span size=\"xx-large\"><b>%s </b></span>", _("Screensaver"));
+ /* XScreenSaver foo label */
+ label = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", s,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox2), label,
+ FALSE, FALSE, 0);
+ g_free (s);
+
+ /* This display is locked. */
+ label = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", _("<b>This display is locked.</b>"),
+ NULL);
+ pwd->msg_label = label;
+ gtk_box_pack_start (GTK_BOX (vbox2), label,
+ FALSE, FALSE, 0);
+
+ /* hbox1 table with password things */
+ hbox1 = gtk_widget_new (GTK_TYPE_HBOX,
+ "border_width", 3,
+ "visible",TRUE,
+ "homogeneous",FALSE,
+ "spacing",1,
+ NULL);
+
+ /* User: */
+ label = g_object_new (GTK_TYPE_LABEL,
+ "label", _(" User:"),
+ "use_underline", TRUE,
+ "justify",GTK_JUSTIFY_FILL,
+ "xalign", 1.0,
+ NULL);
+
+ /* name */
+ entry = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", user,
+ "justify",GTK_JUSTIFY_CENTER,
+ NULL);
+
+ gtk_box_pack_start ( GTK_BOX(hbox1), label, FALSE, FALSE, 0);
+ gtk_box_pack_end ( GTK_BOX(hbox1), entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+
+ /* Password or Pin */
+
+
+ hbox2 = gtk_widget_new (GTK_TYPE_HBOX,
+ "border_width", 5,
+ "visible",TRUE,
+ "homogeneous",FALSE,
+ "spacing",1,
+ NULL);
+
+ label = g_object_new (GTK_TYPE_LABEL,
+ "label", " ", /*blank space for prompt*/
+ "use-markup", TRUE,
+ "use_underline", TRUE,
+ "justify",GTK_JUSTIFY_RIGHT,
+ "wrap", FALSE,
+ "selectable",FALSE,
+ "xalign", 1.0,
+ "yalign",0.5,
+ "xpad",0,
+ "ypad",0,
+ "visible", FALSE,
+ NULL);
+
+ pwd->user_prompt_label = label; /**mali99*/
+
+
+ entry = g_object_new (GTK_TYPE_ENTRY,
+ "activates-default", TRUE,
+ "visible", TRUE,
+ "editable", TRUE,
+ "visibility", FALSE,
+ "can_focus", TRUE,
+ NULL);
+
+
+ gtk_box_pack_start ( GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+ gtk_box_pack_end ( GTK_BOX(hbox2), entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
+
+ /* passwd */
+ pwd->passwd_entry = entry;
+ gtk_widget_grab_focus (entry);
+
+ tm = localtime (&now);
+ memset (buf, 0, sizeof (buf));
+ format_string_utf8 = _("%d-%b-%y (%a); %I:%M %p");
+ format_string_locale = g_locale_from_utf8 (format_string_utf8, -1,
+ NULL, NULL, NULL);
+ strftime (buf, sizeof (buf) - 1, format_string_locale, tm);
+ g_free (format_string_locale);
+
+ /*bug 4783832 s = g_strdup_printf ("<small>%s</small>", buf);**/
+ utf8_format = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
+
+ s = g_strdup_printf ("<small>%s</small>", utf8_format);
+
+if (utf8_format)
+ g_free (utf8_format);
+
+ /* date string */
+ label = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "label", s,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox2), label,
+ FALSE, FALSE, 0);
+if (s)
+ g_free (s);
+
+ /* button box */
+ bbox = g_object_new (GTK_TYPE_HBUTTON_BOX,
+ "layout-style", GTK_BUTTONBOX_END,
+ "spacing", 10,
+ NULL);
+/*
+ gtk_box_pack_start (GTK_BOX (vbox), bbox,
+ FALSE, FALSE, 0);
+*/
+
+ /* Ok button */
+ button = gtk_button_new_from_stock (GTK_STOCK_OK);
+ pwd->button = button;
+ gtk_box_pack_end (GTK_BOX (bbox), button,
+ FALSE, TRUE, 0);
+
+ free (version);
+ free (user);
+ free (host);
+
+ /* POP */
+ gtk_widget_pop_colormap ();
+
+ return pwd;
+}
+
+static void
+desensitize_entry (PasswdDialog *pwd)
+{
+ g_object_set (pwd->passwd_entry,
+ "editable", FALSE,
+ NULL);
+}
+
+
+
+static void
+ok_clicked_cb (GtkWidget *button, PasswdDialog *pwd)
+{
+ char *s;
+ int i;
+
+
+
+ g_object_set (pwd->msg_label, "label", _("<b>Checking...</b>"), NULL);
+ s = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (pwd->passwd_entry)));
+
+ write_string (s);
+ g_free (s);
+
+/* #6178584 P1 "Xscreensaver needs to use ROLE_PASSWORD_TEXT
+ 1st part: fixing "It is too early to invoke LoginHelper_setSafe(FALSE)"
+ 2nd part: located at GOK
+ only GOK and MAG use loginhelper()
+*/
+
+ if (server_list)
+ {
+ for (i = 0; i < server_list->_length; i++)
+ {
+ helper = helper_list[i];
+ /* really no need to check the return value this time */
+ Accessibility_LoginHelper_setSafe (helper, FALSE, &ev);
+ if (BONOBO_EX (&ev))
+ {
+ g_warning ("setSafe(FALSE) failed: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+ CORBA_Object_release (helper, &ev);
+ }
+ CORBA_free (server_list);
+ bonobo_debug_shutdown ();
+ }
+
+}
+
+static void
+connect_signals (PasswdDialog *pwd)
+{
+ g_signal_connect (pwd->button, "clicked",
+ G_CALLBACK (ok_clicked_cb),
+ pwd);
+
+ g_signal_connect (pwd->passwd_entry, "activate",
+ G_CALLBACK (ok_clicked_cb),
+ pwd);
+
+ g_signal_connect (pwd->dialog, "delete-event",
+ G_CALLBACK (gtk_main_quit),
+ NULL);
+}
+
+
+
+static GdkFilterReturn
+dialog_filter_func (GdkXEvent *xevent, GdkEvent *gevent, gpointer data)
+{
+ PasswdDialog *pwd = data;
+ XEvent *event = xevent;
+ gdouble ratio;
+
+ if ((event->xany.type != ClientMessage ||
+ event->xclient.message_type != XA_UNLOCK_RATIO))
+ return GDK_FILTER_CONTINUE;
+
+ ratio = event->xclient.data.l[0] / (gdouble)100.0;
+
+ /* CR 6176524 passwdTimeoutEnable for disabled user */
+ if (event->xclient.data.l[1] == 0)
+ g_object_set (pwd->progress, "fraction", ratio, NULL);
+ return GDK_FILTER_REMOVE;
+
+}
+
+static gboolean
+handle_input (GIOChannel *source, GIOCondition cond, gpointer data)
+{
+ PasswdDialog *pwd = data;
+ GIOStatus status;
+ char *str;
+ char *label;
+ char* hmsg= (char*) NULL; /* This is the heading of lock dialog..shows status**/
+
+
+
+ read_line:
+ status = g_io_channel_read_line (source, &str, NULL, NULL, NULL);
+ if (status == G_IO_STATUS_AGAIN)
+ goto read_line;
+/* 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)
+ {
+ /**fprintf (stderr,">>>>>Child..in handle_input..string is:%s\n",str);
+ fflush (stderr);
+ **/
+
+ /* This is an ugly code, imp to remember strncmp is a must here,
+ * the string sent by parent is in weird stage only strncmp works,
+ * i believe need to add a \n to the end of string supplied by parent
+ * for it to work with other string operations, but strncmp works fine.
+ */
+
+ if( ((strncmp(str,"pw_", 3)) == 0) )
+ {
+ if ( (strncmp(str,"pw_ok",5)) == 0 )
+ {
+ hmsg = strdup(_("Authentication Successful!"));
+ }
+ else if ( (strncmp(str,"pw_acct_ok",10)) == 0 )
+ {
+ hmsg = strdup(_("PAM Account Management Also Successful!"));
+ }
+ else if ( (strncmp(str,"pw_setcred_fail",15)) == 0 )
+ {
+ hmsg = strdup(_("Just a Warning PAM Set Credential Failed!"));
+ }
+ else if ( (strncmp(str,"pw_setcred_ok",13)) == 0 )
+ {
+ hmsg = strdup(_("PAM Set Credential Also Successful!"));
+ }
+ else if ((strncmp(str,"pw_acct_fail",12)) == 0 )
+ {
+ hmsg = strdup (_("Just a Warning PAM Account Management Unsuccessful"));
+ }
+ else if ((strncmp(str,"pw_fail",7)) == 0 )
+ {
+ hmsg = strdup (_("Sorry!"));
+ }
+ else if ( strncmp(str,"pw_read",7) == 0 )
+ {
+ hmsg = strdup(_("Waiting for user input!"));
+ }
+ else if ( strncmp(str,"pw_time",7) == 0 )
+ {
+ hmsg = strdup(_("Timed Out!"));
+ }
+ else if ( strncmp(str,"pw_null",7) == 0 )
+ {
+ hmsg = strdup(_("Still Checking!"));
+ }
+ else if ( strncmp(str,"pw_cancel",9) == 0)
+ {
+ hmsg =strdup(_("Authentication Cancelled!"));
+ }
+ else
+ {
+ hmsg =strdup(_("Dont know whats up!"));
+ }
+
+ if (hmsg)
+ {
+ label = g_strdup_printf ("<b>%s\n</b>", hmsg);
+ g_object_set (pwd->msg_label, "label", label, NULL);
+ free (hmsg);
+ g_free (label);
+ }
+ }
+ if ( strncmp(str,"pw_", 3) != 0)
+ {
+ gtk_label_set_text (GTK_LABEL(pwd->user_prompt_label), str);
+ }
+
+ g_free (str);
+ }
+
+ return (status == G_IO_STATUS_NORMAL);
+}
+
+int
+main (int argc, char *argv[])
+{
+ GIOChannel *ioc;
+ PasswdDialog *pwd;
+ char *s;
+ char *real_progname = argv[0];
+ GConfClient *client;
+ const char *modulesptr = NULL;
+ int j;
+
+#ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ textdomain (GETTEXT_PACKAGE);
+
+# ifdef HAVE_GTK2
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+# else /* ! HAVE_GTK2 */
+ if (!setlocale (LC_ALL, ""))
+ fprintf (stderr, "%s: locale not supported by C library\n", real_progname);
+# endif /* ! HAVE_GTK2 */
+
+#endif /* ENABLE_NLS */
+
+ s = strrchr (real_progname, '/');
+ if (s) real_progname = s+1;
+ progname = real_progname;
+
+ gtk_init (&argc, &argv);
+
+ /* Intern the atoms that xscreensaver_command() needs.
+ */
+ XA_VROOT = XInternAtom (GDK_DISPLAY (), "__SWM_VROOT", FALSE);
+ XA_SCREENSAVER = XInternAtom (GDK_DISPLAY (), "SCREENSAVER", FALSE);
+ XA_SCREENSAVER_VERSION = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_VERSION",FALSE);
+ XA_SCREENSAVER_STATUS = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_STATUS", FALSE);
+ XA_SCREENSAVER_ID = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_ID", FALSE);
+ XA_SCREENSAVER_RESPONSE = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_RESPONSE", FALSE);
+ XA_SELECT = XInternAtom (GDK_DISPLAY (), "SELECT", FALSE);
+ XA_DEMO = XInternAtom (GDK_DISPLAY (), "DEMO", FALSE);
+ XA_ACTIVATE = XInternAtom (GDK_DISPLAY (), "ACTIVATE", FALSE);
+ XA_BLANK = XInternAtom (GDK_DISPLAY (), "BLANK", FALSE);
+ XA_LOCK = XInternAtom (GDK_DISPLAY (), "LOCK", FALSE);
+ XA_EXIT = XInternAtom (GDK_DISPLAY (), "EXIT", FALSE);
+ XA_RESTART = XInternAtom (GDK_DISPLAY (), "RESTART", FALSE);
+ XA_UNLOCK_RATIO = XInternAtom (GDK_DISPLAY (), "UNLOCK_RATIO", FALSE);
+
+/* bugid 6346056(P1):
+ATOK pallet sometimes appears in screensave/lock-screen mode
+*/
+ putenv ("GTK_IM_MODULE=gtk-im-context-simple");
+
+
+ /* AT-enable mode ? */
+ client = gconf_client_get_default ();
+ at_enabled = gconf_client_get_bool (client, KEY, NULL);
+
+/*CR6205224 disable AT support temp.
+ hardwired, at_enabled is False
+ at_enabled = False;
+* 6240938 screensaver-lock's password timer needs to to be reset for each key
+ (all users) and enabling AT support
+*/
+
+ if (at_enabled) {
+
+
+ /* GTK Accessibility Module initialized */
+ modulesptr = g_getenv ("GTK_MODULES");
+ if (!modulesptr || modulesptr [0] == '\0')
+ putenv ("GTK_MODULES=gail:atk-bridge");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Accessibility_LoginHelper_WindowList *windows;
+ int i, wid_count = 0;
+
+
+ /*
+if there is any running GOK or MAG, using GTK_WIN_POS_MOUSE
+*/
+
+
+
+
+
+
+
+
+
+
+
+ CORBA_exception_init (&ev);
+ if (!bonobo_init (&argc, argv))
+ {
+ g_error ("Can't initialize Bonobo");
+ }
+
+ /* bonobo-activation query lists existing instances */
+ server_list = bonobo_activation_query (
+ "(repo_ids.has('IDL:Accessibility/LoginHelper:1.0')) AND _active",
+ NULL, &ev);
+
+ if (BONOBO_EX (&ev))
+ {
+ 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: scr dialog is obscurred byg MAG window
+*/
+
+ if (server_list && server_list->_length)
+ center_postion = FALSE;
+ else
+ center_postion = TRUE; /* center position of screen */
+
+ pwd = atk_make_dialog(center_postion);
+ connect_signals (pwd);
+
+ gtk_widget_show_all (pwd->dialog);
+ gtk_window_present (GTK_WINDOW (pwd->dialog));
+ gtk_widget_map (pwd->dialog);
+
+ XSync(GDK_DISPLAY(), False);
+
+
+ gdk_window_add_filter (pwd->dialog->window, dialog_filter_func, pwd);
+ s = g_strdup_printf ("%lu\n", GDK_WINDOW_XID (pwd->dialog->window));
+ write_string (s);
+ g_free (s);
+ /*CR 5039878 2 3 "Password:" field should be focused / have flashing caret on the xscreensaver site, it should be focus on passwd_entry
+ */
+ s = g_strdup_printf ("%lu\n", GDK_WINDOW_XID (pwd->passwd_entry->window)); write_string (s);
+ g_free (s);
+
+
+
+
+ g_message ("%d LoginHelpers are running.",
+ server_list ? server_list->_length : 0);
+
+
+ helper_list = g_new0 (Accessibility_LoginHelper, server_list->_length);
+
+ /* for each instance... */
+ for (i = 0; i < server_list->_length; i++)
+ {
+ Accessibility_LoginHelper helper;
+ Bonobo_Unknown server;
+ Bonobo_ServerInfo info = server_list->_buffer[i];
+
+ server = bonobo_activation_activate_from_id (
+ info.iid, Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, &ev);
+
+ if (BONOBO_EX (&ev))
+ {
+ 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 ();
+
+ helper = Bonobo_Unknown_queryInterface (
+ server,
+ "IDL:Accessibility/LoginHelper:1.0",
+ &ev);
+
+ if (BONOBO_EX (&ev))
+ {
+ 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;
+ bonobo_object_release_unref (server, &ev);
+
+ if (helper && !BONOBO_EX (&ev))
+ {
+ /* ask the helper to go into safe mode */
+
+ safe = Accessibility_LoginHelper_setSafe (helper, TRUE, &ev);
+ if (BONOBO_EX (&ev))
+ {
+ 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;
+ gboolean needs_windows_raised = FALSE;
+ Accessibility_LoginHelper_DeviceReqList *list;
+
+ g_message ("safe");
+
+ /* does this helper need to have windows raised? */
+ list = Accessibility_LoginHelper_getDeviceReqs (helper, &ev);
+
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Bonobo exception getting Device Requirements: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+ else
+ {
+ g_message ("LoginHelper device requirements: ");
+ if (list->_length == 0)
+ g_message ("\tNone.");
+
+ for (j = 0; j < list->_length; j++)
+ {
+ switch (list->_buffer[j])
+ {
+ case Accessibility_LoginHelper_GUI_EVENTS:
+ g_message ("\tNeeds access to the GUI event subsystem (e.g. Xserver)");
+ break;
+ case Accessibility_LoginHelper_EXT_INPUT:
+ g_message ("\tReads XInput extended input devices");
+ break;
+ case Accessibility_LoginHelper_POST_WINDOWS:
+ g_message ("\tPosts windows");
+ needs_windows_raised = TRUE;
+ break;
+ case Accessibility_LoginHelper_AUDIO_OUT:
+ g_message ("\tWrites to audio device");
+ break;
+ case Accessibility_LoginHelper_AUDIO_IN:
+ g_message ("\tReads from audio device");
+ break;
+ case Accessibility_LoginHelper_LOCALHOST:
+ g_message ("\tNeeds LOCALHOST network connection");
+ break;
+ case Accessibility_LoginHelper_SERIAL_OUT:
+ g_message ("\tNeeds to write to one or more serial ports");
+ break;
+ default:
+ break;
+ }
+ }
+ CORBA_free (list);
+ }
+ if (needs_windows_raised)
+ {
+ /* don't raise in this test, but do something with each wid */
+ windows = Accessibility_LoginHelper_getRaiseWindows (helper, &ev);
+ if (BONOBO_EX (&ev))
+ {
+ g_warning ("getRaiseWindows failed: %s",
+ bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+ g_message ("%d windows need raising", windows->_length);
+ for (j = 0; j < windows->_length; j++)
+ {
+ Window wid;
+ wid = windows->_buffer[j].winID;
+ g_message ("Window ID = x%x", wid);
+ if (wid_count < MAXRAISEDWINS && wid) {
+ wid_count++;
+ write_string(g_strdup_printf ("%lu\n", wid));
+
+ }
+
+
+ }
+ }
+ }
+ else
+ {
+ g_warning ("LoginHelper %d did not go into safe mode", i);
+ }
+ }
+ else
+ {
+ if (BONOBO_EX (&ev))
+ {
+ g_warning ("Error activating %s: %s",
+ info.iid, bonobo_exception_get_text (&ev));
+ CORBA_exception_free (&ev);
+ }
+ else
+ {
+ g_warning ("no active instance of %s found", info.iid);
+ }
+ }
+ }
+
+
+
+
+
+ if (wid_count == 0)
+ write_null(3);
+ if (wid_count == 1)
+ write_null(1);
+
+ ioc = g_io_channel_unix_new (0);
+ g_io_add_watch (ioc, G_IO_IN, handle_input, pwd);
+
+
+ } /* at-enable mode */
+
+ else
+ { /* non at-enabled mode */
+ pwd = make_dialog ();
+ connect_signals (pwd);
+
+
+
+ gtk_widget_show_all (pwd->dialog);
+ gtk_window_present (GTK_WINDOW (pwd->dialog));
+ gtk_widget_map (pwd->dialog);
+
+
+ XSync(GDK_DISPLAY(), False);
+
+ gdk_window_add_filter (pwd->dialog->window, dialog_filter_func, pwd);
+
+ s = g_strdup_printf ("%lu\n", GDK_WINDOW_XID (pwd->dialog->window));
+ write_string (s);
+ g_free (s);
+
+/*CR 5039878 2 3 "Password:" field should be focused / have flashing caret */
+ s = g_strdup_printf ("%lu\n", GDK_WINDOW_XID (pwd->passwd_entry->window));
+ write_string (s);
+ g_free (s);
+
+
+/* put the dummy for compactible with at-enable mode , change later */
+ /* put the dummy for compactible with at-enable mode , change later */
+ write_null(MAXRAISEDWINS);
+
+ ioc = g_io_channel_unix_new (0);
+ g_io_add_watch (ioc, G_IO_IN, handle_input, pwd);
+
+ }
+
+ gtk_main ();
+
+ return 0;
+}
+
+
+#endif /* HAVE_GTK2 */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/driver/scf-smartcard.c Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,2005 @@
+/* scf-smartcard.c --- Code to deal with smart card authentication
+ * for xscreensaver, Copyright (c) 1993-1997, 1998, 2000
+ * Jamie Zawinski <[email protected]>
+ *
+ * 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
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ *
+ * written by Padraig O'Briain ([email protected])
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef NO_LOCKING /* whole file */
+
+#include <thread.h>
+#include <signal.h>
+#include <security/pam_appl.h>
+#include <pwd.h>
+#include <ctype.h>
+
+#include <X11/Intrinsic.h>
+
+#include "xscreensaver.h"
+#include "resources.h"
+#include "scf-smartcard.h"
+
+#define CF_FILE_PATH "/etc/smartcard/desktop.properties"
+#define BUF_LEN 256
+#define SEPARATOR " \t\n"
+
+struct pam_data {
+ const char *user;
+ const char *typed_passwd;
+ Bool verbose_p;
+};
+
+extern Bool Ignore_SmartCard;
+extern scf_saver_info the_scf_si;
+extern smartcard_info the_smi;
+extern void destroy_passwd_window (saver_info *si);
+
+static int SmartCardGetProperty(FILE *fp, char *name, char *value, int max_value_len);
+static void * smartcard_authenticate (void *);
+static void set_smartcard_lock_state (saver_info *);
+static int run_PAMsession (char *, saver_info*);
+static int conversation_function (int, struct pam_message**,
+ struct pam_response **, void *);
+static void block_signals (void);
+
+static char * get_username(void);
+static Bool is_valid_unlock_user(char *);
+static void wait_for_got_message (saver_info *si);
+static char * get_smartcard_username (saver_info *si);
+static void
+scfevent_handler (SCF_Event_t event,SCF_Terminal_t eventTerminal, void *data);
+static void card_removal_timeout (XtPointer, XtIntervalId *);
+static void start_wait_removal_timer (saver_info *);
+static void card_removal_logout_wait (XtPointer, XtIntervalId *);
+static void force_exit (saver_info *si);
+
+static void dont_block_for_pam (XtPointer ptr, XtIntervalId *invId);
+static XtIntervalId card_removal_logout_wait_id;
+static XtIntervalId card_removal_timeout_id;
+
+static void report_smartcard_init_error (saver_info*, char*, uint32_t);
+static void report_smartcard_error (char*, uint32_t);
+
+
+static struct pam_message safe_pam_message;
+static struct pam_message *saved_pam_message = &safe_pam_message;
+
+static Bool b_PAM_prompted;
+static Bool b_first_prompt;
+static thread_t pam_thread = (thread_t) NULL;
+
+static cond_t c_got_response = DEFAULTCV;
+static mutex_t m_got_response;
+static Bool b_got_response = False;
+
+static cond_t c_validated_response = DEFAULTCV;
+static mutex_t m_validated_response;
+static Bool b_validated_response = False;
+
+static cond_t c_got_username = DEFAULTCV;
+static mutex_t m_got_username;
+static Bool b_got_username = False;
+
+static cond_t c_got_message = DEFAULTCV;
+static mutex_t m_got_message;
+static Bool b_got_message = False;
+
+static cond_t c_event_processed = DEFAULTCV;
+static mutex_t m_event_processed = DEFAULTMUTEX;
+static Bool b_event_processed = True;
+
+static Bool b_validation_succeeded;
+static Bool b_validation_finished;
+static Bool b_got_PAM_message;
+
+static char *saved_user_input = NULL;
+
+static Bool b_card_event_occurred = False;
+static XtSignalId sigusr2_id;
+static thread_t main_thread;
+static void sigusr2_handler(void);
+static void sigusr2_callback (XtPointer client_data, XtSignalId *id);
+static void synthetic_event_callback (XtPointer, XtIntervalId *);
+
+/*
+ * This function is called when set_locked_p() is called, i.e when the
+ * screen is being locked or unlocked. If the screen is being unlocked
+ * nothing is done. If the screen is being locked the authentication
+ * thread is created if it does not already exist.
+ */
+void scf_set_locked_p (saver_info *si, Bool locked_p)
+{
+ if ((si->scf_si) && (si->scf_si->use_smartcard))
+ {
+ if (locked_p)
+ {
+ /*
+ * Check that we have the name of the user for unlocking;
+ * otherwise do not lock
+ */
+ if (!get_username())
+ {
+ fprintf (real_stderr,
+ "%s: Unable to get username for authentication.\n",
+ blurb());
+ return;
+ }
+ /*
+ * When locking the screen we create the Authentication thread
+ * if it does not already exist
+ */
+ if (!pam_thread)
+ {
+ int b_created_auth_thread = 1;
+ set_smartcard_lock_state(si);
+
+ thr_setconcurrency (5);
+ if (thr_create (NULL, 0, smartcard_authenticate, (void *) si,
+ THR_BOUND | THR_NEW_LWP | THR_DETACHED, &pam_thread) != 0)
+ {
+ b_created_auth_thread = 0;
+ }
+ if (!b_created_auth_thread)
+ {
+ /*
+ * Unable to create a thread so output an error
+ * and do not lock
+ */
+ fprintf (real_stderr,
+ "%s: Unable to create a thread for authentication.\n",
+ blurb());
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (si->prefs.verbose_p)
+ fprintf(stderr,"in else of locked_p i.e. screen not already locked\n");
+
+ pam_thread = (thread_t) NULL;
+ /*
+ * The screen is being unlocked so update the state
+ */
+ si->scf_si->scdata->state = SCD_AUTH_CARD_PRESENT;
+ if (si->scf_si->scdata->wait_removal_logout_timer)
+ {
+ if (card_removal_logout_wait_id != (XtIntervalId) 0)
+ XtRemoveTimeOut (card_removal_logout_wait_id);
+ si->scf_si->scdata->wait_removal_logout_timer = 1;
+ }
+ }
+ }
+}
+
+/*
+ * This function is called in handle_passwd_key() to do SCF specific
+ * processing of the data entred by the user.
+ */
+enum passwd_state
+scf_passwd_valid_p (saver_info *si, char *typed_passwd)
+{
+ saver_preferences *p = &si->prefs;
+ enum passwd_state return_state;
+
+/*mali if (si->scf_si->use_smartcard)***/
+ if (0)
+ {
+ /*
+ * When using smart card the user name is determined from the card
+ * so there is no need to call PAM with a different user if the
+ * validation failed.
+ * When using smart card more than one item of data may be
+ * prompted for to complete the validation.
+ */
+ saved_user_input = typed_passwd;
+ mutex_lock (&m_got_response);
+ b_got_response = True;
+ b_validated_response = False;
+ b_validation_finished = False;
+ cond_signal (&c_got_response);
+ mutex_unlock (&m_got_response);
+ /*
+ * We now wait for the validation to complete
+ */
+/**mali
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> scf_passwd_valid_p use_smartcard is True\n");
+ XtAppAddTimeOut (si->app,
+ 1000,
+ dont_block_for_pam, (XtPointer) si);
+ mutex_lock (&m_validated_response);
+ while (b_validated_response == False)
+ cond_wait (&c_validated_response, &m_validated_response);
+ mutex_unlock (&m_validated_response);
+****/
+
+ if ((!b_validation_finished) || (!b_validation_succeeded))
+ {
+ if (!b_validation_finished)
+ {
+ return_state = pw_another;
+ }
+ else
+ {
+ return_state = pw_fail;
+ /*
+ * PAM will be called again so tell the thread that we have
+ * user to authenticate
+ */
+ mutex_lock (&m_got_username);
+ b_validation_finished = False;
+ b_got_username = True;
+ cond_signal (&c_got_username);
+ mutex_unlock (&m_got_username);
+ }
+ /*
+ * We wait for PAM to generate the next prompt before
+ * continuing
+ */
+ wait_for_got_message(si);
+ }
+ else
+ {
+ return_state = pw_ok;
+ }
+ }
+ else {
+ if (si->prefs.verbose_p)
+ {
+ fprintf (stderr, "---> scf_passwd_valid_p calling passwd_valid_p\n");
+ }
+ if (passwd_valid_p ())
+ return (pw_ok);
+ else
+ return (pw_fail);
+ }
+ return return_state;
+}
+
+/*
+ * This function checks what type of dialog should be displayed
+ * based on the card state.
+ */
+Bool
+check_smartcard_dialog (saver_info *si)
+{
+ /*
+ * ret_val == False means display authentication dialog
+ * ret_val == True means display message
+ */
+ Bool ret_val = False;
+
+ if (si->prefs.verbose_p)
+ {
+ fprintf (stderr, "---> check_smartcard_dialog()\n");
+ fprintf (stderr, "use_smartcard=%d state=%d\n", si->scf_si->use_smartcard, si->scf_si->scdata->state);
+ }
+
+ if (si->scf_si->use_smartcard)
+ {
+ switch (si->scf_si->scdata->state)
+ {
+ /* if card is present dont put any message on screen **/
+ case SCD_AUTH_CARD_PRESENT:
+ ret_val = False;
+ break;
+
+ case SCD_WAIT_FOR_CARD:
+ case SCD_WAIT_REMOVAL_LOGOUT_WAIT:
+ case SCD_NO_USER:
+ case SCD_WRONG_USER:
+ ret_val = True;
+ break;
+
+ case SCD_AUTH_REQUIRED:
+ {
+ char *sm_user;
+
+ sm_user = get_smartcard_username(si);
+
+ /* if ((sm_user) && is_valid_unlock_user (sm_user)) */
+ if ((sm_user))
+ {
+ /*
+ * Tell the authentication thread to continue as we now have a
+ * valid user name to authenticate
+ */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> got valid user continue to authenticate!!!\n");
+
+ mutex_lock (&m_got_username);
+ b_got_username = True;
+ cond_signal (&c_got_username);
+ mutex_unlock (&m_got_username);
+
+ si->scf_si->scdata->state = SCD_AUTH_IN_PROGRESS;
+
+ /*
+ * Wait for PAM to prompt
+ */
+
+ wait_for_got_message (si);
+
+ if (!b_got_PAM_message)
+ {
+ /*
+ * The PAM conversation function was not called, probably because
+ * the card was removed very quickly
+ */
+/*mali no need for this..causing AUTH_REQUIRED message to pop up..
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> setting SCD_AUTH_REQUIRED!!!\n");
+ si->scf_si->scdata->state = SCD_AUTH_REQUIRED;
+****/
+ si->scf_si->scdata->state = SCD_AUTH_IN_PROGRESS;
+ ret_val = False;
+ }
+ }
+ else
+ {
+ si->scf_si->scdata->state = (sm_user) ? SCD_WRONG_USER : SCD_NO_USER;
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "in else state=%d\n", si->scf_si->scdata->state);
+ ret_val = True;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ if (si->prefs.verbose_p)
+ {
+ fprintf (stderr, "<--- check_smartcard_dialog ret_val=%d state=%d\n",
+ ret_val, si->scf_si->scdata->state);
+ }
+ return ret_val;
+}
+
+/*
+ * This function returns the message which should be displayed to the user
+ * for the smart card state in an array of character strings, each one
+ * corresponding to one line.
+ */
+char **
+get_scf_message (saver_info *si)
+{
+ char *msg, *lockmsg;
+ char *puser;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> get_scf_message()\n");
+
+ /*si->scf_si->scdata->message_timeout = si->prefs.passwd_timeout;**/
+ si->scf_si->scdata->message_timeout = 10000;
+ puser = get_username ();
+ if (!puser) puser = "";
+
+ if (si->prefs.verbose_p)
+ {
+ fprintf(stderr, "*********SMARTCARD PROPS ***********\n");
+ fprintf(stderr, "\t--> username=%s \n", puser);
+ fprintf(stderr,"\t\tmsg timeout=%d\n",si->scf_si->scdata->message_timeout);
+ fprintf(stderr,"\t\t STATE=%d\n",si->scf_si->scdata->state);
+ fprintf(stderr,"\t\tlogoutWait=%d\n",si->scf_si->card_removal_logout_wait);
+ fprintf(stderr, "************************************\n");
+ }
+
+
+/***mali we are getting timeout=60000 which is too long*/
+/* This is set from message_timeout = si->prefs.passwd_timeout
+ which is usually in minutes hence it is too long setting it 10 secs
+ No...people filed bug against this 4771114 so not resetting it to 10sec
+ si->scf_si->scdata->message_timeout = 10000;
+*******/
+
+ switch (si->scf_si->scdata->state) {
+
+ case SCD_WAIT_FOR_CARD:
+ /* If ignore card removal is True then no need to display logout msg */
+ if (si->scf_si->reauth_after_card_removal)
+ {
+ msg = get_string_resource ("message.SCF.waitforcard",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("Please insert your smartcard..");
+ si->scf_si->scdata->message_timeout = si->scf_si->reauth_timeout;
+ /*mali si->scf_si->reauth_timeout; use this instead of 10000 */
+ /*si->scf_si->scdata->message_timeout = si->scf_si->reauth_timeout;*/
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ }
+ else /* ignore_card_removal is False, we tell user he will be logged out*/
+ {
+ msg = get_string_resource ("message.SCF.waitremovallogoutwait",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("Waiting to Log you out...in %d secs. Locked by user %s");
+ lockmsg = (char *) malloc (strlen (msg) + 10 /* for integer */ +
+ + strlen (puser) + 1);
+ si->scf_si->scdata->message_timeout =
+ si->scf_si->card_removal_logout_wait * 1000;
+ sprintf (lockmsg, msg, si->scf_si->card_removal_logout_wait/1000, puser);
+ }
+ break;
+
+ case SCD_WAIT_REMOVAL_LOGOUT_WAIT:
+ msg = get_string_resource ("message.SCF.waitremovallogoutwait",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("Waiting to Log you out...");
+
+ si->scf_si->scdata->message_timeout =
+ si->scf_si->card_removal_logout_wait * 1000;
+/*mali too long si->scf_si->card_removal_logout_wait * 1000;
+***/
+ lockmsg = (char *) malloc (strlen (msg) + 10 /* for integer */ +
+ + strlen (puser) + 1);
+ sprintf (lockmsg, msg, si->scf_si->card_removal_logout_wait/1000, puser);
+ break;
+
+ case SCD_AUTH_REQUIRED:
+ msg = get_string_resource ("message.SCF.authrequired",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("Authorization is required...");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ case SCD_WRONG_USER:
+ msg = get_string_resource ("message.SCF.wronguser",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("You are the wrong user system already locked by another user...");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ case SCD_NO_USER:
+ msg = get_string_resource ("message.SCF.nouser", "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("No such user found...");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+/*mali all cases added*/
+ case SCD_AUTH_CARD_PRESENT:
+ msg = get_string_resource ("message.SCF.authcardpresent",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("Could not get message string for SCD_AUTH_CARD_PRESENT");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ case SCD_WAIT_REMOVAL_TIMEOUT:
+ msg = get_string_resource ("message.SCF.waitremovaltimeout",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup
+ ("Could not get message string for SCD_WAIT_REMOVAL_TIMEOUT");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ case SCD_CARD_REMOVAL_IGNORED:
+ msg = get_string_resource ("message.SCF.cardremovalignored",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup
+ ("Could not get message string for SCD_CARD_REMOVAL_IGNORED");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ case SCD_ANY_CARD_PRESENT:
+ msg = get_string_resource ("message.SCF.anycardpresent",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("Could not get message string for SCD_ANY_CARD_PRESENT");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ case SCD_WAIT_REMOVAL_LOGOUT_EXPIRED:
+ msg = get_string_resource ("message.SCF.waitremovallogoutexpired",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup
+ ("Could not get message string for SCD_WAIT_REMOVAL_LOGUT_EXPIRED");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ case SCD_AUTH_IN_PROGRESS:
+ msg = get_string_resource ("message.SCF.authinprogress",
+ "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup ("Could not get message string for SCD_AUTH_IN_PROGRESS");
+ lockmsg = (char *) malloc (strlen (msg) + strlen (puser) +1);
+ sprintf (lockmsg, msg, puser);
+ break;
+
+ default:
+ msg = get_string_resource ("message.SCF.default", "Dialog.Label.Label");
+ if (msg == NULL)
+ msg = strdup
+ ("Could not get message string for default smartcard state");
+ lockmsg = (char *) malloc (strlen (msg) + 10 /* for integer */ +
+ + strlen (puser) + 1);
+ sprintf (lockmsg, msg, si->scf_si->scdata->state, puser);
+ break;
+ }
+
+ if (si->prefs.verbose_p)
+ {
+ fprintf(stderr, "\t\tlockmsg is %s \n", lockmsg);
+ fprintf(stderr,"\t\t<--scf_get_message STATE=%d\n",
+ si->scf_si->scdata->state);
+ }
+
+ free (msg);
+ {
+ /*
+ * Split the string into an array of character strings, one per line
+ */
+ int i = 0;
+ char ** return_array;
+ char * pchar;
+
+ pchar = lockmsg;
+
+ while ((pchar = strchr (pchar, '\n')))
+ {
+ i++;
+ pchar++;
+ }
+
+ return_array = (char **) malloc ((i+1) * sizeof (char *));
+ if (return_array)
+ {
+ i = 0;
+ return_array[i] = lockmsg;
+ pchar = lockmsg;
+
+ while ((pchar = strchr (pchar, '\n')))
+ {
+ *pchar = '\0';
+ return_array[++i] = ++pchar;
+ }
+
+ return_array[++i] = NULL;
+ }
+ return return_array;
+ }
+}
+
+/*************************************<->*************************************
+ *
+ * SmartCardGetProperty(fp name value max_value_len)
+ *
+ *
+ * Description:
+ * -----------
+ * Retrieves specified smartcard property value from a file.
+ *
+ *
+ * Inputs:
+ * ------
+ * fp = File handle, in this case : /etc/smartcard/desktop.properties
+ * name = Name of the property to retrieve a value for
+ * value = Char buffer to store retrieved values into.
+ * max_value_len = Maximum number of bytes to be written to value buffer.
+ *
+ *
+ * Outputs:
+ * -------
+ * Return = 0 on error or if property (name) not found, 'n' where n is the number
+ * of bytes written to char buffer "value".
+ *
+ *
+ * Comments:
+ * --------
+ * This is a replacement for SCF_GetClientProperty() see bugid #4499187.
+ *
+ *************************************<->***********************************/
+
+static int SmartCardGetProperty(FILE *fp, char *name, char *value, int max_value_len)
+{
+ register int i = 0;
+ char buf[BUF_LEN];
+ char *ptr1, *ptr2, *tmp_buf, *ptr3 = NULL;
+
+ if (fp == NULL)
+ return (0);
+
+
+ /*
+ * Reset file offset to origin of file
+ * so stuff doesn't get skipped over.
+ */
+ fseek(fp, 0, SEEK_SET);
+
+ while (fgets(buf, BUF_LEN, fp) != NULL) {
+ /* Skip over white space first */
+ ptr3 = buf;
+ i = 0;
+ while (buf[i] && isspace (buf[i])) {
+ i++;
+ ptr3++;
+ }
+ /* Then get rid of # */
+ for (i = 0; i < strlen(ptr3); i++) {
+ if (ptr3[i] == '#') {
+ ptr3[i] = NULL;
+ break;
+ }
+ }
+
+ /*
+ * then, divide ptr3 by =
+ * ptr1 points to the top of the left-hand side
+ * ptr2 points to the top of the right-hand side
+ */
+ if (ptr3[0] == NULL)
+ continue;
+
+ ptr1 = ptr3;
+ for (i = 0; i < strlen(ptr3); i++) {
+ if (ptr3[i] == '=') {
+ ptr3[i] = NULL;
+ ptr2 = ptr3 + i + 1;
+ break;
+ }
+ }
+ if (*ptr1 == NULL || *ptr2 == NULL)
+ break;
+
+ tmp_buf = strtok(ptr1, SEPARATOR);
+
+ /* more than 1 tokens in the left -> error */
+ if (strtok(NULL, SEPARATOR) != NULL)
+ break;
+
+ if (strcmp(name, tmp_buf) == 0) {
+ /* property name matched. */
+ tmp_buf = strtok(ptr2, SEPARATOR);
+ /* more than 1 tokens in the right -> error */
+ if (strtok(NULL, SEPARATOR) != NULL)
+ break;
+ if (strlcpy(value, tmp_buf, max_value_len) >= max_value_len)
+ {
+ fprintf(stderr, "Error Not enough space to write smartcard property name=%s value=%s max_val_len=%d tmp_buf=%s\n", name, value, max_value_len, tmp_buf);
+ return 0;
+ }
+ return (strlen(value));
+ }
+ }
+/**** if debugging *****
+ fprintf(stderr, "Error fgets failed for property name=%s buf=%s\n", name, buf);
+**/
+ return (0);
+}
+
+
+/*
+ * The function must be called while we are still root.
+ *
+ * It gets the values for SCF properties used when screen locking
+ */
+void
+init_scf_properties (saver_info *si)
+{
+ char str_buf[BUF_LEN];
+ int i, rv;
+ FILE *fp = NULL;
+
+#define TYPE_INT 0
+#define TYPE_BOOL 1
+
+ struct ocfProperties {
+ char* name;
+ int type;
+ char ** value;
+ } ;
+
+struct ocfProperties* OcfProperties;
+
+
+/***************************************************************************
+ Solaris 8 and Solaris 9 have different names for these properties
+ We are no longer using SCF_GetClientProperty call instead we have our
+ own function SmartCardGetProperty() which is much more reliable.
+ Hence we need two sets of property names to look for in appropriate files
+ for solaris8 and solaris9
+
+ IMP in future dtsession should be changed to xscreensaver for sol8 props.
+****************************************************************************/
+struct ocfProperties OcfProperties_sol8[] = {
+ "ocf.client.dtsession.root.useSmartCard", TYPE_BOOL,
+ (char **) &(the_scf_si.use_smartcard),
+ "ocf.client.dtsession.root.cardRemovalTimeout", TYPE_INT,
+ (char **) &(the_scf_si.card_removal_timeout),
+ "ocf.client.dtsession.root.ignoreCardRemoval", TYPE_BOOL,
+ (char **) &(the_scf_si.ignore_card_removal),
+ "ocf.client.dtsession.root.reauthAfterCardRemoval", TYPE_BOOL,
+ (char **) &(the_scf_si.reauth_after_card_removal),
+ "ocf.client.dtsession.root.reauthTimeout", TYPE_INT,
+ (char **) &(the_scf_si.reauth_timeout),
+ "ocf.client.dtsession.root.cardRemovalLogoutWait", TYPE_INT,
+ (char **) &(the_scf_si.card_removal_logout_wait),
+ "ocf.client.dtsession.root.firstCardEventTimeout", TYPE_INT,
+ (char **) &(the_scf_si.first_card_event_timeout),
+ };
+
+struct ocfProperties OcfProperties_sol9[] = {
+ "desktop.useSmartCard", TYPE_BOOL,
+ (char **) &(the_scf_si.use_smartcard),
+ "desktop.cardRemovalTimeout", TYPE_INT,
+ (char **) &(the_scf_si.card_removal_timeout),
+ "desktop.ignoreCardRemoval", TYPE_BOOL,
+ (char **) &(the_scf_si.ignore_card_removal),
+ "desktop.reauthAfterCardRemoval", TYPE_BOOL,
+ (char **) &(the_scf_si.reauth_after_card_removal),
+ "desktop.reauthTimeout", TYPE_INT,
+ (char **) &(the_scf_si.reauth_timeout),
+ "desktop.cardRemovalLogoutWait", TYPE_INT,
+ (char **) &(the_scf_si.card_removal_logout_wait),
+ "desktop.firstCardEventTimeout", TYPE_INT,
+ (char **) &(the_scf_si.first_card_event_timeout),
+ };
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> init_scf_properties()\n");
+
+#define NUM_SCF_PROPERTIES 7
+
+/* Assume Solaris 9 try to open /etc/smartcard/desktop.properties file */
+
+ OcfProperties = OcfProperties_sol9;
+
+ fp = fopen(CF_FILE_PATH, "r");
+ if (fp == NULL)
+ {
+ OcfProperties = OcfProperties_sol8;
+
+ if (si->prefs.verbose_p)
+ {
+ fprintf (stderr,"-->Could not open %s to read ocf props\n",
+ CF_FILE_PATH);
+ fprintf (stderr,"-->Instead Trying to open opencard.properties file.\n");
+ }
+
+ fp = fopen("/etc/smartcard/opencard.properties", "r");
+
+ if (fp == NULL)
+ {
+ fprintf (stderr, "---> Failed to open opencard.properties file!! \n");
+ fprintf (stderr, "---> Failed to open desktop.properties file!! \n");
+ fprintf (stderr, "---> SmartCard is not going to work!! \n");
+ }
+ }
+
+ if (fp != NULL)
+ {
+ /*
+ * First check the value of "use_smart_card". If this is set to false,
+ * garbage or not specified at all then there's no point in retrieving
+ * the rest of the smartcard settings
+ */
+ rv = SmartCardGetProperty (fp,OcfProperties[0].name,
+ str_buf,sizeof(str_buf));
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> rv = %d prop=%s value=%s\n\n",
+ rv, OcfProperties[0].name, str_buf);
+ if (rv > 0)
+ {
+ if (!strcasecmp (str_buf, "true"))
+ {
+ *((Boolean *) OcfProperties[0].value) = 1;
+ }
+ else
+ {
+ *((Boolean *) OcfProperties[0].value) = 0;
+ the_scf_si.use_smartcard = 0;
+ return;
+ }
+ }
+ else
+ {
+ /*SmartCardGetProperty Failed*/
+ the_scf_si.use_smartcard = 0;
+ if (si->prefs.verbose_p)
+ {
+ fprintf (stderr, "Could not read smartcard vals from /etc/");
+ fprintf (stderr, "smartcard file using default values!!!\n");
+ }
+ goto FORCEDEFAULT;
+ }
+
+ for (i=1; i < NUM_SCF_PROPERTIES; i++)
+ {
+ rv = SmartCardGetProperty (fp, OcfProperties[i].name, str_buf,
+ sizeof(str_buf));
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> rv = %d prop=%s value=%s\n",
+ rv, OcfProperties[i].name, str_buf);
+
+ if (rv > 0)
+ {
+ switch (OcfProperties[i].type)
+ {
+ case TYPE_INT:
+ *((int *) OcfProperties[i].value) = atoi (str_buf);
+ break;
+ case TYPE_BOOL:
+ if (!strcasecmp (str_buf, "true"))
+ *((Boolean *) OcfProperties[i].value) = 1;
+ else
+ /* If value is false or any non-true value, set to 0 */
+ *((Boolean *) OcfProperties[i].value) = 0;
+ break;
+ default:
+ if (si->prefs.verbose_p)
+ fprintf(stderr,"Unknown Type for prop=%s\n",OcfProperties[i].name);
+
+ }
+ }
+ else /* rv == 0 Error */
+ {
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> rv = %d Error Reading prop=%s value=%s\n",
+ rv, OcfProperties[i].name, str_buf);
+
+ /* Setting negative will be set to default by FORCEDEFAULT */
+ *((int*)OcfProperties[i].value) = -1;
+ }
+
+ }
+ fclose(fp);
+
+ } /* if fp !=NULL */
+
+ /*
+ * Print Smart Card resource values
+ */
+
+ if (si->prefs.verbose_p)
+ {
+ fprintf(stderr,"\nSmartCard Values from desktop/opencard properties file\n");
+ fprintf(stderr,"\t\tcardRemovalTimout:%d\n",the_scf_si.card_removal_timeout);
+ fprintf(stderr,"\t\tignoreCardRemoval=%d\n",the_scf_si.ignore_card_removal);
+ fprintf(stderr,"\t\treauthAfterCardRmv=%d\n",(Bool)the_scf_si.reauth_after_card_removal);
+ fprintf(stderr,"\t\treauthTimeout=%d\n",the_scf_si.reauth_timeout);
+ fprintf(stderr,"\t\tcardRemovalLogoutWait=%d\n\n",the_scf_si.card_removal_logout_wait);
+ }
+
+
+ /*
+ * Sanity check for Smart Card resource values
+ *
+ * If values are non-zero multiply by 1000 to be ready for use
+ * in Xlib calls
+ *
+ */
+FORCEDEFAULT:
+ if (!the_scf_si.ignore_card_removal)
+ {
+ Ignore_SmartCard = False;
+ if (si->prefs.verbose_p)
+ fprintf(stderr, "***Setting ignore_smartcard --> False\n");
+ }
+
+ if (the_scf_si.card_removal_timeout < 0)
+ the_scf_si.card_removal_timeout = 0;
+ else
+ the_scf_si.card_removal_timeout *= 1000;
+ if (the_scf_si.reauth_timeout < 0)
+ the_scf_si.reauth_timeout = 0;
+ else
+ the_scf_si.reauth_timeout *= 1000;
+ if (the_scf_si.card_removal_logout_wait <= 0)
+ /* logout wait should be long else it just logs you out*/
+ the_scf_si.card_removal_logout_wait = 1000;/*default*/
+ else
+ the_scf_si.card_removal_logout_wait *= 1000;
+
+ si->scf_si = &the_scf_si; /*just to make sure */
+}
+
+/*
+ * This function initializes the SCF event handler so that we are informed
+ * of events such as card insertion and card removal.
+ */
+void
+init_scf_handler (saver_info *si)
+{
+ uint64_t time_since_validated;
+ Bool b_card_present = True;
+ struct sigaction sigact;
+
+ SCF_Status_t status;
+ SCF_Session_t session;
+ SCF_Terminal_t terminal;
+ SCF_Card_t card;
+ SCF_ListenerHandle_t listenerHandle;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> init_scf_handler()\n");
+
+ if (!si->scf_si->use_smartcard)
+ {
+ if (si->prefs.verbose_p)
+ {
+ fprintf (stderr, "---> returning from init_scf_handler() since use_");
+ fprintf (stderr, "smartcard is false: %d\n", si->scf_si->use_smartcard);
+ }
+ return;
+ }
+
+ main_thread = thr_self();
+ /*
+ * Register the signal callback with Xt and get the signal Id for use in
+ * the signal handler.
+ */
+ sigusr2_id = XtAppAddSignal (si->app, sigusr2_callback, si);
+ /*
+ * Register a signal handler so that we are informed when a card event
+ * occurs
+ */
+ sigact.sa_handler = sigusr2_handler;
+ sigfillset(&sigact.sa_mask);
+ sigact.sa_flags = 0;
+ (void)sigaction(SIGUSR2, &sigact, NULL);
+
+ si->scf_si->scdata->session_handle = NULL;
+ si->scf_si->scdata->smartcard_username = (char *)NULL;
+
+ status = SCF_Session_getSession(&(si->scf_si->scdata->session_handle));
+ if (status != SCF_STATUS_SUCCESS) {
+ report_smartcard_init_error (si, "SCF_Session_getSession",status);
+ return;
+ }
+/* it needs to invoke smartcard GUI to config the smartcard dev first */
+
+ status = SCF_Session_getTerminal(si->scf_si->scdata->session_handle,
+ NULL,
+ &(si->scf_si->scdata->terminal_handle));
+ if (status != SCF_STATUS_SUCCESS) {
+ report_smartcard_init_error (si, "SCF_Session_getTerminal",status);
+ SCF_Session_close(si->scf_si->scdata->session_handle);
+ return;
+ }
+
+ status = SCF_Terminal_addEventListener(si->scf_si->scdata->terminal_handle,
+ (SCF_EVENT_CARDINSERTED | SCF_EVENT_CARDREMOVED),
+ &scfevent_handler,
+ (void *)si,
+ &si->scf_si->scdata->myListener);
+ if (status != SCF_STATUS_SUCCESS) {
+ report_smartcard_init_error (si,"SCF_Terminal_addEventListener",status);
+ SCF_Session_close(si->scf_si->scdata->session_handle);
+ return;
+ }
+
+
+/*
+ smartcard is used
+*/
+ si->scf_si->use_smartcard = True;
+ b_card_present = False;
+ time_since_validated = 0;
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+
+ /*
+ * Check that there is a card in the reader
+ * and validated card ?
+ */
+
+ status = SCF_Terminal_getCard(si->scf_si->scdata->terminal_handle,
+ &(si->scf_si->scdata->card_handle));
+ if (status == SCF_STATUS_NOCARD ) {
+ return;
+ }
+ else if (status == SCF_STATUS_SUCCESS)
+ {
+ si->scf_si->scdata->state = SCD_AUTH_CARD_PRESENT;
+ b_card_present = True;
+ get_smartcard_username (si);
+ /*
+ * We reach here if the card was removed or there is an unauthenticated
+ * card in the reader. The value of b_card_present tells us which one.
+ */
+
+ /*
+ * There is an unauthenticated card in the reader so a card must
+ * have been removed, We set the state accordingly.
+ */
+ if (si->scf_si->ignore_card_removal)
+ {
+ si->scf_si->scdata->state = SCD_CARD_REMOVAL_IGNORED;
+ }
+ else
+ {
+ if (si->prefs.verbose_p)
+ {
+ fprintf(stderr, "init_scf_handler() locking screen and");
+ fprintf(stderr, " setting SCD_CARD_PRESENT\n");
+ }
+ set_locked_p (si, True);
+ }
+ } /* SCF_STATUS_SUCCESS */
+ else {
+ report_smartcard_init_error (si, "SCF_Session_getCard",status);
+ SCF_Session_close(si->scf_si->scdata->session_handle);
+ return;
+ }
+
+}
+
+/*
+ * This event takes the appropriate action following a card event, i.e.
+ * a card removal or card insertion.
+ */
+void
+handle_scf_event (saver_info *si)
+{
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> handle_scf_event() state=%d\n",
+ si->scf_si->scdata->state);
+
+ if (si->scf_si->scdata->state != SCD_WAIT_REMOVAL_LOGOUT_EXPIRED)
+ {
+ /*
+ * Ignore card events when card state is SCD_WAIT_REMOVAL_LOGOUT_EXIRED
+ * as the user should be forced out
+ */
+ if (si->scf_si->scdata->last_event == SCF_EVENT_CARDREMOVED)
+ {
+ /*
+ * The smart card has been removed so clear the cached user name
+ */
+ if (si->scf_si->scdata->smartcard_username)
+ {
+ free (si->scf_si->scdata->smartcard_username);
+ si->scf_si->scdata->smartcard_username = NULL;
+ }
+ switch (si->scf_si->scdata->state)
+ {
+ case SCD_WAIT_FOR_CARD:
+ if (!si->scf_si->ignore_card_removal)
+ {
+ card_removal_timeout_id = XtAppAddTimeOut (si->app,
+ si->scf_si->card_removal_timeout,
+ card_removal_timeout, (XtPointer) si);
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+
+ /*mali added 12.13 to lock if card is removed
+ this introduced the bug 4771083, i.e. we should wait
+ for card_removal_timeout before locking display, so
+ moving this call in card_removal_timeout function..
+ set_locked_p(si, True);
+ ******************************/
+
+ idle_timer ((XtPointer) si, 0);
+ }
+ break;
+ case SCD_AUTH_CARD_PRESENT:
+ case SCD_ANY_CARD_PRESENT:
+ card_removal_timeout_id = XtAppAddTimeOut (si->app,
+ si->scf_si->card_removal_timeout,
+ card_removal_timeout, (XtPointer) si);
+ si->scf_si->scdata->state = SCD_WAIT_REMOVAL_TIMEOUT;
+ break;
+
+ case SCD_WRONG_USER:
+ case SCD_NO_USER:
+ case SCD_AUTH_IN_PROGRESS:
+ case SCD_AUTH_REQUIRED:
+ card_removal_timeout_id = XtAppAddTimeOut (si->app,
+ si->scf_si->card_removal_timeout,
+ card_removal_timeout, (XtPointer) si);
+ /*does not work si->scf_si->scdata->state = SCD_WAIT_REMOVAL_TIMEOUT;*/
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+ /*
+ * Generate synthetic event so that dialog is displayed
+ */
+ idle_timer ((XtPointer) si, 0);
+ break;
+ default:
+ break;
+ }
+ }
+ else if (si->scf_si->scdata->last_event == SCF_EVENT_CARDINSERTED)
+ {
+ if (si->scf_si->scdata->state == SCD_WAIT_REMOVAL_TIMEOUT)
+ {
+ XtRemoveTimeOut (card_removal_timeout_id);
+ si->scf_si->scdata->state = SCD_ANY_CARD_PRESENT;
+ }
+ else if (si->scf_si->scdata->state == SCD_CARD_REMOVAL_IGNORED)
+ {
+ si->scf_si->scdata->state = SCD_ANY_CARD_PRESENT;
+ }
+ else
+ {
+ if (si->scf_si->scdata->state == SCD_WAIT_REMOVAL_LOGOUT_WAIT)
+ si->scf_si->scdata->wait_removal_logout_timer = 1;
+ si->scf_si->scdata->state = SCD_AUTH_REQUIRED;
+ /*
+ * Generate synthetic event so that dialog is displayed
+ */
+ idle_timer ((XtPointer) si, 0);
+ }
+ }
+ }
+ mutex_lock (&m_event_processed);
+ b_event_processed = True;
+ cond_signal (&c_event_processed);
+ mutex_unlock (&m_event_processed);
+ cond_init (&c_event_processed, NULL, NULL); /*initialize again */
+ mutex_init (&m_event_processed, NULL, NULL); /*initialize again */
+}
+
+/*
+ * This function sets the label on the xscreensaver passwd dialog to
+ * the text returned by th PAM prompt
+ */
+char *
+scf_set_passwd_label (saver_info *si)
+{
+ char *label = 0;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> scf_set_passwd_label()\n");
+
+ if (si->scf_si->use_smartcard)
+ {
+ if ((saved_pam_message->msg_style == PAM_PROMPT_ECHO_OFF) ||
+ (saved_pam_message->msg_style == PAM_PROMPT_ECHO_ON))
+ {
+ label = strdup(saved_pam_message->msg);
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "$$$$--->$$$ \t passwd_prompt_label= %s\n",label);
+ }
+ }
+ return label;
+}
+
+static void*
+smartcard_authenticate (void *xx)
+{
+ saver_info *si = xx;
+ int status;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> smartcard_authenticate()\n");
+ block_signals();
+
+ b_validation_succeeded = False;
+ b_validation_finished = False;
+
+ while (!b_validation_succeeded)
+ {
+ /*
+ * We wait here for a user name to authenticate
+ */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> \tinside while of smartcard_authenticate()\n");
+
+ mutex_lock (&m_got_username);
+ while (b_got_username == False)
+ cond_wait (&c_got_username, &m_got_username);
+ b_got_username= False;
+ mutex_unlock (&m_got_username);
+
+ b_got_PAM_message = False;
+
+ status = run_PAMsession (get_smartcard_username(si), si);
+/*mali1117 status = pam_passwd_valid_p (get_smartcard_username(si), si);**/
+
+ if (!b_got_PAM_message)
+ {
+ /*
+ * The conversation function was probably interrupted so we need to
+ * reset b_got_response.
+ */
+ b_got_response = False;
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> conv func interrupted resetting b_got_response i.e. did not get PAM_message in smartcard_authenticate()\n");
+ /*
+ * The conversation function did not send any message to the user
+ * so we need to restart the UI thread which is waiting.
+ */
+ mutex_lock (&m_got_message);
+ b_got_message = True;
+ mutex_unlock (&m_got_message);
+ cond_signal (&c_got_message);
+ continue;
+ }
+ mutex_lock (&m_validated_response);
+ b_validation_succeeded = (status == PAM_SUCCESS);
+ b_validated_response = True;
+ b_validation_finished = True;
+ cond_signal (&c_validated_response);
+ mutex_unlock (&m_validated_response);
+ } /* end while */
+ return 0;
+}
+
+static void set_smartcard_lock_state(saver_info *si)
+{
+ /*
+ * This function sets the smart card state when the screen is being locked.
+ * It is also called when the lock dialog is being displayed
+ * as the card state may not be correct.
+ */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> set_smartcard_lock_state() state:%d\n",
+ si->scf_si->scdata->state);
+
+ switch (si->scf_si->scdata->state)
+ {
+ case SCD_AUTH_CARD_PRESENT:
+ case SCD_ANY_CARD_PRESENT:
+ {
+ si->scf_si->scdata->state = SCD_AUTH_REQUIRED;
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> SCD_AUTH/ANY_CARD_PRESENT\n");
+ break;
+ }
+ case SCD_WAIT_REMOVAL_TIMEOUT:
+ XtRemoveTimeOut (card_removal_timeout_id);
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> SCD_WAIT_REMOVAL_TIMEOUT\n");
+ /* FALL THRU */
+ case SCD_CARD_REMOVAL_IGNORED:
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+ /*
+ * Generate synthetic event so that dialog is displayed
+ */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> SCD_CARD_REMOVAL_IGNORED\n");
+ idle_timer ((XtPointer) si, 0);
+ break;
+/*** mali
+ case SCD_WAIT_FOR_CARD:
+ {
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+ fprintf (stderr, "---> SCD_WAIT_FOR_CARD\n");
+ break;
+ }
+ case SCD_WAIT_REMOVAL_LOGOUT_WAIT:
+ {
+ si->scf_si->scdata->state = SCD_WAIT_REMOVAL_LOGOUT_WAIT;
+ fprintf (stderr, "---> SCD_WAIT_REMOVAL_LOGOUT_WAIT\n");
+ idle_timer ((XtPointer) si, 0);
+ break;
+ }
+ case SCD_WAIT_REMOVAL_LOGOUT_EXPIRED:
+ {
+ si->scf_si->scdata->state = SCD_WAIT_REMOVAL_LOGOUT_EXPIRED;
+ fprintf (stderr, "---> SCD_WAIT_REMOVAL_LOGOUT_EXPIRED\n");
+ idle_timer ((XtPointer) si, 0);
+ break;
+ }
+ case SCD_AUTH_REQUIRED:
+ {
+ si->scf_si->scdata->state = SCD_AUTH_REQUIRED;
+ fprintf (stderr, "---> SCD_AUTH_REQUIRED\n");
+ idle_timer ((XtPointer) si, 0);
+ break;
+ }
+ case SCD_WRONG_USER:
+ {
+ si->scf_si->scdata->state = SCD_WRONG_USER;
+ fprintf (stderr, "---> SCD_WRONG_USER\n");
+ idle_timer ((XtPointer) si, 0);
+ break;
+ }
+ case SCD_AUTH_IN_PROGRESS:
+ {
+ si->scf_si->scdata->state = SCD_AUTH_IN_PROGRESS;
+ fprintf (stderr, "---> SCD_AUTH_IN_PROGRESS\n");
+ idle_timer ((XtPointer) si, 0);
+ break;
+ }
+ case SCD_NO_USER:
+ {
+ si->scf_si->scdata->state = SCD_NO_USER;
+ fprintf (stderr, "---> SCD_NO_USER\n");
+ idle_timer ((XtPointer) si, 0);
+ break;
+ }
+****/
+
+ default:
+ /* Unexpected card state */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> !! unexpected card state\n");
+ break;
+ }
+}
+
+
+static int run_PAMsession (char *user_name, saver_info *si)
+{
+/* it is SCF_PAM_SERVICE_NAME(dtsession) defined by config.h */
+ const char *service = SCF_PAM_SERVICE_NAME;
+ struct pam_conv pc = {conversation_function, (void *) NULL };
+ struct pam_data c;
+ pam_handle_t *pamh = NULL;
+ int status;
+ saver_preferences *p = &si->prefs;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> run_PAMsession\n");
+
+ c.user = strdup (user_name);
+ c.typed_passwd = strdup ("");
+ c.verbose_p = p->verbose_p;
+
+ pc.appdata_ptr = (void*) &c;
+
+ /*
+ * This will be set to True in the conversation function
+ */
+ b_PAM_prompted = False;
+
+/* PAM needs root privileges****/
+
+ status = pam_start (service, user_name, &pc, &pamh);
+ if (p->verbose_p)
+ {
+ fprintf (real_stderr, "%s: pam_start( \"%s\", \"%s\", ...) ===> "
+ "%d (%s)\n", blurb(), service, user_name,
+ status, pam_strerror(pamh, status));
+ }
+ if (status == PAM_SUCCESS)
+ {
+#ifdef PAM_MSG_VERSION
+ /*
+ * This allows the Solaris PAM module to use the new PAM message types
+ * required to support smart cards.
+ */
+
+ status = pam_set_item (pamh, PAM_MSG_VERSION, PAM_MSG_VERSION_V2);
+ if (status != PAM_SUCCESS)
+ {
+ if (p->verbose_p)
+ {
+ fprintf (stderr, "%s: pam_set_item(...) ===> "
+ "%d (%s)\n", blurb(),
+ status, pam_strerror(pamh, status));
+ }
+ }
+#endif /* PAM_MSG_VERSION */
+
+fprintf(stderr,"\n\n DUDE Calling pam_authenticate in run_PAMsession\n\n");
+
+ status = pam_authenticate (pamh, 0);
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> pam_authenticate returned status= %d\n",status);
+ pam_end (pamh, PAM_ABORT);
+ }
+ else /*pam_start FAILED */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> pam_start returned status= %d\n",status);
+
+ return status;
+
+}
+
+
+static int
+conversation_function (int num_msg, struct pam_message **msg,
+ struct pam_response **response, void *appdata_ptr)
+{
+ struct pam_message *m;
+ struct pam_response *r;
+ int k;
+ char *temp;
+ char errbuf[PAM_MAX_MSG_SIZE];
+
+ fprintf (stderr, "---> conversation_function -->num_msg= %d\n",num_msg);
+ if (num_msg < 0)
+ return (PAM_CONV_ERR);
+
+ *response = (struct pam_response*)
+ calloc (num_msg, sizeof (struct pam_response));
+
+ if (*response == NULL)
+ return (PAM_CONV_ERR);
+
+ k = num_msg;
+ m = *msg;
+ r = *response;
+ while (k--)
+ {
+ switch (m->msg_style)
+ {
+ case PAM_PROMPT_ECHO_ON:
+ case PAM_PROMPT_ECHO_OFF:
+
+ if ((the_scf_si.use_smartcard)) {
+ char *smUser;
+ pam_handle_t *pamh = *((pam_handle_t **) appdata_ptr);
+ if (! pamh
+ || pam_get_item(pamh, PAM_USER,
+ (void **) &smUser) != PAM_SUCCESS
+ || smUser == NULL) {
+ the_smi.state = (enum scstate) SCD_NO_USER;
+ return (PAM_ABORT);
+ }
+
+ if (! is_valid_unlock_user(smUser)) {
+ the_smi.state = (enum scstate) SCD_WRONG_USER;
+ return (PAM_ABORT);
+ }
+ the_smi.smartcard_username =(char *) strdup(smUser);
+ }
+
+ b_PAM_prompted = True;
+ b_got_PAM_message = True;
+ memcpy (saved_pam_message, m, sizeof(*m));
+ /*
+ * PAM has requested some input so we tell the UI thread
+ */
+ if (b_first_prompt)
+ {
+ b_first_prompt = False;
+ }
+ else
+ {
+ /*
+ * Tell the UI thread that the first prompt was validated and that
+ * there is more to come
+ */
+ mutex_lock (&m_validated_response);
+ b_validated_response = True;
+ b_validation_finished = False;
+ cond_signal (&c_validated_response);
+ mutex_unlock (&m_validated_response);
+ }
+ mutex_lock (&m_got_message);
+ b_got_message = True;
+ mutex_unlock (&m_got_message);
+ cond_signal (&c_got_message);
+ /*
+ * We must now wait for the user input to be supplied
+ */
+ mutex_lock (&m_got_response);
+ while (b_got_response == False)
+ cond_wait (&c_got_response, &m_got_response);
+ b_got_response = False;
+ mutex_unlock (&m_got_response);
+ /*
+ * saved_user_input being NULL means that the PAM conversation
+ * should be interrupted because converstion function was called
+ * in another thread with message style PAM_CONV_INTERRUPT.
+ * This ususlly means someone removed the smart card.
+ */
+ if (saved_user_input == NULL)
+ {
+ return (PAM_ABORT);
+ }
+
+ r->resp = (char *) malloc (strlen (saved_user_input) + 1);
+ if (r->resp == NULL)
+ {
+ /*
+ * We need to free all previous responses
+ * __pam_free_resp (num_msg, *response);
+ */
+ struct pam_response *rr;
+ int i;
+
+ rr = *response;
+ for (i = 0; i < num_msg; i++, rr++)
+ {
+ if (rr->resp)
+ {
+ free(r->resp);
+ rr->resp = NULL;
+ }
+ }
+ free(response);
+ *response = NULL;
+ return PAM_CONV_ERR;
+ }
+ (void) strcpy (r->resp, saved_user_input);
+ r->resp_retcode = 0;
+ m++;
+ r++;
+ break;
+
+ case PAM_ERROR_MSG:
+ m++;
+ r++;
+ break;
+
+ case PAM_TEXT_INFO:
+ m++;
+ r++;
+ break;
+
+#ifdef PAM_MSG_VERSION
+ case PAM_CONV_INTERRUPT:
+ memcpy (saved_pam_message, m, sizeof(*m));
+ if (thr_self() != pam_thread)
+ {
+ /*
+ * We need to interrupt the other thread running the PAM
+ * conversation function as it will be waiting on a condition
+ * variable.
+ */
+ saved_user_input = NULL;
+ mutex_lock (&m_got_response);
+ b_got_response = True;
+ b_validated_response = False;
+ cond_signal (&c_got_response);
+ mutex_unlock (&m_got_response);
+ return (PAM_SUCCESS);
+ }
+ m++;
+ r++;
+ break;
+#endif /* PAM_MSG_VERSION */
+
+ default:
+ fprintf (real_stderr, "%s, Unknown PAM Message type %d\n",
+ blurb(), m->msg_style);
+ break;
+ }
+ }
+ fprintf (stderr, "---> conversation_function returning PAM_SUCCESS\n");
+ return(PAM_SUCCESS);
+}
+
+static void
+block_signals (void)
+{
+ sigset_t new;
+ /*
+ * We block any signal which the main thread deals with to make sure it is
+ * caught by the main thread
+ *
+ * The list of signals was got from windows.c
+ */
+ sigemptyset (&new);
+ sigaddset (&new, SIGCHLD);
+ sigaddset (&new, SIGHUP);
+ sigaddset (&new, SIGINT);
+ sigaddset (&new, SIGQUIT);
+ sigaddset (&new, SIGILL);
+ sigaddset (&new, SIGTRAP);
+ sigaddset (&new, SIGIOT);
+ sigaddset (&new, SIGABRT);
+#ifdef SIGEMT
+ sigaddset (&new, SIGEMT);
+#endif
+ sigaddset (&new, SIGFPE);
+ sigaddset (&new, SIGBUS);
+ sigaddset (&new, SIGSEGV);
+#ifdef SIGSYS
+ sigaddset (&new, SIGSYS);
+#endif
+ sigaddset (&new, SIGTERM);
+#ifdef SIGXCPU
+ sigaddset (&new, SIGXCPU);
+#endif
+#ifdef SIGXFSZ
+ sigaddset (&new, SIGXFSZ);
+#endif
+#ifdef SIGDANGER
+ sigaddset (&new, SIGDANGER);
+#endif
+ thr_sigsetmask (SIG_BLOCK, &new, NULL);
+}
+
+static char *
+get_username (void)
+{
+ static char *puser = NULL;
+
+ if (!puser)
+ {
+ struct passwd * pwd;
+ pwd = getpwuid (getuid ());
+ if (pwd)
+ {
+ puser = pwd->pw_name;
+ }
+ }
+ return (puser);
+}
+
+static Bool
+is_valid_unlock_user (char * sm_user)
+{
+ char *loggedin_user = get_username ();
+ Bool b_ret = True;
+
+ if (sm_user == NULL)
+ {
+ b_ret = False;
+ }
+ else if (loggedin_user != NULL)
+ {
+ if (strcmp (sm_user, loggedin_user))
+ {
+ if (strcmp (sm_user, "root"))
+ {
+ b_ret = False;
+ }
+ }
+ }
+ else
+ {
+ b_ret = False;
+ }
+ return b_ret;
+}
+
+static void
+dont_block_for_pam (XtPointer ptr, XtIntervalId *invId)
+{
+ saver_info *si = (saver_info *) ptr;
+
+ b_got_message = True;
+ b_got_PAM_message = True;
+ b_validated_response = True;
+ b_validation_finished = True;
+/* cond_signal (&c_validated_response);*/
+}
+
+static void
+wait_for_got_message (saver_info *si)
+{
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> wait_for_got_message()\n");
+ XtAppAddTimeOut (si->app,
+ 100,
+ dont_block_for_pam, (XtPointer) si);
+ mutex_lock (&m_got_message);
+ while (b_got_message == False)
+ {
+ cond_wait (&c_got_message, &m_got_message);
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> \t while of wait_for_got_message()\n");
+ }
+ b_got_message = False;
+ mutex_unlock (&m_got_message);
+}
+
+static char *
+get_smartcard_username (saver_info *si)
+{
+/*
+** Since OCF_UserInfoCardService() is not availabe
+** it can be obtained from pam_smarcard module
+*/
+ return ((char *)the_smi.smartcard_username) ;
+}
+
+
+static void
+scfevent_handler(SCF_Event_t event, SCF_Terminal_t eventTerminal,void *data)
+{
+ SCF_Status_t status;
+ saver_info *si = (saver_info *) data;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> scfevent_handler() state=%d\n",
+ si->scf_si->scdata->state);
+
+ /*
+ * We wait for the previous event to be dealt with before proceeding
+ */
+ mutex_lock (&m_event_processed);
+ while (!b_event_processed)
+ cond_wait (&c_event_processed, &m_event_processed);
+ b_event_processed = False;
+ mutex_unlock (&m_event_processed);
+
+ if (event == SCF_EVENT_CARDINSERTED)
+ {
+ si->scf_si->scdata->state = SCD_AUTH_REQUIRED;
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> EVENT==> CARD INSERTED()\n");
+ }
+ else if (event == SCF_EVENT_CARDREMOVED)
+ {
+
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+ b_event_processed = True; /* reinitialize to True */
+
+ if (si->prefs.verbose_p)
+ {
+ fprintf (stderr, "---> EVENT==> CARD REMOVED()\n");
+ fprintf (stderr, "---> setting state=%d\n",si->scf_si->scdata->state);
+ }
+ }
+ else
+ {
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> EVENT==> NO CARD INSERTED OR REMOVED()\n");
+ return;
+ }
+ /*
+ * Store the SCF event for card insert or remove
+ */
+ si->scf_si->scdata->last_event = event;
+ thr_kill (main_thread, SIGUSR2);
+#if 1
+ /*
+ * We send a ClientMessage which corresponds to this event
+ * so that the UI thread can deal with it.
+ */
+ {
+ XEvent xevent;
+
+ /*
+ * Store the SCF event
+ */
+ si->scf_si->scdata->last_event = event;
+
+ xevent.xany.type = ClientMessage;
+ xevent.xclient.display = si->dpy;
+ xevent.xclient.window = 0;
+ xevent.xclient.message_type = XA_SCREENSAVER;
+ xevent.xclient.format = 32;
+ memset (&xevent.xclient.data, 0, sizeof (xevent.xclient.data));
+ xevent.xclient.data.l[0] = (long) XA_SMARTCARD;
+ if (! XSendEvent (si->dpy, si->screens[0].screensaver_window,
+ False, 0L, &xevent))
+ {
+ fprintf (real_stderr, "XSendEvent failed\n");
+ }
+ XFlush (si->dpy);
+ }
+#endif
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "<--- scfevent_handler() state=%d\n",
+ si->scf_si->scdata->state);
+
+}
+
+static void
+card_removal_timeout (XtPointer ptr, XtIntervalId *invId)
+{
+ saver_info *si = (saver_info *) ptr;
+ /*
+ * This callback decides what to do when cardRemovalTimeout has expired
+ */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> card_removal_timeout state:%d\n",
+ si->scf_si->scdata->state);
+
+ if (!si->scf_si->ignore_card_removal)
+ set_locked_p(si, True);
+
+ if (!si->scf_si->ignore_card_removal &&
+ si->scf_si->scdata->state != SCD_AUTH_IN_PROGRESS &&
+ !si->scf_si->reauth_after_card_removal)
+ {
+ start_wait_removal_timer (si);
+ }
+
+#if OLDCODE
+ if (si->scf_si->scdata->state == SCD_WAIT_REMOVAL_TIMEOUT)
+ {
+ /*
+ * We make sure that we are in the expected state
+ */
+ if (si->scf_si->ignore_card_removal)
+ {
+ if (si->locked_p)
+ {
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+ /*
+ * Generate synthetic event so that dialog is displayed
+ */
+ idle_timer ((XtPointer) si, invId);
+ }
+ else
+ {
+ si->scf_si->scdata->state = SCD_CARD_REMOVAL_IGNORED;
+ }
+ }
+ else if (si->scf_si->reauth_after_card_removal)
+ {
+ si->scf_si->scdata->state = SCD_WAIT_FOR_CARD;
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "SCD_WAIT_FOR_CARD calling set_locked_p \n");
+ set_locked_p (si, True);
+ /*
+ * Generate synthetic event so that dialog is displayed
+ */
+ idle_timer ((XtPointer) si, invId);
+ }
+ else
+ {
+ start_wait_removal_timer (si);
+ }
+ }
+#endif /*oldcode*/
+}
+
+static void
+start_wait_removal_timer (saver_info *si)
+{
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> start_wait_removal_timeout value:%d \n",
+ si->scf_si->card_removal_logout_wait);
+
+ si->scf_si->scdata->state = SCD_WAIT_REMOVAL_LOGOUT_WAIT;
+
+/*mali somehow timer is too short and calls force_exit()**/
+
+ card_removal_logout_wait_id = XtAppAddTimeOut (si->app,
+ si->scf_si->card_removal_logout_wait,
+ /*10000, mali*/
+ card_removal_logout_wait,
+ (XtPointer) si);
+ set_locked_p (si, True);
+ /*
+ * Generate synthetic event so that dialog is displayed
+ */
+ idle_timer ((XtPointer) si, 0);
+}
+
+static void
+card_removal_logout_wait (XtPointer ptr, XtIntervalId *invId)
+{
+ saver_info *si = (saver_info *) ptr;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> card_removal_logout_wait\n");
+
+/*mali si->scf_si->scdata->state = SCD_WAIT_REMOVAL_LOGOUT_EXPIRED;**
+ we dont really want to log user out do we and if we do..how to do it?
+ pkill gnome-session or /usr/dt/bin/dtconfig -kill or /etc/init.d/dtlogin
+ stop so for now setting state to AUTH_REQUIRED
+ si->scf_si->scdata->state = SCD_AUTH_REQUIRED; */
+
+ si->scf_si->scdata->state = SCD_WAIT_REMOVAL_LOGOUT_EXPIRED;
+ force_exit(si);
+}
+
+static void
+force_exit (saver_info *si)
+{
+ /*
+ * This function is called after cardRemovalLogoutWait has expired and
+ * should cause the user to be logged out
+ */
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> force_exit\n");
+/* saver_exit (si, -1, 0); */
+/*mali */ destroy_passwd_window (si);
+ exec_command (si->prefs.shell, "pkill gnome-session", 0);
+}
+
+static void
+report_smartcard_init_error (saver_info *si, char *name, uint32_t code)
+{
+ char *message = "%s: Smart Card initialization failed\n"
+ "The function %s returned error code %d - disabling locking.\n";
+ fprintf (real_stderr ? real_stderr : stderr, message, blurb(), name, code);
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> report_smartcard_init_error\n");
+
+ if (!si->locking_disabled_p)
+ {
+ si->locking_disabled_p = True;
+ si->nolock_reason = "SCF function failure";
+ }
+}
+
+static void
+report_smartcard_error (char *name, uint32_t code)
+{
+ char *message = "%s: Call to SCF failed\n"
+ " The function %s returned error code %d\n";
+ fprintf (real_stderr ? real_stderr : stderr, message, blurb(), name, code);
+}
+
+/*
+ * The Unix signal handler that is registering with sigaction.
+ * It uses XtNoticeSignal to tell the Intrinsics to invoke the signal
+ * handler assocaited with the signal ID.
+ */
+static void sigusr2_handler (void)
+{
+ XtNoticeSignal (sigusr2_id);
+}
+
+static void sigusr2_callback (XtPointer client_data, XtSignalId *id)
+{
+ /*
+ * This function generates an X event by calling XtAppAddTimeOut with
+ * a timeout value of 0. It is called so that the event loop is called
+ * after the card event has been processed.
+ */
+ saver_info *si = (saver_info *) client_data;
+
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "---> siguser2_callback\n");
+
+ XtAppAddTimeOut (si->app,
+ 1,
+ synthetic_event_callback,
+ (XtPointer) si);
+}
+
+static void synthetic_event_callback (XtPointer client_data, XtIntervalId * id)
+{
+ set_smartcard_event_occurred (True);
+ idle_timer ( (saver_info *) client_data, 0);
+}
+
+Bool has_smartcard_event_occurred (void)
+{
+ Bool ret_val = b_card_event_occurred;
+
+ if (b_card_event_occurred)
+ {
+ b_card_event_occurred = False;
+ }
+ return ret_val;
+}
+
+void set_smartcard_event_occurred (Bool val)
+{
+ b_card_event_occurred = val;
+}
+#endif /* NO_LOCKING -- whole file */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/driver/scf-smartcard.h Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,90 @@
+/* scf-smartcard.h --- Code to deal with smart card authentication
+ * for xscreensaver, Copyright (c) 1993-1998, 2000 Jamie Zawinski <[email protected]>
+ *
+ * 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
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ *
+ * written by Padraig O'Briain ([email protected])
+ *
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+#ifndef __SCF_SMARTCARD_H__
+#define __SCF_SMARTCARD_H__
+
+enum passwd_state { pw_read, pw_ok, pw_null, pw_fail, pw_cancel, pw_time , pw_another};
+
+typedef struct scf_saver_info scf_saver_info;
+
+typedef struct smartcard_info smartcard_info;
+
+struct scf_saver_info {
+ Bool use_smartcard;
+ int card_removal_timeout;
+ Bool ignore_card_removal;
+ Bool reauth_after_card_removal;
+ Time reauth_timeout;
+ Time card_removal_logout_wait;
+ Time first_card_event_timeout;
+ smartcard_info* scdata;
+};
+
+enum scstate {
+ SCD_AUTH_CARD_PRESENT,
+ SCD_WAIT_REMOVAL_TIMEOUT,
+ SCD_CARD_REMOVAL_IGNORED,
+ SCD_WAIT_FOR_CARD,
+ SCD_WAIT_REMOVAL_LOGOUT_WAIT,
+ SCD_ANY_CARD_PRESENT,
+ SCD_WAIT_REMOVAL_LOGOUT_EXPIRED,
+ SCD_AUTH_REQUIRED,
+ SCD_WRONG_USER,
+ SCD_AUTH_IN_PROGRESS,
+ SCD_NO_USER
+};
+
+struct smartcard_info {
+ enum scstate state;
+ int wait_removal_logout_timer;
+ SCF_Event_t last_event;
+ SCF_Session_t session_handle;
+ SCF_Terminal_t terminal_handle;
+ SCF_Card_t card_handle;
+ SCF_ListenerHandle_t myListener;
+ char * smartcard_username;
+ Time message_timeout;
+};
+
+#endif /* __SCF_SMARTCARD_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/driver/trusted-utils.c Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,150 @@
+/*
+ * Trusted xscreensaver
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ *
+ *
+ * Based on work by Erwann Chenede, Ghee Teo
+ *
+ * Used to check if we are in a multilabel session and to load
+ * additional functionality within the multilabel session.
+ */
+
+#include <dlfcn.h>
+#include <link.h>
+#include <stdlib.h>
+#include <user_attr.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <strings.h>
+
+#include "trusted-utils.h"
+
+/*
+ * Checks for Multi label session
+ */
+gboolean
+tsol_is_multi_label_session (void)
+{
+ static char *session = NULL;
+
+ if (!session)
+ session = (char *)getenv("TRUSTED_SESSION");
+
+ if (!session)
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * dynamicly load the libxtsol library
+ */
+static
+void * dlopen_xtsol (void)
+{
+ void *handle = NULL;
+
+ if ((handle = dlopen ("/usr/lib/libXtsol.so.1", RTLD_LAZY)) != NULL)
+ return handle;
+ if ((handle = dlopen ("/usr/openwin/lib/libXtsol.so.1", RTLD_LAZY)) != NULL)
+ return handle;
+
+ return handle;
+}
+
+/*
+ * dynamicly load the libDtTsol library
+ */
+static
+void * dlopen_gnometsol (void)
+{
+ void *handle = NULL;
+
+ if ((handle = dlopen ("/usr/lib/libgnometsol.so.1", RTLD_LAZY)) != NULL)
+ return handle;
+
+ return handle;
+}
+
+xtsol_XTSOLgetWorkstationOwner libxtsol_XTSOLgetWorkstationOwner = NULL;
+
+void
+XTSOLgetWorkstationOwner(Display *dpy, uid_t *WorkstationOwner)
+{
+ static gpointer xtsol_handle = NULL;
+ static gboolean _xtsol_initialized = FALSE;
+
+ if ( ! _xtsol_initialized ) {
+ _xtsol_initialized = TRUE;
+ xtsol_handle = dlopen_xtsol ();
+ if (xtsol_handle != NULL)
+ libxtsol_XTSOLgetWorkstationOwner = (xtsol_XTSOLgetWorkstationOwner) dlsym(xtsol_handle,
+ "XTSOLgetWorkstationOwner");
+ }
+
+ if (libxtsol_XTSOLgetWorkstationOwner == NULL) {
+ *WorkstationOwner = getuid();
+ } else
+ libxtsol_XTSOLgetWorkstationOwner(dpy, WorkstationOwner);
+}
+
+gnome_tsol_get_usrattr_val libgnome_tsol_get_usrattr_val = NULL;
+
+/*
+ * Returns a value from uattr for the given key.
+ * If there is no value in user_attr, then it returns the
+ * system wide default from policy.conf or labelencodings
+ * as appropriate.
+ */
+char *
+getusrattrval(userattr_t *uattr, char *keywd)
+{
+ static gpointer gnometsol_handle = NULL;
+ static gboolean _gnometsol_initialized = FALSE;
+ char *value;
+
+ if ( ! _gnometsol_initialized ) {
+ _gnometsol_initialized = TRUE;
+ gnometsol_handle = dlopen_gnometsol ();
+ if (gnometsol_handle != NULL)
+ libgnome_tsol_get_usrattr_val = (gnome_tsol_get_usrattr_val) dlsym(gnometsol_handle,
+ "gnome_tsol_get_usrattr_val");
+ }
+
+ if (libgnome_tsol_get_usrattr_val == NULL) {
+ if (strcmp(keywd, USERATTR_IDLETIME_KW) == 0)
+ value = strdup("15");
+ else if (strcmp(keywd, USERATTR_IDLECMD_KW) == 0)
+ value = strdup(USERATTR_IDLECMD_LOCK_KW);
+ } else
+ value = libgnome_tsol_get_usrattr_val(uattr, keywd);
+
+ return ( value );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/driver/trusted-utils.h Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,59 @@
+/*
+ * Trusted xscreensaver
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ *
+ * Based on work by Erwann Chenede, Ghee Teo
+ *
+ * Definitions for the trusted functions.
+ */
+#ifndef TRUSTED_XSCREENSAVER_H
+#define TRUSTED_XSCREENSAVER_H
+
+#ifdef HAVE_XTSOL
+#include <X11/extensions/Xtsol.h>
+#endif /* HAVE_XTSOL */
+#include <user_attr.h>
+#include <glib.h>
+#include <X11/Xlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+extern gboolean tsol_is_multi_label_session (void);
+extern char *getusrattrval(userattr_t *, char *);
+extern void XTSOLgetWorkstationOwner(Display *, uid_t *);
+
+typedef void (*xtsol_XTSOLgetWorkstationOwner) (Display *, uid_t *);
+typedef char *(*gnome_tsol_get_usrattr_val) (userattr_t *, char *);
+
+enum {
+ LOCK_CMD = 0,
+ LOGOUT_CMD
+};
+#endif /* TRUSTED_XSCREENSAVER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/sun-src/driver/xscreensaver-demo.glade2p Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
+
+<glade-project>
+ <name>xscreensaver-demo</name>
+ <program_name>xscreensaver-demo</program_name>
+ <source_directory></source_directory>
+ <pixmaps_directory>../utils/images</pixmaps_directory>
+ <gnome_support>FALSE</gnome_support>
+ <use_widget_names>TRUE</use_widget_names>
+ <output_main_file>FALSE</output_main_file>
+ <output_support_files>FALSE</output_support_files>
+ <output_build_files>FALSE</output_build_files>
+</glade-project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/tooltips.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Sun bug 4818062:
+ mouse-over displays incorrect information
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=4818062
+
+diff -urp -x '*~' driver/xscreensaver-demo.glade2 driver/xscreensaver-demo.glade2
+--- driver/xscreensaver-demo.glade2 2006-05-10 08:49:02.837844000 -0700
++++ driver/xscreensaver-demo.glade2 2006-05-10 08:49:10.988281000 -0700
+@@ -385,7 +385,7 @@
+ <child>
+ <widget class="GtkSpinButton" id="lock_spinbutton">
+ <property name="visible">True</property>
+- <property name="tooltip" translatable="yes">How long before the monitor goes completely black.</property>
++ <property name="tooltip" translatable="yes">How long before the screen becomes locked.</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">15</property>
+ <property name="digits">0</property>
+@@ -439,7 +439,7 @@
+ <child>
+ <widget class="GtkSpinButton" id="cycle_spinbutton">
+ <property name="visible">True</property>
+- <property name="tooltip" translatable="yes">How long before the monitor goes completely black.</property>
++ <property name="tooltip" translatable="yes">How long before the new hack sub-process starts.</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">15</property>
+ <property name="digits">0</property>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/trusted.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,392 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Support needed for Solaris Trusted Extensions / Trusted Java Desktop System.
+
+diff -urp -x '*~' configure.in configure.in
+--- configure.in 2006-05-10 08:49:50.311248000 -0700
++++ configure.in 2006-05-10 08:49:57.787065000 -0700
+@@ -3308,6 +3308,18 @@ fi
+ AC_SUBST([XPM_LOGO_FILE])
+ AC_SUBST([XPM_LOGO_NAME])
+
++if test -r driver/tsunlogo.xpm ; then
++ TRUSTED_XPM_LOGO_FILE=tsunlogo.xpm
++ TRUSTED_XPM_LOGO_NAME=tsunlogo_xpm
++ TRUSTED_XPM_COMMENT=""
++else
++ TRUSTED_XPM_COMMENT="#"
++fi
++
++AC_SUBST([TRUSTED_XPM_LOGO_FILE])
++AC_SUBST([TRUSTED_XPM_LOGO_NAME])
++AC_SUBST([TRUSTED_XPM_COMMENT])
++
+ #--- End SUNW addition
+
+ if test "$have_kerberos" = yes; then
+diff -urp -x '*~' driver/Makefile.in driver/Makefile.in
+--- driver/Makefile.in 2006-05-10 08:49:50.406340000 -0700
++++ driver/Makefile.in 2006-05-10 08:49:57.796787000 -0700
+@@ -101,6 +101,10 @@ GTK_OBJS = demo-Gtk.o demo-Gtk-conf.o @G
+ GTK_LOCK_SRCS = lock-Gtk.c remote.c
+ GTK_LOCK_OBJS = lock-Gtk.o remote.o
+
++TRUSTED_LIBS = -lglib-2.0 -lsecdb
++TRUSTED_SRCS = trusted-utils.c
++TRUSTED_OBJS = trusted-utils.o
++
+ PWENT_SRCS = passwd-pwent.c
+ PWENT_OBJS = passwd-pwent.o
+
+@@ -808,8 +812,10 @@ demo-Gtk-conf.o: demo-Gtk-conf.c
+ $(srcdir)/demo-Gtk-conf.c
+
+ # lock-Gtk takes extra -D and -I options.
++@TRUSTED_XPM_COMMENT@ TRUSTED_LOGO_DEFS=-DTRUSTED_XPM_LOGO_FILE=\"@TRUSTED_XPM_LOGO_FILE@\" \
++@TRUSTED_XPM_COMMENT@ -DTRUSTED_XPM_LOGO_NAME=@TRUSTED_XPM_LOGO_NAME@
+ GTK_LOCK_LOGO_DEFS=-DXPM_LOGO_FILE=\"@XPM_LOGO_FILE@\" \
+- -DXPM_LOGO_NAME=@XPM_LOGO_NAME@
++ -DXPM_LOGO_NAME=@XPM_LOGO_NAME@ $(TRUSTED_LOGO_DEFS)
+
+ lock-Gtk.o: lock-Gtk.c
+ $(CC) -c $(INCLUDES) -I$(ICON_SRC) $(GTK_DEFS) \
+@@ -825,8 +831,9 @@ XScreenSaver_ad.h: XScreenSaver.ad
+
+ # The executables linked in this directory.
+ #
+-xscreensaver: $(SAVER_OBJS)
+- $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS)
++xscreensaver: $(SAVER_OBJS) $(TRUSTED_OBJS)
++ $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(TRUSTED_OBJS) \
++ $(TRUSTED_LIBS) $(SAVER_LIBS)
+
+ xscreensaver-command: $(CMD_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS)
+@@ -839,8 +846,9 @@ xscreensaver-demo: @PREFERRED_DEMO_PROGR
+ xscreensaver-lock: @PREFERRED_LOCK_PROGRAM@
+ $(INSTALL_PROGRAM) @PREFERRED_LOCK_PROGRAM@ $@
+
+-xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS)
++xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS) $(TRUSTED_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(GTK_LOCK_OBJS) $(LIBS) $(X_LIBS) \
++ $(TRUSTED_OBJS) $(TRUSTED_LIBS) \
+ $(GTK_LIBS) $(XML_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
+ $(XDPMS_LIBS) -lXext \
+ $(X_EXTRA_LIBS)
+@@ -850,13 +858,15 @@ xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOT
+ $(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
+ $(XDPMS_LIBS) -lXext $(X_EXTRA_LIBS)
+
+-xscreensaver-demo-Gtk: $(DEMO_OBJS) $(GTK_OBJS)
+- $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(GTK_OBJS) $(LIBS) $(X_LIBS) \
+- $(GTK_LIBS) $(XML_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
++xscreensaver-demo-Gtk: $(DEMO_OBJS) $(GTK_OBJS) $(TRUSTED_OBJS)
++ $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(GTK_OBJS) $(TRUSTED_OBJS) \
++ $(LIBS) $(X_LIBS) $(GTK_LIBS) $(XML_LIBS) $(INTL_LIBS) \
++ $(TRUSTED_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
+ $(XDPMS_LIBS) -lXext $(X_EXTRA_LIBS)
+
+-xscreensaver-getimage: $(GETIMG_OBJS)
+- $(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(GETIMG_LIBS) -lm
++xscreensaver-getimage: $(GETIMG_OBJS) $(TRUSTED_OBJS)
++ $(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(TRUSTED_OBJS) \
++ $(GETIMG_LIBS) $(TRUSTED_LIBS) -lm
+
+
+ TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PASSWD_OBJS) \
+diff -urp -x '*~' driver/demo-Gtk.c driver/demo-Gtk.c
+--- driver/demo-Gtk.c 2006-05-10 08:49:50.661964000 -0700
++++ driver/demo-Gtk.c 2006-05-10 08:49:57.837940000 -0700
+@@ -112,6 +112,8 @@
+ #include <string.h>
+ #include <ctype.h>
+
++#include <user_attr.h>
++
+ #ifdef HAVE_GTK2
+ enum {
+ COL_ENABLED,
+@@ -126,6 +128,7 @@ extern void exec_command (const char *sh
+ #undef countof
+ #define countof(x) (sizeof((x))/sizeof((*x)))
+
++extern Display *global_dpy;
+
+ char *progname = 0;
+ char *progclass = "XScreenSaver";
+@@ -2231,10 +2234,15 @@ update_list_sensitivity (state *s)
+ #endif /* !HAVE_GTK2 */
+ }
+
++void XTSOLgetWorkstationOwner(Display *, uid_t *);
++char *getusrattrval(userattr_t *, char *);
++gboolean tsol_is_multi_label_session (void);
+
+ static void
+ populate_prefs_page (state *s)
+ {
++ static gboolean tsol_hack_initialized = False;
++ static gboolean tsol_multi_label_session = False;
+ saver_preferences *p = &s->prefs;
+
+ /* The file supports timeouts of less than a minute, but the GUI does
+@@ -2361,9 +2369,61 @@ populate_prefs_page (state *s)
+ SENSITIZE ("pwd_spinbutton", p->pwd_p);
+ SENSITIZE ("pwd_mlabel", p->pwd_p);
+
++ tsol_multi_label_session = tsol_is_multi_label_session();
++ if ( ! tsol_hack_initialized && tsol_multi_label_session )
++ {
++ GtkWidget *lock_spinbutton = name_to_widget(s, "lock_spinbutton");
++ GtkWidget *lock_container = name_to_widget(s, "blanking_table");
++ GtkWidget *lock_button_eventbox = name_to_widget(s, "lock_button_eventbox");
++ Widget *newlabel = g_object_new(GTK_TYPE_LABEL, "label",
++ _("_Lock Screen After"),
++ "use-underline", TRUE,
++ "mnemonic-widget", lock_spinbutton,
++ NULL);
++ GValue *gv = g_new0(GValue, 1);
++ GtkAdjustment *adj;
++ userattr_t *uent;
++ int idletime;
++ char *value = NULL;
++ uid_t WorkstationOwner;
++ Display *dpy = GDK_DISPLAY();
++
++ adj = gtk_spin_button_get_adjustment((GtkSpinButton *)lock_spinbutton);
++
++ XTSOLgetWorkstationOwner(dpy, &WorkstationOwner);
++ uent = getuseruid(WorkstationOwner);
++ value = getusrattrval(uent, USERATTR_IDLETIME_KW);
++ if (value != NULL && *value != '\0')
++ idletime = atoi(value);
++ adj->upper = (gdouble)idletime;
++ if (adj->value > adj->upper)
++ adj->value = adj->upper;
++
++ gtk_spin_button_set_adjustment((GtkSpinButton *)lock_spinbutton, adj);
++
++ gtk_container_add(GTK_CONTAINER(lock_container), GTK_WIDGET(newlabel));
++ g_value_init(gv, G_TYPE_INT);
++ g_value_set_int(gv, 2);
++ gtk_container_child_set_property(GTK_CONTAINER(lock_container), GTK_WIDGET(newlabel), "top_attach", gv);
++ g_value_set_int(gv, 1);
++ gtk_container_child_set_property(GTK_CONTAINER(lock_container), GTK_WIDGET(newlabel), "left_attach", gv);
++ gtk_widget_show(GTK_WIDGET(newlabel));
++ gtk_widget_hide(GTK_WIDGET(lock_button_eventbox));
++ g_object_set(lock_button_eventbox, "active", TRUE, NULL);
++
++ SENSITIZE ("lock_button", 1);
++ }
++
++ if ( tsol_multi_label_session )
++ {
++ SENSITIZE ("lock_spinbutton", 1);
++ SENSITIZE ("lock_mlabel", 1);
++ }
++ else
++ {
+ SENSITIZE ("lock_spinbutton", p->lock_p);
+ SENSITIZE ("lock_mlabel", p->lock_p);
+-
++ }
+ /* DPMS
+ */
+ SENSITIZE ("dpms_frame", dpms_supported);
+@@ -2392,6 +2452,7 @@ populate_prefs_page (state *s)
+
+ # undef SENSITIZE
+ }
++ tsol_hack_initialized = True;
+ }
+
+
+@@ -4043,7 +4104,7 @@ main (int argc, char **argv)
+ applicationShellWidgetClass,
+ dpy, 0, 0);
+
+- dpy = XtDisplay (toplevel_shell);
++ global_dpy = dpy = XtDisplay (toplevel_shell);
+ db = XtDatabase (dpy);
+ XtGetApplicationNameAndClass (dpy, &progname, &progclass);
+ XSetErrorHandler (demo_ehandler);
+diff -urp -x '*~' driver/prefs.c driver/prefs.c
+--- driver/prefs.c 2006-05-10 08:49:50.519771000 -0700
++++ driver/prefs.c 2006-05-10 08:49:57.816439000 -0700
+@@ -36,6 +36,7 @@
+ # include "vms-pwd.h"
+ #endif /* VMS */
+
++#include <user_attr.h>
+
+ /* This file doesn't need the Xt headers, so stub these types out... */
+ #undef XtPointer
+@@ -65,12 +66,13 @@
+
+ #include "prefs.h"
+ #include "resources.h"
+-
++#include "trusted-utils.h"
+
+ extern char *progname;
+ extern char *progclass;
+ extern const char *blurb (void);
+
++Display *global_dpy;
+
+
+ static void get_screenhacks (saver_preferences *p);
+@@ -970,6 +972,9 @@ free_screenhack_list (screenhack **list,
+ free (list);
+ }
+
++void XTSOLgetWorkstationOwner(Display *, uid_t *);
++char *getusrattrval(userattr_t *, char *);
++int tsol_is_multi_label_session (void);
+
+
+ /* Populate `saver_preferences' with the contents of the resource database.
+@@ -1010,7 +1015,10 @@ load_init_file (saver_preferences *p)
+ p->xsync_p = get_boolean_resource ("synchronous", "Synchronous");
+ p->verbose_p = get_boolean_resource ("verbose", "Boolean");
+ p->timestamp_p = get_boolean_resource ("timestamp", "Boolean");
+- p->lock_p = get_boolean_resource ("lock", "Boolean");
++ if ( tsol_is_multi_label_session() )
++ p->lock_p = True; /* always lock in a Multi Label Session */
++ else
++ p->lock_p = get_boolean_resource ("lock", "Boolean");
+ /* *bugid 5077981 pwd timeout */
+ p->pwd_p = get_boolean_resource ("passwdTimeoutEnabled", "Boolean");
+ p->lock_vt_p = get_boolean_resource ("lockVTs", "Boolean");
+@@ -1030,6 +1038,27 @@ load_init_file (saver_preferences *p)
+ p->lock_timeout = 1000 * get_minutes_resource ("lockTimeout", "Time");
+ p->cycle = 1000 * get_minutes_resource ("cycle", "Time");
+ p->passwd_timeout = 1000 * get_seconds_resource ("passwdTimeout", "Time");
++ if ( tsol_is_multi_label_session() )
++ {
++ userattr_t *uent;
++ int idletime;
++ char *value = NULL;
++ uid_t WorkstationOwner;
++
++ XTSOLgetWorkstationOwner(global_dpy, &WorkstationOwner);
++ uent = getuseruid(WorkstationOwner);
++ value = getusrattrval(uent, USERATTR_IDLETIME_KW);
++ if (value != NULL && *value != '\0')
++ idletime = atoi(value) * 1000;
++ if (p->passwd_timeout > idletime)
++ p->passwd_timeout = idletime;
++
++ value = getusrattrval(uent, USERATTR_IDLECMD_KW);
++ if (value && strcmp(value, USERATTR_IDLECMD_LOGOUT_KW) == 0)
++ p->lock_cmd = LOGOUT_CMD;
++ else
++ p->lock_cmd = LOCK_CMD;
++ }
+ p->pointer_timeout = 1000 * get_seconds_resource ("pointerPollTime", "Time");
+ p->notice_events_timeout = 1000*get_seconds_resource("windowCreationTimeout",
+ "Time");
+diff -urp -x '*~' driver/prefs.h driver/prefs.h
+--- driver/prefs.h 2006-05-10 08:49:50.407982000 -0700
++++ driver/prefs.h 2006-05-10 08:49:57.831994000 -0700
+@@ -70,6 +70,7 @@ struct saver_preferences {
+ Time initial_delay; /* how long to sleep after launch */
+ Time splash_duration; /* how long the splash screen stays up */
+ Time timeout; /* how much idle time before activation */
++ int lock_cmd; /* tsol only - whether to lock or logout */
+ Time lock_timeout; /* how long after activation locking starts */
+ Time cycle; /* how long each hack should run */
+ Time passwd_timeout; /* how much time before pw dialog goes down */
+diff -urp -x '*~' driver/subprocs.c driver/subprocs.c
+--- driver/subprocs.c 2006-05-10 08:49:50.587973000 -0700
++++ driver/subprocs.c 2006-05-10 08:49:57.835657000 -0700
+@@ -74,6 +74,7 @@ extern int kill (pid_t, int); /* signal
+ #include "xscreensaver.h"
+ #include "yarandom.h"
+ #include "visual.h" /* for id_to_visual() */
++#include "trusted-utils.h"
+
+ extern saver_info *global_si_kludge; /* I hate C so much... */
+
+@@ -820,6 +821,14 @@ spawn_screenhack_1 (saver_screen_info *s
+ ssi->number, complete_hack_command,
+ (unsigned long) getpid (), p->nice_inferior);
+
++ if ( tsol_is_multi_label_session() )
++ if (p->lock_cmd == LOGOUT_CMD)
++ {
++ free (complete_hack_command);
++ exec_command (p->shell, "/usr/bin/pkill gnome-session", 0);
++ exit(1);
++ }
++
+ exec_command (p->shell, complete_hack_command, p->nice_inferior);
+
+ /* If that returned, we were unable to exec the subprocess. */
+diff -urp -x '*~' driver/xscreensaver-getimage.c driver/xscreensaver-getimage.c
+--- driver/xscreensaver-getimage.c 2002-05-29 13:49:34.000000000 -0700
++++ driver/xscreensaver-getimage.c 2006-05-10 08:49:57.797465000 -0700
+@@ -58,6 +58,7 @@ static char *defaults[] = {
+ 0
+ };
+
++extern Display *global_dpy;
+
+
+ char *progname = 0;
+@@ -596,7 +597,7 @@ main (int argc, char **argv)
+ toplevel = XtAppInitialize (&app, progclass, 0, 0, &argc, argv,
+ defaults, 0, 0);
+ argv[0] = progname;
+- dpy = XtDisplay (toplevel);
++ global_dpy = dpy = XtDisplay (toplevel);
+ screen = XtScreen (toplevel);
+ db = XtDatabase (dpy);
+
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:49:50.641581000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:49:57.862256000 -0700
+@@ -189,6 +189,7 @@ passwd_dialog_data *ptr_mygtkpwd = &mygt
+ char *progname = 0;
+ char *progclass = 0;
+ XrmDatabase db = 0;
++extern Display *global_dpy;
+
+
+ static Atom XA_SCREENSAVER_RESPONSE;
+@@ -1381,6 +1382,7 @@ while (debug_flag)
+ hack_environment (si);
+
+ shell = connect_to_server (si, &argc, argv);
++ global_dpy = XtDisplay(shell);
+ process_command_line (si, &argc, argv);
+ print_banner (si);
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xscreensaver/xinput.patch Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,464 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+Add support for listening to X Input Extension devices to wake up the system
+to support users of the GNOME On-screen Keyboard (GOK) and similar
+accessibility helpers (Sun bugid 5077966)
+
+
+diff -urp -x '*~' driver/Makefile.in driver/Makefile.in
+--- driver/Makefile.in 2006-05-10 08:48:46.809952000 -0700
++++ driver/Makefile.in 2006-05-10 08:48:52.404220000 -0700
+@@ -197,7 +197,7 @@ DEMO_OBJS = prefs.o dpms.o remote.o exec
+
+ SAVER_LIBS = $(LIBS) $(X_LIBS) $(XMU_LIBS) @SAVER_LIBS@ \
+ $(XDPMS_LIBS) $(GL_LIBS) $(X_PRE_LIBS) \
+- -lXt -lX11 -lXext $(X_EXTRA_LIBS) \
++ -lXt -lX11 -lXext -lXi $(X_EXTRA_LIBS) \
+ $(PASSWD_LIBS)
+
+ CMD_LIBS = $(LIBS) $(X_LIBS) \
+diff -urp -x '*~' driver/XScreenSaver.ad.in driver/XScreenSaver.ad.in
+--- driver/XScreenSaver.ad.in 2006-05-10 08:48:46.868803000 -0700
++++ driver/XScreenSaver.ad.in 2006-05-10 08:48:52.397560000 -0700
+@@ -66,6 +66,7 @@
+ *mitSaverExtension: False
+ *xidleExtension: True
+ *procInterrupts: True
++*xinputExtensionDev: True
+
+ ! This is what the "Demo" button on the splash screen runs (/bin/sh syntax.)
+ *demoCommand: xscreensaver-demo
+diff -urp -x '*~' driver/prefs.c driver/prefs.c
+--- driver/prefs.c 2006-05-10 08:48:46.891011000 -0700
++++ driver/prefs.c 2006-05-10 08:48:52.388565000 -0700
+@@ -279,6 +279,7 @@ static const char * const prefs[] = {
+ "mitSaverExtension",
+ "xidleExtension",
+ "procInterrupts",
++ "xinputExtensionDev",
+ "overlayStderr",
+ "overlayTextBackground", /* not saved -- X resources only */
+ "overlayTextForeground", /* not saved -- X resources only */
+@@ -810,6 +811,10 @@ write_init_file (saver_preferences *p, c
+ CHECK("mitSaverExtension")type = pref_bool, b=p->use_mit_saver_extension;
+ CHECK("xidleExtension") type = pref_bool, b = p->use_xidle_extension;
+ CHECK("procInterrupts") type = pref_bool, b = p->use_proc_interrupts;
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++CHECK("xinputExtensionDev") type = pref_bool, b=p->use_xinputdev_extension;
+ CHECK("overlayStderr") type = pref_bool, b = overlay_stderr_p;
+ CHECK("overlayTextBackground") continue; /* don't save */
+ CHECK("overlayTextForeground") continue; /* don't save */
+@@ -1060,6 +1065,11 @@ load_init_file (saver_preferences *p)
+ p->use_sgi_saver_extension = get_boolean_resource ("sgiSaverExtension",
+ "Boolean");
+ p->use_proc_interrupts = get_boolean_resource ("procInterrupts", "Boolean");
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++ p->use_xinputdev_extension =
++ get_boolean_resource ("xinputExtensionDev", "Boolean");
+
+ get_screenhacks (p); /* Parse the "programs" resource. */
+
+diff -urp -x '*~' driver/prefs.h driver/prefs.h
+--- driver/prefs.h 2006-05-10 08:48:46.902760000 -0700
++++ driver/prefs.h 2006-05-10 08:48:52.389118000 -0700
+@@ -91,6 +91,10 @@ struct saver_preferences {
+ Bool use_mit_saver_extension;
+ Bool use_sgi_saver_extension;
+ Bool use_proc_interrupts;
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++ Bool use_xinputdev_extension;
+
+ char *shell; /* where to find /bin/sh */
+
+diff -urp -x '*~' driver/timers.c driver/timers.c
+--- driver/timers.c 2006-05-10 08:48:46.849018000 -0700
++++ driver/timers.c 2006-05-10 08:48:52.407651000 -0700
+@@ -60,6 +60,12 @@ extern void unblank_screen (saver_info *
+ extern Bool Ignore_SmartCard;
+ #endif /* HAVE_SCF_SMARTCARD */
+
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++extern int valuator_type, press_type, release_type;
++
++
+ void
+ idle_timer (XtPointer closure, XtIntervalId *id)
+ {
+@@ -609,10 +615,14 @@ sleep_until_idle (saver_info *si, Bool u
+ and query the server with that extension. For our purposes, polling
+ /proc/interrupts is just like polling the mouse position. It has to
+ happen on the same kind of schedule. */
++/*CR 5077966 P1 "password prompt cant be directly activated by GOK device
++*/
++
+ Bool polling_mouse_position = (si->using_proc_interrupts ||
+ !(si->using_xidle_extension ||
+ si->using_mit_saver_extension ||
+- si->using_sgi_saver_extension));
++ si->using_sgi_saver_extension) ||
++ si->using_xinputdev_extension);
+
+ #ifdef HAVE_SCF_SMARTCARD
+ static Bool display_required = False;
+@@ -1000,6 +1010,49 @@ sleep_until_idle (saver_info *si, Bool u
+ }
+ else
+ #endif /* HAVE_SGI_SAVER_EXTENSION */
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++/*
++CR6200441(P1)Fix for bug #5077966 breaks 2nd mouse working with GOK
++ it causes flashing screen as GOK geneerates a lot of
++ XInputExtension dev XEvents
++ it needs to check only when the screen is locked
++*/
++
++ if ((!until_idle_p) && (event.type == valuator_type ||
++ event.type == press_type ||
++ event.type == release_type ))
++ {
++/* for debug only
++
++ if (si->locking_disabled_p)
++ fprintf (stderr, "BUG ext event locking_disabled_p is true\n");
++ else
++ fprintf (stderr, "BUG ext event locking_disabled_p is false\n");
++ if (si->locked_p)
++ fprintf (stderr, "BUG ext event locked_p is true\n");
++ else
++ fprintf (stderr, "BUG ext event locked_p is false\n");
++ if (p->lock_p)
++ fprintf (stderr, "BUG ext event lock_p is true\n");
++ else
++ fprintf (stderr, "BUG ext event lock_p is false\n");
++*/
++ dispatch_event (si, &event);
++ if (si->demoing_p &&
++ event.type == valuator_type ||
++ event.type == release_type )
++ /* When we're demoing a single hack, mouse motion doesn't
++ cause deactivation. Only clicks and keypresses do. */
++ ;
++ else
++ /* If we're not demoing, then any activity causes deactivation.
++ */
++ goto DONE;
++ } /* ext dev */
++
++ else
+
+ /* Just some random event. Let the Widgets handle it, if desired. */
+ dispatch_event (si, &event);
+diff -urp -x '*~' driver/xscreensaver.c driver/xscreensaver.c
+--- driver/xscreensaver.c 2006-05-10 08:48:46.850383000 -0700
++++ driver/xscreensaver.c 2006-05-10 08:48:52.422327000 -0700
+@@ -820,12 +820,18 @@ initialize_server_extensions (saver_info
+ Bool server_has_mit_saver_extension_p = False;
+ Bool system_has_proc_interrupts_p = False;
+ const char *piwhy = 0;
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++ Bool server_has_xinputdev_extension_p = False;
+
+ si->using_xidle_extension = p->use_xidle_extension;
+ si->using_sgi_saver_extension = p->use_sgi_saver_extension;
+ si->using_mit_saver_extension = p->use_mit_saver_extension;
+ si->using_proc_interrupts = p->use_proc_interrupts;
+
++ si->using_xinputdev_extension = p->use_xinputdev_extension;
++
+ #ifdef HAVE_XIDLE_EXTENSION
+ server_has_xidle_extension_p = query_xidle_extension (si);
+ #endif
+@@ -838,6 +844,10 @@ initialize_server_extensions (saver_info
+ #ifdef HAVE_PROC_INTERRUPTS
+ system_has_proc_interrupts_p = query_proc_interrupts_available (si, &piwhy);
+ #endif
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++ server_has_xinputdev_extension_p = query_xinputdev_extension (si);
+
+ if (!server_has_xidle_extension_p)
+ si->using_xidle_extension = False;
+@@ -874,6 +884,22 @@ initialize_server_extensions (saver_info
+ blurb());
+ }
+
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++ if (!server_has_xinputdev_extension_p)
++ si->using_xinputdev_extension = False;
++ else if (p->verbose_p)
++ {
++ if (si->using_xinputdev_extension)
++ fprintf (stderr, "%s: using XInputExtension device.\n",
++ blurb());
++ else
++ fprintf (stderr,
++ "%s: not using XInputExtension device.\n",
++ blurb());
++ }
++
+ if (!system_has_proc_interrupts_p)
+ {
+ si->using_proc_interrupts = False;
+@@ -1964,6 +1990,8 @@ analyze_display (saver_info *si)
+ # endif
+ }, { "XINERAMA", "Xinerama",
+ True
++ }, { "XInputExtension", "XInputExtension",
++ True
+ },
+ };
+
+diff -urp -x '*~' driver/xscreensaver.h driver/xscreensaver.h
+--- driver/xscreensaver.h 2006-05-10 08:48:46.850991000 -0700
++++ driver/xscreensaver.h 2006-05-10 08:48:52.404876000 -0700
+@@ -80,6 +80,12 @@ struct saver_info {
+ int sgi_saver_ext_event_number;
+ int sgi_saver_ext_error_number;
+ # endif
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++ Bool using_xinputdev_extension; /* Note that `p->use_*' is the *request*, */
++ int xinputdev_ext_event_number; /*may not be used */
++ int xinputdev_ext_error_number;
+
+
+ /* =======================================================================
+@@ -305,6 +311,10 @@ extern Bool query_xidle_extension (saver
+ #ifdef HAVE_PROC_INTERRUPTS
+ extern Bool query_proc_interrupts_available (saver_info *, const char **why);
+ #endif
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++extern Bool query_xinputdev_extension (saver_info *);
+
+ /* Display Power Management System (DPMS) interface. */
+ extern Bool monitor_powered_on_p (saver_info *si);
+diff -urp -x '*~' driver/xset.c driver/xset.c
+--- driver/xset.c 2006-05-10 08:48:46.708383000 -0700
++++ driver/xset.c 2006-05-10 08:48:52.421037000 -0700
+@@ -34,6 +34,22 @@
+ #ifdef _VROOT_H_
+ ERROR! You must not include vroot.h in this file.
+ #endif
++ /* XInputExtension dev support */
++#include <X11/extensions/XInput.h>
++
++/* Xinput protocol allows for 129 devices (unique id's in range 0-128),
++ but Xsun supports a max of 9, and Xorg a max of 20, so this should be
++ enough for now. We only care about 3 event types per device
++ (DeviceButtonPress, DeviceButtonRelease, and DeviceMotionNotify), hence
++ the * 3 for the event count.
++*/
++#define MAX_XI_DEVICES 24
++#define MAX_XI_EVENTS (MAX_XI_DEVICES * 3)
++static XDevice *xdevice[MAX_XI_DEVICES];
++
++static int extdev_count = 0;
++
++int valuator_type = 0, press_type = 0, release_type = 0;
+
+
+ /* MIT SCREEN-SAVER server extension hackery.
+@@ -94,6 +110,141 @@ init_mit_saver_extension (saver_info *si
+ }
+ #endif /* HAVE_MIT_SAVER_EXTENSION */
+
++/*
++Adding XInputExtension dev support (5077966)
++*/
++
++
++#include <X11/extensions/XInput.h>
++
++Bool
++query_xinputdev_extension (saver_info *si)
++{
++ XExtCodes codes;
++
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "-->query_xinputdev_extension()\n");
++
++ if (!XQueryExtension (si->dpy, INAME, &codes.major_opcode, &codes.first_event,
++ &codes.first_error))
++ {
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "\t XInputExtension is not present!\n");
++ return (False);
++ }
++ else
++ {
++ if (si->prefs.verbose_p)
++ fprintf (stderr, "\t XInputExtension is present!\n");
++ return (True);
++ }
++}
++
++static void
++init_xinputdev_extension (saver_info *si)
++{
++ int i,loop,ndevices;
++ int xid = -1;
++ int class;
++ int nkeys, nvaluators, nbuttons;
++ XAnyClassPtr pClass;
++ XDeviceInfo *list = NULL;
++ int nevents = 0;
++ XEventClass event_list[MAX_XI_EVENTS];
++
++
++ list = XListInputDevices (si->dpy, &ndevices);
++
++ bzero(xdevice, MAX_XI_DEVICES * sizeof(XDevice));
++ bzero(event_list, MAX_XI_EVENTS * sizeof(XEventClass));
++ extdev_count = 0;
++
++ for (loop = 0; (loop < ndevices) && (extdev_count < MAX_XI_DEVICES); loop++)
++ {
++
++
++ if(list[loop].use == IsXExtensionDevice)
++
++ {
++ if (si->prefs.debug_p)
++ fprintf(stderr,
++ "Device count %2d: XID=%2d type=%3d name=\"%s\"\n",
++ loop, list[loop].id, list[loop].type, list[loop].name);
++
++ xid = list[loop].id;
++ xdevice[extdev_count] = XOpenDevice (si->dpy, xid);
++ /* it needs to check , xid might be -1 */
++
++ pClass = list[loop].inputclassinfo;
++ nbuttons = 0;
++ nvaluators = 0;
++ for (class = 0; class < list[loop].num_classes; class++)
++ {
++ switch (pClass->class)
++ {
++ case KeyClass:
++ break;
++ case ButtonClass:
++ nbuttons = ((XButtonInfo *) pClass)->num_buttons;
++ if (nbuttons && ((nevents + 1) < MAX_XI_EVENTS))
++ {
++ DeviceButtonPress (xdevice[extdev_count],
++ press_type, event_list[nevents]);
++ nevents++;
++ DeviceButtonRelease (xdevice[extdev_count],
++ release_type, event_list[nevents]);
++ nevents++;
++ }
++ break;
++ case ValuatorClass:
++ nvaluators = ((XValuatorInfo *) pClass)->num_axes;
++ if (nvaluators && (nevents < MAX_XI_EVENTS))
++ {
++ DeviceMotionNotify (xdevice[extdev_count],
++ valuator_type, event_list[nevents]);
++ nevents++;
++ }
++
++ break;
++ default:
++ fprintf (stderr," Class %d is unknown class %d.\n", class, pClass->class);
++ break;
++ }
++
++ pClass = (XAnyClassPtr) & ((char *) pClass)[pClass->length];
++ }
++
++ extdev_count++;
++
++ }
++
++ }
++
++ if (list)
++ XFreeDeviceList (list);
++
++ for (i = 0; i < si->nscreens; i++)
++ {
++ saver_screen_info *ssi = &si->screens[i];
++ Window root = RootWindowOfScreen (ssi->screen);
++ XSelectExtensionEvent(si->dpy, root, event_list, nevents);
++ }
++}
++
++#if 0
++/* not used */
++
++static void
++close_xinputdev_extension (saver_info *si)
++{
++ int i;
++
++ for (i = 0; i < extdev_count; i++)
++ XCloseDevice (si->dpy, xdevice[i]);
++}
++#endif
++
++
+
+ /* SGI SCREEN_SAVER server extension hackery.
+ */
+@@ -252,6 +403,15 @@ disable_builtin_screensaver (saver_info
+ # ifdef HAVE_SGI_SAVER_EXTENSION
+ if (si->using_sgi_saver_extension) init_sgi_saver_extension(si);
+ # endif
++/* since HAVE_MIT_SAVER_EXTENSION is configured on all 3 Sun platforms
++ it is safe to add the XInputExtension dev suppport here
++*/
++ /* Adding XInputExtension Dev support
++#5077966 P1 "password prompt cant be directly activated by GOK device"
++ */
++ if (si->using_xinputdev_extension) init_xinputdev_extension(si);
++
++
+ }
+ }
+ #endif /* HAVE_MIT_SAVER_EXTENSION || HAVE_SGI_SAVER_EXTENSION */
--- a/open-src/common/Makefile.inc Fri May 05 00:00:00 2006 -0700
+++ b/open-src/common/Makefile.inc Wed May 10 18:06:31 2006 -0700
@@ -27,7 +27,7 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.
#
-# @(#)Makefile.inc 1.60 06/04/11
+# @(#)Makefile.inc 1.61 06/05/10
#
BUILD_DATE:sh=date +'%e-%B-%Y'
@@ -50,7 +50,7 @@
LIB_LDFLAGS = $(LDFLAGS) $(LIB_REQUIRED_LDFLAGS)
# Flags for programs
-PROG_LDFLAGS = $(LDFLAGS) $(MAPFILES_FOR_PROGS)
+PROG_LDFLAGS = $(LDFLAGS) $(MAPFILES_FOR_PROGS) -B direct
# Linker mapfiles to link with for better performance & security
# SPARC archicteture requires PLT section in .data be executable, so
@@ -174,7 +174,7 @@
WGET=/usr/sfw/bin/wget
SOURCE_TARBALL=$(TARBALLDIR)/$(SOURCE_TARBALL_NAME)
-XORG_RELEASES_URL=http://xorg.freedesktop.org/releases/individual
+XORG_RELEASES_URL=http://ftp.x.org/pub/individual
download:
if [ ! -f $(SOURCE_TARBALL) ] ; then \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/common/table-prepend Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,36 @@
+'\" t
+.\" /*
+.\" This file needs to be prepended to any man page that is having a
+.\" table added, such as via the sun-manpage-templates/attributes file,
+.\" that doesn't already have one, so that man pre-processes it via tbl.
+.\"
+.\" Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+.\"
+.\" 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, and/or sell copies of the Software, and to permit persons
+.\" to whom the Software is furnished to do so, provided that the above
+.\" copyright notice(s) and this permission notice appear in all copies of
+.\" the Software and that both the above copyright notice(s) and this
+.\" permission notice appear in supporting documentation.
+.\"
+.\" 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
+.\" OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+.\" HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+.\" INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of a copyright holder
+.\" shall not be used in advertising or otherwise to promote the sale, use
+.\" or other dealings in this Software without prior written authorization
+.\" of the copyright holder.
+.\"
+.\" ident "@(#)table-prepend 1.2 05/11/08 SMI"
+.\" */
+.\"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/util/lndir/Makefile Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,73 @@
+###############################################################################
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# 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, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# 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
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.1 06/05/10
+#
+
+PWD:sh=pwd
+TOP=$(PWD)/../..
+
+# Not really 32 or 64-bit, but we call it 32-bit to avoid subdirs
+BUILD_TYPES=32
+
+# Version number (used in path names)
+VERSION=1.0.1
+
+# Source tarball
+SOURCE_TARBALL_NAME=lndir-$(VERSION).tar.bz2
+
+# Download site for source
+SOURCE_URL=$(XORG_RELEASES_URL)/util/$(SOURCE_TARBALL_NAME)
+
+# Patches to apply to source after unpacking, in order
+SOURCE_PATCHES=
+
+# Directory created by unpacking source
+SOURCE_DIR=$(BUILD_DIR)/lndir-$(VERSION)
+
+### Include common rulesets
+include $(TOP)/common/Makefile.inc
+
+### Rules specific to this directory:
+
+# Command line options to GNU autoconf configure script
+LNDIR_CFG=--prefix=$(X11_DIR)
+
+build_gen: $(SOURCE_DIR)/Makefile
+
+# Run configure script
+$(SOURCE_DIR)/Makefile: $(UNPACK_TARGET)
+ (cd $(SOURCE_DIR) ; \
+ chmod a+x configure ; \
+ CC=$(CC) CFLAGS="$(LIB_CFLAGS)" LD="$(CC) $(PROG_CFLAGS) $(LDFLAGS)" LDFLAGS="$(PROG_LDFLAGS)" PKG_CONFIG_PATH=$(PROTODIR)/usr/X11/lib/pkgconfig ./configure $(LNDIR_CFG) )
+
+# Install
+install_gen: $(SOURCE_DIR)/Makefile
+ (cd $(SOURCE_DIR) ; $(MAKE) $(MFLAGS) -e DESTDIR=$(PROTODIR) install)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks-gl/copyright.add Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,19 @@
+
+The xscreensaver base software is Copyright 1991-2002 by Jamie Zawinski
+<[email protected]>.
+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
+software for any purpose. It is provided "as is" without express or
+implied warranty.
+
+Individual "hack" modules are covered by additional copyright notices as
+documented in their manual pages included in this package.
+
+The endgame & glsnake programs are distributed under the terms of the
+GNU General Public License Version 2 as published by the Free Software Foundation.
+A copy of the license and the source code for these programs is located at
+:pserver:[email protected]:/cvs/sun-gnome.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks-gl/depend.i386 Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,15 @@
+# Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)depend.i386 1.1 05/05/05 Sun Microsystems, Inc.
+
+P SUNWcsr Core Sparc, (Root)
+P SUNWcsu Core Sparc, (Usr)
+P SUNWcsl Core Solaris, (Shared Libs)
+P SUNWxorg-mesa Mesa OpenGL for Solaris Runtime Libraries
+P SUNWgnome-base-libs GNOME base GUI libraries
+P SUNWlibms Forte Developer Bundled shared libm
+P SUNWxwplt X Window System platform software
+P SUNWxwrtl X Window System & Graphics Runtime Library Links in /usr/lib
+P SUNWxwsvr XScreenSaver
+P SUNWxwice X Window System Inter-Client Exchange (ICE) Components
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks-gl/depend.sparc Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,15 @@
+# Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)depend.sparc 1.4 04/12/17 Sun Microsystems, Inc.
+
+P SUNWcsr Core Sparc, (Root)
+P SUNWcsu Core Sparc, (Usr)
+P SUNWcsl Core Solaris, (Shared Libs)
+P SUNWglrt Sun OpenGL for Solaris Runtime Libraries
+P SUNWgnome-base-libs GNOME base GUI libraries
+P SUNWlibms Forte Developer Bundled shared libm
+P SUNWxwplt X Window System platform software
+P SUNWxwrtl X Window System & Graphics Runtime Library Links in /usr/lib
+P SUNWxwsvr XScreenSaver
+P SUNWxwice X Window System Inter-Client Exchange (ICE) Components
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks-gl/pkginfo.tmpl Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,21 @@
+# Copyright 2003 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)pkginfo.tmpl 1.1 03/11/17 Sun Microsystems, Inc.
+
+PKG="SUNWxscreensaver-hacks-gl"
+NAME="XScreenSaver OpenGL display mode modules"
+ARCH="ISA"
+VERSION=6.6.2.0,REV=0.2000.02.02
+CATEGORY="system"
+SUNW_PRODNAME="Solaris X11"
+SUNW_PRODVERS=6.6.2
+DESC="Modules that provide different OpenGL-based display modes (hacks) for the screen saver"
+BASEDIR="/usr"
+VENDOR="Sun Microsystems, Inc."
+HOTLINE="Please contact your local service provider"
+EMAIL=""
+MAXINST="1000"
+SUNW_PKGTYPE="ow"
+CLASSES=none
+SUNW_PKGVERS=1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks-gl/prototype_com Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,126 @@
+# Copyright 2003 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# "@(#)prototype_com 1.5 05/05/03 Sun Microsystems"
+#
+
+i pkginfo
+i copyright
+
+# OpenGL hacks and helper app
+
+!HOME=../openwin
+d none openwin 0755 root bin
+d none openwin/lib 0755 root bin
+d none openwin/lib/xscreensaver 0755 root bin
+
+!search $HOME/bin
+d none openwin/lib/xscreensaver/bin 0755 root bin
+f none openwin/lib/xscreensaver/bin/xscreensaver-gl-helper 0555 root bin
+
+!search $HOME/lib/xscreensaver/hacks
+d none openwin/lib/xscreensaver/hacks 0755 root bin
+f none openwin/lib/xscreensaver/hacks/atlantis 0555 root bin
+f none openwin/lib/xscreensaver/hacks/boxed 0555 root bin
+f none openwin/lib/xscreensaver/hacks/bubble3d 0555 root bin
+f none openwin/lib/xscreensaver/hacks/cage 0555 root bin
+f none openwin/lib/xscreensaver/hacks/circuit 0555 root bin
+f none openwin/lib/xscreensaver/hacks/cubenetic 0555 root bin
+f none openwin/lib/xscreensaver/hacks/dangerball 0555 root bin
+f none openwin/lib/xscreensaver/hacks/endgame 0555 root bin
+f none openwin/lib/xscreensaver/hacks/engine 0555 root bin
+f none openwin/lib/xscreensaver/hacks/gears 0555 root bin
+f none openwin/lib/xscreensaver/hacks/gflux 0555 root bin
+f none openwin/lib/xscreensaver/hacks/glforestfire 0555 root bin
+f none openwin/lib/xscreensaver/hacks/glplanet 0555 root bin
+f none openwin/lib/xscreensaver/hacks/glsnake 0555 root bin
+f none openwin/lib/xscreensaver/hacks/gltext 0555 root bin
+f none openwin/lib/xscreensaver/hacks/lament 0555 root bin
+f none openwin/lib/xscreensaver/hacks/lavalite 0555 root bin
+f none openwin/lib/xscreensaver/hacks/menger 0555 root bin
+f none openwin/lib/xscreensaver/hacks/moebius 0555 root bin
+f none openwin/lib/xscreensaver/hacks/molecule 0555 root bin
+f none openwin/lib/xscreensaver/hacks/morph3d 0555 root bin
+f none openwin/lib/xscreensaver/hacks/pipes 0555 root bin
+f none openwin/lib/xscreensaver/hacks/pulsar 0555 root bin
+f none openwin/lib/xscreensaver/hacks/queens 0555 root bin
+f none openwin/lib/xscreensaver/hacks/rubik 0555 root bin
+f none openwin/lib/xscreensaver/hacks/sballs 0555 root bin
+f none openwin/lib/xscreensaver/hacks/sierpinski3d 0555 root bin
+f none openwin/lib/xscreensaver/hacks/spheremonics 0555 root bin
+f none openwin/lib/xscreensaver/hacks/sproingies 0555 root bin
+f none openwin/lib/xscreensaver/hacks/stairs 0555 root bin
+f none openwin/lib/xscreensaver/hacks/starwars 0555 root bin
+f none openwin/lib/xscreensaver/hacks/stonerview 0555 root bin
+f none openwin/lib/xscreensaver/hacks/superquadrics 0555 root bin
+
+!search $HOME/share/man/man1
+1 s none openwin/man=./share/man
+1 d none openwin/share 0755 root bin
+1 d none openwin/share/man 0755 root bin
+d none openwin/share/man/man1 0755 root bin
+f none openwin/share/man/man1/xscreensaver-gl-helper.1 0444 root bin
+f none openwin/share/man/man1/atlantis.1 0444 root bin
+f none openwin/share/man/man1/boxed.1 0444 root bin
+f none openwin/share/man/man1/cage.1 0444 root bin
+f none openwin/share/man/man1/circuit.1 0444 root bin
+f none openwin/share/man/man1/cubenetic.1 0444 root bin
+f none openwin/share/man/man1/dangerball.1 0444 root bin
+f none openwin/share/man/man1/endgame.1 0444 root bin
+f none openwin/share/man/man1/engine.1 0444 root bin
+f none openwin/share/man/man1/extrusion.1 0444 root bin
+f none openwin/share/man/man1/gears.1 0444 root bin
+f none openwin/share/man/man1/gflux.1 0444 root bin
+f none openwin/share/man/man1/glplanet.1 0444 root bin
+f none openwin/share/man/man1/glsnake.1 0444 root bin
+f none openwin/share/man/man1/gltext.1 0444 root bin
+f none openwin/share/man/man1/lament.1 0444 root bin
+f none openwin/share/man/man1/lavalite.1 0444 root bin
+f none openwin/share/man/man1/menger.1 0444 root bin
+f none openwin/share/man/man1/moebius.1 0444 root bin
+f none openwin/share/man/man1/molecule.1 0444 root bin
+f none openwin/share/man/man1/morph3d.1 0444 root bin
+f none openwin/share/man/man1/pipes.1 0444 root bin
+f none openwin/share/man/man1/pulsar.1 0444 root bin
+f none openwin/share/man/man1/queens.1 0444 root bin
+f none openwin/share/man/man1/rubik.1 0444 root bin
+f none openwin/share/man/man1/sballs.1 0444 root bin
+f none openwin/share/man/man1/spheremonics.1 0444 root bin
+f none openwin/share/man/man1/sproingies.1 0444 root bin
+f none openwin/share/man/man1/stairs.1 0444 root bin
+f none openwin/share/man/man1/starwars.1 0444 root bin
+f none openwin/share/man/man1/superquadrics.1 0444 root bin
+
+!search $HOME/lib/xscreensaver/config/control-center-2.0/
+d none openwin/lib/xscreensaver/config 0755 root bin
+d none openwin/lib/xscreensaver/config/control-center-2.0 0755 root other
+f none openwin/lib/xscreensaver/config/control-center-2.0/atlantis.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/boxed.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/bubble3d.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/cage.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/circuit.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/cubenetic.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/dangerball.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/engine.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/gears.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/gflux.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/glforestfire.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/glplanet.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/glsnake.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/gltext.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/lament.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/menger.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/moebius.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/molecule.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/morph3d.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/pipes.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/pulsar.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/rubik.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/sballs.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/sierpinski3d.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/spheremonics.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/sproingies.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/stairs.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/starwars.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/stonerview.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/superquadrics.xml 0444 root bin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks-gl/prototype_i386 Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,14 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "@(#)prototype_i386 1.1 05/05/03 SMI"
+#
+
+i depend=depend.i386
+
+#
+# Include ISA independent files (prototype_com)
+#
+!include prototype_com
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks-gl/prototype_sparc Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,14 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "@(#)prototype_sparc 1.1 05/05/03 SMI"
+#
+
+i depend=depend.sparc
+
+#
+# Include ISA independent files (prototype_com)
+#
+!include prototype_com
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks/copyright.add Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,14 @@
+
+The xscreensaver base software is Copyright 1991-2002 by Jamie Zawinski
+<[email protected]>.
+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
+software for any purpose. It is provided "as is" without express or
+implied warranty.
+
+Individual "hack" modules are covered by additional copyright notices as
+documented in their manual pages included in this package.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks/depend Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,15 @@
+# Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)depend 1.3 04/12/17 Sun Microsystems, Inc.
+
+P SUNWcsr Core Sparc, (Root)
+P SUNWcsu Core Sparc, (Usr)
+P SUNWcsl Core Solaris, (Shared Libs)
+P SUNWgnome-base-libs GNOME base GUI libraries
+P SUNWlibms Forte Developer Bundled shared libm
+P SUNWxwplt X Window System platform software
+P SUNWxwrtl X Window System & Graphics Runtime Library Links in /usr/lib
+P SUNWxwsvr XScreenSaver
+P SUNWxwice X Window System Inter-Client Exchange (ICE) Components
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks/pkginfo.tmpl Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,21 @@
+# Copyright 2003 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)pkginfo.tmpl 1.1 03/11/17 Sun Microsystems, Inc.
+
+PKG="SUNWxscreensaver-hacks"
+NAME="XScreenSaver display mode modules"
+ARCH="ISA"
+VERSION=6.6.2.0,REV=0.2000.02.02
+CATEGORY="system"
+SUNW_PRODNAME="Solaris X11"
+SUNW_PRODVERS=6.6.2
+DESC="Modules that provide different display modes (hacks) for the screen saver"
+BASEDIR="/usr"
+VENDOR="Sun Microsystems, Inc."
+HOTLINE="Please contact your local service provider"
+EMAIL=""
+MAXINST="1000"
+SUNW_PKGTYPE="ow"
+CLASSES=none
+SUNW_PKGVERS=1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxscreensaver-hacks/prototype Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,314 @@
+# Copyright 2003 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)prototype 1.2 03/11/17 Sun Microsystems, Inc.
+
+i pkginfo
+i copyright
+i depend
+
+# Many of the search paths in this file look strange due to the weird
+# Xscreensaver install process
+
+!HOME=../openwin
+d none openwin 0755 root bin
+d none openwin/lib 0755 root bin
+d none openwin/lib/xscreensaver 0755 root bin
+
+!search $HOME/lib/xscreensaver/hacks
+d none openwin/lib/xscreensaver/hacks 0755 root bin
+f none openwin/lib/xscreensaver/hacks/anemone 0555 root bin
+f none openwin/lib/xscreensaver/hacks/ant 0555 root bin
+f none openwin/lib/xscreensaver/hacks/apollonian 0555 root bin
+f none openwin/lib/xscreensaver/hacks/attraction 0555 root bin
+f none openwin/lib/xscreensaver/hacks/blaster 0555 root bin
+f none openwin/lib/xscreensaver/hacks/bouboule 0555 root bin
+f none openwin/lib/xscreensaver/hacks/braid 0555 root bin
+f none openwin/lib/xscreensaver/hacks/ccurve 0555 root bin
+f none openwin/lib/xscreensaver/hacks/compass 0555 root bin
+f none openwin/lib/xscreensaver/hacks/coral 0555 root bin
+f none openwin/lib/xscreensaver/hacks/critical 0555 root bin
+f none openwin/lib/xscreensaver/hacks/crystal 0555 root bin
+f none openwin/lib/xscreensaver/hacks/cynosure 0555 root bin
+f none openwin/lib/xscreensaver/hacks/deco 0555 root bin
+f none openwin/lib/xscreensaver/hacks/deluxe 0555 root bin
+f none openwin/lib/xscreensaver/hacks/demon 0555 root bin
+f none openwin/lib/xscreensaver/hacks/discrete 0555 root bin
+f none openwin/lib/xscreensaver/hacks/drift 0555 root bin
+f none openwin/lib/xscreensaver/hacks/epicycle 0555 root bin
+f none openwin/lib/xscreensaver/hacks/euler2d 0555 root bin
+f none openwin/lib/xscreensaver/hacks/fadeplot 0555 root bin
+f none openwin/lib/xscreensaver/hacks/flag 0555 root bin
+f none openwin/lib/xscreensaver/hacks/flame 0555 root bin
+f none openwin/lib/xscreensaver/hacks/flow 0555 root bin
+f none openwin/lib/xscreensaver/hacks/fluidballs 0555 root bin
+f none openwin/lib/xscreensaver/hacks/forest 0555 root bin
+f none openwin/lib/xscreensaver/hacks/galaxy 0555 root bin
+f none openwin/lib/xscreensaver/hacks/goop 0555 root bin
+f none openwin/lib/xscreensaver/hacks/grav 0555 root bin
+f none openwin/lib/xscreensaver/hacks/greynetic 0555 root bin
+f none openwin/lib/xscreensaver/hacks/halo 0555 root bin
+f none openwin/lib/xscreensaver/hacks/helix 0555 root bin
+f none openwin/lib/xscreensaver/hacks/hopalong 0555 root bin
+f none openwin/lib/xscreensaver/hacks/hyperball 0555 root bin
+f none openwin/lib/xscreensaver/hacks/hypercube 0555 root bin
+f none openwin/lib/xscreensaver/hacks/ifs 0555 root bin
+f none openwin/lib/xscreensaver/hacks/imsmap 0555 root bin
+f none openwin/lib/xscreensaver/hacks/interference 0555 root bin
+f none openwin/lib/xscreensaver/hacks/juggle 0555 root bin
+f none openwin/lib/xscreensaver/hacks/kaleidescope 0555 root bin
+f none openwin/lib/xscreensaver/hacks/kumppa 0555 root bin
+f none openwin/lib/xscreensaver/hacks/laser 0555 root bin
+f none openwin/lib/xscreensaver/hacks/lightning 0555 root bin
+f none openwin/lib/xscreensaver/hacks/lisa 0555 root bin
+f none openwin/lib/xscreensaver/hacks/lissie 0555 root bin
+f none openwin/lib/xscreensaver/hacks/lmorph 0555 root bin
+f none openwin/lib/xscreensaver/hacks/loop 0555 root bin
+f none openwin/lib/xscreensaver/hacks/maze 0555 root bin
+f none openwin/lib/xscreensaver/hacks/moire 0555 root bin
+f none openwin/lib/xscreensaver/hacks/moire2 0555 root bin
+f none openwin/lib/xscreensaver/hacks/mountain 0555 root bin
+f none openwin/lib/xscreensaver/hacks/munch 0555 root bin
+f none openwin/lib/xscreensaver/hacks/nerverot 0555 root bin
+f none openwin/lib/xscreensaver/hacks/pedal 0555 root bin
+f none openwin/lib/xscreensaver/hacks/penetrate 0555 root bin
+f none openwin/lib/xscreensaver/hacks/petri 0555 root bin
+f none openwin/lib/xscreensaver/hacks/polyominoes 0555 root bin
+f none openwin/lib/xscreensaver/hacks/pyro 0555 root bin
+f none openwin/lib/xscreensaver/hacks/qix 0555 root bin
+f none openwin/lib/xscreensaver/hacks/rd-bomb 0555 root bin
+f none openwin/lib/xscreensaver/hacks/rocks 0555 root bin
+f none openwin/lib/xscreensaver/hacks/rorschach 0555 root bin
+f none openwin/lib/xscreensaver/hacks/rotor 0555 root bin
+f none openwin/lib/xscreensaver/hacks/rotzoomer 0555 root bin
+f none openwin/lib/xscreensaver/hacks/shadebobs 0555 root bin
+f none openwin/lib/xscreensaver/hacks/sierpinski 0555 root bin
+f none openwin/lib/xscreensaver/hacks/sonar 0555 root bin
+f none openwin/lib/xscreensaver/hacks/speedmine 0555 root bin
+f none openwin/lib/xscreensaver/hacks/sphere 0555 root bin
+f none openwin/lib/xscreensaver/hacks/spiral 0555 root bin
+f none openwin/lib/xscreensaver/hacks/squiral 0555 root bin
+f none openwin/lib/xscreensaver/hacks/starfish 0555 root bin
+f none openwin/lib/xscreensaver/hacks/strange 0555 root bin
+f none openwin/lib/xscreensaver/hacks/swirl 0555 root bin
+f none openwin/lib/xscreensaver/hacks/t3d 0555 root bin
+f none openwin/lib/xscreensaver/hacks/thornbird 0555 root bin
+f none openwin/lib/xscreensaver/hacks/triangle 0555 root bin
+f none openwin/lib/xscreensaver/hacks/truchet 0555 root bin
+f none openwin/lib/xscreensaver/hacks/twang 0555 root bin
+f none openwin/lib/xscreensaver/hacks/vermiculate 0555 root bin
+f none openwin/lib/xscreensaver/hacks/vidwhacker 0555 root bin
+f none openwin/lib/xscreensaver/hacks/vines 0555 root bin
+f none openwin/lib/xscreensaver/hacks/wander 0555 root bin
+f none openwin/lib/xscreensaver/hacks/whirlwindwarp 0555 root bin
+f none openwin/lib/xscreensaver/hacks/whirlygig 0555 root bin
+f none openwin/lib/xscreensaver/hacks/worm 0555 root bin
+f none openwin/lib/xscreensaver/hacks/xflame 0555 root bin
+f none openwin/lib/xscreensaver/hacks/xjack 0555 root bin
+f none openwin/lib/xscreensaver/hacks/xmatrix 0555 root bin
+f none openwin/lib/xscreensaver/hacks/xrayswarm 0555 root bin
+f none openwin/lib/xscreensaver/hacks/xspirograph 0555 root bin
+f none openwin/lib/xscreensaver/hacks/xsublim 0555 root bin
+
+!search $HOME/share/man/man1
+1 s none openwin/man=./share/man
+1 d none openwin/share 0755 root bin
+1 d none openwin/share/man 0755 root bin
+d none openwin/share/man/man1 0755 root bin
+f none openwin/share/man/man1/anemone.1 0444 root bin
+f none openwin/share/man/man1/ant.1 0444 root bin
+f none openwin/share/man/man1/apollonian.1 0444 root bin
+f none openwin/share/man/man1/attraction.1 0444 root bin
+f none openwin/share/man/man1/blaster.1 0444 root bin
+f none openwin/share/man/man1/bouboule.1 0444 root bin
+f none openwin/share/man/man1/braid.1 0444 root bin
+f none openwin/share/man/man1/ccurve.1 0444 root bin
+f none openwin/share/man/man1/compass.1 0444 root bin
+f none openwin/share/man/man1/coral.1 0444 root bin
+f none openwin/share/man/man1/critical.1 0444 root bin
+f none openwin/share/man/man1/crystal.1 0444 root bin
+f none openwin/share/man/man1/cynosure.1 0444 root bin
+f none openwin/share/man/man1/deco.1 0444 root bin
+f none openwin/share/man/man1/deluxe.1 0444 root bin
+f none openwin/share/man/man1/demon.1 0444 root bin
+f none openwin/share/man/man1/discrete.1 0444 root bin
+f none openwin/share/man/man1/drift.1 0444 root bin
+f none openwin/share/man/man1/epicycle.1 0444 root bin
+f none openwin/share/man/man1/euler2d.1 0444 root bin
+f none openwin/share/man/man1/fadeplot.1 0444 root bin
+f none openwin/share/man/man1/flag.1 0444 root bin
+f none openwin/share/man/man1/flame.1 0444 root bin
+f none openwin/share/man/man1/flow.1 0444 root bin
+f none openwin/share/man/man1/fluidballs.1 0444 root bin
+f none openwin/share/man/man1/forest.1 0444 root bin
+f none openwin/share/man/man1/galaxy.1 0444 root bin
+f none openwin/share/man/man1/goop.1 0444 root bin
+f none openwin/share/man/man1/grav.1 0444 root bin
+f none openwin/share/man/man1/greynetic.1 0444 root bin
+f none openwin/share/man/man1/halo.1 0444 root bin
+f none openwin/share/man/man1/helix.1 0444 root bin
+f none openwin/share/man/man1/hopalong.1 0444 root bin
+f none openwin/share/man/man1/hyperball.1 0444 root bin
+f none openwin/share/man/man1/hypercube.1 0444 root bin
+f none openwin/share/man/man1/ifs.1 0444 root bin
+f none openwin/share/man/man1/imsmap.1 0444 root bin
+f none openwin/share/man/man1/kaleidescope.1 0444 root bin
+f none openwin/share/man/man1/kumppa.1 0444 root bin
+f none openwin/share/man/man1/laser.1 0444 root bin
+f none openwin/share/man/man1/lightning.1 0444 root bin
+f none openwin/share/man/man1/lisa.1 0444 root bin
+f none openwin/share/man/man1/lissie.1 0444 root bin
+f none openwin/share/man/man1/lmorph.1 0444 root bin
+f none openwin/share/man/man1/loop.1 0444 root bin
+f none openwin/share/man/man1/maze.1 0444 root bin
+f none openwin/share/man/man1/moire.1 0444 root bin
+f none openwin/share/man/man1/moire2.1 0444 root bin
+f none openwin/share/man/man1/mountain.1 0444 root bin
+f none openwin/share/man/man1/munch.1 0444 root bin
+f none openwin/share/man/man1/nerverot.1 0444 root bin
+f none openwin/share/man/man1/pedal.1 0444 root bin
+f none openwin/share/man/man1/penetrate.1 0444 root bin
+f none openwin/share/man/man1/petri.1 0444 root bin
+f none openwin/share/man/man1/polyominoes.1 0444 root bin
+f none openwin/share/man/man1/pyro.1 0444 root bin
+f none openwin/share/man/man1/qix.1 0444 root bin
+f none openwin/share/man/man1/rd-bomb.1 0444 root bin
+f none openwin/share/man/man1/rocks.1 0444 root bin
+f none openwin/share/man/man1/rorschach.1 0444 root bin
+f none openwin/share/man/man1/rotor.1 0444 root bin
+f none openwin/share/man/man1/rotzoomer.1 0444 root bin
+f none openwin/share/man/man1/shadebobs.1 0444 root bin
+f none openwin/share/man/man1/sierpinski.1 0444 root bin
+f none openwin/share/man/man1/sonar.1 0444 root bin
+f none openwin/share/man/man1/speedmine.1 0444 root bin
+f none openwin/share/man/man1/sphere.1 0444 root bin
+f none openwin/share/man/man1/spiral.1 0444 root bin
+f none openwin/share/man/man1/squiral.1 0444 root bin
+f none openwin/share/man/man1/starfish.1 0444 root bin
+f none openwin/share/man/man1/strange.1 0444 root bin
+f none openwin/share/man/man1/swirl.1 0444 root bin
+f none openwin/share/man/man1/t3d.1 0444 root bin
+f none openwin/share/man/man1/thornbird.1 0444 root bin
+f none openwin/share/man/man1/triangle.1 0444 root bin
+f none openwin/share/man/man1/truchet.1 0444 root bin
+f none openwin/share/man/man1/twang.1 0444 root bin
+f none openwin/share/man/man1/vermiculate.1 0444 root bin
+f none openwin/share/man/man1/vidwhacker.1 0444 root bin
+f none openwin/share/man/man1/vines.1 0444 root bin
+f none openwin/share/man/man1/wander.1 0444 root bin
+f none openwin/share/man/man1/whirlwindwarp.1 0444 root bin
+f none openwin/share/man/man1/whirlygig.1 0444 root bin
+f none openwin/share/man/man1/worm.1 0444 root bin
+f none openwin/share/man/man1/xflame.1 0444 root bin
+f none openwin/share/man/man1/xjack.1 0444 root bin
+f none openwin/share/man/man1/xmatrix.1 0444 root bin
+f none openwin/share/man/man1/xrayswarm.1 0444 root bin
+f none openwin/share/man/man1/xspirograph.1 0444 root bin
+f none openwin/share/man/man1/xsublim.1 0444 root bin
+
+
+!search $HOME/lib/xscreensaver/config/control-center-2.0/
+d none openwin/lib/xscreensaver/config 0755 root bin
+d none openwin/lib/xscreensaver/config/control-center-2.0 0755 root other
+f none openwin/lib/xscreensaver/config/control-center-2.0/ant.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/apollonian.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/attraction.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/blaster.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/bouboule.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/braid.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/ccurve.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/compass.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/coral.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/cosmos.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/critical.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/crystal.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/cynosure.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/deco.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/deluxe.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/demon.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/discrete.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/drift.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/electricsheep.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/epicycle.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/euler2d.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/extrusion.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/fadeplot.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/flag.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/flame.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/flow.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/fluidballs.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/forest.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/galaxy.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/goban.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/goop.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/grav.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/greynetic.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/halo.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/helix.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/hopalong.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/hyperball.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/hypercube.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/ifs.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/imsmap.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/interference.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/juggle.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/kaleidescope.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/kumppa.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/laser.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/lightning.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/lisa.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/lissie.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/lmorph.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/loop.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/maze.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/moire.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/moire2.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/mountain.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/munch.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/nerverot.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/pedal.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/penetrate.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/petri.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/polyominoes.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/pyro.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/qix.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/rd-bomb.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/rocks.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/rorschach.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/rotor.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/rotzoomer.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/shadebobs.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/sierpinski.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/sonar.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/speedmine.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/sphere.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/sphereEversion.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/spiral.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/squiral.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/ssystem.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/starfish.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/strange.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/swirl.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/t3d.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/thornbird.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/triangle.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/truchet.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/twang.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/vermiculate.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/vidwhacker.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/vines.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/wander.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/whirlwindwarp.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/whirlygig.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/worm.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xaos.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xdaliclock.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xearth.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xfishtank.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xflame.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xjack.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xmatrix.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xmountains.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xrayswarm.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xsnow.xml 0444 root bin
+f none openwin/lib/xscreensaver/config/control-center-2.0/xspirograph.xml 0444 root bin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxwsvr/copyright.add Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,11 @@
+
+The xscreensaver base software is Copyright 1991-2002 by Jamie Zawinski
+<[email protected]>.
+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
+software for any purpose. It is provided "as is" without express or
+implied warranty.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxwsvr/depend Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,21 @@
+# Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)depend 1.3 05/05/03 Sun Microsystems, Inc.
+
+P SUNWcsr Core Sparc, (Root)
+P SUNWcsu Core Sparc, (Usr)
+P SUNWcsl Core Solaris, (Shared Libs)
+P SUNWgnome-base-libs GNOME base GUI libraries
+P SUNWlibms Forte Developer Bundled shared libm
+P SUNWlxml The XML library
+P SUNWocf Open Card Framework
+P SUNWxwplt X Window System platform software
+P SUNWxwrtl X Window System & Graphics Runtime Library Links in /usr/lib
+P SUNWzlib The Zip compression library
+P SUNWgnome-config GNOME configuration framework
+P SUNWgnome-component GNOME CORBA ORB and component framework
+P SUNWgnome-a11y-libs Accessibility Implementation for GNOME
+P SUNWxwice X Window System Inter-Client Exchange (ICE) Components
+P SUNWxorg-clientlibs X.Org Foundation X Client Libraries
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxwsvr/pkginfo.tmpl Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,21 @@
+# Copyright 2003 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)pkginfo.tmpl 1.3 03/12/17 Sun Microsystems, Inc.
+
+PKG="SUNWxwsvr"
+NAME="XScreenSaver"
+ARCH="ISA"
+VERSION=6.6.2.0,REV=0.2000.02.02
+CATEGORY="system"
+SUNW_PRODNAME="Solaris X11"
+SUNW_PRODVERS=6.6.2
+DESC="Screen Saver/Locker for X Window System"
+BASEDIR="/usr"
+VENDOR="Sun Microsystems, Inc."
+HOTLINE="Please contact your local service provider"
+EMAIL=""
+MAXINST="1000"
+SUNW_PKGTYPE="ow"
+CLASSES=none
+SUNW_PKGVERS=1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/SUNWxwsvr/prototype Wed May 10 18:06:31 2006 -0700
@@ -0,0 +1,76 @@
+# Copyright 2003 Sun Microsystems, Inc. All Rights Reserved
+# Use is subject to license terms
+#
+# @(#)prototype 1.7 04/07/01 Sun Microsystems, Inc.
+
+i pkginfo
+i copyright
+i depend
+
+# Many of the search paths in this file look strange due to the weird
+# Xscreensaver install process
+
+!HOME=../openwin
+
+!search $HOME/bin
+d none bin 0755 root bin
+f none bin/screensaver-properties-capplet 0755 root bin
+
+!search $HOME/bin
+d none openwin 0755 root bin
+d none openwin/bin 0755 root bin
+f none openwin/bin/xscreensaver 4755 root bin
+f none openwin/bin/xscreensaver-command 0755 root bin
+f none openwin/bin/xscreensaver-demo 0755 root bin
+
+d none openwin/lib 0755 root bin
+d none openwin/lib/xscreensaver 0755 root bin
+d none openwin/lib/xscreensaver/bin 0755 root bin
+!search $HOME/lib/xscreensaver/bin
+f none openwin/lib/xscreensaver/bin/xscreensaver-lock 0555 root bin
+!search $HOME/bin
+f none openwin/lib/xscreensaver/bin/xscreensaver-getimage 0555 root bin
+f none openwin/lib/xscreensaver/bin/xscreensaver-getimage-file 0555 root bin
+f none openwin/lib/xscreensaver/bin/xscreensaver-getimage-video 0555 root bin
+
+!search $HOME/share/man/man1
+1 s none openwin/man=./share/man
+1 d none openwin/share 0755 root bin
+1 d none openwin/share/man 0755 root bin
+d none openwin/share/man/man1 0755 root bin
+f none openwin/share/man/man1/xscreensaver-command.1 0444 root bin
+f none openwin/share/man/man1/xscreensaver-demo.1 0444 root bin
+f none openwin/share/man/man1/xscreensaver-getimage-file.1 0444 root bin
+f none openwin/share/man/man1/xscreensaver-getimage-video.1 0444 root bin
+f none openwin/share/man/man1/xscreensaver-getimage.1 0444 root bin
+f none openwin/share/man/man1/xscreensaver.1 0444 root bin
+
+!search $HOME/lib/X11/app-defaults
+d none openwin/lib/app-defaults 0755 root bin
+f none openwin/lib/app-defaults/XScreenSaver 0444 root bin
+
+!search $HOME/lib/xscreensaver/config/applications
+d none share 0755 root sys
+d none share/applications 0755 root other
+f none share/applications/screensaver-properties.desktop 0444 root bin
+
+d none share/gnome 0755 root other
+d none share/gnome/control-center-2.0 0755 root other
+!search $HOME/share/control-center-2.0/capplets
+d none share/gnome/control-center-2.0/capplets 0755 root other
+s none share/gnome/control-center-2.0/capplets/screensaver-properties.desktop=../../../applications/screensaver-properties.desktop
+
+!search $HOME/lib/xscreensaver/config/control-center-2.0/
+d none openwin/lib/xscreensaver/config 0755 root bin
+d none openwin/lib/xscreensaver/config/control-center-2.0 0755 root other
+f none openwin/lib/xscreensaver/config/control-center-2.0/README 0444 root bin
+
+!search $HOME/lib/xscreensaver/config
+f none openwin/lib/xscreensaver/config/screensaver-cmndln.xpm 0444 root bin
+f none openwin/lib/xscreensaver/config/screensaver-colorselector.xpm 0444 root bin
+f none openwin/lib/xscreensaver/config/screensaver-diagnostic.xpm 0444 root bin
+f none openwin/lib/xscreensaver/config/screensaver-locking.xpm 0444 root bin
+f none openwin/lib/xscreensaver/config/screensaver-power.xpm 0444 root bin
+f none openwin/lib/xscreensaver/config/screensaver-snap.xpm 0444 root bin
+f none openwin/lib/xscreensaver/config/xscreensaver-demo.glade2 0444 root bin
+f none openwin/lib/xscreensaver/config/xscreensaver.xpm 0444 root bin