[accounts-dialog] Keep the passwd driver code in sync with gnome-system-tools



commit fd0f26e9bbdfb4949f878bd0c90e244d8343e3cf
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jul 20 22:51:42 2010 -0400

    Keep the passwd driver code in sync with gnome-system-tools
    
    Changes taken from bug 613844, thanks  to Milan Bouchet-Valat.

 src/run-passwd.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/run-passwd.c b/src/run-passwd.c
index 7e40661..6f7cfab 100644
--- a/src/run-passwd.c
+++ b/src/run-passwd.c
@@ -467,9 +467,13 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *pass
                                                 "palindrome",
                                                 "dictionary",
                                                 "simple",
+                                                "simplistic",
                                                 "similar",
+                                                "case",
+                                                "different",
                                                 "wrapped",
                                                 "recovered",
+                                                "recent",
                                                 "unchanged",
                                                 "match",
                                                 "1 numeric or special",
@@ -502,13 +506,19 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *pass
                                                                      _("The new password is too short"));
                                         } else if (strstr (str->str, "palindrome") != NULL ||
                                                    strstr (str->str, "simple") != NULL ||
+                                                   strstr (str->str, "simplistic") != NULL ||
                                                    strstr (str->str, "dictionary") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The new password is too simple"));
                                         } else if (strstr (str->str, "similar") != NULL ||
+                                                   strstr (str->str, "different") != NULL ||
+                                                   strstr (str->str, "case") != NULL ||
                                                    strstr (str->str, "wrapped") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The old and new passwords are too similar"));
+                                        } else if (strstr (str->str, "recent") != NULL) {
+                                                error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
+                                                                     _("The new password has already been used recently."));
                                         } else if (strstr (str->str, "1 numeric or special") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The new password must contain numeric or special characters"));
@@ -569,6 +579,10 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *pass
                                          * in this case, simply remove it from the queue */
                                         pw = g_queue_pop_head (passwd_handler->backend_stdin_queue);
                                         g_free (pw);
+
+                                        /* Pop the IO queue, i.e. send new password */
+                                        io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin);
+
                                 } else {
 
                                         passwd_handler->backend_state = PASSWD_STATE_AUTH;
@@ -743,8 +757,14 @@ passwd_change_password (PasswdHandler *passwd_handler,
                 update_password (passwd_handler);
         }
 
-        /* Pop new password through the backend */
-        io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin);
+        /* Pop new password through the backend.
+         * If user has no password, popping the queue would output current
+         * password, while 'passwd' is waiting for the new one. So wait for
+         * io_watch_stdout() to remove current password from the queue,
+         * and output the new one for us.
+         */
+        if (passwd_handler->current_password)
+                io_queue_pop (passwd_handler->backend_stdin_queue, passwd_handler->backend_stdin);
 
         /* Our IO watcher should now handle the rest */
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]