summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-04-12 16:23:17 +1000
committerAndrew Tridgell <tridge@samba.org>2011-04-13 14:47:07 +1000
commite3138f2ffef32ee33778e0c068c6009a58536419 (patch)
tree207ab87a4baeb36d43e66cc746fef58a52a4c0fa /source3/smbd
parentd458f6b3bd7043bb78953bdc48ee6e2dcb034042 (diff)
downloadsamba-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.c34
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) {