summaryrefslogtreecommitdiff
path: root/source4/lib/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-26 00:12:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:48 -0500
commit8c53aba485e7986baacf91b2c99ef7999142aee4 (patch)
treeb615503de3ef8a222ba95d5dd8a591d71cf7653f /source4/lib/util.c
parentb3e493470f3465cfe5cfa958b019ac8cfb8f12f2 (diff)
downloadsamba-8c53aba485e7986baacf91b2c99ef7999142aee4.tar.gz
samba-8c53aba485e7986baacf91b2c99ef7999142aee4.tar.bz2
samba-8c53aba485e7986baacf91b2c99ef7999142aee4.zip
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)
Diffstat (limited to 'source4/lib/util.c')
-rw-r--r--source4/lib/util.c8
1 files changed, 7 insertions, 1 deletions
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;
}