aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-07-19 18:00:17 -0400
committerSteve French <sfrench@us.ibm.com>2010-08-02 08:40:39 -0400
commit3e4b3e1f68c10510ec8d3076cffc5729b88f8de6 (patch)
treebee962570f8a54547cfb67550f76874d82981fea /fs/cifs/connect.c
parentf55fdcca6bf1c17e86a270a8c0d81c6677c61222 (diff)
cifs: add separate cred_uid field to sesInfo
Right now, there's no clear separation between the uid that owns the credentials used to do the mount and the overriding owner of the files on that mount. Add a separate cred_uid field that is set to the real uid of the mount user. Unlike the linux_uid, the uid= option does not override this parameter. The parm is sent to cifs.upcall, which can then preferentially use the creduid= parm instead of the uid= parm for finding credentials. This is not the only way to solve this. We could try to do all of this in kernel instead by having a module parameter that affects what gets passed in the uid= field of the upcall. That said, we have a lot more flexibility to change things in userspace so I think it probably makes sense to do it this way. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 399b60129b74..52a7646cc7af 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -67,6 +67,7 @@ struct smb_vol {
67 char *iocharset; /* local code page for mapping to and from Unicode */ 67 char *iocharset; /* local code page for mapping to and from Unicode */
68 char source_rfc1001_name[16]; /* netbios name of client */ 68 char source_rfc1001_name[16]; /* netbios name of client */
69 char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */ 69 char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */
70 uid_t cred_uid;
70 uid_t linux_uid; 71 uid_t linux_uid;
71 gid_t linux_gid; 72 gid_t linux_gid;
72 mode_t file_mode; 73 mode_t file_mode;
@@ -832,7 +833,8 @@ cifs_parse_mount_options(char *options, const char *devname,
832 /* null target name indicates to use *SMBSERVR default called name 833 /* null target name indicates to use *SMBSERVR default called name
833 if we end up sending RFC1001 session initialize */ 834 if we end up sending RFC1001 session initialize */
834 vol->target_rfc1001_name[0] = 0; 835 vol->target_rfc1001_name[0] = 0;
835 vol->linux_uid = current_uid(); /* use current_euid() instead? */ 836 vol->cred_uid = current_uid();
837 vol->linux_uid = current_uid();
836 vol->linux_gid = current_gid(); 838 vol->linux_gid = current_gid();
837 839
838 /* default to only allowing write access to owner of the mount */ 840 /* default to only allowing write access to owner of the mount */
@@ -1658,7 +1660,7 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
1658 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 1660 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
1659 switch (server->secType) { 1661 switch (server->secType) {
1660 case Kerberos: 1662 case Kerberos:
1661 if (vol->linux_uid != ses->linux_uid) 1663 if (vol->cred_uid != ses->cred_uid)
1662 continue; 1664 continue;
1663 break; 1665 break;
1664 default: 1666 default:
@@ -1775,6 +1777,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
1775 if (ses->domainName) 1777 if (ses->domainName)
1776 strcpy(ses->domainName, volume_info->domainname); 1778 strcpy(ses->domainName, volume_info->domainname);
1777 } 1779 }
1780 ses->cred_uid = volume_info->cred_uid;
1778 ses->linux_uid = volume_info->linux_uid; 1781 ses->linux_uid = volume_info->linux_uid;
1779 ses->overrideSecFlg = volume_info->secFlg; 1782 ses->overrideSecFlg = volume_info->secFlg;
1780 1783