summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2010-04-03mount.cifs: fix toggle_cap_dac_overrideJeff Layton1-7/+6
...it clears the capability set completely, which it shouldn't do. It also doesn't call cap_set_proc to make the new capability set active. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-03mount.cifs: only enable CAP_DAC_OVERRIDE when neededJeff Layton1-66/+144
When dropping capabilities, drop CAP_DAC_OVERRIDE from the effective set but not the permitted. When we need to open credential or password files, make it effective again and drop it after the open completes. This reduces CAP_DAC_OVERRIDE exposure. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-02mount.cifs: if real uid is 0, child must keep CAP_DAC_OVERRIDEJeff Layton1-7/+10
...otherwise, root may not be able to read credential files. The ideal thing would be to remove it from the effective set, and only turn it on when needed, but for now this should fix the immediate problem. Signed-off-by: Jeff Layton <jlayton@samba.org>
2010-04-02cifs-utils: bump version to 4.2cifs-utils-4.2Jeff Layton4-6/+7
- fix URL's and email addresses - update copyright notices Signed-off-by: Jeff Layton <jlayton@samba.org>
2010-04-01cifs.upcall: run it through LindentJeff Layton1-72/+66
...coding style cleanup. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01cifs-upcall: krb5.h inclusion quick fixTorsten Kurbad1-0/+4
...eventually it might be better to make autoconf set -I/usr/include/krb5 or whatever and get rid of the #ifdef's here. It's a little tricky to figure out the include dir however, so this will do for now. Signed-off-by: Torsten Kurbad <torsten@tk-webart.de>
2010-04-01cifs-upcall: heimdal fixesTorsten Kurbad3-13/+64
Signed-off-by: Torsten Kurbad <torsten@tk-webart.de>
2010-04-01mount.cifs: re-enable setuid usageJeff Layton1-27/+18
Now that mount.cifs is safe(r) we don't need to disable setuid capability by default. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: drop capabilities if libcap is availableJeff Layton4-0/+94
Might as well be as safe as possible. Have child drop all capabilities, and have the parent drop all but CAP_SYS_ADMIN (needed for mounting) and CAP_DAC_OVERRIDE (needed in case mtab isn't writable by root). We might even eventually consider being clever and dropping CAP_DAC_OVERRIDE when root has access to the mtab. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: guard against signals by unprivileged usersJeff Layton1-9/+38
If mount.cifs is setuid root, then the unprivileged user who runs the program can send the mount.cifs process a signal and kill it. This is not a huge problem unless we happen to be updating the mtab at the time, in which case the mtab lockfiles might not get cleaned up. To remedy this, have the privileged mount.cifs process set its real uid to the effective uid (usually, root). This prevents unprivileged users from being able to signal the process. While we're at it, also mask off signals while we're updating the mtab. This leaves a SIGKILL by root as the only way to interrupt the mtab update, but there's really nothing we can do about that. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: introduce privilege separationJeff Layton1-16/+80
Much of the mount option parsing and other activities can be done by an unprivileged process. Allocate the parsed_mount_info struct as an anonymous mmap() segment and then fork to do the actual mount option parsing. The child can then drop root privileges before populating the parsed_mount_info struct. The parent waits for the child to exit and then continues the mount process based on the child's exit status. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: move nomtab, fakemnt, and verboseflag flags to parsed_mount_infoJeff Layton1-13/+13
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: move assembly of parsed_mount_info to separate functionJeff Layton1-94/+110
...later, we'll want to introduce privilege separation so make this a separate function to facilitate that. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: run mount.cifs through LindentJeff Layton1-282/+336
...code cleanup Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: move mtab adding code to separate functionJeff Layton1-57/+71
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: clean up command-line optionsJeff Layton1-96/+3
The mount.cifs command apparently tries to take a ton of command-line options. Many of these will never be passed to mount.cifs by /bin/mount. Others are more appropriately specified as mount options. In both cases, there are a lot of options in the switch statement that are not listed in the optstring, and there are characters in the optstring that are not dealt with by the switch statement. Other options are poorly wired to the rest of the code and don't actually do anything. Clean it up by removing all but the ones that are likely to ever be used. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: reassemble device name from piecesJeff Layton1-8/+30
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: clean up setting of password fieldJeff Layton1-109/+84
Add a function to set and escape the password properly. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: eliminate "legacy" setuid behaviorJeff Layton1-81/+9
This behavior is demonstrably unsafe and not something we want to support going forward. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: eliminate some unneeded flags in parsed_mount_infoJeff Layton1-6/+1
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: parse unc into separate fieldsJeff Layton1-196/+179
The UNC is currently handled as a single string and mount.cifs will just munge it whenever it needs to change the delimiter type or uppercase it, etc. This is tricky to handle correctly and means that we often need to keep track of what's already been changed. Instead of doing this, just track the pieces of the UNC in separate fields in the parsed_mount_info, and then use those pieces to build strings as needed. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: add username and domain fields to parsed_mount_infoJeff Layton1-172/+116
...and fill and use them accordingly. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: make mountpassword a field in parsed_infoJeff Layton1-130/+78
...rather than a buffer pointed to by a global var Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: make parse_options return proper mount error codesJeff Layton1-16/+17
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: have parse_options fill parsed_mount_infoJeff Layton1-130/+89
Allocate a zeroed out parsed_mount_info struct and have parse_options put its info into that instead. realloc() is no longer used here and instead we just have the option parser carefully check that the result will fit in the buffer before copying it. We also no longer use snprintf to stuff info directly into the buffer. It may not be possible given the other checks, but snprintf can leave a non-NULL terminated string. Use strlcat everywhere instead to ensure that doesn't occur. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-04-01mount.cifs: declare new struct for holding parsed mount infoJeff Layton1-3/+23
Currently mount.cifs puts mount info into a disparate series of dynamically sized buffers. Declate a new struct that holds a set of fixed-size buffers. The option and UNC parsing routines can place their results in this struct. This should make it easier to implement privilege separation using shared memory to pass data between processes. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-23cifs-utils: release 4.1cifs-utils-4.1Jeff Layton1-1/+1
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-23mount.cifs: fix ver= option passed to the kernelJeff Layton1-1/+7
Rather than passing the VERSION string to the kernel in the ver= option, track the OPTIONS_VERSION separately and pass that to the kernel. If we ever need to have different behavior in kernel for different mount.cifs versions, we can bump this number. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: don't use exit(3) in get_password_from_fileJeff Layton1-7/+13
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: don't use exit(3) in mount_cifs_usage() and open_cred_file()Jeff Layton1-19/+23
...to help ensure that exit processing is handled appropriately. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: don't use exit(3) in main()Jeff Layton1-11/+19
Clean up error handling in main() so that cleanup tasks are completed rather than assuming exit processing will handle it. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: fix error handling when duplicating options stringJeff Layton1-2/+7
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: make check_mountpoint a noop for non-legacy buildsJeff Layton1-23/+8
Now that we chdir() to the mountpoint, the checks in that function are pointless. Just make it a noop for non-legacy setuid builds. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: remove uuid optionJeff Layton1-5/+0
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: remove bogus rsize/wsize optionsJeff Layton1-10/+0
They don't actually do anything. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: simplify command-line option parsingJeff Layton1-28/+8
Let getopt_long do the work of parsing options, then check what's left. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: remove unneeded uname callJeff Layton1-7/+0
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-22mount.cifs: clean up parse_serverJeff Layton1-69/+68
Get rid of a lot of unnecessary nesting. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-20mount.cifs: clean up preprocessor macrosJeff Layton1-17/+0
...remove some unneeded junk. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-20Update the READMEJeff Layton1-2/+9
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-20cifs-utils: switch to using autoconf package versionJeff Layton3-12/+5
Rather than using a hardcoded version string, use the VERSION macro that autoconf provides. This will help make it clear what version is actually being used in bug reports when someone runs "mount.cifs -V" or "cifs.upcall --version". Also, clean up AC_INIT and AM_INIT_AUTOMAKE macros. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-08autotools: make cifs.upcall dependent on an enable optionJeff Layton2-5/+48
Make it so that cifs.upcall is built by default, but autodisable it if the needed headers aren't present. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-07mount.cifs: check for NULL addr pointer before handling scopeidJeff Layton1-1/+1
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-03-03docs: these tools are no longer part of SambaMichael Wood4-12/+6
Remove references to samba(7). There's no cifs-utils(7) man page, so don't refer to one. Signed-off-by: Michael Wood <esiotrot@gmail.com>
2010-03-03docs: change source from Samba 3.6Michael Wood4-6/+6
These tools are no longer part of the Samba suite, so change the source to cifs-utils 4.0. Signed-off-by: Michael Wood <esiotrot@gmail.com>
2010-02-26autotools: check for keyutils.hcifs-utils-4.0Jeff Layton1-0/+1
...and throw a (hopefully) helpful error message if it's not present. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-26cifs.upcall: use non-legacy krb5.h locationJeff Layton2-3/+4
<krb5.h> is deprecated in favor of <krb5/krb5.h>. Also, make autoconf throw a more helpful error message if it's not present. Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-20autotools: remove autogenerated files from git repocifs-utils-4.0rc1Jeff Layton2-990/+0
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-20autoconf: make sure C files include config.hJeff Layton5-25/+18
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-19autoconf: now it works with autoconf 2.59 (RHEL5)Igor Mammedov1-7/+3
suggest to install libtalloc-devel if talloc.h is missing