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
47fc7731
Commit
47fc7731
authored
May 31, 2011
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 2.6.38 sources from stable (v2.6.38.7)
parent
c298cd36
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
95 deletions
+100
-95
cifs_unicode.c
sources/2.6.38/cifs_unicode.c
+23
-26
cifs_unicode.h
sources/2.6.38/cifs_unicode.h
+1
-1
connect.c
sources/2.6.38/connect.c
+72
-53
sess.c
sources/2.6.38/sess.c
+4
-15
No files found.
sources/2.6.38/cifs_unicode.c
View file @
47fc7731
...
...
@@ -90,7 +90,7 @@ cifs_mapchar(char *target, const __u16 src_char, const struct nls_table *cp,
case
UNI_COLON
:
*
target
=
':'
;
break
;
case
UNI_ASTERIK
:
case
UNI_ASTERI
S
K
:
*
target
=
'*'
;
break
;
case
UNI_QUESTION
:
...
...
@@ -264,40 +264,41 @@ cifs_strndup_from_ucs(const char *src, const int maxlen, const bool is_unicode,
* names are little endian 16 bit Unicode on the wire
*/
int
cifsConvertToUCS
(
__le16
*
target
,
const
char
*
source
,
int
max
len
,
cifsConvertToUCS
(
__le16
*
target
,
const
char
*
source
,
int
src
len
,
const
struct
nls_table
*
cp
,
int
mapChars
)
{
int
i
,
j
,
charlen
;
int
len_remaining
=
maxlen
;
char
src_char
;
__u16
temp
;
__le16
dst_char
;
wchar_t
tmp
;
if
(
!
mapChars
)
return
cifs_strtoUCS
(
target
,
source
,
PATH_MAX
,
cp
);
for
(
i
=
0
,
j
=
0
;
i
<
max
len
;
j
++
)
{
for
(
i
=
0
,
j
=
0
;
i
<
src
len
;
j
++
)
{
src_char
=
source
[
i
];
charlen
=
1
;
switch
(
src_char
)
{
case
0
:
put_unaligned
_le16
(
0
,
&
target
[
j
]);
put_unaligned
(
0
,
&
target
[
j
]);
goto
ctoUCS_out
;
case
':'
:
temp
=
UNI_COLON
;
dst_char
=
cpu_to_le16
(
UNI_COLON
)
;
break
;
case
'*'
:
temp
=
UNI_ASTERIK
;
dst_char
=
cpu_to_le16
(
UNI_ASTERISK
)
;
break
;
case
'?'
:
temp
=
UNI_QUESTION
;
dst_char
=
cpu_to_le16
(
UNI_QUESTION
)
;
break
;
case
'<'
:
temp
=
UNI_LESSTHAN
;
dst_char
=
cpu_to_le16
(
UNI_LESSTHAN
)
;
break
;
case
'>'
:
temp
=
UNI_GRTRTHAN
;
dst_char
=
cpu_to_le16
(
UNI_GRTRTHAN
)
;
break
;
case
'|'
:
temp
=
UNI_PIPE
;
dst_char
=
cpu_to_le16
(
UNI_PIPE
)
;
break
;
/*
* FIXME: We can not handle remapping backslash (UNI_SLASH)
...
...
@@ -305,28 +306,24 @@ cifsConvertToUCS(__le16 *target, const char *source, int maxlen,
* as they use backslash as separator.
*/
default:
charlen
=
cp
->
char2uni
(
source
+
i
,
len_remaining
,
&
temp
);
charlen
=
cp
->
char2uni
(
source
+
i
,
srclen
-
i
,
&
tmp
);
dst_char
=
cpu_to_le16
(
tmp
);
/*
* if no match, use question mark, which at least in
* some cases serves as wild card
*/
if
(
charlen
<
1
)
{
temp
=
0x003f
;
dst_char
=
cpu_to_le16
(
0x003f
)
;
charlen
=
1
;
}
len_remaining
-=
charlen
;
/*
* character may take more than one byte in the source
* string, but will take exactly two bytes in the
* target string
*/
i
+=
charlen
;
continue
;
}
put_unaligned_le16
(
temp
,
&
target
[
j
]);
i
++
;
/* move to next char in source string */
len_remaining
--
;
/*
* character may take more than one byte in the source string,
* but will take exactly two bytes in the target string
*/
i
+=
charlen
;
put_unaligned
(
dst_char
,
&
target
[
j
]);
}
ctoUCS_out:
...
...
sources/2.6.38/cifs_unicode.h
View file @
47fc7731
...
...
@@ -44,7 +44,7 @@
* reserved symbols (along with \ and /), otherwise illegal to store
* in filenames in NTFS
*/
#define UNI_ASTERI
K
(__u16) ('*' + 0xF000)
#define UNI_ASTERI
SK
(__u16) ('*' + 0xF000)
#define UNI_QUESTION (__u16) ('?' + 0xF000)
#define UNI_COLON (__u16) (':' + 0xF000)
#define UNI_GRTRTHAN (__u16) ('>' + 0xF000)
...
...
sources/2.6.38/connect.c
View file @
47fc7731
...
...
@@ -276,7 +276,8 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB)
char
*
data_area_of_target
;
char
*
data_area_of_buf2
;
int
remaining
;
__u16
byte_count
,
total_data_size
,
total_in_buf
,
total_in_buf2
;
unsigned
int
byte_count
,
total_in_buf
;
__u16
total_data_size
,
total_in_buf2
;
total_data_size
=
get_unaligned_le16
(
&
pSMBt
->
t2_rsp
.
TotalDataCount
);
...
...
@@ -289,7 +290,7 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB)
remaining
=
total_data_size
-
total_in_buf
;
if
(
remaining
<
0
)
return
-
E
INVAL
;
return
-
E
PROTO
;
if
(
remaining
==
0
)
/* nothing to do, ignore */
return
0
;
...
...
@@ -310,20 +311,29 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB)
data_area_of_target
+=
total_in_buf
;
/* copy second buffer into end of first buffer */
memcpy
(
data_area_of_target
,
data_area_of_buf2
,
total_in_buf2
);
total_in_buf
+=
total_in_buf2
;
/* is the result too big for the field? */
if
(
total_in_buf
>
USHRT_MAX
)
return
-
EPROTO
;
put_unaligned_le16
(
total_in_buf
,
&
pSMBt
->
t2_rsp
.
DataCount
);
/* fix up the BCC */
byte_count
=
get_bcc_le
(
pTargetSMB
);
byte_count
+=
total_in_buf2
;
/* is the result too big for the field? */
if
(
byte_count
>
USHRT_MAX
)
return
-
EPROTO
;
put_bcc_le
(
byte_count
,
pTargetSMB
);
byte_count
=
pTargetSMB
->
smb_buf_length
;
byte_count
+=
total_in_buf2
;
/* BB also add check that we are not beyond maximum buffer size */
/* don't allow buffer to overflow */
if
(
byte_count
>
CIFSMaxBufSize
)
return
-
ENOBUFS
;
pTargetSMB
->
smb_buf_length
=
byte_count
;
memcpy
(
data_area_of_target
,
data_area_of_buf2
,
total_in_buf2
);
if
(
remaining
==
total_in_buf2
)
{
cFYI
(
1
,
"found the last secondary response"
);
return
0
;
/* we are done */
...
...
@@ -609,59 +619,63 @@ incomplete_rcv:
list_for_each_safe
(
tmp
,
tmp2
,
&
server
->
pending_mid_q
)
{
mid_entry
=
list_entry
(
tmp
,
struct
mid_q_entry
,
qhead
);
if
((
mid_entry
->
mid
==
smb_buffer
->
Mid
)
&&
(
mid_entry
->
midState
==
MID_REQUEST_SUBMITTED
)
&&
(
mid_entry
->
command
==
smb_buffer
->
Command
))
{
if
(
length
==
0
&&
check2ndT2
(
smb_buffer
,
server
->
maxBuf
)
>
0
)
{
/* We have a multipart transact2 resp */
isMultiRsp
=
true
;
if
(
mid_entry
->
resp_buf
)
{
/* merge response - fix up 1st*/
if
(
coalesce_t2
(
smb_buffer
,
mid_entry
->
resp_buf
))
{
mid_entry
->
multiRsp
=
true
;
break
;
}
else
{
/* all parts received */
mid_entry
->
multiEnd
=
true
;
goto
multi_t2_fnd
;
}
if
(
mid_entry
->
mid
!=
smb_buffer
->
Mid
||
mid_entry
->
midState
!=
MID_REQUEST_SUBMITTED
||
mid_entry
->
command
!=
smb_buffer
->
Command
)
{
mid_entry
=
NULL
;
continue
;
}
if
(
length
==
0
&&
check2ndT2
(
smb_buffer
,
server
->
maxBuf
)
>
0
)
{
/* We have a multipart transact2 resp */
isMultiRsp
=
true
;
if
(
mid_entry
->
resp_buf
)
{
/* merge response - fix up 1st*/
length
=
coalesce_t2
(
smb_buffer
,
mid_entry
->
resp_buf
);
if
(
length
>
0
)
{
length
=
0
;
mid_entry
->
multiRsp
=
true
;
break
;
}
else
{
if
(
!
isLargeBuf
)
{
cERROR
(
1
,
"1st trans2 resp needs bigbuf"
);
/* BB maybe we can fix this up, switch
to already allocated large buffer? */
}
else
{
/* Have first buffer */
mid_entry
->
resp_buf
=
smb_buffer
;
mid_entry
->
largeBuf
=
true
;
bigbuf
=
NULL
;
}
/* all parts received or
* packet is malformed
*/
mid_entry
->
multiEnd
=
true
;
goto
multi_t2_fnd
;
}
}
else
{
if
(
!
isLargeBuf
)
{
/*
* FIXME: switch to already
* allocated largebuf?
*/
cERROR
(
1
,
"1st trans2 resp "
"needs bigbuf"
);
}
else
{
/* Have first buffer */
mid_entry
->
resp_buf
=
smb_buffer
;
mid_entry
->
largeBuf
=
true
;
bigbuf
=
NULL
;
}
break
;
}
mid_entry
->
resp_buf
=
smb_buffer
;
mid_entry
->
largeBuf
=
isLargeBuf
;
break
;
}
mid_entry
->
resp_buf
=
smb_buffer
;
mid_entry
->
largeBuf
=
isLargeBuf
;
multi_t2_fnd:
if
(
length
==
0
)
mid_entry
->
midState
=
MID_RESPONSE_RECEIVED
;
else
mid_entry
->
midState
=
MID_RESPONSE_MALFORMED
;
if
(
length
==
0
)
mid_entry
->
midState
=
MID_RESPONSE_RECEIVED
;
else
mid_entry
->
midState
=
MID_RESPONSE_MALFORMED
;
#ifdef CONFIG_CIFS_STATS2
mid_entry
->
when_received
=
jiffies
;
mid_entry
->
when_received
=
jiffies
;
#endif
list_del_init
(
&
mid_entry
->
qhead
);
mid_entry
->
callback
(
mid_entry
);
break
;
}
mid_entry
=
NULL
;
list_del_init
(
&
mid_entry
->
qhead
);
mid_entry
->
callback
(
mid_entry
);
break
;
}
spin_unlock
(
&
GlobalMid_Lock
);
...
...
@@ -2650,6 +2664,11 @@ is_path_accessible(int xid, struct cifsTconInfo *tcon,
0
/* not legacy */
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
rc
==
-
EOPNOTSUPP
||
rc
==
-
EINVAL
)
rc
=
SMBQueryInformation
(
xid
,
tcon
,
full_path
,
pfile_info
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
kfree
(
pfile_info
);
return
rc
;
}
...
...
sources/2.6.38/sess.c
View file @
47fc7731
...
...
@@ -277,7 +277,7 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
}
static
void
decode_unicode_ssetup
(
char
**
pbcc_area
,
__u16
bleft
,
struct
cifsSesInfo
*
ses
,
decode_unicode_ssetup
(
char
**
pbcc_area
,
int
bleft
,
struct
cifsSesInfo
*
ses
,
const
struct
nls_table
*
nls_cp
)
{
int
len
;
...
...
@@ -285,19 +285,6 @@ decode_unicode_ssetup(char **pbcc_area, __u16 bleft, struct cifsSesInfo *ses,
cFYI
(
1
,
"bleft %d"
,
bleft
);
/*
* Windows servers do not always double null terminate their final
* Unicode string. Check to see if there are an uneven number of bytes
* left. If so, then add an extra NULL pad byte to the end of the
* response.
*
* See section 2.7.2 in "Implementing CIFS" for details
*/
if
(
bleft
%
2
)
{
data
[
bleft
]
=
0
;
++
bleft
;
}
kfree
(
ses
->
serverOS
);
ses
->
serverOS
=
cifs_strndup_from_ucs
(
data
,
bleft
,
true
,
nls_cp
);
cFYI
(
1
,
"serverOS=%s"
,
ses
->
serverOS
);
...
...
@@ -930,7 +917,9 @@ ssetup_ntlmssp_authenticate:
}
/* BB check if Unicode and decode strings */
if
(
smb_buf
->
Flags2
&
SMBFLG2_UNICODE
)
{
if
(
bytes_remaining
==
0
)
{
/* no string area to decode, do nothing */
}
else
if
(
smb_buf
->
Flags2
&
SMBFLG2_UNICODE
)
{
/* unicode string area must be word-aligned */
if
(((
unsigned
long
)
bcc_ptr
-
(
unsigned
long
)
smb_buf
)
%
2
)
{
++
bcc_ptr
;
...
...
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