diff options
author | Jeremy Allison <jra@samba.org> | 2003-12-03 23:16:27 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-12-03 23:16:27 +0000 |
commit | 8a31a346ef1c42f868a4b7a4f667e6eb56c4a7a9 (patch) | |
tree | 901a9f15ed86029bf9e38502edf77f11ab50c13c /source3 | |
parent | 89ebcb185d493051394a381f0195baa2a53abc01 (diff) | |
download | samba-8a31a346ef1c42f868a4b7a4f667e6eb56c4a7a9.tar.gz samba-8a31a346ef1c42f868a4b7a4f667e6eb56c4a7a9.tar.bz2 samba-8a31a346ef1c42f868a4b7a4f667e6eb56c4a7a9.zip |
Fix for "hash" (not hash2) type mangling. Noticed by "Forrest W. Christian" <fwc@mt.net>
Jeremy.
(This used to be commit 3a8fe3b2ef30cbe0cf441d6c4ffa9c309dc71e54)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/mangle_hash.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index ac2d7681e8..16722ae6e9 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -139,7 +139,7 @@ extern BOOL case_mangle; /* If true, all chars in 8.3 should be same case. */ /* -------------------------------------------------------------------- */ -static NTSTATUS has_valid_chars(const smb_ucs2_t *s, BOOL allow_wildcards) +static NTSTATUS has_valid_83_chars(const smb_ucs2_t *s, BOOL allow_wildcards) { if (!s || !*s) return NT_STATUS_INVALID_PARAMETER; @@ -176,7 +176,7 @@ static NTSTATUS mangle_get_prefix(const smb_ucs2_t *ucs2_string, smb_ucs2_t **pr if ((p = strrchr_w(*prefix, UCS2_CHAR('.')))) { ext_len = strlen_w(p+1); if ((ext_len > 0) && (ext_len < 4) && (p != *prefix) && - (NT_STATUS_IS_OK(has_valid_chars(p+1,allow_wildcards)))) /* check extension */ { + (NT_STATUS_IS_OK(has_valid_83_chars(p+1,allow_wildcards)))) /* check extension */ { *p = 0; *extension = strdup_w(p+1); if (!*extension) { @@ -200,7 +200,7 @@ static NTSTATUS mangle_get_prefix(const smb_ucs2_t *ucs2_string, smb_ucs2_t **pr * ************************************************************************** ** */ -static NTSTATUS is_valid_name(const smb_ucs2_t *fname, BOOL allow_wildcards) +static NTSTATUS is_valid_name(const smb_ucs2_t *fname, BOOL allow_wildcards, BOOL only_8_3) { smb_ucs2_t *str, *p; NTSTATUS ret = NT_STATUS_OK; @@ -216,9 +216,11 @@ static NTSTATUS is_valid_name(const smb_ucs2_t *fname, BOOL allow_wildcards) if (*fname == UCS2_CHAR('.')) return NT_STATUS_UNSUCCESSFUL; - ret = has_valid_chars(fname, allow_wildcards); - if (!NT_STATUS_IS_OK(ret)) - return ret; + if (only_8_3) { + ret = has_valid_83_chars(fname, allow_wildcards); + if (!NT_STATUS_IS_OK(ret)) + return ret; + } str = strdup_w(fname); p = strchr_w(str, UCS2_CHAR('.')); @@ -286,7 +288,7 @@ static NTSTATUS is_8_3_w(const smb_ucs2_t *fname, BOOL allow_wildcards) if (strcmp_wa(fname, ".") == 0 || strcmp_wa(fname, "..") == 0) return NT_STATUS_OK; - if (!NT_STATUS_IS_OK(is_valid_name(fname, allow_wildcards))) + if (!NT_STATUS_IS_OK(is_valid_name(fname, allow_wildcards, True))) goto done; if (!NT_STATUS_IS_OK(mangle_get_prefix(fname, &pref, &ext, allow_wildcards))) @@ -737,7 +739,7 @@ static void name_map(char *OutName, BOOL need83, BOOL cache83) return; } - if( !need83 && !NT_STATUS_IS_OK(is_valid_name(OutName_ucs2, False))) + if( !need83 && !NT_STATUS_IS_OK(is_valid_name(OutName_ucs2, False, False))) need83 = True; /* check if it's already in 8.3 format */ |