summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
* libmount: update utab after successful extern helper mountKarel Zak2013-11-043-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>
* libmount: allow to use -s (sloppy) for all external helpersKarel Zak2013-11-041-6/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mnt_context_is_child() commentKarel Zak2013-10-111-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: Fix typo in commentNamhyung Kim2013-10-111-2/+2
| | | | | | s/MNT_OMASK_/MNT_OMODE_/ Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* various: fix mixing declarations and code compiler warnings [smatch]Sami Kerola2013-10-082-2/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* COPYING: fix grammar of referring phrase, and indicate location betterBenno Schulenberg2013-10-081-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libmount: remove dead code [coverity scan]Karel Zak2013-10-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: check for mnt_fs_get_tag() return value [coverity scan]Karel Zak2013-10-011-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: make tab parsers more robust [coverity scan]Karel Zak2013-10-011-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make mnt_table_replace_file() more robust [coverity scan]Karel Zak2013-10-011-1/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: Save errno if mkostemp() failedNamhyung Kim2013-09-301-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>
* build-sys: one install dir for all pylibmount stuffKarel Zak2013-09-271-4/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: update docsKarel Zak2013-09-274-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: small cleanup in umount codeKarel Zak2013-09-272-3/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: compose mount.<type> helpers paths more carefullyKarel Zak2013-09-261-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>
* build-sys: add pylibmount __init__.py EXTRA_DISTKarel Zak2013-09-261-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: install to the correct python dirsKarel Zak2013-09-261-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>
* libmount: make mnt_fs_{ap,pre}pend_options() more robustKarel Zak2013-09-261-0/+6
| | | | | | | We should not use the results from mnt_split_optstr() if the function failed. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: Remove stale comment on mnt_context_mount()Namhyung Kim2013-09-261-5/+0Star
| | | | | | | 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>
* libmount: Set each optstr's to NULL if failedNamhyung Kim2013-09-261-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>
* libmount: Free splitted optstr's when error occurredNamhyung Kim2013-09-261-1/+5
| | | | | | When strdup() failed, u, v and f optstr's should be freed. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* libmount: Get rid of an unnecessary checkNamhyung Kim2013-09-261-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>
* pylibmount: rewrite to be py2/py3 universalOndrej Oprala2013-09-208-116/+203
| | | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: support --with-python[={2,3}]Karel Zak2013-09-201-2/+1Star
| | | | | | | | | | | | | | * 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>
* libmount: free username after checkDave Reisner2013-09-201-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>
* libmount: use memmove when overlap possibleDave Reisner2013-09-201-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>
* lib: rename time-util.c to timeutils.c, fix headersKarel Zak2013-09-101-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: move *swith() functions to private librarySami Kerola2013-08-294-36/+2Star
| | | | | | | | 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>
* build-sys: add CFLAGS and LDFLAGS for daemons and shared libsKarel Zak2013-08-271-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>
* pylibmount: improve helps strings formattingKarel Zak2013-08-221-218/+214Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: add debug messagesKarel Zak2013-08-225-6/+114
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup libmnt_fs list after mnt_table_remove_fs()Karel Zak2013-08-222-1/+13
| | | | | | | .. otherwise mnt_free_fs() will try to remove FS from non-existing list. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: use libmount reference countingKarel Zak2013-08-225-26/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counter to libmnt_tableKarel Zak2013-08-2110-50/+100
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counting to libmnt_cacheKarel Zak2013-08-216-30/+70
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counting to libmount_fsKarel Zak2013-08-2110-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>
* pylibmount: remove Context_get_table()Karel Zak2013-08-211-29/+0Star
| | | | | | It's too problematic and too low-level to support it Py binding. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: cleanup cxt usageKarel Zak2013-08-212-73/+15Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add function for context userdataKarel Zak2013-08-214-0/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: remove unnecessary codeKarel Zak2013-08-201-1/+0Star
| | | | | | It's enough to call mnt_free_fs() to remove fs from the table. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_is_empty(), improve table list usageKarel Zak2013-08-205-9/+31
| | | | | | | | Currently you have to use mnt_table_remove_fs() + mnt_free_fs() to destroy the list in the table. This is complicated in same situations. This patch allows to use mnt_free_fs() only. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: coding style changes, don't touch Context() statusKarel Zak2013-08-202-54/+50Star
| | | | | | | It's better to follow libmnt_context status than allow to play any nasty games with this important variables in Python. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: use only public libmount API in tab.cKarel Zak2013-08-201-34/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_{first,last}_fs()Karel Zak2013-08-204-0/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add new function to docsKarel Zak2013-08-201-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_{set,get}_userdata()Karel Zak2013-08-203-0/+36
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_with_comments()Karel Zak2013-08-203-0/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: cleanup *_HELP strings formattingKarel Zak2013-08-201-136/+144
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: use mnt_fs_set_userdata() rather than ->userdataKarel Zak2013-08-201-12/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: fs.c - cleanup, remove libmount private stuffKarel Zak2013-08-201-81/+97
| | | | | | | | * remove unnecessary comments * cleanup up strings format * remove direct access to private libmount stuff Signed-off-by: Karel Zak <kzak@redhat.com>