patches/xscreensaver-13-trusted.diff
author akumrao
Wed, 16 Jun 2010 15:08:19 +0000
changeset 18132 dc3852ef4fe2
parent 18124 ac2b6be91df8
child 18138 69ee6368d6dc
permissions -rw-r--r--
CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     1
/*
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     2
 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     3
 *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     4
 * Permission is hereby granted, free of charge, to any person obtaining a
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     5
 * copy of this software and associated documentation files (the "Software"),
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     6
 * to deal in the Software without restriction, including without limitation
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     8
 * and/or sell copies of the Software, and to permit persons to whom the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     9
 * Software is furnished to do so, subject to the following conditions:
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    10
 *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    11
 * The above copyright notice and this permission notice (including the next
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    12
 * paragraph) shall be included in all copies or substantial portions of the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    13
 * Software.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    14
 *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    21
 * DEALINGS IN THE SOFTWARE.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    22
 */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    23
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    24
Support needed for Solaris Trusted Extensions / Trusted GNOME.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    25
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    26
diff --git xscreensaver-5.11/driver/Makefile.in xscreensaver-5.11/driver/Makefile.in
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    27
--- xscreensaver-5.11/driver/Makefile.in
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    28
+++ xscreensaver-5.11/driver/Makefile.in
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    29
@@ -105,6 +105,10 @@ GTK_OBJS	= demo-Gtk.o demo-Gtk-conf.o @GTK_EXTRA_OBJS@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    30
 GTK_LOCK_SRCS	= lock-Gtk.c remote.c
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    31
 GTK_LOCK_OBJS	= lock-Gtk.o remote.o
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    32
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    33
+TRUSTED_LIBS	= -lglib-2.0 -lsecdb
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    34
+TRUSTED_SRCS	= trusted-utils.c
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    35
+TRUSTED_OBJS	= trusted-utils.o
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    36
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    37
 PWENT_SRCS	= passwd-pwent.c
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    38
 PWENT_OBJS	= passwd-pwent.o
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    39
 
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
    40
@@ -794,9 +798,9 @@ XScreenSaver_Xm_ad.h: XScreenSaver-Xm.ad
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    41
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    42
 # The executables linked in this directory.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    43
 #
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    44
-xscreensaver: $(SAVER_OBJS)
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
    45
-	$(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS) \
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
    46
