summaryrefslogtreecommitdiff
path: root/mount.cifs.c
AgeCommit message (Collapse)AuthorFilesLines
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-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-20cifs-utils: switch to using autoconf package versionJeff Layton1-8/+2
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-07mount.cifs: check for NULL addr pointer before handling scopeidJeff Layton1-1/+1
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-20autoconf: make sure C files include config.hJeff Layton1-3/+3
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-08silence some build warningsJeff Layton1-3/+3
mount.cifs.c: In function 'main': mount.cifs.c:1201: warning: 'dev_name' may be used uninitialized in this function mount.cifs.c:1217: warning: 'addr6' may be used uninitialized in this function asn1.c: In function 'ber_read_OID_String': asn1.c:591: warning: 'bytes_eaten' may be used uninitialized in this function Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-07util.c: move strlcat and strlcpy into a separate "util.c" objectJeff Layton1-44/+1
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2010-02-07Initial import of files from samba master branchJeff Layton1-0/+1779
(commit 6e510b49c03be9caba4f587f3f6cec547841b0d7)