Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etercifs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etercifs
Commits
622954af
Commit
622954af
authored
Dec 06, 2015
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 3.12 sources from stable (v3.12.51)
parent
6c5601b5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
15 deletions
+96
-15
cifsencrypt.c
sources/3.12/cifsencrypt.c
+51
-1
cifssmb.c
sources/3.12/cifssmb.c
+2
-3
connect.c
sources/3.12/connect.c
+20
-5
smb2ops.c
sources/3.12/smb2ops.c
+6
-2
smb2transport.c
sources/3.12/smb2transport.c
+8
-2
transport.c
sources/3.12/transport.c
+9
-2
No files found.
sources/3.12/cifsencrypt.c
View file @
622954af
...
...
@@ -441,6 +441,48 @@ find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp)
return
0
;
}
/* Server has provided av pairs/target info in the type 2 challenge
* packet and we have plucked it and stored within smb session.
* We parse that blob here to find the server given timestamp
* as part of ntlmv2 authentication (or local current time as
* default in case of failure)
*/
static
__le64
find_timestamp
(
struct
cifs_ses
*
ses
)
{
unsigned
int
attrsize
;
unsigned
int
type
;
unsigned
int
onesize
=
sizeof
(
struct
ntlmssp2_name
);
unsigned
char
*
blobptr
;
unsigned
char
*
blobend
;
struct
ntlmssp2_name
*
attrptr
;
if
(
!
ses
->
auth_key
.
len
||
!
ses
->
auth_key
.
response
)
return
0
;
blobptr
=
ses
->
auth_key
.
response
;
blobend
=
blobptr
+
ses
->
auth_key
.
len
;
while
(
blobptr
+
onesize
<
blobend
)
{
attrptr
=
(
struct
ntlmssp2_name
*
)
blobptr
;
type
=
le16_to_cpu
(
attrptr
->
type
);
if
(
type
==
NTLMSSP_AV_EOL
)
break
;
blobptr
+=
2
;
/* advance attr type */
attrsize
=
le16_to_cpu
(
attrptr
->
length
);
blobptr
+=
2
;
/* advance attr size */
if
(
blobptr
+
attrsize
>
blobend
)
break
;
if
(
type
==
NTLMSSP_AV_TIMESTAMP
)
{
if
(
attrsize
==
sizeof
(
u64
))
return
*
((
__le64
*
)
blobptr
);
}
blobptr
+=
attrsize
;
/* advance attr value */
}
return
cpu_to_le64
(
cifs_UnixTimeToNT
(
CURRENT_TIME
));
}
static
int
calc_ntlmv2_hash
(
struct
cifs_ses
*
ses
,
char
*
ntlmv2_hash
,
const
struct
nls_table
*
nls_cp
)
{
...
...
@@ -630,6 +672,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)
struct
ntlmv2_resp
*
buf
;
char
ntlmv2_hash
[
16
];
unsigned
char
*
tiblob
=
NULL
;
/* target info blob */
__le64
rsp_timestamp
;
if
(
ses
->
server
->
negflavor
==
CIFS_NEGFLAVOR_EXTENDED
)
{
if
(
!
ses
->
domainName
)
{
...
...
@@ -648,6 +691,12 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)
}
}
/* Must be within 5 minutes of the server (or in range +/-2h
* in case of Mac OS X), so simply carry over server timestamp
* (as Windows 7 does)
*/
rsp_timestamp
=
find_timestamp
(
ses
);
baselen
=
CIFS_SESS_KEY_SIZE
+
sizeof
(
struct
ntlmv2_resp
);
tilen
=
ses
->
auth_key
.
len
;
tiblob
=
ses
->
auth_key
.
response
;
...
...
@@ -664,7 +713,8 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)
(
ses
->
auth_key
.
response
+
CIFS_SESS_KEY_SIZE
);
buf
->
blob_signature
=
cpu_to_le32
(
0x00000101
);
buf
->
reserved
=
0
;
buf
->
time
=
cpu_to_le64
(
cifs_UnixTimeToNT
(
CURRENT_TIME
));
buf
->
time
=
rsp_timestamp
;
get_random_bytes
(
&
buf
->
client_chal
,
sizeof
(
buf
->
client_chal
));
buf
->
reserved2
=
0
;
...
...
sources/3.12/cifssmb.c
View file @
622954af
...
...
@@ -629,9 +629,8 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
server
->
negflavor
=
CIFS_NEGFLAVOR_UNENCAP
;
memcpy
(
ses
->
server
->
cryptkey
,
pSMBr
->
u
.
EncryptionKey
,
CIFS_CRYPTO_KEY_SIZE
);
}
else
if
((
pSMBr
->
hdr
.
Flags2
&
SMBFLG2_EXT_SEC
||
server
->
capabilities
&
CAP_EXTENDED_SECURITY
)
&&
(
pSMBr
->
EncryptionKeyLength
==
0
))
{
}
else
if
(
pSMBr
->
hdr
.
Flags2
&
SMBFLG2_EXT_SEC
||
server
->
capabilities
&
CAP_EXTENDED_SECURITY
)
{
server
->
negflavor
=
CIFS_NEGFLAVOR_EXTENDED
;
rc
=
decode_ext_sec_blob
(
ses
,
pSMBr
);
}
else
if
(
server
->
sec_mode
&
SECMODE_PW_ENCRYPT
)
{
...
...
sources/3.12/connect.c
View file @
622954af
...
...
@@ -2250,6 +2250,8 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
spin_lock
(
&
cifs_tcp_ses_lock
);
list_for_each_entry
(
ses
,
&
server
->
smb_ses_list
,
smb_ses_list
)
{
if
(
ses
->
status
==
CifsExiting
)
continue
;
if
(
!
match_session
(
ses
,
vol
))
continue
;
++
ses
->
ses_count
;
...
...
@@ -2263,24 +2265,37 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
static
void
cifs_put_smb_ses
(
struct
cifs_ses
*
ses
)
{
unsigned
int
xid
;
unsigned
int
rc
,
xid
;
struct
TCP_Server_Info
*
server
=
ses
->
server
;
cifs_dbg
(
FYI
,
"%s: ses_count=%d
\n
"
,
__func__
,
ses
->
ses_count
);
spin_lock
(
&
cifs_tcp_ses_lock
);
if
(
ses
->
status
==
CifsExiting
)
{
spin_unlock
(
&
cifs_tcp_ses_lock
);
return
;
}
if
(
--
ses
->
ses_count
>
0
)
{
spin_unlock
(
&
cifs_tcp_ses_lock
);
return
;
}
list_del_init
(
&
ses
->
smb_ses_list
)
;
if
(
ses
->
status
==
CifsGood
)
ses
->
status
=
CifsExiting
;
spin_unlock
(
&
cifs_tcp_ses_lock
);
if
(
ses
->
status
==
Cifs
Good
&&
server
->
ops
->
logoff
)
{
if
(
ses
->
status
==
Cifs
Exiting
&&
server
->
ops
->
logoff
)
{
xid
=
get_xid
();
server
->
ops
->
logoff
(
xid
,
ses
);
rc
=
server
->
ops
->
logoff
(
xid
,
ses
);
if
(
rc
)
cifs_dbg
(
VFS
,
"%s: Session Logoff failure rc=%d
\n
"
,
__func__
,
rc
);
_free_xid
(
xid
);
}
spin_lock
(
&
cifs_tcp_ses_lock
);
list_del_init
(
&
ses
->
smb_ses_list
);
spin_unlock
(
&
cifs_tcp_ses_lock
);
sesInfoFree
(
ses
);
cifs_put_tcp_session
(
server
);
}
...
...
sources/3.12/smb2ops.c
View file @
622954af
...
...
@@ -49,9 +49,13 @@ change_conf(struct TCP_Server_Info *server)
break
;
default:
server
->
echoes
=
true
;
server
->
oplocks
=
true
;
if
(
enable_oplocks
)
{
server
->
oplocks
=
true
;
server
->
oplock_credits
=
1
;
}
else
server
->
oplocks
=
false
;
server
->
echo_credits
=
1
;
server
->
oplock_credits
=
1
;
}
server
->
credits
-=
server
->
echo_credits
+
server
->
oplock_credits
;
return
0
;
...
...
sources/3.12/smb2transport.c
View file @
622954af
...
...
@@ -516,13 +516,19 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct smb2_hdr *buf,
return
-
EAGAIN
;
}
if
(
ses
->
status
!=
CifsGood
)
{
/* check if SMB2 session is bad because we are setting it up */
if
(
ses
->
status
==
CifsNew
)
{
if
((
buf
->
Command
!=
SMB2_SESSION_SETUP
)
&&
(
buf
->
Command
!=
SMB2_NEGOTIATE
))
return
-
EAGAIN
;
/* else ok - we are setting up session */
}
if
(
ses
->
status
==
CifsExiting
)
{
if
(
buf
->
Command
!=
SMB2_LOGOFF
)
return
-
EAGAIN
;
/* else ok - we are shutting down the session */
}
*
mid
=
smb2_mid_entry_alloc
(
buf
,
ses
->
server
);
if
(
*
mid
==
NULL
)
return
-
ENOMEM
;
...
...
sources/3.12/transport.c
View file @
622954af
...
...
@@ -431,13 +431,20 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
return
-
EAGAIN
;
}
if
(
ses
->
status
!=
CifsGood
)
{
/* check if SMB session is bad because we are setting it up */
if
(
ses
->
status
==
CifsNew
)
{
if
((
in_buf
->
Command
!=
SMB_COM_SESSION_SETUP_ANDX
)
&&
(
in_buf
->
Command
!=
SMB_COM_NEGOTIATE
))
return
-
EAGAIN
;
/* else ok - we are setting up session */
}
if
(
ses
->
status
==
CifsExiting
)
{
/* check if SMB session is bad because we are setting it up */
if
(
in_buf
->
Command
!=
SMB_COM_LOGOFF_ANDX
)
return
-
EAGAIN
;
/* else ok - we are shutting down session */
}
*
ppmidQ
=
AllocMidQEntry
(
in_buf
,
ses
->
server
);
if
(
*
ppmidQ
==
NULL
)
return
-
ENOMEM
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment