From 8c53aba485e7986baacf91b2c99ef7999142aee4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 26 Jun 2005 00:12:44 +0000 Subject: r7912: make private_path() recognise a non-relative filename, so we can have sam database = sam.ldb and it will know to put it in the private dir, but if you use sam database = ldap://server it knows to use it as-is (This used to be commit c5bccbc366db144d3e1cb7b21f0e3284d841dd06) --- source4/lib/util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source4/lib/util.c') diff --git a/source4/lib/util.c b/source4/lib/util.c index ba2c0e1ae4..308d1b6f45 100644 --- a/source4/lib/util.c +++ b/source4/lib/util.c @@ -657,13 +657,19 @@ char *lib_path(TALLOC_CTX* mem_ctx, const char *name) * @brief Returns an absolute path to a file in the Samba private directory. * * @param name File to find, relative to PRIVATEDIR. + * if name is not relative, then use it as-is * * @retval Pointer to a talloc'ed string containing the full path. **/ - char *private_path(TALLOC_CTX* mem_ctx, const char *name) { char *fname; + if (name == NULL) { + return NULL; + } + if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) { + return talloc_strdup(mem_ctx, name); + } fname = talloc_asprintf(mem_ctx, "%s/%s", lp_private_dir(), name); return fname; } -- cgit