[Xfce4-commits] <thunar-shares-plugin:master> Changes arround writables shares, and user permissions when creating a new share

Daniel Morales noreply at xfce.org
Tue Jan 26 05:24:05 CET 2010


Updating branch refs/heads/master
         to 57a40cdbf9d0fe5c6ce702dac94b7d1438c90801 (commit)
       from 7cc34b5f09e18ad024d11bef72fa1359beeb4934 (commit)

commit 57a40cdbf9d0fe5c6ce702dac94b7d1438c90801
Author: Daniel Morales <daniel at daniel.com.uy>
Date:   Tue Jan 26 02:19:46 2010 -0200

    Changes arround writables shares, and user permissions when creating a new share

 libshares/shares.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/libshares/shares.c b/libshares/shares.c
index b771e8f..6aa5bf1 100644
--- a/libshares/shares.c
+++ b/libshares/shares.c
@@ -690,6 +690,8 @@ add_share (ShareInfo *info, GError **error)
 	GError *real_error;
 	gboolean supports_success;
 	gboolean supports_guest_ok;
+        gboolean net_success;
+
 #ifdef G_ENABLE_DEBUG
 	g_message ("add_share() start");
 #endif
@@ -713,7 +715,13 @@ add_share (ShareInfo *info, GError **error)
 	argv[2] = info->share_name;
 	argv[3] = info->path;
 	argv[4] = info->comment;
-	argv[5] = info->is_writable ? "Everyone:F" : "Everyone:R";
+	argv[5] = "Everyone:F";
+
+	if (info->is_writable)
+	{
+		/* Review: Maye set Everyone:R when is guest_ok (?) */
+		argv[5] = g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+	}
 
 	if (supports_guest_ok) {
 		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
@@ -722,7 +730,13 @@ add_share (ShareInfo *info, GError **error)
 		argc = 6;
 
 	real_error = NULL;
-	if (!net_usershare_run (argc, argv, &key_file, &real_error)) {
+
+	net_success = net_usershare_run (argc, argv, &key_file, &real_error);
+
+	if (info->is_writable) g_free (argv[5]);
+
+	if (!net_success)
+	{
 #ifdef G_ENABLE_DEBUG
 		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
 #endif



More information about the Xfce4-commits mailing list