From 7f2cf6b16635fcf7a4307dab4e6f6fed87ba2315 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 Jan 2009 08:36:24 +0100 Subject: s3:smbd: make mangle_fns const metze --- source3/include/proto.h | 6 +++--- source3/smbd/mangle.c | 4 ++-- source3/smbd/mangle_hash.c | 6 +++--- source3/smbd/mangle_hash2.c | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 35cb490d17..afc207b6f6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -6814,12 +6814,12 @@ bool name_to_8_3(const char *in, /* The following definitions come from smbd/mangle_hash.c */ -struct mangle_fns *mangle_hash_init(void); +const struct mangle_fns *mangle_hash_init(void); /* The following definitions come from smbd/mangle_hash2.c */ -struct mangle_fns *mangle_hash2_init(void); -struct mangle_fns *posix_mangle_init(void); +const struct mangle_fns *mangle_hash2_init(void); +const struct mangle_fns *posix_mangle_init(void); /* The following definitions come from smbd/map_username.c */ diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c index 4d4d0dc5af..e47ea7ed49 100644 --- a/source3/smbd/mangle.c +++ b/source3/smbd/mangle.c @@ -19,12 +19,12 @@ #include "includes.h" -static struct mangle_fns *mangle_fns; +static const struct mangle_fns *mangle_fns; /* this allows us to add more mangling backends */ static const struct { const char *name; - struct mangle_fns *(*init_fn)(void); + const struct mangle_fns *(*init_fn)(void); } mangle_backends[] = { { "hash", mangle_hash_init }, { "hash2", mangle_hash2_init }, diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 69ecf77834..3582b7a0a4 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -673,7 +673,7 @@ static bool hash_name_to_8_3(const char *in, the following provides the abstraction layer to make it easier to drop in an alternative mangling implementation */ -static struct mangle_fns mangle_fns = { +static const struct mangle_fns mangle_hash_fns = { mangle_reset, is_mangled, must_mangle, @@ -683,7 +683,7 @@ static struct mangle_fns mangle_fns = { }; /* return the methods for this mangling implementation */ -struct mangle_fns *mangle_hash_init(void) +const struct mangle_fns *mangle_hash_init(void) { mangle_reset(); @@ -691,5 +691,5 @@ struct mangle_fns *mangle_hash_init(void) tdb_mangled_cache = tdb_open_ex("mangled_cache", 1031, TDB_INTERNAL, (O_RDWR|O_CREAT), 0644, NULL, fast_string_hash); - return &mangle_fns; + return &mangle_hash_fns; } diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index a9b94aabc3..e4ce0f0d43 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -679,7 +679,7 @@ static void init_tables(void) /* the following provides the abstraction layer to make it easier to drop in an alternative mangling implementation */ -static struct mangle_fns mangle_fns = { +static const struct mangle_fns mangle_hash2_fns = { mangle_reset, is_mangled, must_mangle, @@ -689,7 +689,7 @@ static struct mangle_fns mangle_fns = { }; /* return the methods for this mangling implementation */ -struct mangle_fns *mangle_hash2_init(void) +const struct mangle_fns *mangle_hash2_init(void) { /* the mangle prefix can only be in the mange 1 to 6 */ mangle_prefix = lp_mangle_prefix(); @@ -703,7 +703,7 @@ struct mangle_fns *mangle_hash2_init(void) init_tables(); mangle_reset(); - return &mangle_fns; + return &mangle_hash2_fns; } static void posix_mangle_reset(void) @@ -746,7 +746,7 @@ static bool posix_name_to_8_3(const char *in, } /* POSIX paths backend - no mangle. */ -static struct mangle_fns posix_mangle_fns = { +static const struct mangle_fns posix_mangle_fns = { posix_mangle_reset, posix_is_mangled, posix_must_mangle, @@ -755,7 +755,7 @@ static struct mangle_fns posix_mangle_fns = { posix_name_to_8_3 }; -struct mangle_fns *posix_mangle_init(void) +const struct mangle_fns *posix_mangle_init(void) { return &posix_mangle_fns; } -- cgit