static void name_map(char *OutName, BOOL need83, BOOL cache83, int default_case, int snum) { smb_ucs2_t *OutName_ucs2; magic_char = lp_magicchar(snum); DEBUG(5,("name_map( %s, need83 = %s, cache83 = %s)\n", OutName, need83 ? "True" : "False", cache83 ? "True" : "False")); if (push_ucs2_allocate(&OutName_ucs2, OutName) == (size_t)-1) { DEBUG(0, ("push_ucs2_allocate failed!\n")); return; } if( !need83 && !NT_STATUS_IS_OK(is_valid_name(OutName_ucs2, False, False))) need83 = True; /* check if it's already in 8.3 format */ if (need83 && !NT_STATUS_IS_OK(is_8_3_w(OutName_ucs2, False))) { char *tmp = NULL; /* mangle it into 8.3 */ if (cache83) tmp = SMB_STRDUP(OutName); to_8_3(OutName, default_case); if(tmp != NULL) { cache_mangled_name(OutName, tmp); SAFE_FREE(tmp); } } DEBUG(5,("name_map() ==> [%s]\n", OutName)); SAFE_FREE(OutName_ucs2); }
static bool is_8_3(const char *fname, bool check_case, bool allow_wildcards, const struct share_params *p) { const char *f; smb_ucs2_t *ucs2name; NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; size_t size; if (!fname || !*fname) return False; if ((f = strrchr(fname, '/')) == NULL) f = fname; else f++; if (strlen(f) > 12) return False; if (!push_ucs2_talloc(NULL, &ucs2name, f, &size)) { DEBUG(0,("is_8_3: internal error push_ucs2_talloc() failed!\n")); goto done; } ret = is_8_3_w(ucs2name, allow_wildcards); done: TALLOC_FREE(ucs2name); if (!NT_STATUS_IS_OK(ret)) { return False; } return True; }
static bool hash_name_to_8_3(const char *in, char out[13], bool cache83, int default_case, const struct share_params *p) { smb_ucs2_t *in_ucs2 = NULL; size_t converted_size; char magic_char; magic_char = lp_magicchar(p); DEBUG(5,("hash_name_to_8_3( %s, cache83 = %s)\n", in, cache83 ? "True" : "False")); if (!push_ucs2_talloc(NULL, &in_ucs2, in, &converted_size)) { DEBUG(0, ("push_ucs2_talloc failed!\n")); return False; } /* If it's already 8.3, just copy. */ if (NT_STATUS_IS_OK(is_valid_name(in_ucs2, False, False)) && NT_STATUS_IS_OK(is_8_3_w(in_ucs2, False))) { TALLOC_FREE(in_ucs2); strlcpy(out, in, 13); return True; } TALLOC_FREE(in_ucs2); if (!to_8_3(magic_char, in, out, default_case)) { return False; } cache_mangled_name(out, in); DEBUG(5,("hash_name_to_8_3(%s) ==> [%s]\n", in, out)); return True; }
static BOOL is_8_3(const char *fname, BOOL check_case, BOOL allow_wildcards, const struct share_params *p) { const char *f; smb_ucs2_t *ucs2name; NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; size_t size; magic_char = lp_magicchar(p); if (!fname || !*fname) return False; if ((f = strrchr(fname, '/')) == NULL) f = fname; else f++; if (strlen(f) > 12) return False; size = push_ucs2_allocate(&ucs2name, f); if (size == (size_t)-1) { DEBUG(0,("is_8_3: internal error push_ucs2_allocate() failed!\n")); goto done; } ret = is_8_3_w(ucs2name, allow_wildcards); done: SAFE_FREE(ucs2name); if (!NT_STATUS_IS_OK(ret)) { return False; } return True; }