summaryrefslogtreecommitdiff
path: root/source3/lib/module.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-09-14 22:03:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:48 -0500
commit3aaca8028e09db58381076f199a43680f81f04ac (patch)
treed9bbbe39fbfdd2b2db8462a156ee97dddf03cf9c /source3/lib/module.c
parent5eb34f5d570b2370e010e81f65b53ce47a1a873d (diff)
downloadsamba-3aaca8028e09db58381076f199a43680f81f04ac.tar.gz
samba-3aaca8028e09db58381076f199a43680f81f04ac.tar.bz2
samba-3aaca8028e09db58381076f199a43680f81f04ac.zip
r25170: Remove pstring limits from ms_fnmatch and module load.
Jeremy. (This used to be commit 764574ee05ea4f13cdd30c0a0668ffeb81756989)
Diffstat (limited to 'source3/lib/module.c')
-rw-r--r--source3/lib/module.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/source3/lib/module.c b/source3/lib/module.c
index 1bf305ea3f..beb9bc9b92 100644
--- a/source3/lib/module.c
+++ b/source3/lib/module.c
@@ -76,7 +76,7 @@ NTSTATUS smb_load_module(const char *module_name)
return do_smb_load_module(module_name, False);
}
-/* Load all modules in list and return number of
+/* Load all modules in list and return number of
* modules that has been successfully loaded */
int smb_load_modules(const char **modules)
{
@@ -96,28 +96,38 @@ int smb_load_modules(const char **modules)
NTSTATUS smb_probe_module(const char *subsystem, const char *module)
{
- pstring full_path;
-
+ char *full_path = NULL;
+ TALLOC_CTX *ctx = talloc_stackframe();
+ NTSTATUS status;
+
/* Check for absolute path */
- /* if we make any 'samba multibyte string'
- calls here, we break
+ /* if we make any 'samba multibyte string'
+ calls here, we break
for loading string modules */
DEBUG(5, ("Probing module '%s'\n", module));
if (module[0] == '/')
return do_smb_load_module(module, True);
-
- pstrcpy(full_path, lib_path(subsystem));
- pstrcat(full_path, "/");
- pstrcat(full_path, module);
- pstrcat(full_path, ".");
- pstrcat(full_path, shlib_ext());
-
- DEBUG(5, ("Probing module '%s': Trying to load from %s\n", module, full_path));
-
- return do_smb_load_module(full_path, True);
+
+ full_path = talloc_asprintf(ctx,
+ "%s/%s.%s",
+ lib_path(subsystem),
+ module,
+ shlib_ext());
+ if (!full_path) {
+ TALLOC_FREE(ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ DEBUG(5, ("Probing module '%s': Trying to load from %s\n",
+ module, full_path));
+
+ status = do_smb_load_module(full_path, True);
+
+ TALLOC_FREE(ctx);
+ return status;
}
#else /* HAVE_DLOPEN */