lib/util Rename init_module_fn to samba_init_module_fn
[samba.git] / source4 / param / share_ldb.c
index eba1665cc9f5654fe22f47e56bb95c005a83eaa7..f4d02b295a3c0ca5633562713df119ba3fe0c960 100644 (file)
 */
 
 #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)
 {
@@ -40,10 +42,10 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops,
                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);
@@ -174,8 +176,8 @@ static NTSTATUS sldb_list_all(TALLOC_CTX *mem_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;
@@ -223,7 +225,7 @@ static NTSTATUS sldb_get_config(TALLOC_CTX *mem_ctx,
 
        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) {
@@ -287,7 +289,7 @@ static NTSTATUS sldb_get_config(TALLOC_CTX *mem_ctx,
                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;
@@ -426,7 +428,7 @@ done:
                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;
@@ -535,7 +537,7 @@ done:
        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;