-	-lgconf-2 -lgobject-2.0
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    47
+xscreensaver: $(SAVER_OBJS) $(TRUSTED_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    48
+	$(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(TRUSTED_OBJS) \
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
    49
+	$(TRUSTED_LIBS) $(SAVER_LIBS) -lgconf-2 -lgobject-2.0
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    50
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    51
 xscreensaver-command: $(CMD_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    52
 	$(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS)
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
    53
@@ -815,8 +819,9 @@ xscreensaver-demo: @PREFERRED_DEMO_PROGRAM@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    54
 xscreensaver-lock: @PREFERRED_LOCK_PROGRAM@
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    55
 	$(INSTALL_PROGRAM) @PREFERRED_LOCK_PROGRAM@ $@
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    56
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    57
-xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    58
+xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS) $(TRUSTED_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    59
 	$(CC) $(LDFLAGS) -o $@ $(GTK_LOCK_OBJS) $(LIBS) $(X_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    60
+	$(TRUSTED_OBJS) $(TRUSTED_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    61
 	$(GTK_LIBS) $(XML_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    62
 	$(XDPMS_LIBS) -lXext \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    63
 	$(X_EXTRA_LIBS)
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
    64
@@ -826,9 +831,9 @@ xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    65
 	$(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    66
 	$(XDPMS_LIBS) $(XINERAMA_LIBS) -lXext $(X_EXTRA_LIBS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    67
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    68
-xscreensaver-demo-Gtk: $(DEMO_OBJS) $(GTK_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    69
-	$(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(GTK_OBJS) $(LIBS) $(X_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    70
-	$(GTK_LIBS) $(XPM_LIBS) $(XML_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    71
+xscreensaver-demo-Gtk: $(DEMO_OBJS) $(GTK_OBJS) $(TRUSTED_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    72
+	$(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(GTK_OBJS) $(TRUSTED_OBJS) $(LIBS) $(X_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    73
+	$(GTK_LIBS) $(XPM_LIBS) $(XML_LIBS) $(INTL_LIBS) $(TRUSTED_LIBS) $(X_PRE_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    74
 	-lXt -lX11 $(XDPMS_LIBS) $(XINERAMA_LIBS) -lXext $(X_EXTRA_LIBS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    75
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    76
 demo-Gtk.o: XScreenSaver_ad.h
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
    77
@@ -837,7 +842,7 @@ xscreensaver.o: XScreenSaver_ad.h
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    78
 xscreensaver-getimage.o: XScreenSaver_ad.h
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    79
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    80
 xscreensaver-getimage: $(GETIMG_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    81
-	$(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(GETIMG_LIBS) -lm
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    82
+	$(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(TRUSTED_OBJS) $(GETIMG_LIBS) $(TRUSTED_LIBS) -lm
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    83
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    84
 pdf2jpeg: $(PDF2JPEG_OBJS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    85
 	$(OBJCC) $(LDFLAGS) -o $@ $(PDF2JPEG_OBJS) $(PDF2JPEG_LIBS) -lm
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    86
diff --git xscreensaver-5.11/driver/demo-Gtk.c xscreensaver-5.11/driver/demo-Gtk.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    87
--- xscreensaver-5.11/driver/demo-Gtk.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    88
+++ xscreensaver-5.11/driver/demo-Gtk.c
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    89
@@ -136,6 +136,14 @@
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    90
 #include <string.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    91
 #include <ctype.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    92
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    93
+#include <user_attr.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    94
+
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
    95
+#include "trusted-utils.h"
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    96
+void XTSOLgetWorkstationOwner(Display *, uid_t *);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    97
+static gboolean tsol_hack_initialized = False;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    98
+static gboolean tsol_multi_label_session = False;
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
    99
+extern Display *global_dpy;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   100
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   101
 #ifdef HAVE_GTK2
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   102
 enum {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   103
   COL_ENABLED,
18064
b75bce7d09e5 2010-06-02 Alan Coopersmith <[email protected]>
alanc
parents: 18061
diff changeset
   104
@@ -2874,9 +2882,73 @@ populate_prefs_page (state *s)
18087
3e1e477dd527 2010-06-04 Alan Coopersmith <[email protected]>
alanc
parents: 18064
diff changeset
   105
     SENSITIZE ("pwd_spinbutton", p->unlock_timeout_p);
3e1e477dd527 2010-06-04 Alan Coopersmith <[email protected]>
alanc
parents: 18064
diff changeset
   106
     SENSITIZE ("pwd_mlabel",     p->unlock_timeout_p);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   107
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   108
+    tsol_multi_label_session = tsol_is_multi_label_session ();
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   109
+    if (! tsol_hack_initialized && tsol_multi_label_session)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   110
+      {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   111
+        GtkWidget *doc_menu = name_to_widget (s, "doc_menu");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   112
+        GtkWidget *restart_menu = name_to_widget (s, "restart");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   113
+        GtkWidget *kill_menu = name_to_widget (s, "kill_menu");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   114
+        GtkWidget *lock_spinbutton = name_to_widget (s, "lock_spinbutton");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   115
+        GtkWidget *lock_container = name_to_widget (s, "blanking_table");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   116
+        GtkWidget *lock_button_eventbox = name_to_widget (s, "lock_button_eventbox");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   117
+        Widget *newlabel = g_object_new (GTK_TYPE_LABEL, "label",
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   118
+                                         _("_Lock Screen After"),
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   119
+                                         "use-underline", TRUE,
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   120
+                                         "mnemonic-widget", lock_spinbutton,
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   121
+                                         NULL);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   122
+        GValue *gv = g_new0 (GValue, 1);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   123
+        GtkAdjustment *adj;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   124
+        userattr_t *uent;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   125
+        int idletime;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   126
+        char *value = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   127
+        uid_t WorkstationOwner;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   128
+        Display *dpy = GDK_DISPLAY ();
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   129
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   130
+        gtk_widget_hide (doc_menu);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   131
+        gtk_widget_set_sensitive (restart_menu, FALSE);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   132
+        gtk_widget_set_sensitive (kill_menu, FALSE);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   133
+
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   134
+        adj = gtk_spin_button_get_adjustment ((GtkSpinButton *) lock_spinbutton);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   135
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   136
+        XTSOLgetWorkstationOwner (dpy, &WorkstationOwner);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   137
+        uent = getuseruid (WorkstationOwner);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   138
+        value = getusrattrval (uent, USERATTR_IDLETIME_KW);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   139
+        if (value != NULL && *value != '\0')
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   140
+          idletime = atoi (value);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   141
+        adj->upper = (gdouble)idletime;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   142
+        if (adj->value > adj->upper)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   143
+          adj->value = adj->upper;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   144
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   145
+        gtk_spin_button_set_adjustment ((GtkSpinButton *)lock_spinbutton, adj);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   146
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   147
+        gtk_container_add (GTK_CONTAINER (lock_container), GTK_WIDGET (newlabel));
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   148
+        g_value_init (gv, G_TYPE_INT);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   149
+        g_value_set_int (gv, 2);
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   150
+        gtk_container_child_set_property (GTK_CONTAINER (lock_container),
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   151
+                                          GTK_WIDGET (newlabel),
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   152
+                                          "top_attach", gv);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   153
+        g_value_set_int (gv, 1);
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   154
+        gtk_container_child_set_property (GTK_CONTAINER (lock_container),
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   155
+                                          GTK_WIDGET (newlabel),
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   156
+                                          "left_attach", gv);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   157
+        gtk_widget_show (GTK_WIDGET (newlabel));
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   158
+        gtk_widget_hide (GTK_WIDGET (lock_button_eventbox));
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   159
+        g_object_set (lock_button_eventbox, "active", TRUE, NULL);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   160
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   161
+        SENSITIZE ("lock_button",     1);
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   162
+      }
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   163
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   164
+    if (tsol_multi_label_session)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   165
+      {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   166
+        SENSITIZE ("lock_spinbutton", 1);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   167
+        SENSITIZE ("lock_mlabel",     1);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   168
+      }
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   169
+    else
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   170
+      {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   171
     SENSITIZE ("lock_button",     can_lock_p);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   172
     SENSITIZE ("lock_spinbutton", can_lock_p && p->lock_p);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   173
     SENSITIZE ("lock_mlabel",     can_lock_p && p->lock_p);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   174
+      }
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   175
 
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   176
     /* DPMS
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   177
      */
18064
b75bce7d09e5 2010-06-02 Alan Coopersmith <[email protected]>
alanc
parents: 18061
diff changeset
   178
@@ -2906,6 +2978,7 @@ populate_prefs_page (state *s)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   179
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   180
 # undef SENSITIZE
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   181
   }
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   182
+  tsol_hack_initialized = True;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   183
 }
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   184
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   185
 
18064
b75bce7d09e5 2010-06-02 Alan Coopersmith <[email protected]>
alanc
parents: 18061
diff changeset
   186
@@ -2991,6 +3064,9 @@ sensitize_menu_items (state *s, Bool force_p)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   187
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   188
   for (i = 0; i < countof(names); i++)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   189
     {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   190
+      if (tsol_is_multi_label_session() && 2==i)
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   191
+        continue;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   192
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   193
       GtkWidget *w = name_to_widget (s, names[i]);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   194
       gtk_widget_set_sensitive (GTK_WIDGET(w), running_p);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   195
     }
18064
b75bce7d09e5 2010-06-02 Alan Coopersmith <[email protected]>
alanc
parents: 18061
diff changeset
   196
@@ -4957,7 +5033,7 @@ main (int argc, char **argv)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   197
                                      applicationShellWidgetClass,
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   198
                                      dpy, 0, 0);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   199
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   200
-  dpy = XtDisplay (toplevel_shell);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   201
+  global_dpy = dpy = XtDisplay (toplevel_shell);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   202
   db = XtDatabase (dpy);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   203
   XtGetApplicationNameAndClass (dpy, &progname, &progclass);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   204
   XSetErrorHandler (demo_ehandler);
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   205
diff --git xscreensaver-5.11/driver/lock-Gtk.c xscreensaver-5.11/driver/lock-Gtk.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   206
--- xscreensaver-5.11/driver/lock-Gtk.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   207
+++ xscreensaver-5.11/driver/lock-Gtk.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   208
@@ -71,6 +71,7 @@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   209
 #include <atk/atkobject.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   210
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   211
 #include "remote.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   212
+#include "trusted-utils.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   213
 
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18087
diff changeset
   214
 #if GTK_CHECK_VERSION(2,14,0)
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18087
diff changeset
   215
 # define GET_WINDOW(w)          gtk_widget_get_window (w)
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18087
diff changeset
   216
@@ -154,7 +155,10 @@ load_unlock_logo_image (void)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   217
   const char *logofile;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   218
   struct stat statbuf;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   219
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   220
-  logofile = DEFAULT_ICONDIR "/unlock-logo.png";
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   221
+  if (tsol_is_multi_label_session())
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   222
+    logofile = DEFAULT_ICONDIR "/trusted-logo.png";
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   223
+  else
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   224
+    logofile = DEFAULT_ICONDIR "/unlock-logo.png";
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   225
 
18045
dbf849ca434c 2010-05-27 Brian Cameron <[email protected]>
alanc
parents: 18044
diff changeset
   226
   if (stat (logofile, &statbuf) != 0)
dbf849ca434c 2010-05-27 Brian Cameron <[email protected]>
alanc
parents: 18044
diff changeset
   227
     {
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   228
diff --git xscreensaver-5.11/driver/prefs.c xscreensaver-5.11/driver/prefs.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   229
--- xscreensaver-5.11/driver/prefs.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   230
+++ xscreensaver-5.11/driver/prefs.c
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   231
@@ -37,6 +37,8 @@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   232
 # include "vms-pwd.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   233
 #endif /* VMS */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   234
 
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   235
+#include "trusted-utils.h"
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   236
+#include <user_attr.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   237
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   238
 /* This file doesn't need the Xt headers, so stub these types out... */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   239
 #undef XtPointer
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   240
@@ -67,6 +69,9 @@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   241
 #include "prefs.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   242
 #include "resources.h"
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   243
 
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   244
+#include "trusted-utils.h"
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   245
+Display *global_dpy;
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   246
+
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   247
 /* don't use realpath() on fedora system */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   248
 #ifdef _FORTIFY_SOURCE
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   249
 #undef HAVE_REALPATH
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18087
diff changeset
   250
@@ -1046,7 +1051,10 @@ load_init_file (Display *dpy, saver_preferences *p)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   251
   p->xsync_p	    = get_boolean_resource (dpy, "synchronous", "Synchronous");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   252
   p->verbose_p	    = get_boolean_resource (dpy, "verbose", "Boolean");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   253
   p->timestamp_p    = get_boolean_resource (dpy, "timestamp", "Boolean");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   254
-  p->lock_p	    = get_boolean_resource (dpy, "lock", "Boolean");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   255
+  if (tsol_is_multi_label_session())
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   256
+    p->lock_p       = True; /* always lock in a Multi Label Session */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   257
+  else
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   258
+    p->lock_p       = get_boolean_resource (dpy, "lock", "Boolean");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   259
   p->fade_p	    = get_boolean_resource (dpy, "fade", "Boolean");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   260
   p->unfade_p	    = get_boolean_resource (dpy, "unfade", "Boolean");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   261
   p->fade_seconds   = 1000 * get_seconds_resource (dpy, "fadeSeconds", "Time");
18132
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   262
@@ -1070,6 +1078,7 @@ load_init_file (Display *dpy, saver_preferences *p)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   263
   p->lock_timeout    = 1000 * get_minutes_resource (dpy, "lockTimeout", "Time");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   264
   p->cycle           = 1000 * get_minutes_resource (dpy, "cycle", "Time");
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   265
   p->passwd_timeout  = 1000 * get_seconds_resource (dpy, "passwdTimeout", "Time");
18132
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   266
+
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   267
   /* bugid 5077981 */
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   268
   p->unlock_timeout_p = get_boolean_resource (dpy, "passwdTimeoutEnabled", "Boolean");
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   269
   p->pointer_timeout = 1000 * get_seconds_resource (dpy, "pointerPollTime", "Time");
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   270
@@ -1175,6 +1184,37 @@ load_init_file (Display *dpy, saver_preferences *p)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   271
     if (s) free (s);
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   272
   }
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   273
 
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   274
+  if (tsol_is_multi_label_session())
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   275
+    {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   276
+      userattr_t *uent;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   277
+      int idletime;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   278
+      char *value = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   279
+      uid_t WorkstationOwner;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   280
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   281
+      XTSOLgetWorkstationOwner (global_dpy, &WorkstationOwner);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   282
+      uent = getuseruid (WorkstationOwner);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   283
+      value = getusrattrval (uent, USERATTR_IDLETIME_KW);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   284
+      if (value != NULL && *value != '\0')
18132
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   285
+        idletime = atoi(value) * 60 * 1000;
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   286
+
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   287
+      if (p->timeout > idletime)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   288
+        p->timeout = idletime;
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   289
+
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   290
+      /* if no timeout mentioned make it 30 mins */
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   291
+      if(!p->timeout)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   292
+        p->timeout = 30 * 60 * 1000;
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   293
+
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   294
+      /* always lock or logout in a Multi Label Session */
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   295
+      if(p->mode == DONT_BLANK)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   296
+        p->mode = BLANK_ONLY;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   297
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   298
+      value = getusrattrval (uent, USERATTR_IDLECMD_KW);
18132
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   299
+      if (value && strcasecmp(value, USERATTR_IDLECMD_LOGOUT_KW) == 0)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   300
+        p->lock_cmd = LOGOUT_CMD;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   301
+      else
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   302
+        p->lock_cmd = LOCK_CMD;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   303
+    }
18132
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   304
+
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   305
   if (system_default_screenhack_count)  /* note: first_time is also true */
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   306
     {
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   307
       merge_system_screenhacks (dpy, p, system_default_screenhacks,
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   308
diff --git xscreensaver-5.11/driver/subprocs.c xscreensaver-5.11/driver/subprocs.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   309
--- xscreensaver-5.11/driver/subprocs.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   310
+++ xscreensaver-5.11/driver/subprocs.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   311
@@ -70,6 +70,7 @@ extern int kill (pid_t, int);		/* signal() is in sys/signal.h... */
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   312
 #include "exec.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   313
 #include "yarandom.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   314
 #include "visual.h"    /* for id_to_visual() */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   315
+#include "trusted-utils.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   316
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   317
 extern saver_info *global_si_kludge;	/* I hate C so much... */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   318
 
18132
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   319
@@ -932,6 +933,26 @@ check_if_hacks_dir_exists(Bool verbose_p)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   320
     }
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   321
 }
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   322
 
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   323
+/* Added separate function for logout as we need to find better way to log user
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   324
+   out. See CR6422890. For s10 we will use /usr/bin/gnome-session-save --kill
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   325
+*/
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   326
+void
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   327
+logout(saver_screen_info *ssi)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   328
+{
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   329
+  saver_info *si = ssi->global;
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   330
+  saver_preferences *p = &si->prefs;
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   331
+  if (p->lock_cmd == LOGOUT_CMD && !(si->emergency_lock_p || si->locked_p))
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   332
+    {
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   333
+      pid_t forked =  fork_and_exec (ssi,"/usr/bin/gnome-session-save\t--force-logout");
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   334
+      if(forked < 1)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   335
+        {
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   336
+          char buf [255];
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   337
+          sprintf (buf, "%s: couldn't fork", blurb());
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   338
+          perror (buf);
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   339
+        }
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   340
+    }
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   341
+}
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   342
+
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   343
 void
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   344
 spawn_screenhack (saver_screen_info *ssi)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   345
 {
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   346
@@ -939,6 +960,9 @@ spawn_screenhack (saver_screen_info *ssi)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   347
   saver_preferences *p = &si->prefs;
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   348
   char* complete_hack_command;
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   349
 
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   350
+  if (tsol_is_multi_label_session())
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   351
+    logout (ssi);
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   352
+
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   353
   if (getuid () == 0)
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   354
     return;  /* Dont let hacks run if logged in as root*/
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   355
 
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   356
@@ -1084,6 +1108,13 @@ spawn_screenhack (saver_screen_info *ssi)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   357
                                              strlen (HACK_PATH));
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   358
       sprintf(complete_hack_command, HACK_PATH"/%s", hack->command);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   359
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   360
+      if (tsol_is_multi_label_session())
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   361
+        if (p->lock_cmd == LOGOUT_CMD)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   362
+          {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   363
+            free (complete_hack_command);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   364
+            exec_command (p->shell, "/usr/bin/pkill gnome-session", 0);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   365
+            exit(1);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   366
+          }
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   367
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   368
       forked = fork_and_exec (ssi, complete_hack_command);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   369
       free (complete_hack_command);
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   370
diff --git xscreensaver-5.11/driver/trusted-utils.c xscreensaver-5.11/driver/trusted-utils.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   371
new file mode 100644
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   372
--- /dev/null
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   373
+++ xscreensaver-5.11/driver/trusted-utils.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   374
@@ -0,0 +1,171 @@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   375
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   376
+ * Trusted xscreensaver
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   377
+ *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   378
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   379
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   380
+ * Permission is hereby granted, free of charge, to any person obtaining a
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   381
+ * copy of this software and associated documentation files (the "Software"),
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   382
+ * to deal in the Software without restriction, including without limitation
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   383
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   384
+ * and/or sell copies of the Software, and to permit persons to whom the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   385
+ * Software is furnished to do so, subject to the following conditions:
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   386
+ *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   387
+ * The above copyright notice and this permission notice (including the next
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   388
+ * paragraph) shall be included in all copies or substantial portions of the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   389
+ * Software.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   390
+ *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   391
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   392
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   393
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   394
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   395
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   396
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   397
+ * DEALINGS IN THE SOFTWARE.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   398
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   399
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   400
+ * Based on work by Erwann Chenede, Ghee Teo
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   401
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   402
+ * Used to check if we are in a multilabel session and to load
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   403
+ * additional functionality within the multilabel session.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   404
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   405
+#include <dlfcn.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   406
+#include <link.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   407
+#include <stdlib.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   408
+#include <user_attr.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   409
+#include <sys/types.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   410
+#include <unistd.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   411
+#include <strings.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   412
+#include <stdio.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   413
+#include "trusted-utils.h"
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   414
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   415
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   416
+ * Checks for Multi label session
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   417
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   418
+gboolean
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   419
+tsol_is_multi_label_session (void)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   420
+{
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   421
+  static char *session = NULL;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   422
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   423
+  if (!session)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   424
+    session = (char *)getenv("TRUSTED_SESSION");
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   425
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   426
+  if (!session)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   427
+    return FALSE;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   428
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   429
+  return TRUE;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   430
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   431
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   432
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   433
+ * dynamicly load the libxtsol library
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   434
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   435
+static
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   436
+void * dlopen_xtsol (void)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   437
+{
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   438
+  void  *handle = NULL;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   439
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   440
+  if ((handle = dlopen ("/usr/lib/libXtsol.so.1", RTLD_LAZY)) != NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   441
+    return handle;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   442
+  if ((handle = dlopen ("/usr/openwin/lib/libXtsol.so.1", RTLD_LAZY)) != NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   443
+    return handle;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   444
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   445
+  return handle;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   446
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   447
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   448
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   449
+ * dynamicly load the libDtTsol library
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   450
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   451
+static
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   452
+void * dlopen_gnometsol (void)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   453
+{
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   454
+  void  *handle = NULL;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   455
+
18132
dc3852ef4fe2 CR 6955133, screensaver IDLECMD in policy.conf does not work with TJDS and ldap users
akumrao
parents: 18124
diff changeset
   456
+  if ((handle = dlopen ("/usr/lib/libgnometsol.so", RTLD_LAZY)) != NULL)
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   457
+    return handle;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   458
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   459
+  return handle;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   460
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   461
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   462
+xtsol_XTSOLgetWorkstationOwner      libxtsol_XTSOLgetWorkstationOwner = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   463
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   464
+void
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   465
+XTSOLgetWorkstationOwner(Display *dpy, uid_t *WorkstationOwner)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   466
+{
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   467
+  static gpointer xtsol_handle = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   468
+  static gboolean _xtsol_initialized = FALSE;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   469
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   470
+  if ( ! _xtsol_initialized )
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   471
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   472
+      _xtsol_initialized = TRUE;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   473
+      xtsol_handle = dlopen_xtsol ();
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   474
+      if (xtsol_handle != NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   475
+	libxtsol_XTSOLgetWorkstationOwner
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   476
+	  = (xtsol_XTSOLgetWorkstationOwner) dlsym(xtsol_handle,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   477
+						   "XTSOLgetWorkstationOwner");
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   478
+    }
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   479
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   480
+  if (libxtsol_XTSOLgetWorkstationOwner == NULL)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   481
+    *WorkstationOwner = getuid();
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   482
+  else
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   483
+    libxtsol_XTSOLgetWorkstationOwner(dpy, WorkstationOwner);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   484
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   485
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   486
+xtsol_XTSOLMakeTPWindow      libxtsol_XTSOLMakeTPWindow = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   487
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   488
+void
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   489
+XTSOLMakeTPWindow(Display *dpy, Window w)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   490
+{
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   491
+  static gpointer xtsol_handle = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   492
+  static gboolean _xtsol_initialized = FALSE;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   493
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   494
+  if ( ! _xtsol_initialized )
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   495
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   496
+      _xtsol_initialized = TRUE;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   497
+      xtsol_handle = dlopen_xtsol ();
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   498
+      if (xtsol_handle != NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   499
+	libxtsol_XTSOLMakeTPWindow
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   500
+	  = (xtsol_XTSOLMakeTPWindow) dlsym(xtsol_handle,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   501
+					    "XTSOLMakeTPWindow");
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   502
+    }
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   503
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   504
+  if (libxtsol_XTSOLMakeTPWindow)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   505
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   506
+      libxtsol_XTSOLMakeTPWindow(dpy, w);
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   507
+    }
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   508
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   509
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   510
+gnome_tsol_get_usrattr_val		libgnome_tsol_get_usrattr_val = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   511
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   512
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   513
+ * Returns a value from uattr for the given key.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   514
+ * If there is no value in user_attr, then it returns the
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   515
+ * system wide default from policy.conf or labelencodings
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   516
+ * as appropriate.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   517
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   518
+char *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   519
+getusrattrval(userattr_t *uattr, char *keywd)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   520
+{
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   521
+  static gpointer gnometsol_handle = NULL;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   522
+  static gboolean _gnometsol_initialized = FALSE;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   523
+  char *value;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   524
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   525
+  if ( ! _gnometsol_initialized )
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   526
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   527
+      _gnometsol_initialized = TRUE;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   528
+      gnometsol_handle = dlopen_gnometsol ();
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   529
+      if (gnometsol_handle != NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   530
+	libgnome_tsol_get_usrattr_val
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   531
+	  = (gnome_tsol_get_usrattr_val) dlsym(gnometsol_handle,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   532
+					       "gnome_tsol_get_usrattr_val");
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   533
+    }
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   534
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   535
+  if (libgnome_tsol_get_usrattr_val == NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   536
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   537
+      if (strcmp(keywd, USERATTR_IDLETIME_KW) == 0)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   538
+	value = strdup("15");
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   539
+      else if (strcmp(keywd, USERATTR_IDLECMD_KW) == 0)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   540
+	value = strdup(USERATTR_IDLECMD_LOCK_KW);
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   541
+    } else
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   542
+      value = libgnome_tsol_get_usrattr_val(uattr, keywd);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   543
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   544
+  return ( value );
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   545
+}
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   546
diff --git xscreensaver-5.11/driver/trusted-utils.h xscreensaver-5.11/driver/trusted-utils.h
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   547
new file mode 100644
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   548
--- /dev/null
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   549
+++ xscreensaver-5.11/driver/trusted-utils.h
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   550
@@ -0,0 +1,54 @@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   551
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   552
+ * Trusted xscreensaver
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   553
+ *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   554
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   555
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   556
+ * Permission is hereby granted, free of charge, to any person obtaining a
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   557
+ * copy of this software and associated documentation files (the "Software"),
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   558
+ * to deal in the Software without restriction, including without limitation
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   559
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   560
+ * and/or sell copies of the Software, and to permit persons to whom the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   561
+ * Software is furnished to do so, subject to the following conditions:
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   562
+ *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   563
+ * The above copyright notice and this permission notice (including the next
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   564
+ * paragraph) shall be included in all copies or substantial portions of the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   565
+ * Software.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   566
+ *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   567
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   568
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   569
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   570
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   571
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   572
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   573
+ * DEALINGS IN THE SOFTWARE.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   574
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   575
+ * Based on work by Erwann Chenede, Ghee Teo
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   576
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   577
+ * Definitions for the trusted functions.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   578
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   579
+#ifndef TRUSTED_XSCREENSAVER_H
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   580
+#define TRUSTED_XSCREENSAVER_H
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   581
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   582
+#ifdef HAVE_XTSOL
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   583
+#include <X11/extensions/Xtsol.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   584
+#endif /* HAVE_XTSOL */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   585
+#include <user_attr.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   586
+#include <glib.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   587
+#include <X11/Xlib.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   588
+#include <sys/types.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   589
+#include <unistd.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   590
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   591
+extern gboolean tsol_is_multi_label_session (void);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   592
+extern char *getusrattrval(userattr_t *, char *);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   593
+extern void XTSOLgetWorkstationOwner(Display *, uid_t *);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   594
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   595
+typedef void (*xtsol_XTSOLgetWorkstationOwner) (Display *, uid_t *);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   596
+extern void XTSOLMakeTPWindow(Display *, Window);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   597
+typedef void (*xtsol_XTSOLMakeTPWindow) (Display *, Window);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   598
+typedef char *(*gnome_tsol_get_usrattr_val) (userattr_t *, char *);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   599
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   600
+enum {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   601
+	LOCK_CMD = 0,
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   602
+	LOGOUT_CMD
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   603
+};
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   604
+#endif /* TRUSTED_XSCREENSAVER_H */
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   605
diff --git xscreensaver-5.11/driver/types.h xscreensaver-5.11/driver/types.h
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   606
--- xscreensaver-5.11/driver/types.h
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   607
+++ xscreensaver-5.11/driver/types.h
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   608
@@ -105,6 +105,8 @@ struct saver_preferences {
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   609
   Time initial_delay;		/* how long to sleep after launch */
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   610
   Time splash_duration;		/* how long the splash screen stays up */
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   611
   Time timeout;			/* how much idle time before activation */
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   612
+  int lock_cmd;                 /* tsol only  - whether to lock or logout */
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   613
+
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   614
   Time lock_timeout;		/* how long after activation locking starts */
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   615
   Time cycle;			/* how long each hack should run */
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   616
   Time passwd_timeout;		/* how much time before pw dialog goes down */
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   617
diff --git xscreensaver-5.11/driver/xscreensaver-getimage.c xscreensaver-5.11/driver/xscreensaver-getimage.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   618
--- xscreensaver-5.11/driver/xscreensaver-getimage.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   619
+++ xscreensaver-5.11/driver/xscreensaver-getimage.c
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   620
@@ -83,6 +83,7 @@ static char *defaults[] = {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   621
  0
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   622
 };
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   623
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   624
+extern Display *global_dpy;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   625
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   626
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   627
 char *progname = 0;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   628
@@ -1797,7 +1798,7 @@ main (int argc, char **argv)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   629
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   630
   toplevel = XtAppInitialize (&app, progclass, 0, 0, &argc, argv,
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   631
                               defaults, 0, 0);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   632
-  dpy = XtDisplay (toplevel);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   633
+  global_dpy = dpy = XtDisplay (toplevel);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   634
   screen = XtScreen (toplevel);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   635
   db = XtDatabase (dpy);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   636
   XtGetApplicationNameAndClass (dpy, &s, &progclass);
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   637
diff --git xscreensaver-5.11/driver/xscreensaver.c xscreensaver-5.11/driver/xscreensaver.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   638
--- xscreensaver-5.11/driver/xscreensaver.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   639
+++ xscreensaver-5.11/driver/xscreensaver.c
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   640
@@ -142,6 +142,7 @@
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   641
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   642
 #include <stdio.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   643
 #include <ctype.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   644
+#include <zone.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   645
 #include <X11/Xlib.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   646
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   647
 #include <locale.h>
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   648
@@ -226,6 +227,9 @@
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   649
 #include "usleep.h"
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   650
 #include "auth.h"
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   651
 
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   652
+#include "trusted-utils.h"
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   653
+extern Display *global_dpy;
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   654
+
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   655
 saver_info *global_si_kludge = 0;	/* I hate C so much... */
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   656
 
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
   657
 /* Globals */
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18087
diff changeset
   658
@@ -1456,6 +1460,9 @@ main (int argc, char **argv)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   659
   struct passwd *spasswd;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   660
   int i;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   661
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   662
+  if (tsol_is_multi_label_session () && (getzoneid () != 0))
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   663
+    exit (1);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   664
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   665
 #ifdef ENABLE_NLS
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   666
   if (!setlocale (LC_ALL, ""))
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   667
     fprintf (stderr, "locale not supported by C library\n");
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18087
diff changeset
   668
@@ -1500,6 +1507,7 @@ main (int argc, char **argv)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   669
 # endif /* !NO_LOCKING */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   670
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   671
   shell = connect_to_server (si, &argc, argv);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   672
+  global_dpy = XtDisplay(shell);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   673
   process_command_line (si, &argc, argv);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   674
   stderr_log_file (si);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   675
   print_banner (si);
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   676