summaryrefslogtreecommitdiff
path: root/mtab.c
AgeCommit message (Collapse)AuthorFilesLines
2014-12-08mtab.c: include <paths.h> for _PATH_MOUNTEDFelix Janda1-0/+1
Signed-off-by: Felix Janda <felix.janda@posteo.de>
2013-07-18cifs-utils: fix some sparse warningsJeff Layton1-1/+1
Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-04-19mount.cifs: fix up some -D_FORTIFY_SOURCE=2 warningsJeff Layton1-1/+3
...and add -D_FORTIFY_SOURCE=2 to the default $CFLAGS. Acked-by: Acked-by: Suresh Jayaraman <sjayaraman@suse.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
2011-07-12mtab: handle ENOSPC/EFBIG condition properly when altering mtabJeff Layton1-0/+27
It's possible that when mount.cifs goes to append the mtab that there won't be enough space to do so, and the mntent won't be appended to the file in its entirety. Add a my_endmntent routine that will fflush and then fsync the FILE if that succeeds. If either fails then it will truncate the file back to its provided size. It will then call endmntent unconditionally. Have add_mtab call fstat on the opened mtab file in order to get the size of the file before it has been appended. Assuming that that succeeds, use my_endmntent to ensure that the file is not corrupted before closing it. It's possible that we'll have a small race window where the mtab is incorrect, but it should be quickly corrected. This was reported some time ago as CVE-2011-1678: http://openwall.com/lists/oss-security/2011/03/04/9 ...and it seems to fix the reproducer that I was able to come up with. Signed-off-by: Jeff Layton <jlayton@samba.org> Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
2011-01-31mount.cifs: don't try to alter mtab if it's a symlinkJeff Layton1-0/+16
Some distros replace /etc/mtab with a symlink to /proc/mounts. In that situation, mount.cifs will hang for a while trying to lock the mtab. /bin/mount checks to see if the mtab is a symlink. If it is or if a stat() call on it fails, it doesn't try to to update the mtab. Have mount.cifs do the same. Signed-off-by: Jeff Layton <jlayton@samba.org>
2010-08-24mount.cifs: use monotonic time for timeoutsBjörn Jacke1-3/+20
this is especially important during the boot process, where the clock is often being set initially and clock jumps are more common.
2010-07-27mtab: add __attribute__((unused)) to unused variablesJeff Layton1-2/+2
...to silence -Wextra warnings. Signed-off-by: Jeff Layton <jlayton@samba.org>
2010-02-07Initial import of files from samba master branchJeff Layton1-0/+220
(commit 6e510b49c03be9caba4f587f3f6cec547841b0d7)