diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-06 14:37:06 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-06 17:37:51 +1000 |
commit | de46ad9084aff4384f33660acf91da3b81554a88 (patch) | |
tree | 42cdab1c24a8a38ba07d46f33d0b596f69d47bcc /source3 | |
parent | 876b1b3d198e2306c36423bfb1449870c74181fd (diff) | |
download | samba-de46ad9084aff4384f33660acf91da3b81554a88.tar.gz samba-de46ad9084aff4384f33660acf91da3b81554a88.tar.bz2 samba-de46ad9084aff4384f33660acf91da3b81554a88.zip |
lib/util use modules_path(), data_path() and shlib_ext() from source3
This brings these helpful utility functions in common, as they are not
based on either loadparm system.
(The 'modules dir' parameter from Samba4 will shortly be removed, so
there is no loss in functionality)
Andrew Bartlett
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 2 | ||||
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/intl/lang_tdb.c | 2 | ||||
-rw-r--r-- | source3/lib/module.c | 8 | ||||
-rw-r--r-- | source3/lib/util.c | 37 | ||||
-rw-r--r-- | source3/smbd/mangle_hash.c | 2 |
6 files changed, 7 insertions, 47 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index f7458d353a..d4b59b95b9 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -421,7 +421,7 @@ LIBSAMBAUTIL_OBJ = \ UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \ ../lib/util/xfile.o ../lib/util/util_strlist.o \ ../lib/util/util_file.o ../lib/util/data_blob.o \ - ../lib/util/util.o ../lib/util/fsusage.o \ + ../lib/util/util.o ../lib/util/util_paths.o ../lib/util/fsusage.o \ ../lib/util/params.o ../lib/util/talloc_stack.o \ ../lib/util/genrand.o ../lib/util/util_net.o \ ../lib/util/become_daemon.o ../lib/util/system.o \ diff --git a/source3/include/proto.h b/source3/include/proto.h index 1cdc0c9081..10a84f9050 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -570,11 +570,8 @@ void *smb_xmalloc_array(size_t size, unsigned int count); char *myhostname(void); char *lock_path(const char *name); char *pid_path(const char *name); -char *modules_path(const char *name); -char *data_path(const char *name); char *state_path(const char *name); char *cache_path(const char *name); -const char *shlib_ext(void); bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent, const char **name); bool ms_has_wild(const char *s); diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c index c6206c16e4..6070e29e5a 100644 --- a/source3/intl/lang_tdb.c +++ b/source3/intl/lang_tdb.c @@ -131,7 +131,7 @@ bool lang_tdb_init(const char *lang) return True; if (asprintf(&msg_path, "%s.msg", - data_path((const char *)lang)) == -1) { + data_path(talloc_tos(), (const char *)lang)) == -1) { DEBUG(0, ("asprintf failed\n")); goto done; } diff --git a/source3/lib/module.c b/source3/lib/module.c index de13668009..bec4fddefd 100644 --- a/source3/lib/module.c +++ b/source3/lib/module.c @@ -117,10 +117,10 @@ NTSTATUS smb_probe_module(const char *subsystem, const char *module) } full_path = talloc_asprintf(ctx, - "%s/%s.%s", - modules_path(subsystem), - module, - shlib_ext()); + "%s/%s.%s", + modules_path(ctx, subsystem), + module, + shlib_ext()); if (!full_path) { TALLOC_FREE(ctx); return NT_STATUS_NO_MEMORY; diff --git a/source3/lib/util.c b/source3/lib/util.c index dc91fa06a1..a596385bfb 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1514,32 +1514,6 @@ char *pid_path(const char *name) } /** - * @brief Returns an absolute path to a file in the Samba modules directory. - * - * @param name File to find, relative to MODULESDIR. - * - * @retval Pointer to a string containing the full path. - **/ - -char *modules_path(const char *name) -{ - return talloc_asprintf(talloc_tos(), "%s/%s", get_dyn_MODULESDIR(), name); -} - -/** - * @brief Returns an absolute path to a file in the Samba data directory. - * - * @param name File to find, relative to CODEPAGEDIR. - * - * @retval Pointer to a talloc'ed string containing the full path. - **/ - -char *data_path(const char *name) -{ - return talloc_asprintf(talloc_tos(), "%s/%s", get_dyn_CODEPAGEDIR(), name); -} - -/** * @brief Returns an absolute path to a file in the Samba state directory. * * @param name File to find, relative to STATEDIR. @@ -1565,17 +1539,6 @@ char *cache_path(const char *name) return xx_path(name, lp_cachedir()); } -/** - * @brief Returns the platform specific shared library extension. - * - * @retval Pointer to a const char * containing the extension. - **/ - -const char *shlib_ext(void) -{ - return get_dyn_SHLIBEXT(); -} - /******************************************************************* Given a filename - get its directory name ********************************************************************/ diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 575c35e458..988251e878 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -87,7 +87,7 @@ static void init_valid_table(void) return; } - valid_table = (uint8 *)map_file(data_path("valid.dat"), 0x10000); + valid_table = (uint8 *)map_file(data_path(talloc_tos(), "valid.dat"), 0x10000); if (!valid_table) { smb_panic("Could not load valid.dat file required for mangle method=hash"); return; |