*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
+#include <ldb.h>
+#include <ldb_errors.h>
#include "auth/auth.h"
#include "ldb_wrap.h"
#include "param/share.h"
#include "param/param.h"
+NTSTATUS share_ldb_init(void);
+
static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops,
- struct event_context *ev_ctx,
+ struct tevent_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct share_context **ctx)
{
return NT_STATUS_NO_MEMORY;
}
- sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx,
- private_path(*ctx, lp_ctx, "share.ldb"),
- system_session(*ctx, lp_ctx),
- NULL, 0, NULL);
+ sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx,
+ lpcfg_private_path(*ctx, lp_ctx, "share.ldb"),
+ system_session(lp_ctx),
+ NULL, 0);
if (!sdb) {
talloc_free(*ctx);
ldb = talloc_get_type(ctx->priv_data, struct ldb_context);
- ret = ldb_search(ldb, ldb_dn_new(tmp_ctx, ldb, "CN=SHARES"), LDB_SCOPE_SUBTREE, "(name=*)", NULL, &res);
- talloc_steal(tmp_ctx, res);
+ ret = ldb_search(ldb, tmp_ctx, &res, ldb_dn_new(tmp_ctx, ldb, "CN=SHARES"),
+ LDB_SCOPE_SUBTREE, NULL, "(name=*)");
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
ldb = talloc_get_type(ctx->priv_data, struct ldb_context);
- ret = ldb_search_exp_fmt(ldb, tmp_ctx, &res,
+ ret = ldb_search(ldb, tmp_ctx, &res,
ldb_dn_new(tmp_ctx, ldb, "CN=SHARES"), LDB_SCOPE_SUBTREE, NULL,
"(name=%s)", name);
if (ret != LDB_SUCCESS || res->count > 1) {
goto done; \
} } while(0)
-NTSTATUS sldb_create(struct share_context *ctx, const char *name, struct share_info *info, int count)
+static NTSTATUS sldb_create(struct share_context *ctx, const char *name, struct share_info *info, int count)
{
struct ldb_context *ldb;
struct ldb_message *msg;
goto done; \
} } while(0)
-NTSTATUS sldb_set(struct share_context *ctx, const char *name, struct share_info *info, int count)
+static NTSTATUS sldb_set(struct share_context *ctx, const char *name, struct share_info *info, int count)
{
struct ldb_context *ldb;
struct ldb_message *msg;
return ret;
}
-NTSTATUS sldb_remove(struct share_context *ctx, const char *name)
+static NTSTATUS sldb_remove(struct share_context *ctx, const char *name)
{
struct ldb_context *ldb;
struct ldb_dn *dn;