diff options
| -rw-r--r-- | source3/include/proto.h | 3 | ||||
| -rw-r--r-- | source3/lib/netapi/netapi.c | 1 | ||||
| -rw-r--r-- | source3/lib/util.c | 1 | ||||
| -rw-r--r-- | source3/lib/util_unistr.c | 49 | ||||
| -rw-r--r-- | source3/smbd/mangle_hash.c | 34 | 
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) {  | 
