+ if (si->pw_data->state == pw_fail)
+ si->unlock_failures++;
+
+ if (p->verbose_p)
+ switch (si->pw_data->state)
+ {
+ case pw_ok:
+ fprintf (stderr, "%s: password correct.\n", blurb()); break;
+ case pw_fail:
+ fprintf (stderr, "%s: password incorrect!\n", blurb()); break;
+ case pw_null:
+ case pw_cancel:
+ fprintf (stderr, "%s: password entry cancelled.\n", blurb()); break;
+ case pw_time:
+ fprintf (stderr, "%s: password entry timed out.\n", blurb()); break;
+ default: break;
+ }
+
+#ifdef HAVE_SYSLOG
+ if (si->pw_data->state == pw_fail)
+ {
+ /* If they typed a password (as opposed to just hitting return) and
+ the password was invalid, log it.
+ */
+ struct passwd *pw = getpwuid (getuid ());
+ char *d = DisplayString (si->dpy);
+ char *u = (pw->pw_name ? pw->pw_name : "???");
+ int opt = 0;
+ int fac = 0;
+
+# ifdef LOG_PID
+ opt = LOG_PID;
+# endif
+
+# if defined(LOG_AUTHPRIV)
+ fac = LOG_AUTHPRIV;
+# elif defined(LOG_AUTH)
+ fac = LOG_AUTH;
+# else
+ fac = LOG_DAEMON;
+# endif
+
+ if (!d) d = "";
+ openlog (progname, opt, fac);
+ syslog (LOG_NOTICE, "FAILED LOGIN %d ON DISPLAY \"%s\", FOR \"%s\"",
+ si->unlock_failures, d, u);
+ closelog ();
+ }
+#endif /* HAVE_SYSLOG */
+
+ if (si->pw_data->state == pw_ok && si->unlock_failures != 0)
+ {
+ if (si->unlock_failures == 1)
+ fprintf (real_stderr,
+ "%s: WARNING: 1 failed attempt to unlock the screen.\n",
+ blurb());
+ else
+ fprintf (real_stderr,
+ "%s: WARNING: %d failed attempts to unlock the screen.\n",
+ blurb(), si->unlock_failures);
+ fflush (real_stderr);
+
+ si->unlock_failures = 0;
+ }
+