Fix include paths to new location of libutil.
[bbaumbach/samba-autobuild/.git] / source4 / ntvfs / common / notify.c
index 187a349b4bf111ac8d7576a9b6c42efb9245a0fc..dbe4722d37e487ac0d4720613308156dd766607e 100644 (file)
 
 #include "includes.h"
 #include "system/filesys.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
+#include "../tdb/include/tdb.h"
+#include "../lib/util/util_tdb.h"
 #include "messaging/messaging.h"
 #include "tdb_wrap.h"
 #include "lib/messaging/irpc.h"
 #include "librpc/gen_ndr/ndr_notify.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
 #include "ntvfs/common/ntvfs_common.h"
 #include "ntvfs/sysdep/sys_notify.h"
 #include "cluster/cluster.h"
@@ -45,6 +45,7 @@ struct notify_context {
        struct notify_array *array;
        int seqnum;
        struct sys_notify_context *sys_notify_ctx;
+       struct smb_iconv_convenience *iconv_convenience;
 };
 
 
@@ -82,6 +83,7 @@ static int notify_destructor(struct notify_context *notify)
 */
 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, 
                                   struct messaging_context *messaging_ctx,
+                                  struct loadparm_context *lp_ctx,
                                   struct event_context *ev,
                                   struct share_config *scfg)
 {
@@ -91,12 +93,16 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
                return NULL;
        }
 
+       if (ev == NULL) {
+               return NULL;
+       }
+
        notify = talloc(mem_ctx, struct notify_context);
        if (notify == NULL) {
                return NULL;
        }
 
-       notify->w = cluster_tdb_tmp_open(notify, global_loadparm, "notify.tdb", TDB_SEQNUM);
+       notify->w = cluster_tdb_tmp_open(notify, lp_ctx, "notify.tdb", TDB_SEQNUM);
        if (notify->w == NULL) {
                talloc_free(notify);
                return NULL;
@@ -106,6 +112,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
        notify->messaging_ctx = messaging_ctx;
        notify->list = NULL;
        notify->array = NULL;
+       notify->iconv_convenience = lp_iconv_convenience(lp_ctx);
        notify->seqnum = tdb_get_seqnum(notify->w->tdb);
 
        talloc_set_destructor(notify, notify_destructor);
@@ -170,7 +177,8 @@ static NTSTATUS notify_load(struct notify_context *notify)
        blob.data = dbuf.dptr;
        blob.length = dbuf.dsize;
 
-       ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->array,
+       ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->iconv_convenience,
+                                      notify->array,
                                       (ndr_pull_flags_fn_t)ndr_pull_notify_array);
        free(dbuf.dptr);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -218,7 +226,7 @@ static NTSTATUS notify_save(struct notify_context *notify)
        tmp_ctx = talloc_new(notify);
        NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
 
-       ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->array,
+       ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->iconv_convenience, notify->array,
                                       (ndr_push_flags_fn_t)ndr_push_notify_array);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
@@ -254,7 +262,7 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data
                return;
        }
 
-       ndr_err = ndr_pull_struct_blob(data, tmp_ctx, &ev,
+       ndr_err = ndr_pull_struct_blob(data, tmp_ctx, notify->iconv_convenience, &ev,
                                      (ndr_pull_flags_fn_t)ndr_pull_notify_event);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
@@ -553,8 +561,7 @@ static void notify_send(struct notify_context *notify, struct notify_entry *e,
 
        tmp_ctx = talloc_new(notify);
 
-       ndr_err = ndr_push_struct_blob(&data, tmp_ctx, &ev,
-                                     (ndr_push_flags_fn_t)ndr_push_notify_event);
+       ndr_err = ndr_push_struct_blob(&data, tmp_ctx, notify->iconv_convenience, &ev, (ndr_push_flags_fn_t)ndr_push_notify_event);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
                return;