svn commit: samba r19383 - in branches/SAMBA_4_0/services/samba: .
derrell at samba.org
derrell at samba.org
Wed Oct 18 00:29:27 GMT 2006
Author: derrell
Date: 2006-10-18 00:29:26 +0000 (Wed, 18 Oct 2006)
New Revision: 19383
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19383
Log:
pass only the base filename of an ldb file to be opened; allow server to prepend path where it's located (private_dir)
Modified:
branches/SAMBA_4_0/services/samba/ldb.esp
Changeset:
Modified: branches/SAMBA_4_0/services/samba/ldb.esp
===================================================================
--- branches/SAMBA_4_0/services/samba/ldb.esp 2006-10-18 00:28:05 UTC (rev 19382)
+++ branches/SAMBA_4_0/services/samba/ldb.esp 2006-10-18 00:29:26 UTC (rev 19383)
@@ -30,7 +30,7 @@
*
* @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 @@
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);
More information about the samba-cvs
mailing list