cifs: add "multiuser" mount option

This allows someone to declare a mount as a multiuser mount.

Multiuser mounts also imply "noperm" since we want to allow the server
to handle permission checking. It also (for now) requires Kerberos
authentication. Eventually, we could expand this to other authtypes, but
that requires a scheme to allow per-user credential stashing in some
form.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
Jeff Layton 2010-10-06 19:51:12 -04:00 committed by Steve French
parent 9d002df492
commit 0eb8a132c4
1 changed files with 13 additions and 0 deletions

View File

@ -100,6 +100,7 @@ struct smb_vol {
bool nostrictsync:1; /* do not force expensive SMBflush on every sync */ bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
bool fsc:1; /* enable fscache */ bool fsc:1; /* enable fscache */
bool mfsymlinks:1; /* use Minshall+French Symlinks */ bool mfsymlinks:1; /* use Minshall+French Symlinks */
bool multiuser:1;
unsigned int rsize; unsigned int rsize;
unsigned int wsize; unsigned int wsize;
bool sockopt_tcp_nodelay:1; bool sockopt_tcp_nodelay:1;
@ -1347,6 +1348,8 @@ cifs_parse_mount_options(char *options, const char *devname,
vol->fsc = true; vol->fsc = true;
} else if (strnicmp(data, "mfsymlinks", 10) == 0) { } else if (strnicmp(data, "mfsymlinks", 10) == 0) {
vol->mfsymlinks = true; vol->mfsymlinks = true;
} else if (strnicmp(data, "multiuser", 8) == 0) {
vol->multiuser = true;
} else } else
printk(KERN_WARNING "CIFS: Unknown mount option %s\n", printk(KERN_WARNING "CIFS: Unknown mount option %s\n",
data); data);
@ -1378,6 +1381,13 @@ cifs_parse_mount_options(char *options, const char *devname,
return 1; return 1;
} }
} }
if (vol->multiuser && !(vol->secFlg & CIFSSEC_MAY_KRB5)) {
cERROR(1, "Multiuser mounts currently require krb5 "
"authentication!");
return 1;
}
if (vol->UNCip == NULL) if (vol->UNCip == NULL)
vol->UNCip = &vol->UNC[2]; vol->UNCip = &vol->UNC[2];
@ -2563,6 +2573,9 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM;
if (pvolume_info->fsc) if (pvolume_info->fsc)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_FSCACHE; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_FSCACHE;
if (pvolume_info->multiuser)
cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_MULTIUSER |
CIFS_MOUNT_NO_PERM);
if (pvolume_info->direct_io) { if (pvolume_info->direct_io) {
cFYI(1, "mounting share using direct i/o"); cFYI(1, "mounting share using direct i/o");
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;