s3:smbd: make mangle_fns const
authorStefan Metzmacher <metze@samba.org>
Thu, 8 Jan 2009 07:36:24 +0000 (08:36 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 8 Jan 2009 11:22:17 +0000 (12:22 +0100)
metze

source3/include/proto.h
source3/smbd/mangle.c
source3/smbd/mangle_hash.c
source3/smbd/mangle_hash2.c

index 35cb490d17831f10dbcca8df3a71b8f220b90a4f..afc207b6f6057a204310bec285cb603da52007d1 100644 (file)
@@ -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  */
 
index 4d4d0dc5afbb5c70c3065a65510ed6e99a97f5a9..e47ea7ed499cb29c708c3f9b0645c404c2b3a2d1 100644 (file)
 
 #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 },
index 69ecf77834b09ce494799c7d23bb459594b27ac5..3582b7a0a434528f2bd3f66078241dfdb77ba5fc 100644 (file)
@@ -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;
 }
index a9b94aabc3877fcaf5d1014ebfd2a72efa80442d..e4ce0f0d43bb68dd50b483272e01c304940c418e 100644 (file)
@@ -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;
 }