Add allow_badcharcnv argument to all conversion function, for
[vlendec/samba-autobuild/.git] / source4 / libnet / libnet_samdump.c
index 2186271491f4c691b8ac43e2652fdf6d6e53da4c..04a73c53fff53deaa4894a32e533c25326cd9fc7 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "includes.h"
 #include "libnet/libnet.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
 #include "samba3/samba3.h"
 #include "libcli/security/security.h"
 
@@ -75,13 +75,13 @@ static NTSTATUS vampire_samdump_handle_secret(TALLOC_CTX *mem_ctx,
 {
        struct netr_DELTA_SECRET *secret = delta->delta_union.secret;
        const char *name = delta->delta_id_union.name;
-       struct samdump_secret *new = talloc(samdump_state, struct samdump_secret);
+       struct samdump_secret *n = talloc(samdump_state, struct samdump_secret);
 
-       new->name = talloc_strdup(new, name);
-       new->secret = data_blob_talloc(new, secret->current_cipher.cipher_data, secret->current_cipher.maxlen);
-       new->mtime = secret->current_cipher_set_time;
+       n->name = talloc_strdup(n, name);
+       n->secret = data_blob_talloc(n, secret->current_cipher.cipher_data, secret->current_cipher.maxlen);
+       n->mtime = secret->current_cipher_set_time;
 
-       DLIST_ADD(samdump_state->secrets, new);
+       DLIST_ADD(samdump_state->secrets, n);
 
        return NT_STATUS_OK;
 }
@@ -93,24 +93,24 @@ static NTSTATUS vampire_samdump_handle_trusted_domain(TALLOC_CTX *mem_ctx,
        struct netr_DELTA_TRUSTED_DOMAIN *trusted_domain = delta->delta_union.trusted_domain;
        struct dom_sid *dom_sid = delta->delta_id_union.sid;
 
-       struct samdump_trusted_domain *new = talloc(samdump_state, struct samdump_trusted_domain);
+       struct samdump_trusted_domain *n = talloc(samdump_state, struct samdump_trusted_domain);
 
-       new->name = talloc_strdup(new, trusted_domain->domain_name.string);
-       new->sid = talloc_steal(new, dom_sid);
+       n->name = talloc_strdup(n, trusted_domain->domain_name.string);
+       n->sid = talloc_steal(n, dom_sid);
 
-       DLIST_ADD(samdump_state->trusted_domains, new);
+       DLIST_ADD(samdump_state->trusted_domains, n);
 
        return NT_STATUS_OK;
 }
 
-static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx,                 
-                                 void *private,                        
+static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx,
+                                 void *private_data,
                                  enum netr_SamDatabaseID database,
                                  struct netr_DELTA_ENUM *delta,
                                  char **error_string)
 {
        NTSTATUS nt_status = NT_STATUS_OK;
-       struct samdump_state *samdump_state = (struct samdump_state *)private;
+       struct samdump_state *samdump_state = (struct samdump_state *)private_data;
 
        *error_string = NULL;
        switch (delta->delta_type) {
@@ -163,7 +163,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
 
        r2.out.error_string            = NULL;
        r2.in.binding_string           = r->in.binding_string;
-       r2.in.rid_crypt                = lp_parm_bool(global_loadparm, NULL, "vampire", "rid decrypt", true);
+       r2.in.rid_crypt                = lp_parm_bool(ctx->lp_ctx, NULL, "vampire", "rid decrypt", true);
        r2.in.init_fn                  = NULL;
        r2.in.delta_fn                 = libnet_samdump_fn;
        r2.in.fn_ctx                   = samdump_state;
@@ -185,9 +185,9 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
                        if (strcasecmp_m(s->name, secret_name) != 0) {
                                continue;
                        }
-                       if (convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, 
+                       if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX, 
                                                  s->secret.data, s->secret.length, 
-                                                 (void **)&secret_string) == -1) {
+                                                 (void **)&secret_string, false) == -1) {
                                r->out.error_string = talloc_asprintf(mem_ctx, 
                                                                      "Could not convert secret for domain %s to a string",
                                                                      t->name);