diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-04-12 03:26:19 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-04-12 03:26:19 +0000 |
commit | 3067ec21fb34f46fd1683aad6d455e7d6da8f52e (patch) | |
tree | 4bfbb894a9ebda5c99ad6df8c45916b95883276d /source3/smbd | |
parent | 4c0399915cde591cb06f99b50acd5e5bf48bc6cb (diff) | |
download | samba-3067ec21fb34f46fd1683aad6d455e7d6da8f52e.tar.gz samba-3067ec21fb34f46fd1683aad6d455e7d6da8f52e.tar.bz2 samba-3067ec21fb34f46fd1683aad6d455e7d6da8f52e.zip |
- added a mangling test suite that measures the collision rate on
randomised filenames
- fixed several mangling bugs that the test suite pointed out
(This used to be commit 858fa7efc34f6e7cdf8500900aed3f7943c91348)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/mangle_hash2.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index 96ca7360b8..959a93e07b 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -344,6 +344,7 @@ static BOOL check_cache(char *name) /* we found it - construct the full name */ strncpy(extension, name+9, 3); + extension[3] = 0; if (extension[0]) { M_DEBUG(0,("check_cache: %s -> %s.%s\n", name, prefix, extension)); @@ -435,6 +436,19 @@ static BOOL name_map(char *name, BOOL need83, BOOL cache83) /* find the '.' if any */ dot_p = strrchr(name, '.'); + if (dot_p) { + /* if the extension contains any illegal characters or + is too long or zero length then we treat it as part + of the prefix */ + for (i=0; i<4 && dot_p[i+1]; i++) { + if (! FLAG_CHECK(dot_p[i+1], FLAG_ASCII)) { + dot_p = NULL; + break; + } + } + if (i == 0 || i == 4) dot_p = NULL; + } + /* the leading character in the mangled name is taken from the first character of the name, if it is ascii otherwise '_' is used |