--- xscreensaver-3.09/driver/passwd-pam.c.diffs	Mon Nov 16 14:33:15 1998
+++ xscreensaver-3.09/driver/passwd-pam.c	Mon May  3 19:24:25 1999
@@ -210,15 +210,50 @@
      If "/etc/pam.d" exists and is a directory, but "/etc/pam.d/xlock"
      does not exist, warn that PAM probably isn't going to work.
    */
-  const char  dir[] = "/etc/pam.d";
-  const char file[] = "/etc/pam.d/" PAM_SERVICE_NAME;
+  const char   dir[] = "/etc/pam.d";
+  const char  file[] = "/etc/pam.d/" PAM_SERVICE_NAME;
+  const char file2[] = "/etc/pam.conf";
   struct stat st;
+
   if (stat (dir, &st) == 0 && st.st_mode & S_IFDIR)
-    if (stat (file, &st) != 0)
+    {
+      if (stat (file, &st) != 0)
+        fprintf (stderr,
+                 "%s: warning: %s does not exist.\n"
+                 "%s: password authentication via PAM is unlikely to work.\n",
+                 blurb(), file, blurb());
+    }
+  else if (stat (file2, &st) == 0)
+    {
+      FILE *f = fopen (file2, "r");
+      if (f)
+        {
+          Bool ok = False;
+          char buf[255];
+          while (fgets (buf, sizeof(buf), f))
+            if (strstr (buf, PAM_SERVICE_NAME))
+              {
+                ok = True;
+                break;
+              }
+          fclose (f);
+          if (!ok)
+            {
+              fprintf (stderr,
+                  "%s: warning: %s does not list the `%s' service.\n"
+                  "%s: password authentication via PAM is unlikely to work.\n",
+                       blurb(), file2, PAM_SERVICE_NAME, blurb());
+            }
+        }
+      /* else warn about file2 existing but being unreadable? */
+    }
+  else
+    {
       fprintf (stderr,
-               "%s: warning: %s does not exist.\n"
+               "%s: warning: neither %s nor %s exist.\n"
                "%s: password authentication via PAM is unlikely to work.\n",
-               blurb(), file, blurb());
+               blurb(), file2, file, blurb());
+    }
 
   /* Return true anyway, just in case. */
   return True;
--- xscreensaver-3.09/driver/passwd-pwent.c.diffs	Sun Nov 15 14:36:53 1998
+++ xscreensaver-3.09/driver/passwd-pwent.c	Mon May  3 19:22:59 1999
@@ -195,9 +195,15 @@
 	*s = 0;
     }
 
+#ifndef HAVE_PAM
+  /* We only issue this warning if not compiled with support for PAM.
+     If we're using PAM, it's not unheard of that normal pwent passwords
+     would be unavailable. */
+
   if (!result)
     fprintf (stderr, "%s: couldn't get password of \"%s\"\n",
 	     blurb(), (user ? user : "(null)"));
+#endif /* !HAVE_PAM */
 
   return result;
 }
--- xscreensaver-3.09/driver/setuid.c.diffs	Wed Oct 21 16:12:49 1998
+++ xscreensaver-3.09/driver/setuid.c	Mon May  3 19:22:59 1999
@@ -14,8 +14,6 @@
 # include "config.h"
 #endif
 
-#ifndef NO_SETUID /* whole file */
-
 #include <X11/Xlib.h>		/* not used for much... */
 
 /* This file doesn't need the Xt headers, so stub these types out... */
@@ -35,7 +33,6 @@
 #include <pwd.h>		/* for getpwnam() and struct passwd */
 #include <grp.h>		/* for getgrgid() and struct group */
 
-
 static const char *
 uid_gid_string (uid_t uid, gid_t gid)
 {
@@ -310,10 +307,3 @@
       }
   }
 }
-
-#else  /* !NO_SETUID */
-
-void hack_uid (saver_info *si) { }
-void describe_uids (saver_info *si, FILE *out) { }
-
-#endif /* NO_SETUID */
--- xscreensaver-3.09/driver/subprocs.c.diffs	Sun Nov 15 04:26:19 1998
+++ xscreensaver-3.09/driver/subprocs.c	Mon May  3 19:22:59 1999
@@ -248,6 +248,17 @@
   Bool hairy_p = !!strpbrk (command, "*?$&!<>[];`'\\\"=");
   /* note: = is in the above because of the sh syntax "FOO=bar cmd". */
 
+  if (getuid() == (uid_t) 0 || geteuid() == (uid_t) 0)
+    {
+      /* If you're thinking of commenting this out, think again.
+         If you do so, you will open a security hole.  Mail jwz
+         so that he may enlighten you as to the error of your ways.
+       */
+      fprintf (stderr, "%s: we're still running as root!  Disaster!\n",
+               blurb());
+      saver_exit (si, 1, 0);
+    }
+
   if (p->verbose_p)
     fprintf (stderr, "%s: spawning \"%s\" in pid %lu%s.\n",
 	     blurb(), command, (unsigned long) getpid (),
--- xscreensaver-3.09/driver/xscreensaver.c.diffs	Thu Apr  8 18:02:05 1999
+++ xscreensaver-3.09/driver/xscreensaver.c	Mon May  3 19:22:59 1999
@@ -432,9 +432,7 @@
     }
 #endif /* NO_LOCKING */
 
-#ifndef NO_SETUID
   hack_uid (si);
-#endif /* NO_SETUID */
 }
 
 
