summaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
Diffstat (limited to 'driver')
-rw-r--r--driver/Makefile.in11
-rw-r--r--driver/XScreenSaver.ad.in5
-rw-r--r--driver/XScreenSaver_ad.h1
-rw-r--r--driver/demo-Gtk.c5
-rw-r--r--driver/passwd.c46
-rw-r--r--driver/test-yarandom.c66
-rw-r--r--driver/xscreensaver.c12
7 files changed, 137 insertions, 9 deletions
diff --git a/driver/Makefile.in b/driver/Makefile.in
index 55effec..b13853e 100644
--- a/driver/Makefile.in
+++ b/driver/Makefile.in
@@ -115,10 +115,12 @@ NOLOCK_OBJS_1 = lock.o
TEST_SRCS = test-passwd.c test-uid.c test-xdpms.c test-grab.c \
test-apm.c test-fade.c test-xinerama.c test-vp.c \
- test-randr.c xdpyinfo.c test-mlstring.c test-screens.c
+ test-randr.c xdpyinfo.c test-mlstring.c test-screens.c \
+ test-yarandom.c
TEST_EXES = test-passwd test-uid test-xdpms test-grab \
test-apm test-fade test-xinerama test-vp \
- test-randr xdpyinfo test-mlstring test-screens
+ test-randr xdpyinfo test-mlstring test-screens \
+ test-yarandom
MOTIF_LIBS = @MOTIF_LIBS@ @PNG_LIBS@ $(XMU_LIBS)
GTK_LIBS = @GTK_LIBS@ $(XMU_LIBS)
@@ -865,6 +867,9 @@ test-screens.o: screens.c
test-screens: test-screens.o
$(CC) $(LDFLAGS) -o $@ $(TEST_SCREENS_OBJS) $(SAVER_LIBS)
+test-yarandom: test-yarandom.o
+ $(CC) -DTEST $(LDFLAGS) -o $@ test-yarandom.o $(UTILS_BIN)/yarandom.o
+
xdpyinfo.o: xdpyinfo.c
$(CC) -c $(INCLUDES) -DHAVE_GLX $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \
@@ -980,6 +985,8 @@ test-uid.o: ../config.h
test-vp.o: ../config.h
test-xdpms.o: ../config.h
test-xinerama.o: ../config.h
+test-yarandom.o: ../config.h
+test-yarandom.o: $(UTILS_SRC)/yarandom.h
timers.o: ../config.h
timers.o: $(srcdir)/prefs.h
timers.o: $(srcdir)/types.h
diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in
index f4e29d4..eec998f 100644
--- a/driver/XScreenSaver.ad.in
+++ b/driver/XScreenSaver.ad.in
@@ -4,8 +4,8 @@
! a screen saver and locker for the X window system
! by Jamie Zawinski
!
-! version 5.40
-! 12-Aug-2018
+! version 5.42
+! 28-Dec-2018
!
! See "man xscreensaver" for more info. The latest version is always
! available at https://www.jwz.org/xscreensaver/
@@ -386,6 +386,7 @@ GetViewPortIsFullOfLies: False
@GL_KLUDGE@ GL: crumbler -root \n\
filmleader -root \n\
glitchpeg -root \n\
+@GL_KLUDGE@ GL: handsy -root \n\
@GL_KLUDGE@ GL: maze3d -root \n\
@GL_KLUDGE@ GL: peepers -root \n\
@GL_KLUDGE@ GL: razzledazzle -root \n\
diff --git a/driver/XScreenSaver_ad.h b/driver/XScreenSaver_ad.h
index cd4976e..2d7b168 100644
--- a/driver/XScreenSaver_ad.h
+++ b/driver/XScreenSaver_ad.h
@@ -281,6 +281,7 @@
GL: crumbler -root \\n\
filmleader -root \\n\
glitchpeg -root \\n\
+ GL: handsy -root \\n\
GL: maze3d -root \\n\
GL: peepers -root \\n\
GL: razzledazzle -root \\n\
diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
index 0dfc387..ef00d82 100644
--- a/driver/demo-Gtk.c
+++ b/driver/demo-Gtk.c
@@ -3970,6 +3970,11 @@ launch_preview_subproc (state *s)
}
else
{
+ /* We do this instead of relying on $XSCREENSAVER_WINDOW specifically
+ so that third-party savers that don't implement -window-id will fail:
+ otherwise we might have full-screen windows popping up when we were
+ just trying to get a preview thumbnail.
+ */
strcpy (new_cmd, cmd);
sprintf (new_cmd + strlen (new_cmd), " -window-id 0x%X",
(unsigned int) id);
diff --git a/driver/passwd.c b/driver/passwd.c
index ac5a3f0..f443726 100644
--- a/driver/passwd.c
+++ b/driver/passwd.c
@@ -1,5 +1,5 @@
/* passwd.c --- verifying typed passwords with the OS.
- * xscreensaver, Copyright (c) 1993-2014 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1993-2018 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -24,6 +24,7 @@
#endif
#include <time.h>
#include <sys/time.h>
+#include <sys/stat.h>
#ifndef VMS
# include <pwd.h> /* for getpwuid() */
@@ -111,6 +112,44 @@ struct auth_methods methods[] = {
};
+# ifdef HAVE_PROC_OOM
+/* On some recent Linux systems you can tell the kernel's OOM-killer to
+ consider the possibility of maybe sometimes not killing you in low-memory
+ situations. Because that would unlock the screen. And that would be bad.
+
+ Linux >= 2.6.11: echo -17 > /proc/$$/oom_adj <-- ignoring this.
+ Linux >= 2.6.37: echo -1000 > /proc/$$/oom_score_adj <-- trying this.
+ */
+static void
+oom_assassin_immunity (Bool verbose_p)
+{
+ char fn[1024];
+ struct stat st;
+ FILE *out;
+ sprintf (fn, "/proc/%d/oom_score_adj", getpid());
+ if (stat(fn, &st) != 0)
+ {
+ if (verbose_p)
+ fprintf (stderr, "%s: OOM: %s does not exist\n", blurb(), fn);
+ return;
+ }
+ out = fopen (fn, "w");
+ if (!out)
+ {
+ if (verbose_p)
+ {
+ char b[2048];
+ sprintf (b, "%s: OOM: unable to write %s\n", blurb(), fn);
+ perror(b);
+ }
+ return;
+ }
+ fputs ("-1000\n", out);
+ fclose (out);
+}
+# endif /* HAVE_PROC_OOM */
+
+
Bool
lock_priv_init (int argc, char **argv, Bool verbose_p)
{
@@ -130,6 +169,11 @@ lock_priv_init (int argc, char **argv, Bool verbose_p)
fprintf (stderr, "%s: initialization of %s passwords failed.\n",
blurb(), methods[i].name);
}
+
+# ifdef HAVE_PROC_OOM
+ oom_assassin_immunity (verbose_p);
+# endif
+
return any_ok;
}
diff --git a/driver/test-yarandom.c b/driver/test-yarandom.c
new file mode 100644
index 0000000..6701ff8
--- /dev/null
+++ b/driver/test-yarandom.c
@@ -0,0 +1,66 @@
+/* test-yarandom.c --- generate a file of random bytes for analysis.
+ * xscreensaver, Copyright (c) 2018 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. No representations are made about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include "yarandom.h"
+
+char *progname = 0;
+
+int
+main (int argc, char **argv)
+{
+ unsigned long i, n;
+ char *f;
+ FILE *fd;
+
+ progname = argv[0];
+ if (argc != 3)
+ {
+ fprintf(stderr, "usage: %s bytes outfile\n", argv[0]);
+ exit(1);
+ }
+
+ n = atol (argv[1]);
+ f = argv[2];
+
+# undef ya_rand_init
+ ya_rand_init(0);
+
+ fd = fopen (f, "w");
+ if (!fd) { perror (f); exit (1); }
+
+ n /= sizeof(uint32_t);
+ for (i = 0; i < n; i++)
+ {
+ union { uint32_t i; char s[sizeof(uint32_t)]; } rr;
+ rr.i = random();
+ if (! fwrite (rr.s, sizeof(rr.s), 1, fd))
+ {
+ perror ("write");
+ exit (1);
+ }
+ }
+ fclose (fd);
+ fprintf (stderr, "%s: %s: wrote %ld bytes\n",
+ progname, f, i * sizeof(uint32_t));
+ exit(0);
+}
diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
index f5f65dc..abcb07f 100644
--- a/driver/xscreensaver.c
+++ b/driver/xscreensaver.c
@@ -1328,6 +1328,10 @@ main_loop (saver_info *si)
{
Time lock_timeout = p->lock_timeout;
+ /* If we're fading, don't lock until the fade finishes. */
+ if (si->fading_possible_p && p->fade_p)
+ lock_timeout += p->fade_seconds / 1000;
+
if (si->emergency_lock_p && p->lock_p && lock_timeout)
{
int secs = p->lock_timeout / 1000;
@@ -2071,15 +2075,15 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
sprintf (buf, "LOCK ClientMessage received; %s", response);
clientmessage_response (si, window, False, buf, response);
+ /* Have to set the time or xscreensaver-command doesn't report
+ the LOCK state change. Must come before set_locked_p(). */
+ si->blank_time = time ((time_t *) 0);
+
/* Note that this leaves things in a slightly inconsistent state:
we are blanked but not locked. And blanking might actually
fail if we can't get the grab. */
set_locked_p (si, True);
- /* Have to set the time or xscreensaver-command doesn't
- report the LOCK state change. */
- si->blank_time = time ((time_t *) 0);
-
si->selection_mode = 0;
si->demoing_p = False;