[nautilus-share] Do not always require go+rx permissions
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-share] Do not always require go+rx permissions
- Date: Tue, 21 Jul 2009 23:54:05 +0000 (UTC)
commit ec44b17aaf3bd914187ad95c9edc13e3c5a78ae0
Author: Chow Loong Jin <hyperair gmail com>
Date: Thu Jul 2 16:13:15 2009 +0800
Do not always require go+rx permissions
Samba does not appear to require usershares to have go+rx permissions. This
commit changes nautilus-share's behaviour to only require go+rx permissions if
guest access is enabled for the share.
src/nautilus-share.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-share.c b/src/nautilus-share.c
index e26eae3..783707c 100644
--- a/src/nautilus-share.c
+++ b/src/nautilus-share.c
@@ -57,9 +57,9 @@
#include "shares.h"
-#define NEED_ALWAYS_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* all usershares need go+rx */
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH) /* writable usershares need go+w additionally*/
-#define NEED_ALL_MASK (NEED_ALWAYS_MASK | NEED_IF_WRITABLE_MASK)
+#define NEED_ALL_MASK (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
static GObjectClass *parent_class;
@@ -323,7 +323,7 @@ typedef enum {
} ConfirmPermissionsStatus;
static ConfirmPermissionsStatus
-confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean is_writable)
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
{
struct stat st;
mode_t mode, new_mode, need_mask;
@@ -334,9 +334,10 @@ confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_sh
if (stat (path, &st) != 0)
return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
- mode = st.st_mode;
- new_mode = mode | NEED_ALWAYS_MASK;
+ new_mode = mode = st.st_mode;
+ if (guest_ok)
+ new_mode |= NEED_IF_GUESTOK_MASK;
if (is_writable)
new_mode |= NEED_IF_WRITABLE_MASK;
@@ -390,7 +391,7 @@ property_page_commit (PropertyPage *page)
if (is_shared && page->was_writable && !share_info.is_writable)
restore_write_permissions (page->path);
- status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.is_writable);
+ status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
if (status == CONFIRM_CANCEL_OR_ERROR)
return FALSE; /* the user didn't want us to change his folder's permissions */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]