cifs: Convert struct cifs_sb_info to use kuids and kgids

Cc: Steve French <smfrench@gmail.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
Eric W. Biederman 2013-02-06 01:20:20 -08:00
parent 3da4656504
commit 1f68233c52
4 changed files with 16 additions and 10 deletions

View File

@ -55,10 +55,10 @@ struct cifs_sb_info {
unsigned int wsize; unsigned int wsize;
unsigned long actimeo; /* attribute cache timeout (jiffies) */ unsigned long actimeo; /* attribute cache timeout (jiffies) */
atomic_t active; atomic_t active;
uid_t mnt_uid; kuid_t mnt_uid;
gid_t mnt_gid; kgid_t mnt_gid;
uid_t mnt_backupuid; kuid_t mnt_backupuid;
gid_t mnt_backupgid; kgid_t mnt_backupgid;
umode_t mnt_file_mode; umode_t mnt_file_mode;
umode_t mnt_dir_mode; umode_t mnt_dir_mode;
unsigned int mnt_cifs_flags; unsigned int mnt_cifs_flags;

View File

@ -376,13 +376,15 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
(int)(srcaddr->sa_family)); (int)(srcaddr->sa_family));
} }
seq_printf(s, ",uid=%u", cifs_sb->mnt_uid); seq_printf(s, ",uid=%u",
from_kuid_munged(&init_user_ns, cifs_sb->mnt_uid));
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)
seq_printf(s, ",forceuid"); seq_printf(s, ",forceuid");
else else
seq_printf(s, ",noforceuid"); seq_printf(s, ",noforceuid");
seq_printf(s, ",gid=%u", cifs_sb->mnt_gid); seq_printf(s, ",gid=%u",
from_kgid_munged(&init_user_ns, cifs_sb->mnt_gid));
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)
seq_printf(s, ",forcegid"); seq_printf(s, ",forcegid");
else else
@ -437,9 +439,13 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
seq_printf(s, ",noperm"); seq_printf(s, ",noperm");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID)
seq_printf(s, ",backupuid=%u", cifs_sb->mnt_backupuid); seq_printf(s, ",backupuid=%u",
from_kuid_munged(&init_user_ns,
cifs_sb->mnt_backupuid));
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID)
seq_printf(s, ",backupgid=%u", cifs_sb->mnt_backupgid); seq_printf(s, ",backupgid=%u",
from_kgid_munged(&init_user_ns,
cifs_sb->mnt_backupgid));
seq_printf(s, ",rsize=%u", cifs_sb->rsize); seq_printf(s, ",rsize=%u", cifs_sb->rsize);
seq_printf(s, ",wsize=%u", cifs_sb->wsize); seq_printf(s, ",wsize=%u", cifs_sb->wsize);

View File

@ -2743,7 +2743,7 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)
if (new->rsize && new->rsize < old->rsize) if (new->rsize && new->rsize < old->rsize)
return 0; return 0;
if (old->mnt_uid != new->mnt_uid || old->mnt_gid != new->mnt_gid) if (!uid_eq(old->mnt_uid, new->mnt_uid) || !gid_eq(old->mnt_gid, new->mnt_gid))
return 0; return 0;
if (old->mnt_file_mode != new->mnt_file_mode || if (old->mnt_file_mode != new->mnt_file_mode ||

View File

@ -569,7 +569,7 @@ bool
backup_cred(struct cifs_sb_info *cifs_sb) backup_cred(struct cifs_sb_info *cifs_sb)
{ {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) {
if (cifs_sb->mnt_backupuid == current_fsuid()) if (uid_eq(cifs_sb->mnt_backupuid, current_fsuid()))
return true; return true;
} }
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) {