use integer to avoid comparison being always true due to limited range.

2005-08-15  Olaf Heiring <olh@suse.de>

	* gnome-about-me-password.c (read_everything): use integer to avoid
	  comparison being always true due to limited range.

2005-08-15  Diego Gonzalez <diego@pemas.net>

	* gnome-about-me-password.c (update_password): use "wrapped" instead
	  of "one" to handler the case where the passwd command finds the
	  password wrapped. Use a long delay period.

	  Patch by Jaap Hatsima.
This commit is contained in:
Olaf Heiring 2005-08-15 18:09:33 +00:00 committed by Diego González
parent f2548a55cd
commit 4c49664894
2 changed files with 10 additions and 15 deletions

View file

@ -161,7 +161,8 @@ read_everything (PasswordDialog *pdialog, gchar *needle, va_list ap)
{ {
GString *str = g_string_new (""); GString *str = g_string_new ("");
GSList *list = NULL; GSList *list = NULL;
gchar*arg, *ptr, c; gchar*arg, *ptr;
int c;
list = g_slist_prepend (list, needle); list = g_slist_prepend (list, needle);
@ -307,7 +308,7 @@ update_password (PasswordDialog *pdialog, gchar **msg)
write_to_backend (pdialog, retyped_password); write_to_backend (pdialog, retyped_password);
s = read_from_backend (pdialog, "successfully", "short", "panlindrome", "simple", "similar", "one", "recovered", "unchanged", NULL); s = read_from_backend (pdialog, "successfully", "short", "panlindrome", "simple", "similar", "wrapped", "recovered", "unchanged", NULL);
if (g_strrstr (s, "recovered") != NULL) { if (g_strrstr (s, "recovered") != NULL) {
retcode = -2; retcode = -2;
} else if (g_strrstr (s, "short") != NULL) { } else if (g_strrstr (s, "short") != NULL) {
@ -319,12 +320,9 @@ update_password (PasswordDialog *pdialog, gchar **msg)
} else if (g_strrstr (s, "simple") != NULL) { } else if (g_strrstr (s, "simple") != NULL) {
*msg = g_strdup (_("Password is too simple")); *msg = g_strdup (_("Password is too simple"));
retcode = -3; retcode = -3;
} else if (g_strrstr (s, "similar") != NULL) { } else if ((g_strrstr (s, "similar") != NULL) || (g_strrstr (s, "wrapped") != NULL)) {
*msg = g_strdup (_("Old and new passwords are too similar")); *msg = g_strdup (_("Old and new passwords are too similar"));
retcode = -3; retcode = -3;
} else if (g_strrstr (s, "one") != NULL) {
*msg = g_strdup (_("Old and new password are the same"));
retcode = -3;
} else if (g_strrstr (s, "unchanged") != NULL) { } else if (g_strrstr (s, "unchanged") != NULL) {
kill (pdialog->backend_pid, SIGKILL); kill (pdialog->backend_pid, SIGKILL);
*msg = g_strdup (_("Old and new password are the same")); *msg = g_strdup (_("Old and new password are the same"));
@ -447,7 +445,7 @@ passdlg_check_password (GtkEntry *entry, PasswordDialog *pdialog)
} }
pdialog->check_password_timeout_id = pdialog->check_password_timeout_id =
g_timeout_add (300, (GSourceFunc) passdlg_check_password_timeout_cb, pdialog); g_timeout_add (500, (GSourceFunc) passdlg_check_password_timeout_cb, pdialog);
} }
@ -550,13 +548,10 @@ gnome_about_me_password (GtkWindow *parent)
gtk_widget_show_all (wpassdlg); gtk_widget_show_all (wpassdlg);
retry: do {
result = gtk_dialog_run (GTK_DIALOG (wpassdlg)); result = gtk_dialog_run (GTK_DIALOG (wpassdlg));
result = passdlg_process_response (pdialog, result);
result = passdlg_process_response (pdialog, result); } while (result <= 0);
if (result <= 0)
goto retry;
gtk_widget_destroy (wpassdlg); gtk_widget_destroy (wpassdlg);
g_free (pdialog); g_free (pdialog);

View file

@ -2843,7 +2843,7 @@
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">39</property> <property name="width_chars">50</property>
<property name="single_line_mode">False</property> <property name="single_line_mode">False</property>
<property name="angle">0</property> <property name="angle">0</property>
</widget> </widget>