summaryrefslogtreecommitdiff
path: root/source3/smbd/mangle_hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/mangle_hash.c')
-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) {