# Description: Grant full access to creator of share
# Origin: vendor
# Author: Chow Loong Jin <hyperair@ubuntu.com>
# Forwarded: no
# Bug-Ubuntu: https://bugs.launchpad.net/bugs/480316
Index: nautilus-share/src/shares.c
===================================================================
--- nautilus-share.orig/src/shares.c	2009-12-15 19:19:37.381682791 +0800
+++ nautilus-share/src/shares.c	2009-12-15 19:19:52.489203930 +0800
@@ -605,6 +605,7 @@
 	GError *real_error;
 	gboolean supports_success;
 	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
 
 	/*	g_message ("add_share() start"); */
 
@@ -626,7 +627,7 @@
 	argv[2] = info->share_name;
 	argv[3] = info->path;
 	argv[4] = info->comment;
-	argv[5] = info->is_writable ? "Everyone:F" : "Everyone:R";
+	argv[5] = info->is_writable ? "Everyone:F" : 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";
@@ -635,7 +636,10 @@
 		argc = 6;
 
 	real_error = NULL;
-	if (!net_usershare_run (argc, argv, &key_file, &real_error)) {
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
 		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
 		g_propagate_error (error, real_error);
 		return FALSE;
