summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-03-12 11:39:08 +0100
committerGünther Deschner <gd@samba.org>2013-03-15 12:11:03 +0100
commit90068bb460c5229f0e146d2118c48d5086c3eb9a (patch)
tree9bed52bc01d9ab6b944108e37fe12912206661d5 /source3/printing
parentc8abc6f13879c6aad9dbde4f464f707e28083ff1 (diff)
downloadsamba-90068bb460c5229f0e146d2118c48d5086c3eb9a.tar.gz
samba-90068bb460c5229f0e146d2118c48d5086c3eb9a.tar.bz2
samba-90068bb460c5229f0e146d2118c48d5086c3eb9a.zip
s3-net: Add encoding=<CP> to 'net printing migrate'.
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 <gd@samba.org>
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing_migrate.c14
-rw-r--r--source3/printing/nt_printing_migrate.h6
-rw-r--r--source3/printing/nt_printing_migrate_internal.c6
3 files changed, 20 insertions, 6 deletions
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);