summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2006-10-18 00:29:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:22 -0500
commitc111683f31c274a4df388b75e06896c5f7890ace (patch)
tree4ea674fc934473e266409dec248b9bd507b33f31
parent52317b1351dc40ea3ee2e63b6b0b2313b84ddf52 (diff)
downloadsamba-c111683f31c274a4df388b75e06896c5f7890ace.tar.gz
samba-c111683f31c274a4df388b75e06896c5f7890ace.tar.bz2
samba-c111683f31c274a4df388b75e06896c5f7890ace.zip
r19383: pass only the base filename of an ldb file to be opened; allow server to prepend path where it's located (private_dir)
(This used to be commit 5a21c97b73a896dbba0d814c2226e17a67034802)
-rw-r--r--services/samba/ldb.esp18
1 files changed, 16 insertions, 2 deletions
diff --git a/services/samba/ldb.esp b/services/samba/ldb.esp
index d886d1a566..1cd98adc3a 100644
--- a/services/samba/ldb.esp
+++ b/services/samba/ldb.esp
@@ -30,7 +30,7 @@ jsonrpc_include("resources.esp");
*
* @return
* Success: The resource id to be used for future access to the database
- * Failure: -1
+ * Failure: error event
*
* @note
* Credentials or session_info may be set up first.
@@ -52,9 +52,23 @@ function _connect(params, error)
return resourceId;
}
+ /* Ensure there are no slashes in the database name */
+ var components = split('/', params[0]);
+ if (components.length > 1)
+ {
+ error.setError(1, "Invalid database name (contains '/')");
+ return error;
+ }
+
+ /* Get access to loadparm functions */
+ var lp = loadparm_init();
+
+ /* Determine the private directory */
+ var private_dir = lp.get("private dir");
+
/* Database was not previously opened. Connect to it. */
ldb = ldb_init();
- var ret = ldb.connect(params[0]);
+ var ret = ldb.connect(private_dir + "/" + params[0]);
if (ret && ldb.db)
{
return session.resources.set(ldb, "ldb:" + params[0], error);