im.pidgin.pidgin.2.3.1: 2466eb94c1743869116a509f2dd00b90503cb803

nosnilmot at pidgin.im nosnilmot at pidgin.im
Wed Dec 5 20:35:55 EST 2007


-----------------------------------------------------------------
Revision: 2466eb94c1743869116a509f2dd00b90503cb803
Ancestor: 54a1cdfd1a70da928835d2ca2d37d1519a291334
Author: nosnilmot at pidgin.im
Date: 2007-12-06T01:21:06
Branch: im.pidgin.pidgin.2.3.1

Modified files:
        ChangeLog libpurple/plugins/autoaccept.c

ChangeLog: 

applied changes from 4e3cab31e53166c95ce21536f6ebb84b904f6b58
             through 81a2d60e6ab943bb88178215dd69843570bae655

applied changes from 81a2d60e6ab943bb88178215dd69843570bae655
             through 7e3fbc31d04d03b44eec338a8703cd9329136a9a
Prevent autoaccept plugin overwriting existing files

-------------- next part --------------
============================================================
--- ChangeLog	049828e86206be7a4fb223a9ffc2e8ad6cec644f
+++ ChangeLog	6ead114a0713a7b86a021d2060daf303cc99594a
@@ -20,6 +20,7 @@ version 2.3.1 (12/??/2007):
 	* Do not allow ISON requests to stack in IRC, preventing flooding IRC
 	  servers when temporary network outages are restored
 	* Plug several leaks in the perl plugin loader
+	* Prevent autoaccept plugin overwriting existing files
 
 
 version 2.3.0 (11/24/2007):
============================================================
--- libpurple/plugins/autoaccept.c	135615827fb471bdc49b7e60edd271c4c2bb5134
+++ libpurple/plugins/autoaccept.c	486791f12dfd236428c003df1625e54450573619
@@ -114,22 +114,33 @@ file_recv_request_cb(PurpleXfer *xfer, g
 		case FT_ACCEPT:
 			if (ensure_path_exists(pref))
 			{
-				dirname = g_build_filename(pref, xfer->who, NULL);
+				int count = 1;
+				const char *escape;
+				dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL);
 
 				if (!ensure_path_exists(dirname))
 				{
 					g_free(dirname);
 					break;
 				}
-				
-				filename = g_build_filename(dirname, xfer->filename, NULL);
 
+				escape = purple_escape_filename(xfer->filename);
+				filename = g_build_filename(dirname, escape, NULL);
+
+				/* Make sure the file doesn't exist. Do we want some better checking than this? */
+				while (g_file_test(filename, G_FILE_TEST_EXISTS)) {
+					char *file = g_strdup_printf("%s-%d", escape, count++);
+					g_free(filename);
+					filename = g_build_filename(dirname, file, NULL);
+					g_free(file);
+				}
+
 				purple_xfer_request_accepted(xfer, filename);
 
 				g_free(dirname);
 				g_free(filename);
 			}
-			
+
 			purple_signal_connect(purple_xfers_get_handle(), "file-recv-complete", handle,
 								PURPLE_CALLBACK(auto_accept_complete_cb), xfer);
 			break;


More information about the Commits mailing list