1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-30 06:50:24 +03:00

s3/smbd: convert "mangled names" option to an enum

This is in preparation of adding an additional setting for this
option. No change in behaviour by this commit, that comes in the next
one.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2016-11-17 14:22:41 +01:00 committed by Jeremy Allison
parent e2f34116ab
commit 19eae53773
5 changed files with 26 additions and 5 deletions

View File

@ -236,6 +236,9 @@ enum inheritowner_options {
INHERIT_OWNER_UNIX_ONLY
};
/* mangled names options */
enum mangled_names_options {MANGLED_NAMES_NO, MANGLED_NAMES_YES};
/*
* Default passwd chat script.
*/

View File

@ -315,6 +315,16 @@ static const struct enum_list enum_inherit_owner_vals[] = {
{INHERIT_OWNER_UNIX_ONLY, "unix only"},
{-1, NULL}};
static const struct enum_list enum_mangled_names[] = {
{MANGLED_NAMES_NO, "no"},
{MANGLED_NAMES_NO, "false"},
{MANGLED_NAMES_NO, "0"},
{MANGLED_NAMES_YES, "yes"},
{MANGLED_NAMES_YES, "true"},
{MANGLED_NAMES_YES, "1"},
{-1, NULL}
};
/* Note: We do not initialise the defaults union - it is not allowed in ANSI C
*
* NOTE: Handling of duplicated (synonym) parameters:

View File

@ -201,7 +201,7 @@ static struct loadparm_service sDefault =
.oplocks = true,
.kernel_oplocks = false,
.level2_oplocks = true,
.mangled_names = true,
.mangled_names = MANGLED_NAMES_YES,
.wide_links = false,
.follow_symlinks = true,
.sync_always = false,

View File

@ -104,7 +104,7 @@ bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
bool mangle_must_mangle(const char *fname,
const struct share_params *p)
{
if (!lp_mangled_names(p)) {
if (lp_mangled_names(p) == MANGLED_NAMES_NO) {
return False;
}
return mangle_fns->must_mangle(fname, p);
@ -140,7 +140,7 @@ bool name_to_8_3(const char *in,
/* name mangling can be disabled for speed, in which case
we just truncate the string */
if (!lp_mangled_names(p)) {
if (lp_mangled_names(p) == MANGLED_NAMES_NO) {
strlcpy(out, in, 13);
return True;
}

View File

@ -2440,11 +2440,17 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
bool ok;
uint64_t last_entry_off = 0;
NTSTATUS status;
enum mangled_names_options mangled_names;
bool marshall_with_83_names;
mangled_names = lp_mangled_names(conn->params);
ZERO_STRUCT(state);
state.conn = conn;
state.info_level = info_level;
state.check_mangled_names = lp_mangled_names(conn->params);
if (mangled_names != MANGLED_NAMES_NO) {
state.check_mangled_names = true;
}
state.has_wild = dptr_has_wild(dirptr);
state.got_exact_match = false;
@ -2480,12 +2486,14 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
*got_exact_match = state.got_exact_match;
marshall_with_83_names = (mangled_names == MANGLED_NAMES_YES);
status = smbd_marshall_dir_entry(ctx,
conn,
flags2,
info_level,
name_list,
state.check_mangled_names,
marshall_with_83_names,
requires_resume_key,
mode,
fname,