[linux-cifs-client] [PATCH 00/12] cifs: fix string conversions from
wire format to
Jeff Layton
jlayton at redhat.com
Wed Apr 29 17:25:50 GMT 2009
This is the second set of patches for this problem. The main changes
from the first set are:
1) moved the null char size helper to include/linux/nls.h
2) renamed the *_utf16le_* functions to *_ucs2le_*
3) shortened some of those function names (took out the "host" portion)
4) fixed some bad length checking in decode_unicode_ssetup
5) added a patch to rip out the really scary NTLMSSP code
6) added a patch to remove cifs_strfromUCS_le
This patchset is intended to fix the string conversions in cifs that
convert strings from "wire-format" (little-endian UTF-16) to whatever
character set is in use on the client.
This patch is built upon work by Suresh Jayaraman. This shouldn't be
taken as a comment on his work -- he did a fine job on the earlier
patchsets. It became clear to me as I was reviewing them though that
there were fundamental problems with the existing code that couldn't
really be remedied without a more invasive set:
1) When converting into a destination buffer, the size of that buffer
isn't checked in a clear and consistent fashion. This patchset attempts
to remedy that by providing functions that do this.
2) In some functions there are clear limits on how many wide characters
the functions should walk. The numbers passed to them don't always
reflect the amount of data in the actual packet though, so it's possible
for these functions to walk off of the end of the source buffer. This
set attempts to fix that by making the callers of the new functions
consistently pass in a max size the reflects the size of the data left
in the response.
3) The function interfaces are inconsistent and use wide characters for
some lengths and bytes for others. This means that we often have to
convert between different length units and leads to more confusing code.
This patchset tries to settle on using lengths in bytes for most
interfaces since that is more useful when allocating buffers and such.
4) There are a lot of similar functions that could be consolidated. This
set does that where it makes sense.
There are a number of other bugs that are fixed in this. It also removes
some dead and broken code.
Comments and suggestions appreciated...
Jeff Layton (12):
nls: add a nls_nullsize inline
cifs: move #defines for mapchars into cifs_unicode.h
cifs: add replacement for cifs_strtoUCS_le called cifs_ucs2le_to_host
cifs: add new function to get unicode string length in bytes
cifs: rename cifs_strlcpy_to_host and make it use new functions
cifs: convert CIFSTCon to use new unicode helper functions
cifs: fix session setup unicode string saving to use new unicode
helpers
cifs: remove cifs_readlink and CIFSSMBQueryReparseLinkInfo
cifs: change CIFSSMBUnixQuerySymLink to use new helpers
cifs: change cifs_get_name_from_search_buf to use new unicode helper
cifs: remove legacy NTLMSSP code
cifs: remove cifs_strfromUCS_le
fs/cifs/cifs_unicode.c | 201 ++++++++-
fs/cifs/cifs_unicode.h | 21 +-
fs/cifs/cifsfs.h | 2 -
fs/cifs/cifspdu.h | 11 -
fs/cifs/cifsproto.h | 5 +-
fs/cifs/cifssmb.c | 217 +--------
fs/cifs/connect.c | 1151 +-----------------------------------------------
fs/cifs/link.c | 114 +-----
fs/cifs/misc.c | 71 ---
fs/cifs/readdir.c | 26 +-
fs/cifs/sess.c | 80 +---
include/linux/nls.h | 19 +
12 files changed, 302 insertions(+), 1616 deletions(-)
More information about the linux-cifs-client
mailing list