Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19005
b: refs/heads/master
c: eeac804
h: refs/heads/master
i:
  19003: 5d4654f
v: v3
  • Loading branch information
Steve French committed Jan 14, 2006
1 parent fa3d3a5 commit 6cffd75
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84153973a29dfb3f3d9fe2fe75c2cd613a3cdf27
refs/heads/master: eeac8047fcf4c659eb15f2e27a0ef4aeba64157f
3 changes: 2 additions & 1 deletion trunk/fs/cifs/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Version 1.40
Use fsuid (fsgid) more consistently instead of uid (gid). Improve performance
of readpages by eliminating one extra memcpy. Allow update of file size
from remote server even if file is open for write as long as mount is
directio.
directio. Recognize share mode security and send NTLM encrypted password
on tree connect if share mode negotiated.

Version 1.39
------------
Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/cifs/cifsacl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ struct cifs_sid {
__u8 revision; /* revision level */
__u8 num_subauths;
__u8 authority[6];
__u8 sub_auth[4];
__u32 sub_auth[4];
/* next sub_auth if any ... */
} __attribute__((packed));

/* everyone */
const cifs_sid sid_everyone = {1, 1, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0}};
extern const struct cifs_sid sid_everyone;
/* group users */
const cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {32, 545, 0, 0}};
extern const struct cifs_sid sid_user;

#endif /* _CIFSACL_H */
20 changes: 14 additions & 6 deletions trunk/fs/cifs/cifssmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "cifsproto.h"
#include "cifs_unicode.h"
#include "cifs_debug.h"
#include "cifsacl.h"

#ifdef CONFIG_CIFS_POSIX
static struct {
Expand Down Expand Up @@ -372,8 +373,10 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc == 0) {
server->secMode = pSMBr->SecurityMode;
server->secType = NTLM; /* BB override default for
server->secMode = pSMBr->SecurityMode;
if((server->secMode & SECMODE_USER) == 0)
cFYI(1,("share mode security"));
server->secType = NTLM; /* BB override default for
NTLMv2 or kerberos v5 */
/* one byte - no need to convert this or EncryptionKeyLen
from little endian */
Expand All @@ -383,7 +386,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
min(le32_to_cpu(pSMBr->MaxBufferSize),
(__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
server->maxRw = le32_to_cpu(pSMBr->MaxRawSize);
cFYI(0, ("Max buf = %d ", ses->server->maxBuf));
cFYI(0, ("Max buf = %d", ses->server->maxBuf));
GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey);
server->capabilities = le32_to_cpu(pSMBr->Capabilities);
server->timeZone = le16_to_cpu(pSMBr->ServerTimeZone);
Expand Down Expand Up @@ -411,8 +414,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
(server->server_GUID,
pSMBr->u.extended_response.
GUID, 16) != 0) {
cFYI(1,
("UID of server does not match previous connection to same ip address"));
cFYI(1, ("server UID changed"));
memcpy(server->
server_GUID,
pSMBr->u.
Expand Down Expand Up @@ -2494,8 +2496,14 @@ CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon,

#endif /* CONFIG_POSIX */


/* security id for everyone */
const struct cifs_sid sid_everyone = {1, 1, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0}};
/* group users */
const struct cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {32, 545, 0, 0}};

/* Convert CIFS ACL to POSIX form */
static int parse_sec_desc(struct sec_desc * psec_desc, int acl_len)
static int parse_sec_desc(struct cifs_sid * psec_desc, int acl_len)
{
return 0;
}
Expand Down
27 changes: 22 additions & 5 deletions trunk/fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
cifs_sb->mnt_gid = volume_info.linux_gid;
cifs_sb->mnt_file_mode = volume_info.file_mode;
cifs_sb->mnt_dir_mode = volume_info.dir_mode;
cFYI(1,("file mode: 0x%x dir mode: 0x%x",cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode));
cFYI(1,("file mode: 0x%x dir mode: 0x%x",
cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode));

if(volume_info.noperm)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM;
Expand Down Expand Up @@ -1972,7 +1973,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
__u32 capabilities;
__u16 count;

cFYI(1, ("In sesssetup "));
cFYI(1, ("In sesssetup"));
if(ses == NULL)
return -EINVAL;
user = ses->userName;
Expand Down Expand Up @@ -3248,9 +3249,26 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,

pSMB->AndXCommand = 0xFF;
pSMB->Flags = cpu_to_le16(TCON_EXTENDED_SECINFO);
pSMB->PasswordLength = cpu_to_le16(1); /* minimum */
bcc_ptr = &pSMB->Password[0];
bcc_ptr++; /* skip password */
if((ses->server->secMode) & SECMODE_USER) {
pSMB->PasswordLength = cpu_to_le16(1); /* minimum */
bcc_ptr++; /* skip password */
} else {
pSMB->PasswordLength = cpu_to_le16(CIFS_SESSION_KEY_SIZE);
/* BB FIXME add code to fail this if NTLMv2 or Kerberos
specified as required (when that support is added to
the vfs in the future) as only NTLM or the much
weaker LANMAN (which we do not send) is accepted
by Samba (not sure whether other servers allow
NTLMv2 password here) */
SMBNTencrypt(ses->password,
ses->server->cryptKey,
bcc_ptr);

bcc_ptr += CIFS_SESSION_KEY_SIZE;
*bcc_ptr = 0;
bcc_ptr++; /* align */
}

if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
Expand All @@ -3268,7 +3286,6 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */
bcc_ptr += 2; /* skip trailing null */
} else { /* ASCII */

strcpy(bcc_ptr, tree);
bcc_ptr += strlen(tree) + 1;
}
Expand Down

0 comments on commit 6cffd75

Please sign in to comment.