summaryrefslogtreecommitdiff
path: root/lib/param
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-04-11 17:12:10 +0930
committerJeremy Allison <jra@samba.org>2013-04-12 14:59:23 -0700
commitccfd929d964ae111cfac33acaf6c3bcc039724c1 (patch)
tree9df203bcafa86b928f855f8d688a19f68ec6e247 /lib/param
parent1cf46d2e35c3c290a3d7d1c57d622a2abf2643e6 (diff)
downloadsamba-ccfd929d964ae111cfac33acaf6c3bcc039724c1.tar.gz
samba-ccfd929d964ae111cfac33acaf6c3bcc039724c1.tar.bz2
samba-ccfd929d964ae111cfac33acaf6c3bcc039724c1.zip
lib/param: lpcfg_private_db_path()
This wrapper avoids testing lpcfg_use_ntdb() everywhere. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/param')
-rw-r--r--lib/param/param.h15
-rw-r--r--lib/param/util.c27
2 files changed, 42 insertions, 0 deletions
diff --git a/lib/param/param.h b/lib/param/param.h
index 18d4b29ea0..7e73dd0f23 100644
--- a/lib/param/param.h
+++ b/lib/param/param.h
@@ -284,6 +284,21 @@ char *lpcfg_private_path(TALLOC_CTX* mem_ctx,
const char *name);
/**
+ * @brief Returns an absolute path to a NTDB or TDB file in the Samba
+ * private directory.
+ *
+ * @param name File to find, relative to PRIVATEDIR, without .(n)tdb extension.
+ * Only provide fixed-string names which are supposed to change with "use ntdb"
+ * option.
+ *
+ * @retval Pointer to a talloc'ed string containing the full path, for
+ * use with dbwrap_local_open().
+ **/
+char *lpcfg_private_db_path(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ const char *name);
+
+/**
return a path in the smbd.tmp directory, where all temporary file
for smbd go. If NULL is passed for name then return the directory
path itself
diff --git a/lib/param/util.c b/lib/param/util.c
index f488540b7f..29266c493d 100644
--- a/lib/param/util.c
+++ b/lib/param/util.c
@@ -190,6 +190,33 @@ char *lpcfg_private_path(TALLOC_CTX* mem_ctx,
}
/**
+ * @brief Returns an absolute path to a NTDB or TDB file in the Samba
+ * private directory.
+ *
+ * @param name File to find, relative to PRIVATEDIR, without .(n)tdb extension.
+ * Only provide fixed-string names which are supposed to change with "use ntdb"
+ * option.
+ *
+ * @retval Pointer to a talloc'ed string containing the full path, for
+ * use with dbwrap_local_open().
+ **/
+char *lpcfg_private_db_path(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ const char *name)
+{
+ const char *extension = ".tdb";
+
+#ifndef DISABLE_NTDB
+ if (lpcfg_use_ntdb(lp_ctx)) {
+ extension = ".ntdb";
+ }
+#endif
+
+ return talloc_asprintf(mem_ctx, "%s/%s%s",
+ lpcfg_private_dir(lp_ctx), name, extension);
+}
+
+/**
return a path in the smbd.tmp directory, where all temporary file
for smbd go. If NULL is passed for name then return the directory
path itself