Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3870253e
Commit
3870253e
authored
Jul 08, 2007
by
Steve French
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CIFS] more whitespace fixes
Signed-off-by:
Steve French
<
sfrench@us.ibm.com
>
parent
790fe579
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
137 deletions
+141
-137
fs/cifs/netmisc.c
fs/cifs/netmisc.c
+42
-40
fs/cifs/readdir.c
fs/cifs/readdir.c
+82
-81
fs/cifs/sess.c
fs/cifs/sess.c
+5
-4
fs/cifs/smbdes.c
fs/cifs/smbdes.c
+12
-12
No files found.
fs/cifs/netmisc.c
View file @
3870253e
...
@@ -3,23 +3,22 @@
...
@@ -3,23 +3,22 @@
*
*
* Copyright (c) International Business Machines Corp., 2002
* Copyright (c) International Business Machines Corp., 2002
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* Error mapping routines from Samba libsmb/errormap.c
* Error mapping routines from Samba libsmb/errormap.c
* Copyright (C) Andrew Tridgell 2001
* Copyright (C) Andrew Tridgell 2001
*
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
* the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
...
@@ -67,22 +66,22 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
...
@@ -67,22 +66,22 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
{
ERRbadshare
,
-
ETXTBSY
},
{
ERRbadshare
,
-
ETXTBSY
},
{
ERRlock
,
-
EACCES
},
{
ERRlock
,
-
EACCES
},
{
ERRunsup
,
-
EINVAL
},
{
ERRunsup
,
-
EINVAL
},
{
ERRnosuchshare
,
-
ENXIO
},
{
ERRnosuchshare
,
-
ENXIO
},
{
ERRfilexists
,
-
EEXIST
},
{
ERRfilexists
,
-
EEXIST
},
{
ERRinvparm
,
-
EINVAL
},
{
ERRinvparm
,
-
EINVAL
},
{
ERRdiskfull
,
-
ENOSPC
},
{
ERRdiskfull
,
-
ENOSPC
},
{
ERRinvname
,
-
ENOENT
},
{
ERRinvname
,
-
ENOENT
},
{
ERRinvlevel
,
-
EOPNOTSUPP
},
{
ERRinvlevel
,
-
EOPNOTSUPP
},
{
ERRdirnotempty
,
-
ENOTEMPTY
},
{
ERRdirnotempty
,
-
ENOTEMPTY
},
{
ERRnotlocked
,
-
ENOLCK
},
{
ERRnotlocked
,
-
ENOLCK
},
{
ERRcancelviolation
,
-
ENOLCK
},
{
ERRcancelviolation
,
-
ENOLCK
},
{
ERRalreadyexists
,
-
EEXIST
},
{
ERRalreadyexists
,
-
EEXIST
},
{
ERRmoredata
,
-
EOVERFLOW
},
{
ERRmoredata
,
-
EOVERFLOW
},
{
ERReasnotsupported
,
-
EOPNOTSUPP
},
{
ERReasnotsupported
,
-
EOPNOTSUPP
},
{
ErrQuota
,
-
EDQUOT
},
{
ErrQuota
,
-
EDQUOT
},
{
ErrNotALink
,
-
ENOLINK
},
{
ErrNotALink
,
-
ENOLINK
},
{
ERRnetlogonNotStarted
,
-
ENOPROTOOPT
},
{
ERRnetlogonNotStarted
,
-
ENOPROTOOPT
},
{
ErrTooManyLinks
,
-
EMLINK
},
{
ErrTooManyLinks
,
-
EMLINK
},
{
0
,
0
}
{
0
,
0
}
};
};
...
@@ -133,15 +132,15 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
...
@@ -133,15 +132,15 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
/* returns 0 if invalid address */
/* returns 0 if invalid address */
int
int
cifs_inet_pton
(
int
address_family
,
char
*
cp
,
void
*
dst
)
cifs_inet_pton
(
int
address_family
,
char
*
cp
,
void
*
dst
)
{
{
int
ret
=
0
;
int
ret
=
0
;
/* calculate length by finding first slash or NULL */
/* calculate length by finding first slash or NULL */
/* BB Should we convert '/' slash to '\' here since it seems already
done
/* BB Should we convert '/' slash to '\' here since it seems already
before this */
* done
before this */
if
(
address_family
==
AF_INET
)
{
if
(
address_family
==
AF_INET
)
{
ret
=
in4_pton
(
cp
,
-
1
/* len */
,
dst
,
'\\'
,
NULL
);
ret
=
in4_pton
(
cp
,
-
1
/* len */
,
dst
,
'\\'
,
NULL
);
}
else
if
(
address_family
==
AF_INET6
)
{
}
else
if
(
address_family
==
AF_INET6
)
{
ret
=
in6_pton
(
cp
,
-
1
/* len */
,
dst
,
'\\'
,
NULL
);
ret
=
in6_pton
(
cp
,
-
1
/* len */
,
dst
,
'\\'
,
NULL
);
}
}
...
@@ -185,7 +184,7 @@ static const struct {
...
@@ -185,7 +184,7 @@ static const struct {
ERRHRD
,
ERRgeneral
,
NT_STATUS_UNRECOGNIZED_MEDIA
},
{
ERRHRD
,
ERRgeneral
,
NT_STATUS_UNRECOGNIZED_MEDIA
},
{
ERRDOS
,
27
,
NT_STATUS_NONEXISTENT_SECTOR
},
ERRDOS
,
27
,
NT_STATUS_NONEXISTENT_SECTOR
},
/* { This NT error code was 'sqashed'
/* { This NT error code was 'sqashed'
from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
during the session setup } */
during the session setup } */
{
{
ERRDOS
,
ERRnomem
,
NT_STATUS_NO_MEMORY
},
{
ERRDOS
,
ERRnomem
,
NT_STATUS_NO_MEMORY
},
{
...
@@ -200,7 +199,7 @@ static const struct {
...
@@ -200,7 +199,7 @@ static const struct {
ERRDOS
,
193
,
NT_STATUS_INVALID_FILE_FOR_SECTION
},
{
ERRDOS
,
193
,
NT_STATUS_INVALID_FILE_FOR_SECTION
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_ALREADY_COMMITTED
},
ERRDOS
,
ERRnoaccess
,
NT_STATUS_ALREADY_COMMITTED
},
/* { This NT error code was 'sqashed'
/* { This NT error code was 'sqashed'
from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
during the session setup } */
during the session setup } */
{
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_ACCESS_DENIED
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_ACCESS_DENIED
},
{
...
@@ -270,7 +269,7 @@ static const struct {
...
@@ -270,7 +269,7 @@ static const struct {
ERRHRD
,
ERRgeneral
,
NT_STATUS_INVALID_ACCOUNT_NAME
},
{
ERRHRD
,
ERRgeneral
,
NT_STATUS_INVALID_ACCOUNT_NAME
},
{
ERRHRD
,
ERRgeneral
,
NT_STATUS_USER_EXISTS
},
ERRHRD
,
ERRgeneral
,
NT_STATUS_USER_EXISTS
},
/* { This NT error code was 'sqashed'
/* { This NT error code was 'sqashed'
from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
during the session setup } */
during the session setup } */
{
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NO_SUCH_USER
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NO_SUCH_USER
},
{
...
@@ -280,7 +279,7 @@ static const struct {
...
@@ -280,7 +279,7 @@ static const struct {
ERRHRD
,
ERRgeneral
,
NT_STATUS_MEMBER_NOT_IN_GROUP
},
{
ERRHRD
,
ERRgeneral
,
NT_STATUS_MEMBER_NOT_IN_GROUP
},
{
ERRHRD
,
ERRgeneral
,
NT_STATUS_LAST_ADMIN
},
ERRHRD
,
ERRgeneral
,
NT_STATUS_LAST_ADMIN
},
/* { This NT error code was 'sqashed'
/* { This NT error code was 'sqashed'
from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE
from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE
during the session setup } */
during the session setup } */
{
{
ERRSRV
,
ERRbadpw
,
NT_STATUS_WRONG_PASSWORD
},
{
ERRSRV
,
ERRbadpw
,
NT_STATUS_WRONG_PASSWORD
},
{
...
@@ -332,8 +331,8 @@ static const struct {
...
@@ -332,8 +331,8 @@ static const struct {
ERRHRD
,
ERRgeneral
,
NT_STATUS_FILE_INVALID
},
{
ERRHRD
,
ERRgeneral
,
NT_STATUS_FILE_INVALID
},
{
ERRHRD
,
ERRgeneral
,
NT_STATUS_ALLOTTED_SPACE_EXCEEDED
},
ERRHRD
,
ERRgeneral
,
NT_STATUS_ALLOTTED_SPACE_EXCEEDED
},
/* { This NT error code was 'sqashed'
/* { This NT error code was 'sqashed'
from NT_STATUS_INSUFFICIENT_RESOURCES to
NT_STATUS_INSUFF_SERVER_RESOURCES
from NT_STATUS_INSUFFICIENT_RESOURCES to
during the session setup } */
NT_STATUS_INSUFF_SERVER_RESOURCES
during the session setup } */
{
{
ERRDOS
,
ERRnomem
,
NT_STATUS_INSUFFICIENT_RESOURCES
},
{
ERRDOS
,
ERRnomem
,
NT_STATUS_INSUFFICIENT_RESOURCES
},
{
ERRDOS
,
ERRbadpath
,
NT_STATUS_DFS_EXIT_PATH_FOUND
},
{
ERRDOS
,
ERRbadpath
,
NT_STATUS_DFS_EXIT_PATH_FOUND
},
{
...
@@ -577,8 +576,8 @@ static const struct {
...
@@ -577,8 +576,8 @@ static const struct {
ERRDOS
,
19
,
NT_STATUS_TOO_LATE
},
{
ERRDOS
,
19
,
NT_STATUS_TOO_LATE
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NO_TRUST_LSA_SECRET
},
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NO_TRUST_LSA_SECRET
},
/* { This NT error code was 'sqashed'
/* { This NT error code was 'sqashed'
from NT_STATUS_NO_TRUST_SAM_ACCOUNT to
NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
from NT_STATUS_NO_TRUST_SAM_ACCOUNT to
during the session setup } */
NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
during the session setup } */
{
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NO_TRUST_SAM_ACCOUNT
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NO_TRUST_SAM_ACCOUNT
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_TRUSTED_DOMAIN_FAILURE
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_TRUSTED_DOMAIN_FAILURE
},
{
...
@@ -597,7 +596,7 @@ static const struct {
...
@@ -597,7 +596,7 @@ static const struct {
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT
},
ERRDOS
,
ERRnoaccess
,
NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT
},
/* { This NT error code was 'sqashed'
/* { This NT error code was 'sqashed'
from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE
from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE
during the session setup } */
during the session setup } */
{
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_DOMAIN_TRUST_INCONSISTENT
},
{
ERRDOS
,
ERRnoaccess
,
NT_STATUS_DOMAIN_TRUST_INCONSISTENT
},
{
...
@@ -728,7 +727,7 @@ cifs_print_status(__u32 status_code)
...
@@ -728,7 +727,7 @@ cifs_print_status(__u32 status_code)
if
(((
nt_errs
[
idx
].
nt_errcode
)
&
0xFFFFFF
)
==
if
(((
nt_errs
[
idx
].
nt_errcode
)
&
0xFFFFFF
)
==
(
status_code
&
0xFFFFFF
))
{
(
status_code
&
0xFFFFFF
))
{
printk
(
KERN_NOTICE
"Status code returned 0x%08x %s
\n
"
,
printk
(
KERN_NOTICE
"Status code returned 0x%08x %s
\n
"
,
status_code
,
nt_errs
[
idx
].
nt_errstr
);
status_code
,
nt_errs
[
idx
].
nt_errstr
);
}
}
idx
++
;
idx
++
;
}
}
...
@@ -760,7 +759,7 @@ int
...
@@ -760,7 +759,7 @@ int
map_smb_to_linux_error
(
struct
smb_hdr
*
smb
)
map_smb_to_linux_error
(
struct
smb_hdr
*
smb
)
{
{
unsigned
int
i
;
unsigned
int
i
;
int
rc
=
-
EIO
;
/* if transport error smb error may not be set */
int
rc
=
-
EIO
;
/* if transport error smb error may not be set */
__u8
smberrclass
;
__u8
smberrclass
;
__u16
smberrcode
;
__u16
smberrcode
;
...
@@ -771,7 +770,8 @@ map_smb_to_linux_error(struct smb_hdr *smb)
...
@@ -771,7 +770,8 @@ map_smb_to_linux_error(struct smb_hdr *smb)
return
0
;
return
0
;
if
(
smb
->
Flags2
&
SMBFLG2_ERR_STATUS
)
{
if
(
smb
->
Flags2
&
SMBFLG2_ERR_STATUS
)
{
/* translate the newer STATUS codes to old style errors and then to POSIX errors */
/* translate the newer STATUS codes to old style SMB errors
* and then to POSIX errors */
__u32
err
=
le32_to_cpu
(
smb
->
Status
.
CifsError
);
__u32
err
=
le32_to_cpu
(
smb
->
Status
.
CifsError
);
if
(
cifsFYI
&
CIFS_RC
)
if
(
cifsFYI
&
CIFS_RC
)
cifs_print_status
(
err
);
cifs_print_status
(
err
);
...
@@ -784,7 +784,7 @@ map_smb_to_linux_error(struct smb_hdr *smb)
...
@@ -784,7 +784,7 @@ map_smb_to_linux_error(struct smb_hdr *smb)
/* old style errors */
/* old style errors */
/* DOS class smb error codes - map DOS */
/* DOS class smb error codes - map DOS */
if
(
smberrclass
==
ERRDOS
)
{
/* one
byte field no need to byte reverse */
if
(
smberrclass
==
ERRDOS
)
{
/* 1
byte field no need to byte reverse */
for
(
i
=
0
;
for
(
i
=
0
;
i
<
i
<
sizeof
(
mapping_table_ERRDOS
)
/
sizeof
(
mapping_table_ERRDOS
)
/
...
@@ -795,9 +795,9 @@ map_smb_to_linux_error(struct smb_hdr *smb)
...
@@ -795,9 +795,9 @@ map_smb_to_linux_error(struct smb_hdr *smb)
rc
=
mapping_table_ERRDOS
[
i
].
posix_code
;
rc
=
mapping_table_ERRDOS
[
i
].
posix_code
;
break
;
break
;
}
}
/* else try
the next error mapping one to see if it will
match */
/* else try
next error mapping one to see if
match */
}
}
}
else
if
(
smberrclass
==
ERRSRV
)
{
/* server class of error codes */
}
else
if
(
smberrclass
==
ERRSRV
)
{
/* server class of error codes */
for
(
i
=
0
;
for
(
i
=
0
;
i
<
i
<
sizeof
(
mapping_table_ERRSRV
)
/
sizeof
(
mapping_table_ERRSRV
)
/
...
@@ -808,14 +808,16 @@ map_smb_to_linux_error(struct smb_hdr *smb)
...
@@ -808,14 +808,16 @@ map_smb_to_linux_error(struct smb_hdr *smb)
rc
=
mapping_table_ERRSRV
[
i
].
posix_code
;
rc
=
mapping_table_ERRSRV
[
i
].
posix_code
;
break
;
break
;
}
}
/* else try
the next error mapping one to see if it will
match */
/* else try
next error mapping to see if
match */
}
}
}
}
/* else ERRHRD class errors or junk - return EIO */
/* else ERRHRD class errors or junk - return EIO */
cFYI
(
1
,
(
" !!Mapping smb error code %d to POSIX err %d !!"
,
smberrcode
,
rc
));
cFYI
(
1
,
(
" !!Mapping smb error code %d to POSIX err %d !!"
,
smberrcode
,
rc
));
/* generic corrective action e.g. reconnect SMB session on ERRbaduid could be added */
/* generic corrective action e.g. reconnect SMB session on
* ERRbaduid could be added */
return
rc
;
return
rc
;
}
}
...
@@ -849,7 +851,7 @@ smbCalcSize_LE(struct smb_hdr *ptr)
...
@@ -849,7 +851,7 @@ smbCalcSize_LE(struct smb_hdr *ptr)
struct
timespec
struct
timespec
cifs_NTtimeToUnix
(
u64
ntutc
)
cifs_NTtimeToUnix
(
u64
ntutc
)
{
{
struct
timespec
ts
;
struct
timespec
ts
;
/* BB what about the timezone? BB */
/* BB what about the timezone? BB */
/* Subtract the NTFS time offset, then convert to 1s intervals. */
/* Subtract the NTFS time offset, then convert to 1s intervals. */
...
@@ -857,7 +859,7 @@ cifs_NTtimeToUnix(u64 ntutc)
...
@@ -857,7 +859,7 @@ cifs_NTtimeToUnix(u64 ntutc)
t
=
ntutc
-
NTFS_TIME_OFFSET
;
t
=
ntutc
-
NTFS_TIME_OFFSET
;
ts
.
tv_nsec
=
do_div
(
t
,
10000000
)
*
100
;
ts
.
tv_nsec
=
do_div
(
t
,
10000000
)
*
100
;
ts
.
tv_sec
=
t
;
ts
.
tv_sec
=
t
;
return
ts
;
return
ts
;
}
}
...
@@ -885,20 +887,20 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
...
@@ -885,20 +887,20 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
SMB_TIME
*
st
=
(
SMB_TIME
*
)
&
time
;
SMB_TIME
*
st
=
(
SMB_TIME
*
)
&
time
;
SMB_DATE
*
sd
=
(
SMB_DATE
*
)
&
date
;
SMB_DATE
*
sd
=
(
SMB_DATE
*
)
&
date
;
cFYI
(
1
,
(
"date %d time %d"
,
date
,
time
));
cFYI
(
1
,
(
"date %d time %d"
,
date
,
time
));
sec
=
2
*
st
->
TwoSeconds
;
sec
=
2
*
st
->
TwoSeconds
;
min
=
st
->
Minutes
;
min
=
st
->
Minutes
;
if
((
sec
>
59
)
||
(
min
>
59
))
if
((
sec
>
59
)
||
(
min
>
59
))
cERROR
(
1
,(
"illegal time min %d sec %d"
,
min
,
sec
));
cERROR
(
1
,
(
"illegal time min %d sec %d"
,
min
,
sec
));
sec
+=
(
min
*
60
);
sec
+=
(
min
*
60
);
sec
+=
60
*
60
*
st
->
Hours
;
sec
+=
60
*
60
*
st
->
Hours
;
if
(
st
->
Hours
>
24
)
if
(
st
->
Hours
>
24
)
cERROR
(
1
,
(
"illegal hours %d"
,
st
->
Hours
));
cERROR
(
1
,
(
"illegal hours %d"
,
st
->
Hours
));
days
=
sd
->
Day
;
days
=
sd
->
Day
;
month
=
sd
->
Month
;
month
=
sd
->
Month
;
if
((
days
>
31
)
||
(
month
>
12
))
if
((
days
>
31
)
||
(
month
>
12
))
cERROR
(
1
,(
"illegal date, month %d day: %d"
,
month
,
days
));
cERROR
(
1
,
(
"illegal date, month %d day: %d"
,
month
,
days
));
month
-=
1
;
month
-=
1
;
days
+=
total_days_of_prev_months
[
month
];
days
+=
total_days_of_prev_months
[
month
];
days
+=
3652
;
/* account for difference in days between 1980 and 1970 */
days
+=
3652
;
/* account for difference in days between 1980 and 1970 */
...
@@ -909,7 +911,7 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
...
@@ -909,7 +911,7 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
for years/100 except for years/400, but since the maximum number for DOS
for years/100 except for years/400, but since the maximum number for DOS
year is 2**7, the last year is 1980+127, which means we need only
year is 2**7, the last year is 1980+127, which means we need only
consider 2 special case years, ie the years 2000 and 2100, and only
consider 2 special case years, ie the years 2000 and 2100, and only
adjust for the lack of leap year for the year 2100, as 2000 was a
adjust for the lack of leap year for the year 2100, as 2000 was a
leap year (divisable by 400) */
leap year (divisable by 400) */
if
(
year
>=
120
)
/* the year 2100 */
if
(
year
>=
120
)
/* the year 2100 */
days
=
days
-
1
;
/* do not count leap year for the year 2100 */
days
=
days
-
1
;
/* do not count leap year for the year 2100 */
...
@@ -925,4 +927,4 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
...
@@ -925,4 +927,4 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
ts
.
tv_nsec
=
0
;
ts
.
tv_nsec
=
0
;
return
ts
;
return
ts
;
}
}
fs/cifs/readdir.c
View file @
3870253e
...
@@ -101,7 +101,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
...
@@ -101,7 +101,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
if
(
*
ptmp_inode
==
NULL
)
if
(
*
ptmp_inode
==
NULL
)
return
rc
;
return
rc
;
if
(
file
->
f_path
.
dentry
->
d_sb
->
s_flags
&
MS_NOATIME
)
if
(
file
->
f_path
.
dentry
->
d_sb
->
s_flags
&
MS_NOATIME
)
(
*
ptmp_inode
)
->
i_flags
|=
S_NOATIME
|
S_NOCMTIME
;
(
*
ptmp_inode
)
->
i_flags
|=
S_NOATIME
|
S_NOCMTIME
;
rc
=
2
;
rc
=
2
;
}
}
...
@@ -431,14 +431,14 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
...
@@ -431,14 +431,14 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
static
int
initiate_cifs_search
(
const
int
xid
,
struct
file
*
file
)
static
int
initiate_cifs_search
(
const
int
xid
,
struct
file
*
file
)
{
{
int
rc
=
0
;
int
rc
=
0
;
char
*
full_path
;
char
*
full_path
;
struct
cifsFileInfo
*
cifsFile
;
struct
cifsFileInfo
*
cifsFile
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsTconInfo
*
pTcon
;
if
(
file
->
private_data
==
NULL
)
{
if
(
file
->
private_data
==
NULL
)
{
file
->
private_data
=
file
->
private_data
=
kzalloc
(
sizeof
(
struct
cifsFileInfo
),
GFP_KERNEL
);
kzalloc
(
sizeof
(
struct
cifsFileInfo
),
GFP_KERNEL
);
}
}
if
(
file
->
private_data
==
NULL
)
if
(
file
->
private_data
==
NULL
)
...
@@ -467,7 +467,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
...
@@ -467,7 +467,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
/* test for Unix extensions */
/* test for Unix extensions */
if
(
pTcon
->
ses
->
capabilities
&
CAP_UNIX
)
{
if
(
pTcon
->
ses
->
capabilities
&
CAP_UNIX
)
{
cifsFile
->
srch_inf
.
info_level
=
SMB_FIND_FILE_UNIX
;
cifsFile
->
srch_inf
.
info_level
=
SMB_FIND_FILE_UNIX
;
}
else
if
((
pTcon
->
ses
->
capabilities
&
}
else
if
((
pTcon
->
ses
->
capabilities
&
(
CAP_NT_SMBS
|
CAP_NT_FIND
))
==
0
)
{
(
CAP_NT_SMBS
|
CAP_NT_FIND
))
==
0
)
{
cifsFile
->
srch_inf
.
info_level
=
SMB_FIND_FILE_INFO_STANDARD
;
cifsFile
->
srch_inf
.
info_level
=
SMB_FIND_FILE_INFO_STANDARD
;
}
else
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
)
{
}
else
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
)
{
...
@@ -476,13 +476,13 @@ static int initiate_cifs_search(const int xid, struct file *file)
...
@@ -476,13 +476,13 @@ static int initiate_cifs_search(const int xid, struct file *file)
cifsFile
->
srch_inf
.
info_level
=
SMB_FIND_FILE_DIRECTORY_INFO
;
cifsFile
->
srch_inf
.
info_level
=
SMB_FIND_FILE_DIRECTORY_INFO
;
}
}
rc
=
CIFSFindFirst
(
xid
,
pTcon
,
full_path
,
cifs_sb
->
local_nls
,
rc
=
CIFSFindFirst
(
xid
,
pTcon
,
full_path
,
cifs_sb
->
local_nls
,
&
cifsFile
->
netfid
,
&
cifsFile
->
srch_inf
,
&
cifsFile
->
netfid
,
&
cifsFile
->
srch_inf
,
cifs_sb
->
mnt_cifs_flags
&
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
,
CIFS_DIR_SEP
(
cifs_sb
));
CIFS_MOUNT_MAP_SPECIAL_CHR
,
CIFS_DIR_SEP
(
cifs_sb
));
if
(
rc
==
0
)
if
(
rc
==
0
)
cifsFile
->
invalidHandle
=
FALSE
;
cifsFile
->
invalidHandle
=
FALSE
;
if
((
rc
==
-
EOPNOTSUPP
)
&&
if
((
rc
==
-
EOPNOTSUPP
)
&&
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
))
{
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
))
{
cifs_sb
->
mnt_cifs_flags
&=
~
CIFS_MOUNT_SERVER_INUM
;
cifs_sb
->
mnt_cifs_flags
&=
~
CIFS_MOUNT_SERVER_INUM
;
goto
ffirst_retry
;
goto
ffirst_retry
;
...
@@ -497,7 +497,7 @@ static int cifs_unicode_bytelen(char *str)
...
@@ -497,7 +497,7 @@ static int cifs_unicode_bytelen(char *str)
int
len
;
int
len
;
__le16
*
ustr
=
(
__le16
*
)
str
;
__le16
*
ustr
=
(
__le16
*
)
str
;
for
(
len
=
0
;
len
<=
PATH_MAX
;
len
++
)
{
for
(
len
=
0
;
len
<=
PATH_MAX
;
len
++
)
{
if
(
ustr
[
len
]
==
0
)
if
(
ustr
[
len
]
==
0
)
return
len
<<
1
;
return
len
<<
1
;
}
}
...
@@ -507,7 +507,7 @@ static int cifs_unicode_bytelen(char *str)
...
@@ -507,7 +507,7 @@ static int cifs_unicode_bytelen(char *str)
static
char
*
nxt_dir_entry
(
char
*
old_entry
,
char
*
end_of_smb
,
int
level
)
static
char
*
nxt_dir_entry
(
char
*
old_entry
,
char
*
end_of_smb
,
int
level
)
{
{
char
*
new_entry
;
char
*
new_entry
;
FILE_DIRECTORY_INFO
*
pDirInfo
=
(
FILE_DIRECTORY_INFO
*
)
old_entry
;
FILE_DIRECTORY_INFO
*
pDirInfo
=
(
FILE_DIRECTORY_INFO
*
)
old_entry
;
if
(
level
==
SMB_FIND_FILE_INFO_STANDARD
)
{
if
(
level
==
SMB_FIND_FILE_INFO_STANDARD
)
{
...
@@ -523,16 +523,16 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
...
@@ -523,16 +523,16 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
if
(
new_entry
>=
end_of_smb
)
{
if
(
new_entry
>=
end_of_smb
)
{
cERROR
(
1
,
cERROR
(
1
,
(
"search entry %p began after end of SMB %p old entry %p"
,
(
"search entry %p began after end of SMB %p old entry %p"
,
new_entry
,
end_of_smb
,
old_entry
));
new_entry
,
end_of_smb
,
old_entry
));
return
NULL
;
return
NULL
;
}
else
if
(((
level
==
SMB_FIND_FILE_INFO_STANDARD
)
&&
}
else
if
(((
level
==
SMB_FIND_FILE_INFO_STANDARD
)
&&
(
new_entry
+
sizeof
(
FIND_FILE_STANDARD_INFO
)
>
end_of_smb
))
||
(
new_entry
+
sizeof
(
FIND_FILE_STANDARD_INFO
)
>
end_of_smb
))
((
level
!=
SMB_FIND_FILE_INFO_STANDARD
)
&&
||
((
level
!=
SMB_FIND_FILE_INFO_STANDARD
)
&&
(
new_entry
+
sizeof
(
FILE_DIRECTORY_INFO
)
>
end_of_smb
)))
{
(
new_entry
+
sizeof
(
FILE_DIRECTORY_INFO
)
>
end_of_smb
)))
{
cERROR
(
1
,(
"search entry %p extends after end of SMB %p"
,
cERROR
(
1
,
(
"search entry %p extends after end of SMB %p"
,
new_entry
,
end_of_smb
));
new_entry
,
end_of_smb
));
return
NULL
;
return
NULL
;
}
else
}
else
return
new_entry
;
return
new_entry
;
}
}
...
@@ -543,8 +543,8 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
...
@@ -543,8 +543,8 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
static
int
cifs_entry_is_dot
(
char
*
current_entry
,
struct
cifsFileInfo
*
cfile
)
static
int
cifs_entry_is_dot
(
char
*
current_entry
,
struct
cifsFileInfo
*
cfile
)
{
{
int
rc
=
0
;
int
rc
=
0
;
char
*
filename
=
NULL
;
char
*
filename
=
NULL
;
int
len
=
0
;
int
len
=
0
;
if
(
cfile
->
srch_inf
.
info_level
==
SMB_FIND_FILE_UNIX
)
{
if
(
cfile
->
srch_inf
.
info_level
==
SMB_FIND_FILE_UNIX
)
{
FILE_UNIX_INFO
*
pFindData
=
(
FILE_UNIX_INFO
*
)
current_entry
;
FILE_UNIX_INFO
*
pFindData
=
(
FILE_UNIX_INFO
*
)
current_entry
;
...
@@ -556,25 +556,25 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
...
@@ -556,25 +556,25 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
len
=
strnlen
(
filename
,
5
);
len
=
strnlen
(
filename
,
5
);
}
}
}
else
if
(
cfile
->
srch_inf
.
info_level
==
SMB_FIND_FILE_DIRECTORY_INFO
)
{
}
else
if
(
cfile
->
srch_inf
.
info_level
==
SMB_FIND_FILE_DIRECTORY_INFO
)
{
FILE_DIRECTORY_INFO
*
pFindData
=
FILE_DIRECTORY_INFO
*
pFindData
=
(
FILE_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
}
else
if
(
cfile
->
srch_inf
.
info_level
==
}
else
if
(
cfile
->
srch_inf
.
info_level
==
SMB_FIND_FILE_FULL_DIRECTORY_INFO
)
{
SMB_FIND_FILE_FULL_DIRECTORY_INFO
)
{
FILE_FULL_DIRECTORY_INFO
*
pFindData
=
FILE_FULL_DIRECTORY_INFO
*
pFindData
=
(
FILE_FULL_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_FULL_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
}
else
if
(
cfile
->
srch_inf
.
info_level
==
}
else
if
(
cfile
->
srch_inf
.
info_level
==
SMB_FIND_FILE_ID_FULL_DIR_INFO
)
{
SMB_FIND_FILE_ID_FULL_DIR_INFO
)
{
SEARCH_ID_FULL_DIR_INFO
*
pFindData
=
SEARCH_ID_FULL_DIR_INFO
*
pFindData
=
(
SEARCH_ID_FULL_DIR_INFO
*
)
current_entry
;
(
SEARCH_ID_FULL_DIR_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
}
else
if
(
cfile
->
srch_inf
.
info_level
==
}
else
if
(
cfile
->
srch_inf
.
info_level
==
SMB_FIND_FILE_BOTH_DIRECTORY_INFO
)
{
SMB_FIND_FILE_BOTH_DIRECTORY_INFO
)
{
FILE_BOTH_DIRECTORY_INFO
*
pFindData
=
FILE_BOTH_DIRECTORY_INFO
*
pFindData
=
(
FILE_BOTH_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_BOTH_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
...
@@ -598,12 +598,12 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
...
@@ -598,12 +598,12 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
}
else
if
(
len
==
4
)
{
}
else
if
(
len
==
4
)
{
/* check for .. */
/* check for .. */
if
((
ufilename
[
0
]
==
UNICODE_DOT
)
if
((
ufilename
[
0
]
==
UNICODE_DOT
)
&&
(
ufilename
[
1
]
==
UNICODE_DOT
))
&&
(
ufilename
[
1
]
==
UNICODE_DOT
))
rc
=
2
;
rc
=
2
;
}
}
}
else
/* ASCII */
{
}
else
/* ASCII */
{
if
(
len
==
1
)
{
if
(
len
==
1
)
{
if
(
filename
[
0
]
==
'.'
)
if
(
filename
[
0
]
==
'.'
)
rc
=
1
;
rc
=
1
;
}
else
if
(
len
==
2
)
{
}
else
if
(
len
==
2
)
{
if
((
filename
[
0
]
==
'.'
)
&&
(
filename
[
1
]
==
'.'
))
if
((
filename
[
0
]
==
'.'
)
&&
(
filename
[
1
]
==
'.'
))
...
@@ -617,7 +617,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
...
@@ -617,7 +617,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
/* Check if directory that we are searching has changed so we can decide
/* Check if directory that we are searching has changed so we can decide
whether we can use the cached search results from the previous search */
whether we can use the cached search results from the previous search */
static
int
is_dir_changed
(
struct
file
*
file
)
static
int
is_dir_changed
(
struct
file
*
file
)
{
{
struct
inode
*
inode
=
file
->
f_path
.
dentry
->
d_inode
;
struct
inode
*
inode
=
file
->
f_path
.
dentry
->
d_inode
;
struct
cifsInodeInfo
*
cifsInfo
=
CIFS_I
(
inode
);
struct
cifsInodeInfo
*
cifsInfo
=
CIFS_I
(
inode
);
...
@@ -636,22 +636,22 @@ static int is_dir_changed(struct file * file)
...
@@ -636,22 +636,22 @@ static int is_dir_changed(struct file * file)
/* We start counting in the buffer with entry 2 and increment for every
/* We start counting in the buffer with entry 2 and increment for every
entry (do not increment for . or .. entry) */
entry (do not increment for . or .. entry) */
static
int
find_cifs_entry
(
const
int
xid
,
struct
cifsTconInfo
*
pTcon
,
static
int
find_cifs_entry
(
const
int
xid
,
struct
cifsTconInfo
*
pTcon
,
struct
file
*
file
,
char
**
ppCurrentEntry
,
int
*
num_to_ret
)
struct
file
*
file
,
char
**
ppCurrentEntry
,
int
*
num_to_ret
)
{
{
int
rc
=
0
;
int
rc
=
0
;
int
pos_in_buf
=
0
;
int
pos_in_buf
=
0
;
loff_t
first_entry_in_buffer
;
loff_t
first_entry_in_buffer
;
loff_t
index_to_find
=
file
->
f_pos
;
loff_t
index_to_find
=
file
->
f_pos
;
struct
cifsFileInfo
*
cifsFile
=
file
->
private_data
;
struct
cifsFileInfo
*
cifsFile
=
file
->
private_data
;
/* check if index in the buffer */
/* check if index in the buffer */
if
((
cifsFile
==
NULL
)
||
(
ppCurrentEntry
==
NULL
)
||
if
((
cifsFile
==
NULL
)
||
(
ppCurrentEntry
==
NULL
)
||
(
num_to_ret
==
NULL
))
(
num_to_ret
==
NULL
))
return
-
ENOENT
;
return
-
ENOENT
;
*
ppCurrentEntry
=
NULL
;
*
ppCurrentEntry
=
NULL
;
first_entry_in_buffer
=
first_entry_in_buffer
=
cifsFile
->
srch_inf
.
index_of_last_entry
-
cifsFile
->
srch_inf
.
index_of_last_entry
-
cifsFile
->
srch_inf
.
entries_in_buffer
;
cifsFile
->
srch_inf
.
entries_in_buffer
;
/* if first entry in buf is zero then is first buffer
/* if first entry in buf is zero then is first buffer
...
@@ -663,8 +663,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
...
@@ -663,8 +663,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
#ifdef CONFIG_CIFS_DEBUG2
#ifdef CONFIG_CIFS_DEBUG2
dump_cifs_file_struct
(
file
,
"In fce "
);
dump_cifs_file_struct
(
file
,
"In fce "
);
#endif
#endif
if
(((
index_to_find
<
cifsFile
->
srch_inf
.
index_of_last_entry
)
&&
if
(((
index_to_find
<
cifsFile
->
srch_inf
.
index_of_last_entry
)
&&
is_dir_changed
(
file
))
||
is_dir_changed
(
file
))
||
(
index_to_find
<
first_entry_in_buffer
))
{
(
index_to_find
<
first_entry_in_buffer
))
{
/* close and restart search */
/* close and restart search */
cFYI
(
1
,
(
"search backing up - close and restart search"
));
cFYI
(
1
,
(
"search backing up - close and restart search"
));
...
@@ -681,7 +681,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
...
@@ -681,7 +681,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
cifs_buf_release
(
cifsFile
->
srch_inf
.
cifs_buf_release
(
cifsFile
->
srch_inf
.
ntwrk_buf_start
);
ntwrk_buf_start
);
}
}
rc
=
initiate_cifs_search
(
xid
,
file
);
rc
=
initiate_cifs_search
(
xid
,
file
);
if
(
rc
)
{
if
(
rc
)
{
cFYI
(
1
,
(
"error %d reinitiating a search on rewind"
,
cFYI
(
1
,
(
"error %d reinitiating a search on rewind"
,
rc
));
rc
));
...
@@ -689,10 +689,10 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
...
@@ -689,10 +689,10 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
}
}
}
}
while
((
index_to_find
>=
cifsFile
->
srch_inf
.
index_of_last_entry
)
&&
while
((
index_to_find
>=
cifsFile
->
srch_inf
.
index_of_last_entry
)
&&
(
rc
==
0
)
&&
(
cifsFile
->
srch_inf
.
endOfSearch
==
FALSE
)){
(
rc
==
0
)
&&
(
cifsFile
->
srch_inf
.
endOfSearch
==
FALSE
))
{
cFYI
(
1
,
(
"calling findnext2"
));
cFYI
(
1
,
(
"calling findnext2"
));
rc
=
CIFSFindNext
(
xid
,
pTcon
,
cifsFile
->
netfid
,
rc
=
CIFSFindNext
(
xid
,
pTcon
,
cifsFile
->
netfid
,
&
cifsFile
->
srch_inf
);
&
cifsFile
->
srch_inf
);
if
(
rc
)
if
(
rc
)
return
-
ENOENT
;
return
-
ENOENT
;
...
@@ -701,8 +701,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
...
@@ -701,8 +701,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
/* we found the buffer that contains the entry */
/* we found the buffer that contains the entry */
/* scan and find it */
/* scan and find it */
int
i
;
int
i
;
char
*
current_entry
;
char
*
current_entry
;
char
*
end_of_smb
=
cifsFile
->
srch_inf
.
ntwrk_buf_start
+
char
*
end_of_smb
=
cifsFile
->
srch_inf
.
ntwrk_buf_start
+
smbCalcSize
((
struct
smb_hdr
*
)
smbCalcSize
((
struct
smb_hdr
*
)
cifsFile
->
srch_inf
.
ntwrk_buf_start
);
cifsFile
->
srch_inf
.
ntwrk_buf_start
);
...
@@ -712,16 +712,16 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
...
@@ -712,16 +712,16 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
pos_in_buf
=
index_to_find
-
first_entry_in_buffer
;
pos_in_buf
=
index_to_find
-
first_entry_in_buffer
;
cFYI
(
1
,
(
"found entry - pos_in_buf %d"
,
pos_in_buf
));
cFYI
(
1
,
(
"found entry - pos_in_buf %d"
,
pos_in_buf
));
for
(
i
=
0
;(
i
<
(
pos_in_buf
))
&&
(
current_entry
!=
NULL
);
i
++
)
{
for
(
i
=
0
;(
i
<
(
pos_in_buf
))
&&
(
current_entry
!=
NULL
);
i
++
)
{
/* go entry by entry figuring out which is first */
/* go entry by entry figuring out which is first */
current_entry
=
nxt_dir_entry
(
current_entry
,
end_of_smb
,
current_entry
=
nxt_dir_entry
(
current_entry
,
end_of_smb
,
cifsFile
->
srch_inf
.
info_level
);
cifsFile
->
srch_inf
.
info_level
);
}
}
if
((
current_entry
==
NULL
)
&&
(
i
<
pos_in_buf
))
{
if
((
current_entry
==
NULL
)
&&
(
i
<
pos_in_buf
))
{
/* BB fixme - check if we should flag this error */
/* BB fixme - check if we should flag this error */
cERROR
(
1
,(
"reached end of buf searching for pos in buf"
cERROR
(
1
,
(
"reached end of buf searching for pos in buf"
" %d index to find %lld rc %d"
,
" %d index to find %lld rc %d"
,
pos_in_buf
,
index_to_find
,
rc
));
pos_in_buf
,
index_to_find
,
rc
));
}
}
rc
=
0
;
rc
=
0
;
*
ppCurrentEntry
=
current_entry
;
*
ppCurrentEntry
=
current_entry
;
...
@@ -742,17 +742,17 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
...
@@ -742,17 +742,17 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
/* inode num, inode type and filename returned */
/* inode num, inode type and filename returned */
static
int
cifs_get_name_from_search_buf
(
struct
qstr
*
pqst
,
static
int
cifs_get_name_from_search_buf
(
struct
qstr
*
pqst
,
char
*
current_entry
,
__u16
level
,
unsigned
int
unicode
,
char
*
current_entry
,
__u16
level
,
unsigned
int
unicode
,
struct
cifs_sb_info
*
cifs_sb
,
int
max_len
,
ino_t
*
pinum
)
struct
cifs_sb_info
*
cifs_sb
,
int
max_len
,
ino_t
*
pinum
)
{
{
int
rc
=
0
;
int
rc
=
0
;
unsigned
int
len
=
0
;
unsigned
int
len
=
0
;
char
*
filename
;
char
*
filename
;
struct
nls_table
*
nlt
=
cifs_sb
->
local_nls
;
struct
nls_table
*
nlt
=
cifs_sb
->
local_nls
;
*
pinum
=
0
;
*
pinum
=
0
;
if
(
level
==
SMB_FIND_FILE_UNIX
)
{
if
(
level
==
SMB_FIND_FILE_UNIX
)
{
FILE_UNIX_INFO
*
pFindData
=
(
FILE_UNIX_INFO
*
)
current_entry
;
FILE_UNIX_INFO
*
pFindData
=
(
FILE_UNIX_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
if
(
unicode
)
{
if
(
unicode
)
{
...
@@ -762,27 +762,27 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
...
@@ -762,27 +762,27 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
len
=
strnlen
(
filename
,
PATH_MAX
);
len
=
strnlen
(
filename
,
PATH_MAX
);
}
}
/* BB fixme - hash low and high 32 bits if not 64 bit arch BB
fixme
*/
/* BB fixme - hash low and high 32 bits if not 64 bit arch BB */
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
)
*
pinum
=
pFindData
->
UniqueId
;
*
pinum
=
pFindData
->
UniqueId
;
}
else
if
(
level
==
SMB_FIND_FILE_DIRECTORY_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_DIRECTORY_INFO
)
{
FILE_DIRECTORY_INFO
*
pFindData
=
FILE_DIRECTORY_INFO
*
pFindData
=
(
FILE_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
}
else
if
(
level
==
SMB_FIND_FILE_FULL_DIRECTORY_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_FULL_DIRECTORY_INFO
)
{
FILE_FULL_DIRECTORY_INFO
*
pFindData
=
FILE_FULL_DIRECTORY_INFO
*
pFindData
=
(
FILE_FULL_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_FULL_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
}
else
if
(
level
==
SMB_FIND_FILE_ID_FULL_DIR_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_ID_FULL_DIR_INFO
)
{
SEARCH_ID_FULL_DIR_INFO
*
pFindData
=
SEARCH_ID_FULL_DIR_INFO
*
pFindData
=
(
SEARCH_ID_FULL_DIR_INFO
*
)
current_entry
;
(
SEARCH_ID_FULL_DIR_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
*
pinum
=
pFindData
->
UniqueId
;
*
pinum
=
pFindData
->
UniqueId
;
}
else
if
(
level
==
SMB_FIND_FILE_BOTH_DIRECTORY_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_BOTH_DIRECTORY_INFO
)
{
FILE_BOTH_DIRECTORY_INFO
*
pFindData
=
FILE_BOTH_DIRECTORY_INFO
*
pFindData
=
(
FILE_BOTH_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_BOTH_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
...
@@ -798,7 +798,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
...
@@ -798,7 +798,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
}
}
if
(
len
>
max_len
)
{
if
(
len
>
max_len
)
{
cERROR
(
1
,(
"bad search response length %d past smb end"
,
len
));
cERROR
(
1
,
(
"bad search response length %d past smb end"
,
len
));
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -810,12 +810,12 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
...
@@ -810,12 +810,12 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
(
__le16
*
)
filename
,
len
/
2
,
nlt
);
(
__le16
*
)
filename
,
len
/
2
,
nlt
);
else
else
pqst
->
len
=
cifs_strfromUCS_le
((
char
*
)
pqst
->
name
,
pqst
->
len
=
cifs_strfromUCS_le
((
char
*
)
pqst
->
name
,
(
__le16
*
)
filename
,
len
/
2
,
nlt
);
(
__le16
*
)
filename
,
len
/
2
,
nlt
);
}
else
{
}
else
{
pqst
->
name
=
filename
;
pqst
->
name
=
filename
;
pqst
->
len
=
len
;
pqst
->
len
=
len
;
}
}
pqst
->
hash
=
full_name_hash
(
pqst
->
name
,
pqst
->
len
);
pqst
->
hash
=
full_name_hash
(
pqst
->
name
,
pqst
->
len
);
/* cFYI(1, ("filldir on %s",pqst->name)); */
/* cFYI(1, ("filldir on %s",pqst->name)); */
return
rc
;
return
rc
;
}
}
...
@@ -825,10 +825,10 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
...
@@ -825,10 +825,10 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
{
{
int
rc
=
0
;
int
rc
=
0
;
struct
qstr
qstring
;
struct
qstr
qstring
;
struct
cifsFileInfo
*
pCifsF
;
struct
cifsFileInfo
*
pCifsF
;
unsigned
obj_type
;
unsigned
obj_type
;
ino_t
inum
;
ino_t
inum
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifs_sb_info
*
cifs_sb
;
struct
inode
*
tmp_inode
;
struct
inode
*
tmp_inode
;
struct
dentry
*
tmp_dentry
;
struct
dentry
*
tmp_dentry
;
...
@@ -843,7 +843,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
...
@@ -843,7 +843,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
if
((
scratch_buf
==
NULL
)
||
(
pfindEntry
==
NULL
)
||
(
pCifsF
==
NULL
))
if
((
scratch_buf
==
NULL
)
||
(
pfindEntry
==
NULL
)
||
(
pCifsF
==
NULL
))
return
-
ENOENT
;
return
-
ENOENT
;
rc
=
cifs_entry_is_dot
(
pfindEntry
,
pCifsF
);
rc
=
cifs_entry_is_dot
(
pfindEntry
,
pCifsF
);
/* skip . and .. since we added them first */
/* skip . and .. since we added them first */
if
(
rc
!=
0
)
if
(
rc
!=
0
)
return
0
;
return
0
;
...
@@ -851,23 +851,24 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
...
@@ -851,23 +851,24 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
qstring
.
name
=
scratch_buf
;
qstring
.
name
=
scratch_buf
;
rc
=
cifs_get_name_from_search_buf
(
&
qstring
,
pfindEntry
,
rc
=
cifs_get_name_from_search_buf
(
&
qstring
,
pfindEntry
,
pCifsF
->
srch_inf
.
info_level
,
pCifsF
->
srch_inf
.
info_level
,
pCifsF
->
srch_inf
.
unicode
,
cifs_sb
,
pCifsF
->
srch_inf
.
unicode
,
cifs_sb
,
max_len
,
max_len
,
&
inum
/* returned */
);
&
inum
/* returned */
);
if
(
rc
)
if
(
rc
)
return
rc
;
return
rc
;
rc
=
construct_dentry
(
&
qstring
,
file
,
&
tmp_inode
,
&
tmp_dentry
);
rc
=
construct_dentry
(
&
qstring
,
file
,
&
tmp_inode
,
&
tmp_dentry
);
if
((
tmp_inode
==
NULL
)
||
(
tmp_dentry
==
NULL
))
if
((
tmp_inode
==
NULL
)
||
(
tmp_dentry
==
NULL
))
return
-
ENOMEM
;
return
-
ENOMEM
;
if
(
rc
)
{
if
(
rc
)
{
/* inode created, we need to hash it with right inode number */
/* inode created, we need to hash it with right inode number */
if
(
inum
!=
0
)
{
if
(
inum
!=
0
)
{
/* BB fixme - hash the 2 32 quantities bits together if necessary BB */
/* BB fixme - hash the 2 32 quantities bits together if
* necessary BB */
tmp_inode
->
i_ino
=
inum
;
tmp_inode
->
i_ino
=
inum
;
}
}
insert_inode_hash
(
tmp_inode
);
insert_inode_hash
(
tmp_inode
);
...
@@ -892,9 +893,9 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
...
@@ -892,9 +893,9 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
d_rehash
(
tmp_dentry
);
d_rehash
(
tmp_dentry
);
}
}
rc
=
filldir
(
direntry
,
qstring
.
name
,
qstring
.
len
,
file
->
f_pos
,
rc
=
filldir
(
direntry
,
qstring
.
name
,
qstring
.
len
,
file
->
f_pos
,
tmp_inode
->
i_ino
,
obj_type
);
tmp_inode
->
i_ino
,
obj_type
);
if
(
rc
)
{
if
(
rc
)
{
cFYI
(
1
,
(
"filldir rc = %d"
,
rc
));
cFYI
(
1
,
(
"filldir rc = %d"
,
rc
));
/* we can not return filldir errors to the caller
/* we can not return filldir errors to the caller
...
@@ -913,7 +914,7 @@ static int cifs_save_resume_key(const char *current_entry,
...
@@ -913,7 +914,7 @@ static int cifs_save_resume_key(const char *current_entry,
int
rc
=
0
;
int
rc
=
0
;
unsigned
int
len
=
0
;
unsigned
int
len
=
0
;
__u16
level
;
__u16
level
;
char
*
filename
;
char
*
filename
;
if
((
cifsFile
==
NULL
)
||
(
current_entry
==
NULL
))
if
((
cifsFile
==
NULL
)
||
(
current_entry
==
NULL
))
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -932,31 +933,31 @@ static int cifs_save_resume_key(const char *current_entry,
...
@@ -932,31 +933,31 @@ static int cifs_save_resume_key(const char *current_entry,
}
}
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
ResumeKey
;
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
ResumeKey
;
}
else
if
(
level
==
SMB_FIND_FILE_DIRECTORY_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_DIRECTORY_INFO
)
{
FILE_DIRECTORY_INFO
*
pFindData
=
FILE_DIRECTORY_INFO
*
pFindData
=
(
FILE_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
}
else
if
(
level
==
SMB_FIND_FILE_FULL_DIRECTORY_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_FULL_DIRECTORY_INFO
)
{
FILE_FULL_DIRECTORY_INFO
*
pFindData
=
FILE_FULL_DIRECTORY_INFO
*
pFindData
=
(
FILE_FULL_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_FULL_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
}
else
if
(
level
==
SMB_FIND_FILE_ID_FULL_DIR_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_ID_FULL_DIR_INFO
)
{
SEARCH_ID_FULL_DIR_INFO
*
pFindData
=
SEARCH_ID_FULL_DIR_INFO
*
pFindData
=
(
SEARCH_ID_FULL_DIR_INFO
*
)
current_entry
;
(
SEARCH_ID_FULL_DIR_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
}
else
if
(
level
==
SMB_FIND_FILE_BOTH_DIRECTORY_INFO
)
{
}
else
if
(
level
==
SMB_FIND_FILE_BOTH_DIRECTORY_INFO
)
{
FILE_BOTH_DIRECTORY_INFO
*
pFindData
=
FILE_BOTH_DIRECTORY_INFO
*
pFindData
=
(
FILE_BOTH_DIRECTORY_INFO
*
)
current_entry
;
(
FILE_BOTH_DIRECTORY_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
len
=
le32_to_cpu
(
pFindData
->
FileNameLength
);
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
cifsFile
->
srch_inf
.
resume_key
=
pFindData
->
FileIndex
;
}
else
if
(
level
==
SMB_FIND_FILE_INFO_STANDARD
)
{
}
else
if
(
level
==
SMB_FIND_FILE_INFO_STANDARD
)
{
FIND_FILE_STANDARD_INFO
*
pFindData
=
FIND_FILE_STANDARD_INFO
*
pFindData
=
(
FIND_FILE_STANDARD_INFO
*
)
current_entry
;
(
FIND_FILE_STANDARD_INFO
*
)
current_entry
;
filename
=
&
pFindData
->
FileName
[
0
];
filename
=
&
pFindData
->
FileName
[
0
];
/* one byte length, no name conversion */
/* one byte length, no name conversion */
...
@@ -974,13 +975,13 @@ static int cifs_save_resume_key(const char *current_entry,
...
@@ -974,13 +975,13 @@ static int cifs_save_resume_key(const char *current_entry,
int
cifs_readdir
(
struct
file
*
file
,
void
*
direntry
,
filldir_t
filldir
)
int
cifs_readdir
(
struct
file
*
file
,
void
*
direntry
,
filldir_t
filldir
)
{
{
int
rc
=
0
;
int
rc
=
0
;
int
xid
,
i
;
int
xid
,
i
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsFileInfo
*
cifsFile
=
NULL
;
struct
cifsFileInfo
*
cifsFile
=
NULL
;
char
*
current_entry
;
char
*
current_entry
;
int
num_to_fill
=
0
;
int
num_to_fill
=
0
;
char
*
tmp_buf
=
NULL
;
char
*
tmp_buf
=
NULL
;
char
*
end_of_smb
;
char
*
end_of_smb
;
int
max_len
;
int
max_len
;
...
@@ -1009,13 +1010,13 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
...
@@ -1009,13 +1010,13 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
}
}
file
->
f_pos
++
;
file
->
f_pos
++
;
default:
default:
/* 1) If search is active,
/* 1) If search is active,
is in current search buffer?
is in current search buffer?
if it before then restart search
if it before then restart search
if after then keep searching till find it */
if after then keep searching till find it */
if
(
file
->
private_data
==
NULL
)
{
if
(
file
->
private_data
==
NULL
)
{
rc
=
initiate_cifs_search
(
xid
,
file
);
rc
=
initiate_cifs_search
(
xid
,
file
);
cFYI
(
1
,
(
"initiate cifs search rc %d"
,
rc
));
cFYI
(
1
,
(
"initiate cifs search rc %d"
,
rc
));
if
(
rc
)
{
if
(
rc
)
{
FreeXid
(
xid
);
FreeXid
(
xid
);
...
@@ -1037,12 +1038,12 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
...
@@ -1037,12 +1038,12 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
}
/* else {
}
/* else {
cifsFile->invalidHandle = TRUE;
cifsFile->invalidHandle = TRUE;
CIFSFindClose(xid, pTcon, cifsFile->netfid);
CIFSFindClose(xid, pTcon, cifsFile->netfid);
}
}
kfree(cifsFile->search_resume_name);
kfree(cifsFile->search_resume_name);
cifsFile->search_resume_name = NULL; */
cifsFile->search_resume_name = NULL; */
rc
=
find_cifs_entry
(
xid
,
pTcon
,
file
,
rc
=
find_cifs_entry
(
xid
,
pTcon
,
file
,
&
current_entry
,
&
num_to_fill
);
&
current_entry
,
&
num_to_fill
);
if
(
rc
)
{
if
(
rc
)
{
cFYI
(
1
,
(
"fce error %d"
,
rc
));
cFYI
(
1
,
(
"fce error %d"
,
rc
));
goto
rddir2_exit
;
goto
rddir2_exit
;
...
...
fs/cifs/sess.c
View file @
3870253e
...
@@ -75,7 +75,7 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
...
@@ -75,7 +75,7 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
return
capabilities
;
return
capabilities
;
}
}
static
void
unicode_ssetup_strings
(
char
**
pbcc_area
,
struct
cifsSesInfo
*
ses
,
static
void
unicode_ssetup_strings
(
char
**
pbcc_area
,
struct
cifsSesInfo
*
ses
,
const
struct
nls_table
*
nls_cp
)
const
struct
nls_table
*
nls_cp
)
{
{
char
*
bcc_ptr
=
*
pbcc_area
;
char
*
bcc_ptr
=
*
pbcc_area
;
...
@@ -108,7 +108,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
...
@@ -108,7 +108,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
*
(
bcc_ptr
+
1
)
=
0
;
*
(
bcc_ptr
+
1
)
=
0
;
bytes_ret
=
0
;
bytes_ret
=
0
;
}
else
}
else
bytes_ret
=
cifs_strtoUCS
((
__le16
*
)
bcc_ptr
,
ses
->
domainName
,
bytes_ret
=
cifs_strtoUCS
((
__le16
*
)
bcc_ptr
,
ses
->
domainName
,
256
,
nls_cp
);
256
,
nls_cp
);
bcc_ptr
+=
2
*
bytes_ret
;
bcc_ptr
+=
2
*
bytes_ret
;
bcc_ptr
+=
2
;
/* account for null terminator */
bcc_ptr
+=
2
;
/* account for null terminator */
...
@@ -130,7 +130,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
...
@@ -130,7 +130,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
*
pbcc_area
=
bcc_ptr
;
*
pbcc_area
=
bcc_ptr
;
}
}
static
void
ascii_ssetup_strings
(
char
**
pbcc_area
,
struct
cifsSesInfo
*
ses
,
static
void
ascii_ssetup_strings
(
char
**
pbcc_area
,
struct
cifsSesInfo
*
ses
,
const
struct
nls_table
*
nls_cp
)
const
struct
nls_table
*
nls_cp
)
{
{
char
*
bcc_ptr
=
*
pbcc_area
;
char
*
bcc_ptr
=
*
pbcc_area
;
...
@@ -468,7 +468,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
...
@@ -468,7 +468,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
/* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE);
/* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE);
bcc_ptr += LM2_SESS_KEY_SIZE; */
bcc_ptr += LM2_SESS_KEY_SIZE; */
memcpy
(
bcc_ptr
,
(
char
*
)
v2_sess_key
,
sizeof
(
struct
ntlmv2_resp
));
memcpy
(
bcc_ptr
,
(
char
*
)
v2_sess_key
,
sizeof
(
struct
ntlmv2_resp
));
bcc_ptr
+=
sizeof
(
struct
ntlmv2_resp
);
bcc_ptr
+=
sizeof
(
struct
ntlmv2_resp
);
kfree
(
v2_sess_key
);
kfree
(
v2_sess_key
);
if
(
ses
->
capabilities
&
CAP_UNICODE
)
{
if
(
ses
->
capabilities
&
CAP_UNICODE
)
{
...
...
fs/cifs/smbdes.c
View file @
3870253e
/*
/*
Unix SMB/Netbios implementation.
Unix SMB/Netbios implementation.
Version 1.9.
Version 1.9.
a partial implementation of DES designed for use in the
a partial implementation of DES designed for use in the
SMB authentication protocol
SMB authentication protocol
Copyright (C) Andrew Tridgell 1998
Copyright (C) Andrew Tridgell 1998
...
@@ -23,10 +23,10 @@
...
@@ -23,10 +23,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
/* NOTES:
/* NOTES:
This code makes no attempt to be fast! In fact, it is a very
This code makes no attempt to be fast! In fact, it is a very
slow implementation
slow implementation
This code is NOT a complete DES implementation. It implements only
This code is NOT a complete DES implementation. It implements only
the minimum necessary for SMB authentication, as used by all SMB
the minimum necessary for SMB authentication, as used by all SMB
...
@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = {
...
@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = {
};
};
static
void
static
void
permute
(
char
*
out
,
char
*
in
,
uchar
*
p
,
int
n
)
permute
(
char
*
out
,
char
*
in
,
uchar
*
p
,
int
n
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
for
(
i
=
0
;
i
<
n
;
i
++
)
...
@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw)
...
@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw)
char
*
rl
;
char
*
rl
;
/* Have to reduce stack usage */
/* Have to reduce stack usage */
pk1
=
kmalloc
(
56
+
56
+
64
+
64
,
GFP_KERNEL
);
pk1
=
kmalloc
(
56
+
56
+
64
+
64
,
GFP_KERNEL
);
if
(
pk1
==
NULL
)
if
(
pk1
==
NULL
)
return
;
return
;
ki
=
kmalloc
(
16
*
48
,
GFP_KERNEL
);
ki
=
kmalloc
(
16
*
48
,
GFP_KERNEL
);
if
(
ki
==
NULL
)
{
if
(
ki
==
NULL
)
{
kfree
(
pk1
);
kfree
(
pk1
);
return
;
return
;
}
}
cd
=
pk1
+
56
;
cd
=
pk1
+
56
;
pd1
=
cd
+
56
;
pd1
=
cd
+
56
;
rl
=
pd1
+
64
;
rl
=
pd1
+
64
;
permute
(
pk1
,
key
,
perm1
,
56
);
permute
(
pk1
,
key
,
perm1
,
56
);
...
@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw)
...
@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw)
char
*
r2
;
/* r2[32] */
char
*
r2
;
/* r2[32] */
er
=
kmalloc
(
48
+
48
+
32
+
32
+
32
,
GFP_KERNEL
);
er
=
kmalloc
(
48
+
48
+
32
+
32
+
32
,
GFP_KERNEL
);
if
(
er
==
NULL
)
{
if
(
er
==
NULL
)
{
kfree
(
pk1
);
kfree
(
pk1
);
kfree
(
ki
);
kfree
(
ki
);
return
;
return
;
...
@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
...
@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
char
*
keyb
;
/* keyb[64] */
char
*
keyb
;
/* keyb[64] */
unsigned
char
key2
[
8
];
unsigned
char
key2
[
8
];
outb
=
kmalloc
(
64
*
3
,
GFP_KERNEL
);
outb
=
kmalloc
(
64
*
3
,
GFP_KERNEL
);
if
(
outb
==
NULL
)
if
(
outb
==
NULL
)
return
;
return
;
inb
=
outb
+
64
;
inb
=
outb
+
64
;
...
...
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