kudzu patch for "user access" to devices...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This is a small patch for kudzu-0.99.63 (also works on 0.99.52 from
RedHat-7.3), it works well for me under RedHat-7.3 I hope someone else
can test it.

I have rebuild RPM/SRPMS of kudzu for RedHat-7.3 with the patch included, 
they can be found at:
        ftp://osso.univalle.edu.co/pub/jhcaiced/kudzu/

This patch modify updfstab.c to understand a new keyword "user" in the
/etc/updfstab.conf file. When used, this changes the line that is added
to /etc/fstab when updfstab run to specify "user" instead of "owner" e.g.
/dev/sda1        /mnt/camera       auto    noauto,user,kudzu, 0 0

This change, enables normal users to mount/umount the device, I currently 
have two scenarios for using this patch:
- In a server, we want to allow the users to plug/unplug a USB 
  ZipDrive while being able to mount/umount the zip disks without special 
  privileges.
- My desktop is configured to start a remote X session with the server
  (via X -query ....) so I never log in the console of my desktop.
  Now, when I connect a USB device (ZIP or a digital camera), the hotplug
  scripts add a line to /etc/fstab with the "owner" option. Since I haven't
  logged, only "root" can use the devices, the patch allow me to setup
  this so I don't need "root" or sudo access to mount the devices and is
  a little more convenient to me.

Best regards,

--
Jhon H. Caicedo O. <jhcaiced@osso.org.co>
Area de Sistemas/Instrumentacion
Observatorio Sismológico del SurOccidente O.S.S.O
http://www.osso.org.co
Cali - Colombia
--- kudzu-0.99.63/updfstab.c	Sun Apr  7 22:37:01 2002
+++ kudzu-0.99.63-jhc/updfstab.c	Thu Aug  1 10:11:46 2002
@@ -37,6 +37,7 @@
     int defaultPartition;
     struct matchInfo * matches;
     int numMatches;
+    int allowUserAccess;
 };
 
 struct mountInfo {
@@ -658,19 +659,22 @@
 	    }
 	}
 
-	fprintf(output, "%-23s %-23s %-7s %-15s %d %d\n",
+	fprintf(output, "%-23s %-23s %-7s %s,%s,%s,%s %d %d\n",
 		deviceName,
 		addition->mountPoint,
 		!(strcmp(addition->device->type->name, "cdrom") &&
 		  strcmp(addition->device->type->name, "cdwriter") &&
 		  strcmp(addition->device->type->name, "cdrw")) ?
 		"iso9660" : "auto",
+		"noauto",
+		(addition->device->type->allowUserAccess) ? "user" : "owner", 
+		"kudzu",
 		!(strcmp(addition->device->type->name, "cdrom") &&
 		  strcmp(addition->device->type->name, "cdwriter") &&
 		  strcmp(addition->device->type->name, "cdrw")) ?
-		"noauto,owner,kudzu,ro" : "noauto,owner,kudzu",
+		"ro" : "",
 		0, 0);
-    }
+	}
 
     if (!test) {
 	fclose(output);
@@ -828,6 +832,7 @@
     {	"partition",	0,  INTEGER,    NONE  },
     {	"skip",		0,  BOOLEAN,    NONE  },
     {	"symlink",	0,  BOOLEAN,    NONE  },
+    {   "user",     0,  BOOLEAN, NONE  },
     {	"}",		1,  NONE,	NONE  },
 };
 
@@ -847,7 +852,7 @@
     const char ** lineArgv;
     int i, j;
     int intArg1;
-    struct typeInfo defaultStruct = { NULL, 0, 0, 0, 0, NULL, 0 };
+    struct typeInfo defaultStruct = { NULL, 0, 0, 0, 0, NULL, 0, 0 };
     struct typeInfo * item;
 
     if (!defaults) 
@@ -982,6 +987,8 @@
 	    item->skip = intArg1;
 	} else if (!strcmp(lineArgv[0], "symlink")) {
 	    item->makeSymlink = intArg1;
+	} else if (!strcmp(lineArgv[0], "user")) {
+		item->allowUserAccess = intArg1;
 	} else if (!strcmp(lineArgv[0], "device")) {
 	    if (strcmp(lineArgv[2], "{")) {
 		fprintf(stderr, "%s:%d { expected\n", path, line);

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux