diff options
author | George Lebl <jirka@5z.com> | 2003-06-06 18:24:58 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2003-06-06 18:24:58 +0000 |
commit | fcdbd53b0c8c0714742eb18e04f09d32b3ff4152 (patch) | |
tree | 9a60c3a376fa4b7ebcfa8d866131b5dce2852ffa /daemon/verify-shadow.c | |
parent | ccdef3015c675592ee06ffe6636ad2ffd1b01ae7 (diff) | |
download | gdm-fcdbd53b0c8c0714742eb18e04f09d32b3ff4152.tar.gz |
add a query for the capslock state in the greeter
Fri Jun 06 11:21:44 2003 George Lebl <jirka@5z.com>
* daemon/gdm.h, gui/gdmlogin.c, gui/greeter/greeter.c,
gui/greeter/greeter_item_capslock.[ch]: add a query for the capslock
state in the greeter
* daemon/verify-*.c: fix #71496 by checking the capslock state
before telling the user that he should make sure it's off. Also
only say "invalid username or password" if we actually did ask for
a password, else the message would be silly indeed (note that
the check if we did ask for password is a silly hack, but the
verify-pam.c code is a large set of silly hacks and as such it's
ok to add yet another one)
Diffstat (limited to 'daemon/verify-shadow.c')
-rw-r--r-- | daemon/verify-shadow.c | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/daemon/verify-shadow.c b/daemon/verify-shadow.c index 9b1ce5d1..344a3e2c 100644 --- a/daemon/verify-shadow.c +++ b/daemon/verify-shadow.c @@ -43,6 +43,35 @@ extern gboolean GdmAllowRoot; extern gboolean GdmAllowRemoteRoot; extern gint GdmRetryDelay; +static void +print_cant_auth_errbox (void) +{ + gboolean is_capslock = FALSE; + const char *basemsg; + char *msg; + char *ret; + + ret = gdm_slave_greeter_ctl (GDM_QUERY_CAPSLOCK, ""); + if ( ! ve_string_empty (ret)) + is_capslock = TRUE; + g_free (ret); + + basemsg = _("\nIncorrect username or password. " + "Letters must be typed in the correct " + "case."); + if (is_capslock) { + msg = g_strconcat (basemsg, " ", + _("Please make sure the " + "Caps Lock key is not " + "enabled."), + NULL); + } else { + msg = g_strdup (basemsg); + } + gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, msg); + g_free (msg); +} + /** * gdm_verify_user: * @username: Name of user or NULL if we should ask @@ -58,7 +87,7 @@ extern gint GdmRetryDelay; gchar * gdm_verify_user (GdmDisplay *d, const char *username, const gchar *display, gboolean local) { - gchar *login, *passwd, *ppasswd, *auth_errmsg; + gchar *login, *passwd, *ppasswd; struct passwd *pwent; struct spwd *sp; @@ -129,17 +158,10 @@ gdm_verify_user (GdmDisplay *d, const char *username, const gchar *display, gboo if (pwent == NULL) { sleep (GdmRetryDelay); - gdm_error (_("Couldn't authenticate user")); - /* FIXME: Hmm, how are we sure that the login is username - * and password. That is the most common case but not - * necessarily true, this message needs to be changed - * to allow for such cases */ - auth_errmsg = g_strdup_printf - (_("\nIncorrect username or password. " - "Letters must be typed in the correct case. " - "Please make sure the Caps Lock key is not enabled.")); - gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, auth_errmsg); - g_free (auth_errmsg); + gdm_error (_("Couldn't authenticate user \"%s\""), login); + + print_cant_auth_errbox (); + g_free (login); g_free (passwd); g_free (ppasswd); @@ -150,16 +172,10 @@ gdm_verify_user (GdmDisplay *d, const char *username, const gchar *display, gboo if (ppasswd == NULL || (ppasswd[0] != '\0' && strcmp (crypt (passwd, ppasswd), ppasswd) != 0)) { sleep (GdmRetryDelay); - /* FIXME: Hmm, how are we sure that the login is username - * and password. That is the most common case but not - * necessarily true, this message needs to be changed - * to allow for such cases */ - auth_errmsg = g_strdup_printf - (_("\nIncorrect username or password. " - "Letters must be typed in the correct case. " - "Please make sure the Caps Lock key is not enabled.")); - gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, auth_errmsg); - g_free (auth_errmsg); + gdm_error (_("Couldn't authenticate user \"%s\""), login); + + print_cant_auth_errbox (); + g_free (login); g_free (passwd); g_free (ppasswd); |