file-roller r2235 - in branches/gnome-2-22: . src



Author: paobac
Date: Sun Apr 13 11:29:37 2008
New Revision: 2235
URL: http://svn.gnome.org/viewvc/file-roller?rev=2235&view=rev

Log:
2008-04-13  Paolo Bacchilega  <paobac svn gnome org>

	* src/fr-command-zip.c (add_password_arg): 
	* src/fr-command-rar.c (add_password_arg): quote the whole password 
	option usgin g_shell_quote.
	
	Fixes bug #523158 â exclamation mark in passwords

Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/src/fr-command-rar.c
   branches/gnome-2-22/src/fr-command-zip.c

Modified: branches/gnome-2-22/src/fr-command-rar.c
==============================================================================
--- branches/gnome-2-22/src/fr-command-rar.c	(original)
+++ branches/gnome-2-22/src/fr-command-rar.c	Sun Apr 13 11:29:37 2008
@@ -178,17 +178,16 @@
 		  const char	*password,
 		  gboolean	disable_query)
 {
-	if (password != NULL && password[0] != '\0') {
-		char *arg, *e_password;
+	if ((password != NULL) && (password[0] != '\0')) {
+		char *arg;
+		char *quoted_arg;
+		
+		arg = g_strdup_printf ("-p%s", password);
+		quoted_arg = g_shell_quote (arg);
 
-		e_password = escape_str (password, "\"*?[]'`()$!;");
-		g_assert (e_password != NULL);  /* since password is non-NULL */
+		fr_process_add_arg (comm->process, quoted_arg);
 
-		arg = g_strconcat ("-p\"", e_password, "\"", NULL);
-
-		fr_process_add_arg (comm->process, arg);
-
-		g_free (e_password);
+		g_free (quoted_arg);
 		g_free (arg);
 	} 
 	else if (disable_query)

Modified: branches/gnome-2-22/src/fr-command-zip.c
==============================================================================
--- branches/gnome-2-22/src/fr-command-zip.c	(original)
+++ branches/gnome-2-22/src/fr-command-zip.c	Sun Apr 13 11:29:37 2008
@@ -222,20 +222,16 @@
 		  const char    *password,
 		  gboolean       always_specify)
 {
-	if (always_specify || ((password != NULL) && (*password != 0))) {
+	if (always_specify || ((password != NULL) && (password[0] != '\0'))) {
 		char *arg;
-		char *e_password;
+		char *quoted_arg;
+		
+		arg = g_strdup_printf ("-P %s", password);
+		quoted_arg = g_shell_quote (arg);
 
-		fr_process_add_arg (comm->process, "-P");
+		fr_process_add_arg (comm->process, quoted_arg);
 
-		e_password = escape_str (password, "\"*?[]'`()$!;");
-		if (e_password != NULL) {
-			arg = g_strconcat ("\"", e_password, "\"", NULL);
-			g_free (e_password);
-		} else
-			arg = g_strdup ("\"\"");
-
-		fr_process_add_arg (comm->process, arg);
+		g_free (quoted_arg);
 		g_free (arg);
 	}
 }



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