Commit Graph

13 Commits

Author SHA1 Message Date
Karel Zak 1dbbd85b94 lib/canonicalize: make DM canonicalization more robust
The current code cares about filenames, but it's too fragile, we have
to check the path is really path to the block device.

Addresses: https://github.com/karelzak/util-linux/issues/83
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-20 10:11:57 +02:00
Karel Zak 8a52ef658c lib/canonical: use realpath() from libc
.. after many many years it seems that we can follow libc code rather
than duplicate realpath(3) implementation.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-01 16:13:46 +02:00
Karel Zak 7ba207e781 libmount: be robust for empty target/source strings
* lib/canonicalize.c: don't interpret empty strings as relative paths
 * libmount: more robust libmnt_table find function and debug messages

References: https://bugzilla.novell.com/show_bug.cgi?id=825150
Signed-off-by: Karel Zak <kzak@redhat.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-17 13:02:15 +02:00
Karel Zak b1fa3e2234 lib: use O_CLOEXEC in libcommon
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-03 16:13:06 +02:00
Karel Zak 4e5262e450 lib/canonicalize: don't use /dev/mapper/<name> if the node does not exist
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-03 13:32:39 +02:00
Karel Zak 33c5fd0c5a lib/canonicalize: add canonicalize_path_restricted() to canonicalize without suid permisssions
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-26 16:24:28 +01:00
Karel Zak 225b804b66 Revert "lib/canonicalize: always remove tailing slash"
It's overkill to modify unknown paths in a generic function like
canonicalize_path().

for example:

 mount -t fuse 'sshfs#marty@thee:/' /media/thee

will be canonicalized to

 mount -t fuse 'sshfs#marty@thee:' /media/thee

and this obvious bug.

Reported-by: Martin Panter <vadmium+floss@gmail.com>

This reverts commit 28074a0952.
2012-03-26 10:08:48 +02:00
Karel Zak 28074a0952 lib/canonicalize: always remove tailing slash
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-24 21:26:11 +01:00
Karel Zak 10ee593293 lib: [loopdev.c] add module for work loop devices
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-30 16:37:46 +02:00
Karel Zak 6cfa971e1b lib: add test program to canonicalize.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-25 11:00:15 +02:00
Karel Zak a4a1da09cd build-sys: remove duplicate #includes
$ make checkincludes
fsck/fsck.c: errno.h is included more than once.
lib/canonicalize.c: string.h is included more than once.
shlibs/blkid/src/blkidP.h: stdio.h is included more than once.
shlibs/blkid/src/devname.c: string.h is included more than once.
shlibs/blkid/src/devno.c: string.h is included more than once.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 10:21:05 +01:00
Karel Zak a992137b7b mount: and libblkid: covert /dev/dm-N to /dev/mapper/<name>
* mount(8) uses private device-mapper names in mtab

 * libblkid returns private device-mapper names when evaluate udev
   /dev/disk-by symlinks.

 * on systems where DM is fully integrated with udev the /dev/mapper/<name>
   files are symlinks to /dev/dm-N. It means we need a special care to hide
   private device-mapper names.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-26 13:33:03 +01:00
Karel Zak 74a9c6f7b7 mount: move realpath.c code to lib/
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-11 23:55:51 +01:00