summaryrefslogtreecommitdiff
path: root/source3
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
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')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/lib/netapi/netapi.c1
-rw-r--r--source3/lib/util.c1
-rw-r--r--source3/lib/util_unistr.c49
-rw-r--r--source3/smbd/mangle_hash.c34
5 files changed, 34 insertions, 54 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2ffff4c137..a4de21faa2 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1048,12 +1048,9 @@ char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
/* The following definitions come from lib/util_unistr.c */
-void gfree_case_tables(void);
-void load_case_tables(void);
size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
-bool isvalid83_w(smb_ucs2_t c);
size_t strlen_w(const smb_ucs2_t *src);
size_t strnlen_w(const smb_ucs2_t *src, size_t max);
smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index c04ca70249..cd590273ce 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -182,7 +182,6 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
gfree_names();
gfree_loadparm();
- gfree_case_tables();
gfree_charcnv();
gfree_interfaces();
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 887d21f160..0bb46db05f 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -156,7 +156,6 @@ void gfree_all( void )
{
gfree_names();
gfree_loadparm();
- gfree_case_tables();
gfree_charcnv();
gfree_interfaces();
gfree_debugsyms();
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 90fc6769f9..18df993b5a 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -21,11 +21,6 @@
#include "includes.h"
-/* these 3 tables define the unicode case handling. They are loaded
- at startup either via mmap() or read() from the lib directory */
-static uint8 *valid_table;
-static bool initialized;
-
/* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */
#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\
((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest))
@@ -36,40 +31,6 @@ static bool initialized;
static int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
-/**
- * Destroy global objects allocated by load_case_tables()
- **/
-void gfree_case_tables(void)
-{
- if ( valid_table ) {
- unmap_file(valid_table, 0x10000);
- valid_table = NULL;
- }
- initialized = false;
-}
-
-/**
- * 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 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;
- }
-}
-
/*******************************************************************
Write a string in (little-endian) unicode format. src is in
the current DOS codepage. len is the length in bytes of the
@@ -111,16 +72,6 @@ int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src)
}
/*******************************************************************
- Determine if a character is valid in a 8.3 name.
-********************************************************************/
-
-bool isvalid83_w(smb_ucs2_t c)
-{
- init_valid_table();
- return valid_table[SVAL(&c,0)] != 0;
-}
-
-/*******************************************************************
Count the number of two-byte pairs in a UTF16 string.
********************************************************************/
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) {