s3-lib Move isvalid83_w to mangle_hash.c
authorAndrew Bartlett <abartlet@samba.org>
Tue, 12 Apr 2011 06:23:17 +0000 (16:23 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 13 Apr 2011 04:47:07 +0000 (14:47 +1000)
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>
source3/include/proto.h
source3/lib/netapi/netapi.c
source3/lib/util.c
source3/lib/util_unistr.c
source3/smbd/mangle_hash.c

index 2ffff4c137e4b66e32fd41786fdf0cae18b9e361..a4de21faa2e75deaec26ee1385b70b499209e46f 100644 (file)
@@ -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);
index c04ca70249371c06e47372d3de8fb89188dbe3fb..cd590273ce2e997e8cd571a05831645ea0813bed 100644 (file)
@@ -182,7 +182,6 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
 
        gfree_names();
        gfree_loadparm();
-       gfree_case_tables();
        gfree_charcnv();
        gfree_interfaces();
 
index 887d21f16078811d3b10b7d53f3cbf7854c80c3d..0bb46db05f65b50227750fc7b828223fc26e1c0f 100644 (file)
@@ -156,7 +156,6 @@ void gfree_all( void )
 {
        gfree_names();
        gfree_loadparm();
-       gfree_case_tables();
        gfree_charcnv();
        gfree_interfaces();
        gfree_debugsyms();
index 90fc6769f9b7dbe746ae83609c8b8dda80fb967c..18df993b5a6481d4ffc4a53c7986a97daf7be7ac 100644 (file)
 
 #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
@@ -110,16 +71,6 @@ int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src)
                return -1;
 }
 
-/*******************************************************************
- 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.
 ********************************************************************/
index 86d84ca68c6e61c65f00e4f417e93e58d1401bb6..80cd3abc7b479919351908a20d404ea7c80cc10a 100644 (file)
@@ -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) {