summaryrefslogtreecommitdiff
path: root/libmount
AgeCommit message (Collapse)AuthorFilesLines
2014-01-24include/c.h: prefer nanosleep() over usleep()Karel Zak1-2/+2
Let's use nanosleep() although if usleep() exists. The nanosleep function does no interact with signals and other timers. The patch introduces xusleep() as replacement to libc (or our fallback) usleep(). Yes, we don't want to use struct timespec + nanosleep() everywhere in code as nano-time resolution is useless for us. The patch also enlarges delays in some busy wait loops. It seems enough to try read/write 4x per second. Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-14libmount: fix scanf format string [coverity scan]Karel Zak1-4/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-14pylibmount: import directly from pylibmount in testsKarel Zak3-3/+9
This change does not have any impact to in a standard way installed libmount impact. It's simplification for in-tree tests. Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-14pylibmount: remove unncessary subdirectoryKarel Zak2-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-11libmount: add mnt_table_uniq_fs()Karel Zak4-14/+158
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-10libmount: add efivarfs to the list of pseudo filesystemsKarel Zak1-1/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-02pylibmount: correctly import from pylibmount.soDave Reisner1-1/+1
Without this, python is unable to find the module: $ python -c 'import libmount' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.3/site-packages/libmount/__init__.py", line 1, in <module> from pylibmount import * ImportError: No module named 'pylibmount' Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-11-19libmount: add mnt_tag_is_valid()Karel Zak4-0/+23
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-12libmount: cleanup fix_optstr() regards to selinux and smackKarel Zak1-19/+47
It's better (more robust) to make the code based on datetypes rather than on if(strcmp(...)). Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-12libmount: fix typo in smack pathKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-12libmount: remove smackfs* option when SMACK not enabledKarel Zak1-0/+22
If there is no /sys/fs/smackfs then libmount removes smackfs*= mount options when compiled --with-smack. Note that we do the same for SELinux. References: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg13740.html Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-08strutils: add skip_space() functionOndrej Oprala1-13/+4
[kzak@redhat.com: - add also skip_blank(), - remove duplicate implementation from libmount] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-04libmount: update utab after successful extern helper mountKarel Zak3-10/+84
This patch allows to maintain private utab libmount file also for external mount/umount helpers that are not linked with libmount. The libmount check if utab has been updated after successful extern helper execution (status=0). If not then the file is updated. This patch affects only 'user' fstab mount option. So, for example with suid mount.cifs you can use: //server/foo /mnt cifs username=foo,noauto,user Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-04libmount: allow to use -s (sloppy) for all external helpersKarel Zak1-6/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-11libmount: fix mnt_context_is_child() commentKarel Zak1-1/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-11libmount: Fix typo in commentNamhyung Kim1-2/+2
s/MNT_OMASK_/MNT_OMODE_/ Signed-off-by: Namhyung Kim <namhyung@gmail.com>
2013-10-08various: fix mixing declarations and code compiler warnings [smatch]Sami Kerola2-2/+4
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-10-08COPYING: fix grammar of referring phrase, and indicate location betterBenno Schulenberg1-2/+2
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-01libmount: remove dead code [coverity scan]Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-01pylibmount: check for mnt_fs_get_tag() return value [coverity scan]Karel Zak1-1/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-01pylibmount: make tab parsers more robust [coverity scan]Karel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-01libmount: make mnt_table_replace_file() more robust [coverity scan]Karel Zak1-1/+13
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-30libmount: Save errno if mkostemp() failedNamhyung Kim1-1/+3
After mkostemp() failed, umask() and free() might alter the errno to another value. Not sure those calls really changes the errno or not. But let's be more conservative. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
2013-09-27build-sys: one install dir for all pylibmount stuffKarel Zak1-4/+6
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-27libmount: update docsKarel Zak4-7/+7
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-27libmount: small cleanup in umount codeKarel Zak2-3/+6
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-26libmount: compose mount.<type> helpers paths more carefullyKarel Zak1-0/+1
The [u]mount helper path is "/sbin/mount.<type>", the <type> should not be possible to interpret like a path, for example: # mkdir /sbin/mount.fake # mount -t fake/../../../home/user/foo.sh Anyway, this is *not mount(8) security issue*, because: - non-root users don't have permissions to specify -t on mount(8) command line - /sbin is not writable for regular users This patch makes libmount more robust for situations when the library is used by incompetent developers who don't sanitize user's input. Reported-by: "Horsfall, Matthew" <mhorsfal@akamai.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-26build-sys: add pylibmount __init__.py EXTRA_DISTKarel Zak1-0/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-26build-sys: install to the correct python dirsKarel Zak1-1/+3
It seems we have to call AM_PATH_PYTHON() monster to get pyexec (shared libs) and python (scripts) directories. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-26libmount: make mnt_fs_{ap,pre}pend_options() more robustKarel Zak1-0/+6
We should not use the results from mnt_split_optstr() if the function failed. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-26libmount: Remove stale comment on mnt_context_mount()Namhyung Kim1-5/+0
The commit f9906424 ("libmount: add post-mount checks to detect ro/rw") added necessary check so the comment is not valid anymore. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
2013-09-26libmount: Set each optstr's to NULL if failedNamhyung Kim1-3/+9
When mnt_split_optstr() failed in the middle, vfs, fs, user optstr's are freed but not reset. It can lead to double frees at the end of mnt_fs_{ap,pre}pend_options(). Signed-off-by: Namhyung Kim <namhyung@gmail.com>
2013-09-26libmount: Free splitted optstr's when error occurredNamhyung Kim1-1/+5
When strdup() failed, u, v and f optstr's should be freed. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
2013-09-26libmount: Get rid of an unnecessary checkNamhyung Kim1-1/+1
libmount_debug_mask was OR'ed to MNT_DEBUG_INIT so it should be non-null. Thus the check is pointless. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
2013-09-20pylibmount: rewrite to be py2/py3 universalOndrej Oprala8-116/+203
Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-20build-sys: support --with-python[={2,3}]Karel Zak1-2/+1
* we use pkg-config to get CGLAGS and LIBS, use package specific config (e.g. python-config) is non-sense. * default is to follow distribution and use pkg-config module name "python". This is probably symlink to python2.pc or python3.pc. * --with-python=2 forces to pkg-module "python2 >= 2" * --with-python=3 forces to pkg-module "python3 >= 3" Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-20libmount: free username after checkDave Reisner1-0/+2
Leak reported by valgrind: ==14226== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==14226== at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14226== by 0x5534839: strdup (in /usr/lib/libc-2.18.so) ==14226== by 0x4E53FE0: mnt_get_username (utils.c:560) ==14226== by 0x4E456A5: mnt_context_prepare_umount (context_umount.c:413) ==14226== by 0x4E464F7: mnt_context_umount (context_umount.c:851) ==14226== by 0x403476: umount_one (umount.c:299) ==14226== by 0x402B34: main (umount.c:629) Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-09-20libmount: use memmove when overlap possibleDave Reisner1-1/+1
When unmounting some mountpoints as an unprivileged user (via the 'user' option in fstab), the umount fails. Debug output of 'umount /opt' reveals: 17760: libmount: CXT: [0x22890e0]: do umount 17760: libmount: UTILS: moving to /opt parent 17760: libmount: CXT: current directory moved to / [last_component='opt'] 17760: libmount: CXT: [0x22890e0]: umount(2) [target='pt', flags=0x00000000] valgrind shows the problem: ==23544== Source and destination overlap in memcpy(0x58d1370, 0x58d1371, 4) ==23544== at 0x4C2BBC3: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==23544== by 0x4E537C3: mnt_chdir_to_parent (utils.c:168) ==23544== by 0x4E45E4C: mnt_context_do_umount (context_umount.c:601) ==23544== by 0x4E46513: mnt_context_umount (context_umount.c:855) ==23544== by 0x403476: umount_one (umount.c:299) ==23544== by 0x402B34: main (umount.c:629) ==23544== ref: https://bugs.archlinux.org/task/36968 Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-09-10lib: rename time-util.c to timeutils.c, fix headersKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-29lib/strutils: move *swith() functions to private librarySami Kerola4-36/+2
Avoid code dublication in libmount and time-util. Proposed-by: Karel Zak <kzak@redhat.com> Reference: http://markmail.org/message/h7zexvqsieqngtmx Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-27build-sys: add CFLAGS and LDFLAGS for daemons and shared libsKarel Zak1-0/+2
This is necessary for paranoid security guys who believe that things like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the world a safer place... Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-22pylibmount: improve helps strings formattingKarel Zak1-218/+214
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-22pylibmount: add debug messagesKarel Zak5-6/+114
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-22libmount: cleanup libmnt_fs list after mnt_table_remove_fs()Karel Zak2-1/+13
.. otherwise mnt_free_fs() will try to remove FS from non-existing list. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-22pylibmount: use libmount reference countingKarel Zak5-26/+33
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21libmount: add reference counter to libmnt_tableKarel Zak10-50/+100
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21libmount: add reference counting to libmnt_cacheKarel Zak6-30/+70
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21libmount: add reference counting to libmount_fsKarel Zak10-41/+115
* mnt_new_fs() returns object with refcount=1 * mnt_free_fs() does not care about reference counter * new functions mnt_ref_fs() and mnt_unref_fs() * mnt_table_add_fs() and mnt_table_rem_fs() uses reference counter * libmmnt_context uses reference counter for internal FS (as it could be shared outside the context) * backwardly incompatible change: - FS could be deallocated after mnt_table_remove_fs() * it's recommended to use mnt_unref_fs() after mnt_table_add_fs() Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21pylibmount: remove Context_get_table()Karel Zak1-29/+0
It's too problematic and too low-level to support it Py binding. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21pylibmount: cleanup cxt usageKarel Zak2-73/+15
Signed-off-by: Karel Zak <kzak@redhat.com>