/* 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 */
#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 },
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,
};
/* return the methods for this mangling implementation */
-struct mangle_fns *mangle_hash_init(void)
+const struct mangle_fns *mangle_hash_init(void)
{
mangle_reset();
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;
}
/*
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,
};
/* 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();
init_tables();
mangle_reset();
- return &mangle_fns;
+ return &mangle_hash2_fns;
}
static void posix_mangle_reset(void)
}
/* 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,
posix_name_to_8_3
};
-struct mangle_fns *posix_mangle_init(void)
+const struct mangle_fns *posix_mangle_init(void)
{
return &posix_mangle_fns;
}