I think this patch (against 5.07) should make it annoy you less. What do you think?

Index: lock.c
===================================================================
RCS file: /cvsroot/xscreensaver/driver/lock.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- lock.c      16 Jul 2008 21:21:07 -0000      1.95
+++ lock.c      15 Aug 2008 10:23:12 -0000      1.96
@@ -1912,6 +1912,12 @@
   const char *info_msg, *prompt;
   struct auth_response *responses;
 
+  if (si->unlock_state == ul_cancel ||
+      si->unlock_state == ul_time)
+    /* If we've already cancelled or timed out in this PAM conversation,
+       don't prompt again even if PAM asks us to! */
+    return -1;
+
   if (!(responses = calloc(num_msg, sizeof(struct auth_response))))
     goto fail;
 
@@ -2049,7 +2055,7 @@
               event.xany.type == Expose)
             draw_passwd_window (si);
           else if (event.xany.type == ButtonPress || 
-                   event.xany.type == ButtonRelease)
+                   event.xany.type == KeyPress)
             break;
           XSync (si->dpy, False);
         }
Index: passwd.c
===================================================================
RCS file: /cvsroot/xscreensaver/driver/passwd.c,v
retrieving revision 1.31
retrieving revision 1.33
diff -u -r1.31 -r1.33
--- passwd.c    2 Mar 2008 05:04:32 -0000       1.31
+++ passwd.c    15 Aug 2008 10:30:20 -0000      1.33
@@ -249,6 +249,8 @@
 {
   int i, j;
 
+  si->unlock_state = ul_read;
+
   for (i = 0; i < countof(methods); i++)
     {
       if (!methods[i].initted_p)
@@ -267,6 +269,20 @@
 
       check_for_leaks (methods[i].name);
 
+      /* If password authentication failed, but the password was NULL
+         (meaning the user just hit RET) then treat that as "cancel".
+         This means that if the password is literally NULL, it will
+         work; but if not, then NULL passwords are treated as cancel.
+       */
+      if (si->unlock_state == ul_fail &&
+          si->cached_passwd &&
+          !*si->cached_passwd)
+        {
+          fprintf (stderr, "%s: assuming null password means cancel.\n",
+                   blurb());
+          si->unlock_state = ul_cancel;
+        }
+
       if (si->unlock_state == ul_success)
         {
           /* If we successfully authenticated by method N, but attempting
@@ -287,6 +303,18 @@
             }
           goto DONE;           /* Successfully authenticated! */
         }
+      else if (si->unlock_state == ul_cancel ||
+               si->unlock_state == ul_time)
+        {
+          /* If any auth method gets a cancel or timeout, don't try the
+             next auth method!  We're done! */
+          fprintf (stderr,
+                   "%s: authentication via %s %s.\n",
+                       blurb(), methods[i].name,
+                   (si->unlock_state == ul_cancel
+                    ? "cancelled" : "timed out"));
+          goto DONE;
+        }
     }
 
   if (verbose_p)
Index: timers.c
===================================================================
RCS file: /cvsroot/xscreensaver/driver/timers.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- timers.c    3 Jul 2008 03:45:09 -0000       1.81
+++ timers.c    15 Aug 2008 10:23:12 -0000      1.82
@@ -817,9 +817,12 @@
        break;
 
       case KeyPress:
-      case KeyRelease:
       case ButtonPress:
-      case ButtonRelease:
+      /* Ignore release events so that hitting ESC at the password dialog
+         doesn't result in the password dialog coming right back again when
+         the fucking release key is seen! */
+      /* case KeyRelease:*/
+      /* case ButtonRelease:*/
       case MotionNotify:
 
        if (p->debug_p)
@@ -1083,8 +1086,6 @@
 
   if (until_idle_p && si->cycle_id)    /* no cycle timer when inactive */
     abort ();
-
-  return;
 }
 
 



--
Jamie Zawinski       [EMAIL PROTECTED]                  http://www.jwz.org/
                    [EMAIL PROTECTED]      http://www.dnalounge.com/
                                         http://jwz.livejournal.com/

Reply via email to