Hi Frank,
Sorry for not looking into this earlier.
Attached is a new patch on latest eject-2.1.5+deb1+cvs20081104-13 version.
Please let me know if you find any issues with this one.

Thanks,
Bhushan
________________________________________
From: Frank Lichtenheld [fr...@lichtenheld.de]
Sent: Sunday, December 23, 2012 3:19 PM
To: Bhushan Jain; 695...@bugs.debian.org
Subject: Re: Bug#695504: eject: Avoid setuid to root for dmcrypt-get-device

Control: tags -1 = moreinfo

On Mon, Dec 10, 2012 at 12:16:46AM +0000, Bhushan Jain wrote:
> Hi Frank,
> Attached is the patch integrating dmcrypt-get-device functionality with code 
> in eject.c.
> Please let me know if you have any comments or suggestions on the patch.
> I have created this patch over the latest eject_2.1.5+deb1+cvs20081104-12 
> version.

Hi.

I finally managed to test your patch but it didn't work for me. Two reasons:

1) a simple coding error:

+               sprintf(filename,"/sys/block/%s/dm/name",ent->d_name);
+               file = fopen(filename,"r");
+               if(fgets(name, sizeof(name), file) == 0)
+               {
[...]
+               }
+               FCLOSE(file);
+            /* Read the major:minor number for given device */
+               if(!strcmp(name,dev + devmapperlen))

This is never true. The string read by fgets (i.e. name) contains a trailing 
newline.
dev does not. So the two strings never match.

+               {

2) but more importantly reading the major:minor from "dev" also doesn't work.

+                       sprintf(filename,"/sys/block/%s/dev",ent->d_name);
+                       file = fopen(filename,"r");

At least on my system this file always contains 254:0, not the major:minor of
the underlying device (which should be something like 8:XX usually). Does
this really work on your system?

The underlying device seems to be available in the /sys/block/dm-X/slaves/
folder though. Maybe we could read it from there?

Cheers,
  Frank


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to