add a mountopt flag for automatically adding uid
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 16 May 2011 00:06:41 +0000 (00:06 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 16 May 2011 00:06:41 +0000 (00:06 +0000)
SVN revision: 59427

legacy/eeze/ChangeLog
legacy/eeze/src/lib/Eeze_Disk.h
legacy/eeze/src/lib/eeze_disk_mount.c
legacy/eeze/src/lib/eeze_disk_private.h

index f4de526..bb855ca 100644 (file)
@@ -1,4 +1,7 @@
 2011-05-15  Mike Blumenkrantz (discomfitor/zmike)
++EEZE_DISK_MOUNTOPT_UID
+Add a uid=%i mount option using getuid, NOT geteuid
+--------------------------------------
 +eeze_disk_mount_wrapper_set
 +eeze_disk_mount_wrapper_get
 Allow use of wrapper exes for mount commands (such as sudo)
index b8d4e6d..c3501c7 100644 (file)
@@ -48,7 +48,8 @@ typedef enum
    EEZE_DISK_MOUNTOPT_UTF8 = (1 << 2),
    EEZE_DISK_MOUNTOPT_NOEXEC = (1 << 3),
    EEZE_DISK_MOUNTOPT_NOSUID = (1 << 4),
-   EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5)
+   EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5),
+   EEZE_DISK_MOUNTOPT_UID = (1 << 6) /**< use current user's uid */
 } Eeze_Mount_Opts;
 
 
index f72b6ff..63a46ce 100644 (file)
@@ -2,6 +2,8 @@
 #include "config.h"
 #endif
 
+#include <unistd.h>
+
 #include <Ecore.h>
 #include <Eeze.h>
 #include <Eeze_Disk.h>
@@ -154,6 +156,8 @@ eeze_disk_mountopts_set(Eeze_Disk *disk, unsigned long opts)
    if (opts != disk->mount_opts)
      disk->mount_cmd_changed = EINA_TRUE;
    disk->mount_opts = opts;
+   if (opts & EEZE_DISK_MOUNTOPT_UID)
+     disk->uid = getuid();
    return EINA_TRUE;
 }
 
@@ -265,6 +269,8 @@ eeze_disk_mount(Eeze_Disk *disk)
                eina_strbuf_append(disk->mount_cmd, "nosuid,");
              if (disk->mount_opts & EEZE_DISK_MOUNTOPT_REMOUNT)
                eina_strbuf_append(disk->mount_cmd, "remount,");
+             if (disk->mount_opts & EEZE_DISK_MOUNTOPT_UID)
+               eina_strbuf_append_printf(disk->mount_cmd, "uid=%i,", (int)disk->uid);
              eina_strbuf_append_printf(disk->mount_cmd, " UUID=%s %s", disk->cache.uuid, disk->mount_point);
           }
         disk->mount_cmd_changed = EINA_FALSE;
index 0c5b972..1959348 100644 (file)
@@ -55,6 +55,7 @@ struct _Eeze_Disk
    const char *mount_point;
    const char *mount_wrapper;
    unsigned long mount_opts;
+   uid_t uid;
 
    struct
      {