pidgin: c90b505e: Check file permissions before sending a ...

qulogic at pidgin.im qulogic at pidgin.im
Wed Dec 23 03:47:27 EST 2009


-----------------------------------------------------------------
Revision: c90b505ebd09e2e000ae0d20de84ffd837de2206
Ancestor: 47dce238cde8f3b3ca9141a97caa4ca1ad5378f8
Author: qulogic at pidgin.im
Date: 2009-12-23T05:50:48
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c90b505ebd09e2e000ae0d20de84ffd837de2206

Modified files:
        libpurple/ft.c

ChangeLog: 

Check file permissions before sending a file transfer request.

Closes #1944.

-------------- next part --------------
============================================================
--- libpurple/ft.c	eb31098f7f52ccd0df1ee19b298328daf44be937
+++ libpurple/ft.c	916a98c588f9e4b5aa84645d146567e81f90c84b
@@ -328,6 +328,23 @@ purple_xfer_choose_file_ok_cb(void *user
 		g_free(msg);
 		purple_xfer_request_denied(xfer);
 	}
+	else if (type == PURPLE_XFER_SEND) {
+#ifndef _WIN32
+		int mode = R_OK;
+#else
+		int mode = F_OK;
+#endif
+
+		if (g_access(filename, mode) == 0) {
+			purple_xfer_request_accepted(xfer, filename);
+		} else {
+			purple_xfer_ref(xfer);
+			purple_notify_message(
+				NULL, PURPLE_NOTIFY_MSG_ERROR, NULL,
+				_("File is not readable."), NULL,
+				(PurpleNotifyCloseCallback)purple_xfer_choose_file, xfer);
+		}
+	}
 	else {
 		purple_xfer_request_accepted(xfer, filename);
 	}


More information about the Commits mailing list