[grisbi-cvs] [SCM] grisbi branch, master, updated. a076c42bb51d9d5336f473dfbe5353595444b580
Pierre Biava
nobody at users.sourceforge.net
Sun Jun 27 21:13:25 CEST 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, master has been updated
via a076c42bb51d9d5336f473dfbe5353595444b580 (commit)
via 364ba0a43ffae92b179e8ce5b8febb78023635ec (commit)
from 4024100675ca8dbe4ed04a9375dac63cb2e738ea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a076c42bb51d9d5336f473dfbe5353595444b580
Author: pbiava <pierre.biava at nerim.net>
Date: Sun Jun 27 20:55:19 2010 +0200
fixes a crash of grisbi with a new transaction in a new file.
commit 364ba0a43ffae92b179e8ce5b8febb78023635ec
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Jun 26 18:00:30 2010 +0200
Add a test on the length of the password
-----------------------------------------------------------------------
Changes:
diff --git a/po/fr.po b/po/fr.po
index cbf8956..8e1b8c3 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -9965,7 +9965,7 @@ msgid ""
"Please recompile Grisbi with OpenSSL encryption enabled."
msgstr ""
"Cette version compilée de Grisbi ne gère pas le cryptage.\n"
-"Veuillez recompiler Grisbi avec le cryptage OpenSSL d'activé."
+"Veuillez recompiler Grisbi avec le cryptage OpenSSL activé."
#: ../src/plugins/openssl/openssl.c:194
#, c-format
diff --git a/src/gtk_combofix.c b/src/gtk_combofix.c
index 1dc4991..30449a9 100644
--- a/src/gtk_combofix.c
+++ b/src/gtk_combofix.c
@@ -198,7 +198,7 @@ const gchar *gtk_combofix_get_text ( GtkComboFix *combofix )
g_return_val_if_fail (combofix , NULL);
g_return_val_if_fail (GTK_IS_COMBOFIX (combofix), NULL);
- return ( gtk_entry_get_text ( GTK_ENTRY (combofix->entry)));
+ return ( gtk_entry_get_text ( GTK_ENTRY ( combofix -> entry ) ) );
}
@@ -441,15 +441,17 @@ gboolean gtk_combofix_set_list ( GtkComboFix *combofix, GSList *list )
* */
void gtk_combofix_append_text ( GtkComboFix *combofix, const gchar *text )
{
- GtkComboFixPrivate *priv = combofix -> priv;
+ GtkComboFixPrivate *priv;
gchar **tab_char;
gint empty;
- gpointer pointers[3] = { ( gpointer ) text, NULL, GINT_TO_POINTER ( priv -> case_sensitive ) };
+ gpointer pointers[3] = { ( gpointer ) text, NULL, NULL };
g_return_if_fail ( combofix );
g_return_if_fail ( GTK_IS_COMBOFIX ( combofix ) );
//~ g_print ("gtk_combofix_append_text = %s\n", text );
+ priv = combofix -> priv;
+ pointers[2] = GINT_TO_POINTER ( priv -> case_sensitive );
empty = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( combofix -> entry ), "empty" ) );
if ( empty || priv -> force )
@@ -550,8 +552,8 @@ void gtk_combofix_remove_text ( GtkComboFix *combofix, const gchar *text )
* \return
* */
void gtk_combofix_set_selection_callback ( GtkComboFix *combofix,
- GCallback func,
- gpointer data )
+ GCallback func,
+ gpointer data )
{
GtkComboFixPrivate *priv = combofix -> priv;
@@ -1934,21 +1936,28 @@ static gint gtk_combofix_default_sort_func ( GtkTreeModel *model_sort,
gboolean separator_1;
gboolean separator_2;
- gtk_tree_model_get ( GTK_TREE_MODEL (model_sort),
- iter_1,
- COMBOFIX_COL_LIST_NUMBER, &list_number_1,
- COMBOFIX_COL_VISIBLE_STRING, &string_1,
- COMBOFIX_COL_SEPARATOR, &separator_1,
- -1 );
- gtk_tree_model_get ( GTK_TREE_MODEL (model_sort),
- iter_2,
- COMBOFIX_COL_LIST_NUMBER, &list_number_2,
- COMBOFIX_COL_VISIBLE_STRING, &string_2,
- COMBOFIX_COL_SEPARATOR, &separator_2,
- -1 );
+ if ( iter_1 )
+ gtk_tree_model_get ( GTK_TREE_MODEL (model_sort),
+ iter_1,
+ COMBOFIX_COL_LIST_NUMBER, &list_number_1,
+ COMBOFIX_COL_VISIBLE_STRING, &string_1,
+ COMBOFIX_COL_SEPARATOR, &separator_1,
+ -1 );
+ else
+ return -1;
+
+ if ( iter_2 )
+ gtk_tree_model_get ( GTK_TREE_MODEL (model_sort),
+ iter_2,
+ COMBOFIX_COL_LIST_NUMBER, &list_number_2,
+ COMBOFIX_COL_VISIBLE_STRING, &string_2,
+ COMBOFIX_COL_SEPARATOR, &separator_2,
+ -1 );
+ else
+ return 1;
if ( priv -> mixed_sort == FALSE )
- return_value = list_number_1 - list_number_2;
+ return_value = list_number_1 - list_number_2;
if ( return_value == 0 )
{
diff --git a/src/gtk_combofix.h b/src/gtk_combofix.h
index 8e07efe..75bf5f6 100644
--- a/src/gtk_combofix.h
+++ b/src/gtk_combofix.h
@@ -76,7 +76,7 @@ void gtk_combofix_set_mixed_sort ( GtkComboFix *combofix, gboolean mixed_sort );
/* set callback */
void gtk_combofix_set_selection_callback ( GtkComboFix *combofix,
- GCallback func,
- gpointer data );
+ GCallback func,
+ gpointer data );
-#endif /* __GTK_COMBOFIX_H__ */
+#endif /* __GTK_COMBOFIX_H__ */
diff --git a/src/plugins/openssl/openssl.c b/src/plugins/openssl/openssl.c
index 0dded1a..13a54a3 100644
--- a/src/plugins/openssl/openssl.c
+++ b/src/plugins/openssl/openssl.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
-/* Copyright (C) 2006 Benjamin Drieu (bdrieu at april.org) */
-/* http://www.grisbi.org */
+/* Copyright (C) 2006 Benjamin Drieu (bdrieu at april.org) */
+/* http://www.grisbi.org */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
@@ -48,9 +48,9 @@ SYMBOL_IMPORT GtkWidget *window;
#ifndef NOSSL
/*START_STATIC*/
static gchar *gsb_file_util_ask_for_crypt_key ( gchar * file_name, gchar * additional_message,
- gboolean encrypt );
+ gboolean encrypt );
static gulong gsb_file_util_crypt_file ( gchar * file_name, gchar **file_content,
- gboolean crypt, gulong length );
+ gboolean crypt, gulong length );
/*END_STATIC*/
#endif
@@ -69,7 +69,7 @@ gchar *crypt_key;
* \return the length of the new file_content or 0 if problem
*/
gulong gsb_file_util_crypt_file ( gchar * file_name, gchar **file_content,
- gboolean crypt, gulong length )
+ gboolean crypt, gulong length )
{
#ifndef NOSSL
gchar * key, * message = "";
@@ -210,18 +210,18 @@ return_bad_password:
* cancelled. */
#ifndef NOSSL
gchar *gsb_file_util_ask_for_crypt_key ( gchar * file_name, gchar * additional_message,
- gboolean encrypt )
+ gboolean encrypt )
{
gchar *key = NULL;
GtkWidget *dialog, *button, *label, *entry, *hbox, *hbox2, *vbox, *icon;
gint result;
dialog = gtk_dialog_new_with_buttons ( _("Grisbi password"),
- GTK_WINDOW ( window ),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- ( encrypt ? _("Crypt file") : _("Decrypt file") ), GTK_RESPONSE_OK,
- NULL );
+ GTK_WINDOW ( window ),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ ( encrypt ? _("Crypt file") : _("Decrypt file") ), GTK_RESPONSE_OK,
+ NULL );
gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
gtk_window_set_resizable ( GTK_WINDOW ( dialog ), FALSE );
@@ -234,7 +234,7 @@ gchar *gsb_file_util_ask_for_crypt_key ( gchar * file_name, gchar * additional_m
vbox = gtk_vbox_new ( FALSE, 6 );
gtk_box_pack_start ( GTK_BOX ( hbox ), vbox, FALSE, FALSE, 6 );
icon = gtk_image_new_from_stock ( GTK_STOCK_DIALOG_AUTHENTICATION,
- GTK_ICON_SIZE_DIALOG );
+ GTK_ICON_SIZE_DIALOG );
gtk_box_pack_start ( GTK_BOX ( vbox ), icon, FALSE, FALSE, 6 );
vbox = gtk_vbox_new ( FALSE, 6 );
@@ -246,24 +246,24 @@ gchar *gsb_file_util_ask_for_crypt_key ( gchar * file_name, gchar * additional_m
gtk_label_set_line_wrap ( GTK_LABEL(label), TRUE );
if ( encrypt )
- gtk_label_set_markup ( GTK_LABEL (label),
- g_strdup_printf (
- _( "%sPlease enter password to encrypt file\n<span "
- "foreground=\"blue\">%s</span>" ),
- additional_message, file_name ) );
+ gtk_label_set_markup ( GTK_LABEL (label),
+ g_strdup_printf (
+ _( "%sPlease enter password to encrypt file\n<span "
+ "foreground=\"blue\">%s</span>" ),
+ additional_message, file_name ) );
else
- gtk_label_set_markup ( GTK_LABEL (label),
- g_strdup_printf (
- _( "%sPlease enter password to decrypt file\n<span "
- "foreground=\"blue\">%s</span>" ),
- additional_message, file_name ) );
+ gtk_label_set_markup ( GTK_LABEL (label),
+ g_strdup_printf (
+ _( "%sPlease enter password to decrypt file\n<span "
+ "foreground=\"blue\">%s</span>" ),
+ additional_message, file_name ) );
gtk_box_pack_start ( GTK_BOX ( vbox ), label, FALSE, FALSE, 6 );
hbox2 = gtk_hbox_new ( FALSE, 6 );
gtk_box_pack_start ( GTK_BOX ( vbox ), hbox2, FALSE, FALSE, 6 );
gtk_box_pack_start ( GTK_BOX ( hbox2 ),
- gtk_label_new ( COLON(_("Password")) ),
- FALSE, FALSE, 0 );
+ gtk_label_new ( COLON(_("Password")) ),
+ FALSE, FALSE, 0 );
entry = gtk_entry_new ();
gtk_entry_set_activates_default ( GTK_ENTRY ( entry ), TRUE );
@@ -275,25 +275,34 @@ gchar *gsb_file_util_ask_for_crypt_key ( gchar * file_name, gchar * additional_m
gtk_box_pack_start ( GTK_BOX ( vbox ), button, FALSE, FALSE, 5 );
gtk_widget_show_all ( dialog );
+
+return_bad_password:
result = gtk_dialog_run ( GTK_DIALOG ( dialog ));
switch (result)
{
- case GTK_RESPONSE_OK:
+ case GTK_RESPONSE_OK:
+
+ key = g_strdup (gtk_entry_get_text ( GTK_ENTRY ( entry )));
- key = g_strdup (gtk_entry_get_text ( GTK_ENTRY ( entry )));
+ if (!strlen ( key ) )
+ key = NULL;
+ else if ( g_utf8_strlen ( key, -1 ) < 7 )
+ {
+ dialogue_warning_hint ( _("The password must contain at least 7 characters"),
+ _("Password too short" ) );
+ goto return_bad_password;
+ }
- if (!strlen (key))
- key = NULL;
- if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( button )))
- crypt_key = key;
- else
- crypt_key = NULL;
- break;
+ if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( button )))
+ crypt_key = key;
+ else
+ crypt_key = NULL;
+ break;
- case GTK_RESPONSE_CANCEL:
- key = NULL;
+ case GTK_RESPONSE_CANCEL:
+ key = NULL;
}
gtk_widget_destroy ( dialog );
@@ -319,7 +328,7 @@ G_MODULE_EXPORT extern void openssl_plugin_register ()
/** Main function of module. */
G_MODULE_EXPORT extern gint openssl_plugin_run ( gchar * file_name, gchar **file_content,
- gboolean crypt, gulong length )
+ gboolean crypt, gulong length )
{
return gsb_file_util_crypt_file ( file_name, file_content, crypt, length );
}
hooks/post-receive
--
grisbi
More information about the cvs
mailing list