From 90068bb460c5229f0e146d2118c48d5086c3eb9a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 12 Mar 2013 11:39:08 +0100 Subject: s3-net: Add encoding= to 'net printing migrate'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows you to convert printing tdb's which are in e.g. in latin1 to convert to UTF-8 and import them into the registry. Reviewed-by: Günther Deschner --- source3/printing/nt_printing_migrate.c | 14 ++++++++++++-- source3/printing/nt_printing_migrate.h | 6 ++++-- source3/printing/nt_printing_migrate_internal.c | 6 ++++-- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/nt_printing_migrate.c b/source3/printing/nt_printing_migrate.c index 94dc3daa56..eacafa2a5f 100644 --- a/source3/printing/nt_printing_migrate.c +++ b/source3/printing/nt_printing_migrate.c @@ -88,7 +88,8 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *winreg_pipe, const char *key_name, unsigned char *data, - size_t length) + size_t length, + bool do_string_conversion) { struct dcerpc_binding_handle *b = winreg_pipe->binding_handle; enum ndr_err_code ndr_err; @@ -105,6 +106,10 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx, ZERO_STRUCT(r); + if (do_string_conversion) { + r.string_flags = LIBNDR_FLAG_STR_ASCII; + } + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r, (ndr_pull_flags_fn_t)ndr_pull_ntprinting_driver); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -150,7 +155,8 @@ NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *winreg_pipe, const char *key_name, unsigned char *data, - size_t length) + size_t length, + bool do_string_conversion) { struct dcerpc_binding_handle *b = winreg_pipe->binding_handle; enum ndr_err_code ndr_err; @@ -173,6 +179,10 @@ NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx, ZERO_STRUCT(r); + if (do_string_conversion) { + r.info.string_flags = LIBNDR_FLAG_STR_ASCII; + } + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r, (ndr_pull_flags_fn_t) ndr_pull_ntprinting_printer); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source3/printing/nt_printing_migrate.h b/source3/printing/nt_printing_migrate.h index 3da8db4626..0c9800ddcd 100644 --- a/source3/printing/nt_printing_migrate.h +++ b/source3/printing/nt_printing_migrate.h @@ -30,12 +30,14 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *winreg_pipe, const char *key_name, unsigned char *data, - size_t length); + size_t length, + bool do_string_conversion); NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *winreg_pipe, const char *key_name, unsigned char *data, - size_t length); + size_t length, + bool do_string_conversion); NTSTATUS printing_tdb_migrate_secdesc(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *winreg_pipe, const char *key_name, diff --git a/source3/printing/nt_printing_migrate_internal.c b/source3/printing/nt_printing_migrate_internal.c index 7142a5cb24..200db07fe2 100644 --- a/source3/printing/nt_printing_migrate_internal.c +++ b/source3/printing/nt_printing_migrate_internal.c @@ -114,7 +114,8 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx, winreg_pipe, (const char *) kbuf.dptr + strlen(DRIVERS_PREFIX), dbuf.dptr, - dbuf.dsize); + dbuf.dsize, + false); SAFE_FREE(dbuf.dptr); if (!NT_STATUS_IS_OK(status)) { tdb_close(tdb); @@ -130,7 +131,8 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx, winreg_pipe, printer_name, dbuf.dptr, - dbuf.dsize); + dbuf.dsize, + false); SAFE_FREE(dbuf.dptr); if (!NT_STATUS_IS_OK(status)) { tdb_close(tdb); -- cgit