Merge branch 'master' of ssh://git.samba.org/data/git/samba into selftest
[bbaumbach/samba-autobuild/.git] / source4 / lib / registry / tools / regdiff.c
index 1996861a2a62afd62dd6dcdd3a36801eef44b526..fcf7c26237898edcb95830ed416988e5b5518113 100644 (file)
@@ -29,6 +29,7 @@
 enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL };
 
 static struct registry_context *open_backend(poptContext pc,
+                                            struct event_context *ev_ctx,
                                             struct loadparm_context *lp_ctx,
                                             enum reg_backend backend,
                                             const char *remote_host)
@@ -41,14 +42,14 @@ static struct registry_context *open_backend(poptContext pc,
                poptPrintUsage(pc, stderr, 0);
                return NULL;
        case REG_LOCAL:
-               error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials);
+               error = reg_open_samba(NULL, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials);
                break;
        case REG_REMOTE:
-               error = reg_open_remote(&ctx, NULL, cmdline_credentials,
-                                       remote_host, NULL);
+               error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx,
+                                       remote_host, ev_ctx);
                break;
        case REG_NULL:
-               error = reg_open_local(NULL, &ctx, NULL, cmdline_credentials);
+               error = reg_open_local(NULL, &ctx);
                break;
        }
 
@@ -82,6 +83,7 @@ int main(int argc, const char **argv)
        };
        TALLOC_CTX *ctx;
        void *callback_data;
+       struct event_context *ev_ctx;
        struct reg_diff_callbacks *callbacks;
 
        ctx = talloc_init("regdiff");
@@ -116,17 +118,19 @@ int main(int argc, const char **argv)
 
        }
 
-       h1 = open_backend(pc, global_loadparm, backend1, remote1);
+       ev_ctx = s4_event_context_init(NULL);
+
+       h1 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend1, remote1);
        if (h1 == NULL)
                return 1;
 
-       h2 = open_backend(pc, global_loadparm, backend2, remote2);
+       h2 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend2, remote2);
        if (h2 == NULL)
                return 1;
 
        poptFreeContext(pc);
 
-       error = reg_dotreg_diff_save(ctx, outputfile, &callbacks,
+       error = reg_dotreg_diff_save(ctx, outputfile, lp_iconv_convenience(cmdline_lp_ctx), &callbacks,
                                     &callback_data);
        if (!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Problem saving registry diff to '%s': %s\n",