[nautilus-share] Give full access to the owner if not writable
- From: Chow Loong Jin <ljchow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-share] Give full access to the owner if not writable
- Date: Fri, 8 Jul 2011 12:01:23 +0000 (UTC)
commit 25b64453bcfd719532969a50af833ab55ee6a568
Author: Chow Loong Jin <hyperair ubuntu com>
Date: Fri Jul 8 19:59:09 2011 +0800
Give full access to the owner if not writable
When the "Allow others to create and delete files in this folder" checkbox is
not checked, give full access to the owner, and read access to all others.
src/shares.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/shares.c b/src/shares.c
index f65f78d..bac0d1d 100644
--- a/src/shares.c
+++ b/src/shares.c
@@ -605,6 +605,7 @@ add_share (ShareInfo *info, GError **error)
GError *real_error;
gboolean supports_success;
gboolean supports_guest_ok;
+ gboolean net_usershare_success;
/* g_message ("add_share() start"); */
@@ -626,7 +627,7 @@ 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] = 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 @@ add_share (ShareInfo *info, GError **error)
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]