Commit 70128a2e authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://cifs.bkbits.net/linux-2.5cifs

into home.osdl.org:/home/torvalds/v2.5/linux
parents 48087ea2 e2c22381
Version 0.83
------------
Fix oops when mounting to long server names caused by inverted parms to kmalloc.
Fix MultiuserMount (/proc/fs/cifs configuration setting) so that when enabled
we will choose a cifs user session (smb uid) that better matches the local
uid if a) the mount uid does not match the current uid and b) we have another
session to the same server (ip address) for a different mount which
matches the current local uid.
Version 0.82 Version 0.82
------------ ------------
Add support for mknod of block or character devices. Fix oplock Add support for mknod of block or character devices. Fix oplock
......
...@@ -17,9 +17,12 @@ c) multi-user mounts - multiplexed sessionsetups over single vc ...@@ -17,9 +17,12 @@ c) multi-user mounts - multiplexed sessionsetups over single vc
d) Kerberos/SPNEGO session setup support - (started) d) Kerberos/SPNEGO session setup support - (started)
e) NTLMv2 authentication and MD5-HMAC signing SMB PDUs - (mostly implemented) e) NTLMv2 authentication (mostly implemented)
signing necessary for some Windows 2003 servers in domain
mode. f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup
used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM
and raw NTLMSSP already. This is important when enabling
extended security and mounting to Windows 2003 Servers
f) Directory entry caching relies on a 1 second timer, rather than f) Directory entry caching relies on a 1 second timer, rather than
using FindNotify or equivalent. - (started) using FindNotify or equivalent. - (started)
...@@ -43,11 +46,9 @@ extra copy in/out of the socket buffers in some cases. ...@@ -43,11 +46,9 @@ extra copy in/out of the socket buffers in some cases.
m) finish support for IPv6 m) finish support for IPv6
n) send oplock break response when sent (oplock currently disabled in o) Better optimize open (and pathbased setfilesize) to reduce the
/proc/fs/cifs) oplock breaks coming from windows srv. Piggyback identical file
opens on top of each other by incrementing reference count rather
o) reduces the oplock breaks coming from windows). Piggyback identical
file opens on top of each other by incrementing reference count rather
than resending (helps reduce server resource utilization and avoid than resending (helps reduce server resource utilization and avoid
spurious oplock breaks). spurious oplock breaks).
......
...@@ -230,7 +230,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) ...@@ -230,7 +230,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
if (cifs_sb) { if (cifs_sb) {
if (cifs_sb->tcon) { if (cifs_sb->tcon) {
seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName); seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName);
if (cifs_sb->tcon->ses->userName) if ((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->userName))
seq_printf(s, ",username=%s", seq_printf(s, ",username=%s",
cifs_sb->tcon->ses->userName); cifs_sb->tcon->ses->userName);
if(cifs_sb->tcon->ses->domainName) if(cifs_sb->tcon->ses->domainName)
......
...@@ -155,7 +155,8 @@ struct cifsSesInfo { ...@@ -155,7 +155,8 @@ struct cifsSesInfo {
char *serverOS; /* name of operating system underlying the server */ char *serverOS; /* name of operating system underlying the server */
char *serverNOS; /* name of network operating system that the server is running */ char *serverNOS; /* name of network operating system that the server is running */
char *serverDomain; /* security realm of server */ char *serverDomain; /* security realm of server */
int Suid; /* needed for user level security */ int Suid; /* remote smb uid */
uid_t linux_uid; /* local Linux uid */
int capabilities; int capabilities;
char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for tcp names - will ipv6 and sctp addresses fit here?? */ char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for tcp names - will ipv6 and sctp addresses fit here?? */
char userName[MAX_USERNAME_SIZE + 1]; char userName[MAX_USERNAME_SIZE + 1];
......
...@@ -405,7 +405,7 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol) ...@@ -405,7 +405,7 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
return 1; /* needs_arg; */ return 1; /* needs_arg; */
} }
if ((temp_len = strnlen(value, 300)) < 300) { if ((temp_len = strnlen(value, 300)) < 300) {
vol->UNC = kmalloc(GFP_KERNEL, temp_len); vol->UNC = kmalloc(temp_len+1,GFP_KERNEL);
strcpy(vol->UNC,value); strcpy(vol->UNC,value);
if (strncmp(vol->UNC, "//", 2) == 0) { if (strncmp(vol->UNC, "//", 2) == 0) {
vol->UNC[0] = '\\'; vol->UNC[0] = '\\';
...@@ -482,7 +482,7 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol) ...@@ -482,7 +482,7 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
return 1; return 1;
} }
if ((temp_len = strnlen(devname, 300)) < 300) { if ((temp_len = strnlen(devname, 300)) < 300) {
vol->UNC = kmalloc(GFP_KERNEL, temp_len); vol->UNC = kmalloc(temp_len+1,GFP_KERNEL);
strcpy(vol->UNC,devname); strcpy(vol->UNC,devname);
if (strncmp(vol->UNC, "//", 2) == 0) { if (strncmp(vol->UNC, "//", 2) == 0) {
vol->UNC[0] = '\\'; vol->UNC[0] = '\\';
...@@ -860,7 +860,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -860,7 +860,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
FreeXid(xid); FreeXid(xid);
return -EINVAL; return -EINVAL;
} }
/* BB add support to use the multiuser_mount flag BB */
existingCifsSes = existingCifsSes =
find_tcp_session(sin_server.sin_addr.s_addr, find_tcp_session(sin_server.sin_addr.s_addr,
volume_info.username, &srvTcp); volume_info.username, &srvTcp);
...@@ -926,6 +926,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -926,6 +926,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if (volume_info.domainname) if (volume_info.domainname)
strncpy(pSesInfo->domainName, strncpy(pSesInfo->domainName,
volume_info.domainname,MAX_USERNAME_SIZE); volume_info.domainname,MAX_USERNAME_SIZE);
pSesInfo->linux_uid = volume_info.linux_uid;
rc = setup_session(xid,pSesInfo, cifs_sb->local_nls); rc = setup_session(xid,pSesInfo, cifs_sb->local_nls);
if(!rc) if(!rc)
......
...@@ -190,6 +190,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -190,6 +190,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
{ {
int i; int i;
__u32 tmp; __u32 tmp;
struct list_head* temp_item;
struct cifsSesInfo * ses;
char *temp = (char *) buffer; char *temp = (char *) buffer;
for (i = 0; i < MAX_CIFS_HDR_SIZE; i++) { for (i = 0; i < MAX_CIFS_HDR_SIZE; i++) {
...@@ -225,7 +227,52 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -225,7 +227,52 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
if (treeCon->ses->capabilities & CAP_STATUS32) { if (treeCon->ses->capabilities & CAP_STATUS32) {
buffer->Flags2 |= SMBFLG2_ERR_STATUS; buffer->Flags2 |= SMBFLG2_ERR_STATUS;
} }
buffer->Uid = treeCon->ses->Suid; /* always in LE format */ buffer->Uid = treeCon->ses->Suid; /* always in LE format */
if(multiuser_mount != 0) {
/* For the multiuser case, there are few obvious technically */
/* possible mechanisms to match the local linux user (uid) */
/* to a valid remote smb user (smb_uid): */
/* 1) Query Winbind (or other local pam/nss daemon */
/* for userid/password/logon_domain or credential */
/* 2) Query Winbind for uid to sid to username mapping */
/* and see if we have a matching password for existing*/
/* session for that user perhas getting password by */
/* adding a new pam_cifs module that stores passwords */
/* so that the cifs vfs can get at that for all logged*/
/* on users */
/* 3) (Which is the mechanism we have chosen) */
/* Search through sessions to the same server for a */
/* a match on the uid that was passed in on mount */
/* with the current processes uid (or euid?) and use */
/* that smb uid. If no existing smb session for */
/* that uid found, use the default smb session ie */
/* the smb session for the volume mounted which is */
/* the same as would be used if the multiuser mount */
/* flag were disabled. */
/* BB Add support for establishing new tCon and SMB Session */
/* with userid/password pairs found on the smb session */
/* for other target tcp/ip addresses BB */
if(current->uid != treeCon->ses->linux_uid) {
cFYI(1,("Multiuser mode and UID did not match tcon uid "));
read_lock(&GlobalSMBSeslock);
list_for_each(temp_item, &GlobalSMBSessionList) {
ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList);
if(ses->linux_uid == current->uid) {
if(ses->server == treeCon->ses->server) {
cFYI(1,("found matching uid substitute right smb_uid"));
buffer->Uid = ses->Suid;
break;
} else {
/* BB eventually call setup_session here */
cFYI(1,("local UID found but smb sess with this server does not exist"));
}
}
}
read_unlock(&GlobalSMBSeslock);
}
}
} }
if (treeCon->Flags & SMB_SHARE_IS_IN_DFS) if (treeCon->Flags & SMB_SHARE_IS_IN_DFS)
buffer->Flags2 |= SMBFLG2_DFS; buffer->Flags2 |= SMBFLG2_DFS;
......
...@@ -45,6 +45,11 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses) ...@@ -45,6 +45,11 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
cERROR(1, ("Null session passed in to AllocMidQEntry ")); cERROR(1, ("Null session passed in to AllocMidQEntry "));
return NULL; return NULL;
} }
if (ses->server == NULL) {
cERROR(1, ("Null TCP session in AllocMidQEntry"));
return NULL;
}
temp = (struct mid_q_entry *) kmem_cache_alloc(cifs_mid_cachep, temp = (struct mid_q_entry *) kmem_cache_alloc(cifs_mid_cachep,
SLAB_KERNEL); SLAB_KERNEL);
if (temp == NULL) if (temp == NULL)
...@@ -65,7 +70,6 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses) ...@@ -65,7 +70,6 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
/* Should we wake up tcp thread first? BB */ /* Should we wake up tcp thread first? BB */
timeout = wait_event_interruptible_timeout(ses->server->response_q, timeout = wait_event_interruptible_timeout(ses->server->response_q,
(ses->server->tcpStatus == CifsGood), timeout); (ses->server->tcpStatus == CifsGood), timeout);
cFYI(1,("timeout (after reconnection wait) %d",timeout));
} }
if (ses->server->tcpStatus == CifsGood) { if (ses->server->tcpStatus == CifsGood) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment