diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-04-12 16:23:17 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-04-13 14:47:07 +1000 |
commit | e3138f2ffef32ee33778e0c068c6009a58536419 (patch) | |
tree | 207ab87a4baeb36d43e66cc746fef58a52a4c0fa /source3/smbd | |
parent | d458f6b3bd7043bb78953bdc48ee6e2dcb034042 (diff) | |
download | samba-e3138f2ffef32ee33778e0c068c6009a58536419.tar.gz samba-e3138f2ffef32ee33778e0c068c6009a58536419.tar.bz2 samba-e3138f2ffef32ee33778e0c068c6009a58536419.zip |
s3-lib Move isvalid83_w to mangle_hash.c
This means that there is no need for the 'valid.dat' table to be
loaded by anything other than smbd, so the unloader is also removed.
The concept of a 'valid dos character' has been replaced by the hash2
mangle method.
Andrew Bartlett
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/mangle_hash.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 86d84ca68c..80cd3abc7b 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -65,6 +65,40 @@ static const char basechars[43]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%"; /* -------------------------------------------------------------------- */ + +/******************************************************************* + Determine if a character is valid in a 8.3 name. +********************************************************************/ + +/** + * Load the valid character map table from <tt>valid.dat</tt> or + * create from the configured codepage. + * + * This function is called whenever the configuration is reloaded. + * However, the valid character table is not changed if it's loaded + * from a file, because we can't unmap files. + **/ + +static uint8 *valid_table; +static void init_valid_table(void) +{ + if (valid_table) { + return; + } + + valid_table = (uint8 *)map_file(data_path("valid.dat"), 0x10000); + if (!valid_table) { + smb_panic("Could not load valid.dat file required for mangle method=hash"); + return; + } +} + +static bool isvalid83_w(smb_ucs2_t c) +{ + init_valid_table(); + return valid_table[SVAL(&c,0)] != 0; +} + static NTSTATUS has_valid_83_chars(const smb_ucs2_t *s, bool allow_wildcards) { if (!*s) { |