Jeff Layton [Tue, 19 Oct 2010 18:59:49 +0000 (14:59 -0400)]
autoconf: bump release to 4.7
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 8 Oct 2010 19:11:58 +0000 (15:11 -0400)]
manpage: add mount.cifs manpage entry for "multiuser" option
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 8 Oct 2010 19:11:57 +0000 (15:11 -0400)]
mount.cifs: reinstate ip= as an override for address resolution
The manpage says:
ip=arg
sets the destination IP address. This option is set automatically
if the server name portion of the requested UNC name can be
resolved so rarely needs to be specified by the user.
...but recent changes have made it not work anymore as an override if
someone specifies an ip= option as part of the mount options. Reinstate
that behavior by copying the ip= option verbatim into the addrlist of
the parsed options struct and then skipping the name resolution. That
should allow the ip= option to pass unadulterated to the kernel.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Björn Jacke [Tue, 24 Aug 2010 17:30:05 +0000 (13:30 -0400)]
mount.cifs: use monotonic time for timeouts
this is especially important during the boot process, where the clock is often
being set initially and clock jumps are more common.
Björn Jacke [Tue, 24 Aug 2010 17:29:59 +0000 (13:29 -0400)]
autoconf: add checks for clock_gettime
Igor Druzhinin [Fri, 20 Aug 2010 18:53:38 +0000 (14:53 -0400)]
cifs-utils: infrastructure for stashing passwords in keyring
It is a userspace part of a new infrastructure for stashing passwords
in kernel keyring per user basis. The patch adds the "cifscreds"
utility for management keys with credentials. Assembling of the utility
from the distribution is possible with --enable-cifscreds=yes option of
configure script.
Signed-off-by: Igor Druzhinin <jaxbrigs@gmail.com>
Igor Druzhinin [Fri, 20 Aug 2010 18:53:05 +0000 (14:53 -0400)]
cifs-utils: moving resolve_host into separate file
The resolve_host routine from mount.cifs is carried out in
separate file and appropriate corrections are made.
Signed-off-by: Igor Druzhinin <jaxbrigs@gmail.com>
Suresh Jayaraman [Wed, 4 Aug 2010 11:55:54 +0000 (07:55 -0400)]
mount.cifs: remove redundant error assignment
Avoid setting error code twice by moving error handling out of add_mtab_exit
block. We already set error code and report error in other places.
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Jeff Layton [Wed, 4 Aug 2010 10:35:24 +0000 (06:35 -0400)]
autoconf: bump version number to 4.6.1 for non-release builds
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 30 Jul 2010 12:17:01 +0000 (08:17 -0400)]
autoconf: bump version to 4.6
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Tue, 27 Jul 2010 19:24:04 +0000 (15:24 -0400)]
data_blob: change for loop indices to a unsigned int
To silence these warnings:
data_blob.c: In function ‘data_blob_hex_string_lower’:
data_blob.c:155:16: warning: comparison between signed and unsigned integer
expressions
data_blob.c: In function ‘data_blob_hex_string_upper’:
data_blob.c:172:16: warning: comparison between signed and unsigned integer
expressions
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Tue, 27 Jul 2010 19:20:44 +0000 (15:20 -0400)]
cifs.upcall: swap c99 initializers for memset calls
gcc says:
cifs.upcall.c: In function ‘cifs_krb5_get_req’:
cifs.upcall.c:261:2: warning: missing initializer
cifs.upcall.c:261:2: warning: (near initialization for ‘in_creds.client’)
cifs.upcall.c: In function ‘main’:
cifs.upcall.c:622:9: warning: missing initializer
cifs.upcall.c:622:9: warning: (near initialization for ‘arg.ver’)
...this is probably just gcc being balky, but we can silence the
warning. It may also be a micro optimization in an error condition
if we delay zeroing out the struct until it's needed.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Tue, 27 Jul 2010 19:09:27 +0000 (15:09 -0400)]
mtab: add __attribute__((unused)) to unused variables
...to silence -Wextra warnings.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Tue, 27 Jul 2010 19:09:23 +0000 (15:09 -0400)]
automake: add -Wextra to CFLAGS
...for extra warning goodness.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Suresh Jayaraman [Tue, 27 Jul 2010 17:35:59 +0000 (13:35 -0400)]
mount.cifs: document the 'fsc' mount option
Changes since last post:
- added the information about the kernel CONFIG option
- also added the information that caching is currently enabled for files opened as read-only
Document the newly added local caching feature using FS-Cache. This patch
could be queued and considered once the local caching patches gets merged
upstream.
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Suresh Jayaraman [Tue, 27 Jul 2010 16:52:44 +0000 (12:52 -0400)]
mount.cifs: clarify 'fsc' mount option
Changes since last post:
- added the information about the kernel CONFIG option
- also added the information that caching is currently enabled for files opened as read-only
Document the newly added local caching feature using FS-Cache. This patch
could be queued and considered once the local caching patches gets merged
upstream.
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Jeff Layton [Tue, 27 Jul 2010 16:33:33 +0000 (12:33 -0400)]
autoconf: bump version to 4.5.2
Signed-off-by: Jeff Layton <jlayton@samba.org>
Suresh Jayaraman [Tue, 27 Jul 2010 15:11:43 +0000 (11:11 -0400)]
mount.cifs: add 'fsc' mount option to the usage help text
Add 'fsc' mount option to the 'Less commonly used options' section of
mount.cifs usage help text. As with the previous patch, this one too could be
queued and considered once the local caching patches gets merged upstream.
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Suresh Jayaraman [Tue, 27 Jul 2010 15:10:26 +0000 (11:10 -0400)]
manpages: document 'fsc' mount option
Document the newly added local caching feature using FS-Cache. This patch
could be queued and considered once the local caching patches gets merged
upstream.
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Jeff Layton [Tue, 27 Jul 2010 11:37:05 +0000 (07:37 -0400)]
mount.cifs: handle the "mand" and "nomand" mount options (try #2)
These are filesystem-independent mount options that get passed to
mount.cifs too. Handle them appropriately by enabling and disabling
MS_MANDLOCK and not handing them off to the kernel.
Also, don't set MS_MANDLOCK by default. There's no reason to ask the
kernel to enforce mandatory locking by default. This also matches
up better with the way that "mand" is set in the mtab.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Tue, 27 Jul 2010 11:33:51 +0000 (07:33 -0400)]
mount.cifs: ignore the "_netdev" mount option
This mount options is used to clue in init scripts that the filesystem
shouldn't be mounted until networking is available. /bin/mount also passes
that option to the filesystem however, and cifs currently chokes on it.
mount.nfs ignores this option -- have mount.cifs do the same.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Mon, 26 Jul 2010 17:00:44 +0000 (13:00 -0400)]
cifs.upcall: require a uid= or creduid= parm
Even though all known kernels send the uid= parm to userspace,
cifs.upcall doesn't technically require it. It should though. If one
wasn't sent for some reason, then the setuid wouldn't occur. Error out
if there is no uid= or creduid= parm.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 23 Jul 2010 19:28:32 +0000 (15:28 -0400)]
cifs.upcall: use "creduid=" parm by default when available
When I did the original krb5 implementation, I goofed and ended up making
it so that when someone specifies the "uid=" mount option that also affects
the owner of the krb5 credential cache and not just the ownership of the
mount. I'm proposing a patch for the kernel to attempt to fix this by
making the kernel send a "creduid=" parameter in the upcall which is
intended to be the user that should own the credentials cache.
That's not necessarily the same user that has "ownership" of the mount.
Usually the creduid= will be set to the real uid of the user doing the
mounting. When multisession mounts are introduced they will usually set
this to the fsuid that walks into the mount.
To ease the transition, this patch also adds a command line switch that
makes cifs.upcall use the "legacy" uid= parameter instead. Use that if you
want it to behave like it used to.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Wed, 7 Jul 2010 14:48:39 +0000 (10:48 -0400)]
mount.cifs: switch to using _PATH_MNTTAB and paths.h
The code currently uses fstab.h and _PATH_FSTAB, but uClibc apparently
doesn't have that header. It does have paths.h and _PATH_MNTTAB however
and so does glibc, so use that instead.
Fixes samba bug #7539.
Reported-and-Tested-by: Armin Kuster <linux@kama-aina.net>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Wed, 16 Jun 2010 14:50:54 +0000 (10:50 -0400)]
mount.cifs: use original device name as-is for mtab
We don't want to alter the device name in any way for the mtab as
/bin/umount depends on the string being identical for user mounts.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Scott Lovenberg [Sun, 6 Jun 2010 11:33:40 +0000 (07:33 -0400)]
mount.cifs: accept all supported values for dir_mode
The option parsing function now accepts all values for 'dir_mode' that
are supported by the kernel side code.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Jeff Layton [Sun, 6 Jun 2010 11:31:42 +0000 (07:31 -0400)]
cifs-utils: bump version number to 4.5.1
...to distinguish interim builds from official releases.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Sun, 30 May 2010 11:47:26 +0000 (07:47 -0400)]
mount.cifs: fix parsing of "cred=" option
When the mount option parsing was cleaned up recently, the detection of
the "cred=" option was dropped.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 21 May 2010 20:04:14 +0000 (16:04 -0400)]
cifs-utils: bump version number to 4.5
Signed-off-by: Jeff Layton <jlayton@samba.org>
Scott Lovenberg [Fri, 14 May 2010 23:34:26 +0000 (19:34 -0400)]
mount.cifs: cosmetic alignment patch
Align CRED_ macro values to keep style consistent with last patch.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Scott Lovenberg [Fri, 14 May 2010 23:32:05 +0000 (19:32 -0400)]
mount.cifs: clean up option parsing
Moved option string parsing to function parse_opt_token(char*). Main
loop in parse_options(const char*, struct parsed_mount_info*)
transplanted to a switch block.
The parsing function folds common options to a single macro:
1.) 'unc','target', and 'path' -> 'OPT_UNC'
2.) 'dom*' and 'workg*' -> 'OPT_DOM'
3.) 'nobrl' and 'nolock' -> 'OPT_NO_LOCK'
Kept 'fmask' and 'dmask' (OPT_FMASK, OPT_DMASK), which fall through to
'file_mode' and 'dir_mode' in the main loop.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Steve French [Fri, 14 May 2010 19:30:07 +0000 (15:30 -0400)]
mount.cifs: unitialized variable in cred parsing error path
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Steve French [Tue, 11 May 2010 13:32:34 +0000 (09:32 -0400)]
mount.cifs: turn into a multicall binary for smb2
mount.smb2 has different help (many fewer mount options) and different
fsname, but otherwise can reuse all of the good work Jeff did on
mount.cifs. This patch allow mount.cifs to detect if run as mount.smb2
(to display different help and fsname).
Signed-off-by: Steve French <smfrench@gmail.com>
Scott Lovenberg [Tue, 11 May 2010 13:32:34 +0000 (09:32 -0400)]
mount.cifs: removed magic number for max username in parse_options
Replaced max username in parse_options with the sum of its potential
parts for "domain/user%password" formatted values. Note that forward
slashes still expand to a double back slash in the parse_username
function, though.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Jeff Layton [Sun, 2 May 2010 10:32:34 +0000 (06:32 -0400)]
mount.cifs: strip leading delimiter off of prefixpath option
...the kernel doesn't expect to see it and it causes a regression
when mounting some UNCs.
Reported-by: Ales Zelinka <azelinka@redhat.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Sun, 2 May 2010 10:32:30 +0000 (06:32 -0400)]
cifs-utils: bump version number to 4.4.1 for interim builds
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Wed, 28 Apr 2010 11:19:24 +0000 (07:19 -0400)]
cifs-utils: bump version number to 4.4
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Wed, 28 Apr 2010 11:13:17 +0000 (07:13 -0400)]
mount.cifs: fix parsing of password in parse_username
Signed-off-by: Jeff Layton <jlayton@samba.org>
Scott Lovenberg [Sun, 25 Apr 2010 13:35:13 +0000 (09:35 -0400)]
mount.cifs: continued cleanup of open_cred_file and zero out buffer
The parsing for values has been moved to its own function and is a bit
cleaner. Temporary buffers are zeroed out before being freed to ensure
passwords/credentials aren't left in released memory.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Scott Lovenberg [Fri, 23 Apr 2010 10:50:34 +0000 (06:50 -0400)]
mount.cifs: clean up credential file parsing
Remove magic numbers, redundant code and extra variables from open_cred_file().
Remove check for domain length since strlcpy is safe from buffer overflows.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Jeff Layton [Sat, 17 Apr 2010 10:21:02 +0000 (06:21 -0400)]
mount.cifs: remove unneeded newline in verbose output
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Wed, 14 Apr 2010 18:11:37 +0000 (14:11 -0400)]
mount.cifs: check for NULL pointer before calling strchr()
mount.cifs calls strchr on currentaddress, which may be a NULL pointer.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Tue, 13 Apr 2010 14:18:13 +0000 (10:18 -0400)]
automake: don't use @foo@ constructs in Makefile.am
...use $(foo) instead. That doesn't rely on an explicit AC_SUBST().
Reported-by: Lars Müller <lars@samba.org>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Mon, 12 Apr 2010 10:55:24 +0000 (06:55 -0400)]
cifs: enable CAP_DAC_READ_SEARCH before chdir() and realpath() calls
It's possible that root won't have privileges to chdir or evaluate the
paths without that capability.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 9 Apr 2010 13:08:08 +0000 (09:08 -0400)]
cifs-utils: bump version number to 4.3
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 9 Apr 2010 12:47:11 +0000 (08:47 -0400)]
autoconf: remove explicit check for prctl
...it's already checked in AC_LIBCAP
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Tue, 6 Apr 2010 19:45:00 +0000 (15:45 -0400)]
autotools: add --with-libcap autoconf option
...it's rather confusing since we can compile against libcap or libcap-ng
but this is helpful for testing.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Tue, 6 Apr 2010 19:22:05 +0000 (15:22 -0400)]
mount.cifs: fix capability issues when libcap isn't present
...some #defines are missing in that case. This fixes the build for
all possible libcap/libcap-ng availability scenarios.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Scott Lovenberg [Tue, 6 Apr 2010 18:52:07 +0000 (14:52 -0400)]
mount.cifs: make credentials file parameters consistent with mount options
This patch makes the mount.cifs credentials file parameters consistent with
the command line parameters to remove ambiguity between the command line
parameter format and the credentials file format. That is, it parses for
both short and long form of the 'username', 'password', and 'domain'
parameters. This patch is against the current cifs-utils-4.2.
I'm also thinking of adding a second patch that allows for parsing a
"domain/user", "domain%user" and "domain/user%password" formats as allowed
from the command line.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Jeff Layton [Mon, 5 Apr 2010 15:23:37 +0000 (11:23 -0400)]
mount.cifs: restrict capabilities further
Only the parent process will ever need CAP_DAC_OVERRIDE. The child can
get by with CAP_DAC_READ_SEARCH.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Mon, 5 Apr 2010 15:23:32 +0000 (11:23 -0400)]
mount.cifs: properly prune the capabilities bounding set
...libcap-ng does this in a much easier fashion. If that's not
available, then we have to do it manually.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Sun, 4 Apr 2010 14:09:38 +0000 (10:09 -0400)]
mount.cifs: use libcap-ng to manage capabilities
...in preference to libcap if it's available.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Sun, 4 Apr 2010 13:51:31 +0000 (09:51 -0400)]
autotools: don't link mount.cifs against krb5 library
mount.cifs is being linked against the krb5 library. Fix it so that
that doesn't happen.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Sat, 3 Apr 2010 11:12:06 +0000 (07:12 -0400)]
mount.cifs: fix toggle_cap_dac_override
...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>
Jeff Layton [Sat, 3 Apr 2010 10:49:43 +0000 (06:49 -0400)]
mount.cifs: only enable CAP_DAC_OVERRIDE when needed
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>
Jeff Layton [Fri, 2 Apr 2010 20:02:37 +0000 (16:02 -0400)]
mount.cifs: if real uid is 0, child must keep CAP_DAC_OVERRIDE
...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>
Jeff Layton [Fri, 2 Apr 2010 10:42:20 +0000 (06:42 -0400)]
cifs-utils: bump version to 4.2
- fix URL's and email addresses
- update copyright notices
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 2 Apr 2010 02:05:47 +0000 (22:05 -0400)]
cifs.upcall: run it through Lindent
...coding style cleanup.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Torsten Kurbad [Fri, 2 Apr 2010 01:47:25 +0000 (21:47 -0400)]
cifs-upcall: krb5.h inclusion quick fix
...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>
Torsten Kurbad [Fri, 2 Apr 2010 01:47:18 +0000 (21:47 -0400)]
cifs-upcall: heimdal fixes
Signed-off-by: Torsten Kurbad <torsten@tk-webart.de>
Jeff Layton [Thu, 1 Apr 2010 19:29:59 +0000 (15:29 -0400)]
mount.cifs: re-enable setuid usage
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>
Jeff Layton [Thu, 1 Apr 2010 19:28:57 +0000 (15:28 -0400)]
mount.cifs: drop capabilities if libcap is available
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>
Jeff Layton [Thu, 1 Apr 2010 19:28:54 +0000 (15:28 -0400)]
mount.cifs: guard against signals by unprivileged users
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>
Jeff Layton [Thu, 1 Apr 2010 19:19:17 +0000 (15:19 -0400)]
mount.cifs: introduce privilege separation
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>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: move nomtab, fakemnt, and verboseflag flags to parsed_mount_info
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: move assembly of parsed_mount_info to separate function
...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>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: run mount.cifs through Lindent
...code cleanup
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: move mtab adding code to separate function
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: clean up command-line options
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>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: reassemble device name from pieces
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: clean up setting of password field
Add a function to set and escape the password properly.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: eliminate "legacy" setuid behavior
This behavior is demonstrably unsafe and not something we want to support
going forward.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: eliminate some unneeded flags in parsed_mount_info
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: parse unc into separate fields
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>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: add username and domain fields to parsed_mount_info
...and fill and use them accordingly.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: make mountpassword a field in parsed_info
...rather than a buffer pointed to by a global var
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: make parse_options return proper mount error codes
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: have parse_options fill parsed_mount_info
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>
Jeff Layton [Thu, 1 Apr 2010 19:19:16 +0000 (15:19 -0400)]
mount.cifs: declare new struct for holding parsed mount info
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>
Jeff Layton [Tue, 23 Mar 2010 13:47:07 +0000 (09:47 -0400)]
cifs-utils: release 4.1
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Tue, 23 Mar 2010 13:21:25 +0000 (09:21 -0400)]
mount.cifs: fix ver= option passed to the kernel
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>
Jeff Layton [Mon, 22 Mar 2010 12:03:38 +0000 (08:03 -0400)]
mount.cifs: don't use exit(3) in get_password_from_file
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Mon, 22 Mar 2010 12:03:38 +0000 (08:03 -0400)]
mount.cifs: don't use exit(3) in mount_cifs_usage() and open_cred_file()
...to help ensure that exit processing is handled appropriately.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Mon, 22 Mar 2010 12:03:38 +0000 (08:03 -0400)]
mount.cifs: don't use exit(3) in main()
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>
Jeff Layton [Mon, 22 Mar 2010 12:03:38 +0000 (08:03 -0400)]
mount.cifs: fix error handling when duplicating options string
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Mon, 22 Mar 2010 12:03:38 +0000 (08:03 -0400)]
mount.cifs: make check_mountpoint a noop for non-legacy builds
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>
Jeff Layton [Mon, 22 Mar 2010 12:03:37 +0000 (08:03 -0400)]
mount.cifs: remove uuid option
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Mon, 22 Mar 2010 12:03:37 +0000 (08:03 -0400)]
mount.cifs: remove bogus rsize/wsize options
They don't actually do anything.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Mon, 22 Mar 2010 12:03:37 +0000 (08:03 -0400)]
mount.cifs: simplify command-line option parsing
Let getopt_long do the work of parsing options, then check what's left.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Mon, 22 Mar 2010 12:03:37 +0000 (08:03 -0400)]
mount.cifs: remove unneeded uname call
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Mon, 22 Mar 2010 12:03:35 +0000 (08:03 -0400)]
mount.cifs: clean up parse_server
Get rid of a lot of unnecessary nesting.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Sat, 20 Mar 2010 12:10:24 +0000 (08:10 -0400)]
mount.cifs: clean up preprocessor macros
...remove some unneeded junk.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Sat, 20 Mar 2010 11:50:10 +0000 (07:50 -0400)]
Update the README
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Sat, 20 Mar 2010 11:49:44 +0000 (07:49 -0400)]
cifs-utils: switch to using autoconf package version
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>
Jeff Layton [Tue, 9 Mar 2010 03:06:46 +0000 (22:06 -0500)]
autotools: make cifs.upcall dependent on an enable option
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>
Jeff Layton [Sun, 7 Mar 2010 23:49:33 +0000 (18:49 -0500)]
mount.cifs: check for NULL addr pointer before handling scopeid
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Michael Wood [Wed, 3 Mar 2010 18:31:32 +0000 (13:31 -0500)]
docs: these tools are no longer part of Samba
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>
Michael Wood [Wed, 3 Mar 2010 18:31:29 +0000 (13:31 -0500)]
docs: change source from Samba 3.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>
Jeff Layton [Sat, 27 Feb 2010 02:36:56 +0000 (21:36 -0500)]
autotools: check for keyutils.h
...and throw a (hopefully) helpful error message if it's not present.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Sat, 27 Feb 2010 02:36:45 +0000 (21:36 -0500)]
cifs.upcall: use non-legacy krb5.h location
<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>