[PATCHES] some printing related patches
Günther Deschner
gd at samba.org
Sat Sep 10 12:37:49 UTC 2016
Hi,
attached some printing related patches.
Please review and push.
Thanks,
Guenther
--
Günther Deschner GPG-ID: 8EE11688
Red Hat gdeschner at redhat.com
Samba Team gd at samba.org
-------------- next part --------------
From 04e420047880988e88eb3c1bd13ef58711d3c5db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Mon, 7 Apr 2014 15:47:43 +0200
Subject: [PATCH 01/12] pidl: in s3 server templates, support default HRESULT
error returns.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
pidl/lib/Parse/Pidl/Samba3/Template.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pidl/lib/Parse/Pidl/Samba3/Template.pm b/pidl/lib/Parse/Pidl/Samba3/Template.pm
index 4750cef..d50f706 100644
--- a/pidl/lib/Parse/Pidl/Samba3/Template.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/Template.pm
@@ -70,6 +70,8 @@ $pad"."struct $fname *r)
$res .= "\treturn NT_STATUS_NOT_IMPLEMENTED;\n";
} elsif ($d->{RETURN_TYPE} eq "WERROR") {
$res .= "\treturn WERR_NOT_SUPPORTED;\n";
+ } elsif ($d->{RETURN_TYPE} eq "HRESULT") {
+ $res .= "\treturn HRES_ERROR_NOT_SUPPORTED;\n";
}
$res .= "}
--
2.7.4
From 83d789fad4d05a1d8b8a539e7b0f190945def29f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Tue, 23 Aug 2016 12:28:53 +0200
Subject: [PATCH 02/12] spoolss: add IDL for spoolss_LogJobInfoForBranchOffice.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
librpc/idl/spoolss.idl | 97 +++++++++++++++++++++++++++++
source3/rpc_server/spoolss/srv_spoolss_nt.c | 33 ++++++++++
2 files changed, 130 insertions(+)
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index ae10917..c9d9b36 100644
--- a/librpc/idl/spoolss.idl
+++ b/librpc/idl/spoolss.idl
@@ -3413,4 +3413,101 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor")
[out,ref] uint32 *pcProperties,
[out,ref,size_is(,*pcProperties)] RPC_PrintNamedProperty **ppProperties
);
+
+ /******************/
+ /* Function: 0x72 */
+ [todo] WERROR spoolss_72(
+ );
+
+ /******************/
+ /* Function: 0x73 */
+ [todo] WERROR spoolss_73(
+ );
+
+ /******************/
+ /* Function: 0x71 */
+ typedef enum {
+ kInvalidJobState = 0,
+ kLogJobPrinted = 1,
+ kLogJobRendered = 2,
+ kLogJobError = 3,
+ kLogJobPipelineError = 4,
+ kLogOfflineFileFull = 5
+ } EBranchOfficeJobEventType;
+
+ typedef struct {
+ DWORD Status;
+ [string,charset(UTF16)] uint16 *pDocumentName;
+ [string,charset(UTF16)] uint16 *pUserName;
+ [string,charset(UTF16)] uint16 *pMachineName;
+ [string,charset(UTF16)] uint16 *pPrinterName;
+ [string,charset(UTF16)] uint16 *pPortName;
+ hyper Size;
+ DWORD TotalPages;
+ } spoolss_BranchOfficeJobDataPrinted;
+
+ typedef struct {
+ hyper Size;
+ DWORD ICMMethod;
+ short Color;
+ short PrintQuality;
+ short YResolution;
+ short Copies;
+ short TTOption;
+ } spoolss_BranchOfficeJobDataRendered;
+
+ typedef struct {
+ WERROR LastError;
+ [string,charset(UTF16)] uint16 *pDocumentName;
+ [string,charset(UTF16)] uint16 *pUserName;
+ [string,charset(UTF16)] uint16 *pPrinterName;
+ [string,charset(UTF16)] uint16 *pDataType;
+ hyper TotalSize;
+ hyper PrintedSize;
+ DWORD TotalPages;
+ DWORD PrintedPages;
+ [string,charset(UTF16)] uint16 *pMachineName;
+ [string,charset(UTF16)] uint16 *pJobError;
+ [string,charset(UTF16)] uint16 *pErrorDescription;
+ } spoolss_BranchOfficeJobDataError;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *pDocumentName;
+ [string,charset(UTF16)] uint16 *pPrinterName;
+ [string,charset(UTF16)] uint16 *pExtraErrorInfo;
+ } spoolss_BranchOfficeJobDataPipelineFailed;
+
+ typedef struct {
+ [string,charset(UTF16)] uint16 *pMachineName;
+ } spoolss_BranchOfficeLogOfflineFileFull;
+
+ typedef [ms_union,switch_type(EBranchOfficeJobEventType)] union {
+ [case(kLogJobPrinted)]
+ spoolss_BranchOfficeJobDataPrinted LogJobPrinted;
+ [case(kLogJobRendered)]
+ spoolss_BranchOfficeJobDataRendered LogJobRendered;
+ [case(kLogJobError)]
+ spoolss_BranchOfficeJobDataError LogJobError;
+ [case(kLogJobPipelineError)]
+ spoolss_BranchOfficeJobDataPipelineFailed LogPipelineFailed;
+ [case(kLogOfflineFileFull)]
+ spoolss_BranchOfficeLogOfflineFileFull LogOfflineFileFull;
+ } spoolss_BranchOfficeJobInfo;
+
+ typedef struct {
+ EBranchOfficeJobEventType eEventType;
+ DWORD JobId;
+ [switch_is(eEventType)] spoolss_BranchOfficeJobInfo JobInfo;
+ } spoolss_BranchOfficeJobData;
+
+ typedef struct {
+ DWORD cJobDataEntries;
+ [size_is(cJobDataEntries)] spoolss_BranchOfficeJobData JobData[];
+ } spoolss_BranchOfficeJobDataContainer;
+
+ WERROR spoolss_LogJobInfoForBranchOffice(
+ [in,ref] policy_handle *hPrinter,
+ [in,ref] spoolss_BranchOfficeJobDataContainer *pBranchOfficeJobDataContainer
+ );
+
}
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 7413d9d..5a8328c 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -11303,3 +11303,36 @@ WERROR _spoolss_RpcEnumJobNamedProperties(struct pipes_struct *p,
p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
return WERR_NOT_SUPPORTED;
}
+
+/****************************************************************
+ _spoolss_72
+****************************************************************/
+
+WERROR _spoolss_72(struct pipes_struct *p,
+ struct spoolss_72 *r)
+{
+ p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
+ return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+ _spoolss_73
+****************************************************************/
+
+WERROR _spoolss_73(struct pipes_struct *p,
+ struct spoolss_73 *r)
+{
+ p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
+ return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+ _spoolss_RpcLogJobInfoForBranchOffice
+****************************************************************/
+
+WERROR _spoolss_LogJobInfoForBranchOffice(struct pipes_struct *p,
+ struct spoolss_LogJobInfoForBranchOffice *r)
+{
+ p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
+ return WERR_NOT_SUPPORTED;
+}
--
2.7.4
From 2e425b65c51bb05c47e22f4140a21f2f6547729f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Tue, 6 Sep 2016 12:11:26 +0200
Subject: [PATCH 03/12] s4-torture: add test for
spoolss_LogJobInfoForBranchOffice
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
selftest/knownfail | 1 +
source4/torture/rpc/spoolss.c | 58 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+)
diff --git a/selftest/knownfail b/selftest/knownfail
index 2f6a66b..0aefedf 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -181,6 +181,7 @@
^samba3.rpc.spoolss.printer.addprinter.driver_info_winreg # knownfail or flapping?
^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping?
^samba3.rpc.spoolss.printer.*.publish_toggle\(.*\)$ # needs spoolss AD member env
+^samba3.rpc.spoolss.printer.*.log_jobinfo\(.*\)$ # not implemented yet
^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$
^samba3.rpc.spoolss.printserver.*.get_core_printer_drivers\(.*\)$
^samba3.rpc.spoolss.printserver.*.get_printer_driver_package_path\(.*\)$
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index a44b732..23f2b2e 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -9137,6 +9137,63 @@ static bool test_print_job_enum(struct torture_context *tctx,
return true;
}
+static bool test_printer_log_jobinfo(struct torture_context *tctx,
+ void *private_data)
+{
+ struct torture_printer_context *t =
+ (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
+ struct dcerpc_pipe *p = t->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
+ struct spoolss_BranchOfficeJobDataContainer info;
+ int i;
+
+ struct spoolss_LogJobInfoForBranchOffice r;
+
+ torture_comment(tctx, "Testing LogJobInfoForBranchOffice\n");
+
+ info.cJobDataEntries = 0;
+ info.JobData = NULL;
+
+ r.in.hPrinter = &t->handle;
+ r.in.pBranchOfficeJobDataContainer = &info;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_LogJobInfoForBranchOffice_r(b, tctx, &r),
+ "LogJobInfoForBranchOffice failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAMETER,
+ "LogJobInfoForBranchOffice failed");
+
+ info.cJobDataEntries = 1;
+ info.JobData = talloc_zero_array(tctx, struct spoolss_BranchOfficeJobData, info.cJobDataEntries);
+
+ info.JobData[0].eEventType = kLogOfflineFileFull;
+ info.JobData[0].JobId = 42;
+ info.JobData[0].JobInfo.LogOfflineFileFull.pMachineName = talloc_strdup(tctx, "mthelena");
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_LogJobInfoForBranchOffice_r(b, tctx, &r),
+ "LogJobInfoForBranchOffice failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_OK,
+ "LogJobInfoForBranchOffice failed");
+
+ info.cJobDataEntries = 42;
+ info.JobData = talloc_zero_array(tctx, struct spoolss_BranchOfficeJobData, info.cJobDataEntries);
+
+ for (i=0; i < info.cJobDataEntries; i++) {
+ info.JobData[i].eEventType = kLogOfflineFileFull;
+ info.JobData[i].JobId = i;
+ info.JobData[i].JobInfo.LogOfflineFileFull.pMachineName = talloc_asprintf(tctx, "torture_%d", i);
+ }
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_LogJobInfoForBranchOffice_r(b, tctx, &r),
+ "LogJobInfoForBranchOffice failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_OK,
+ "LogJobInfoForBranchOffice failed");
+
+ return true;
+}
+
void torture_tcase_printer(struct torture_tcase *tcase)
{
torture_tcase_add_simple_test(tcase, "openprinter", test_openprinter_wrap);
@@ -9165,6 +9222,7 @@ void torture_tcase_printer(struct torture_tcase *tcase)
torture_tcase_add_simple_test(tcase, "publish_toggle",
test_printer_publish_toggle);
torture_tcase_add_simple_test(tcase, "print_job_enum", test_print_job_enum);
+ torture_tcase_add_simple_test(tcase, "log_jobinfo", test_printer_log_jobinfo);
}
struct torture_suite *torture_rpc_spoolss_printer(TALLOC_CTX *mem_ctx)
--
2.7.4
From 5b733f44c0e54a77b0642901b95769560fdd7b92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 25 Aug 2016 17:10:09 +0200
Subject: [PATCH 04/12] s3-spoolss: add missing newline in debug message of
_spoolss_OpenPrinterEx.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source3/rpc_server/spoolss/srv_spoolss_nt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 5a8328c..aa7e821 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -1819,9 +1819,8 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p,
close_printer_handle(p, r->out.handle);
ZERO_STRUCTP(r->out.handle);
DEBUG(3,("access DENIED as user is not root, "
- "has no printoperator privilege, "
- "not a member of the printoperator builtin group and "
- "is not in printer admin list"));
+ "has no printoperator privilege and is "
+ "not a member of the printoperator builtin group\n"));
return WERR_ACCESS_DENIED;
}
--
2.7.4
From 791273dbe9711cd437095499f53f1bbef36a0f4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Fri, 2 Sep 2016 12:44:34 +0200
Subject: [PATCH 05/12] s4-torture: use torture_comment in
torture_rpc_connection()
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source4/torture/rpc/rpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index e41f726..6553229 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -86,7 +86,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
cmdline_credentials, tctx->ev, tctx->lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
- printf("Failed to connect to remote server: %s %s\n",
+ torture_warning(tctx, "Failed to connect to remote server: %s %s\n",
dcerpc_binding_string(tctx, binding), nt_errstr(status));
}
--
2.7.4
From 3fc154c5d80871056d595c5a8da4d975f4794f6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 10 Jan 2013 13:53:56 +0100
Subject: [PATCH 06/12] s3-waf: give rpcclient its own wscript_build.
Guenther
---
source3/rpcclient/wscript_build | 54 +++++++++++++++++++++++++++++++++++++++++
source3/wscript_build | 53 +---------------------------------------
2 files changed, 55 insertions(+), 52 deletions(-)
create mode 100644 source3/rpcclient/wscript_build
diff --git a/source3/rpcclient/wscript_build b/source3/rpcclient/wscript_build
new file mode 100644
index 0000000..3e8791d
--- /dev/null
+++ b/source3/rpcclient/wscript_build
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+bld.SAMBA3_BINARY('rpcclient',
+ source='''rpcclient.c
+ cmd_lsarpc.c
+ cmd_samr.c
+ cmd_spoolss.c
+ cmd_netlogon.c
+ cmd_srvsvc.c
+ cmd_dfs.c
+ cmd_epmapper.c
+ cmd_dssetup.c
+ cmd_echo.c
+ cmd_shutdown.c
+ cmd_test.c
+ cmd_wkssvc.c
+ cmd_ntsvcs.c
+ cmd_drsuapi.c
+ cmd_eventlog.c
+ cmd_winreg.c
+ cmd_fss.c
+ cmd_clusapi.c
+ cmd_witness.c
+ ''',
+ deps='''
+ talloc
+ popt_samba3
+ pdb
+ libsmb
+ param
+ ndr-standard
+ msrpc3
+ SMBREADLINE
+ trusts_util
+ RPC_NDR_WINREG
+ RPC_NDR_ECHO
+ RPC_CLIENT_SCHANNEL
+ DCUTIL
+ LIBCLI_SAMR
+ libcli_lsa3
+ libcli_netlogon3
+ cli_spoolss
+ RPC_NDR_SRVSVC
+ RPC_NDR_WKSSVC
+ RPC_NDR_DSSETUP
+ RPC_NDR_DFS
+ RPC_NDR_DRSUAPI
+ RPC_NDR_NTSVCS
+ RPC_NDR_EVENTLOG
+ INIT_SAMR
+ RPC_NDR_FSRVP
+ RPC_NDR_CLUSAPI
+ RPC_NDR_WITNESS
+ ''')
diff --git a/source3/wscript_build b/source3/wscript_build
index e25b8d5..a59927a 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -998,58 +998,6 @@ bld.SAMBA3_BINARY('winbindd/winbindd',
enabled=bld.env.build_winbind,
install_path='${SBINDIR}')
-bld.SAMBA3_BINARY('rpcclient/rpcclient',
- source='''rpcclient/rpcclient.c
- rpcclient/cmd_lsarpc.c
- rpcclient/cmd_samr.c
- rpcclient/cmd_spoolss.c
- rpcclient/cmd_netlogon.c
- rpcclient/cmd_srvsvc.c
- rpcclient/cmd_dfs.c
- rpcclient/cmd_epmapper.c
- rpcclient/cmd_dssetup.c
- rpcclient/cmd_echo.c
- rpcclient/cmd_shutdown.c
- rpcclient/cmd_test.c
- rpcclient/cmd_wkssvc.c
- rpcclient/cmd_ntsvcs.c
- rpcclient/cmd_drsuapi.c
- rpcclient/cmd_eventlog.c
- rpcclient/cmd_winreg.c
- rpcclient/cmd_fss.c
- rpcclient/cmd_witness.c
- rpcclient/cmd_clusapi.c''',
- deps='''
- talloc
- popt_samba3
- pdb
- libsmb
- param
- ndr-standard
- msrpc3
- SMBREADLINE
- trusts_util
- RPC_NDR_WINREG
- RPC_NDR_ECHO
- RPC_CLIENT_SCHANNEL
- DCUTIL
- LIBCLI_SAMR
- libcli_lsa3
- libcli_netlogon3
- cli_spoolss
- RPC_NDR_SRVSVC
- RPC_NDR_WKSSVC
- RPC_NDR_DSSETUP
- RPC_NDR_DFS
- RPC_NDR_DRSUAPI
- RPC_NDR_NTSVCS
- RPC_NDR_EVENTLOG
- INIT_SAMR
- RPC_NDR_FSRVP
- RPC_NDR_WITNESS
- RPC_NDR_CLUSAPI
- ''')
-
bld.SAMBA3_BINARY('client/smbclient',
source='''client/client.c
client/clitar.c
@@ -1528,6 +1476,7 @@ bld.RECURSE('../examples/VFS')
bld.RECURSE('lib/netapi/tests')
bld.RECURSE('lib/netapi/examples')
bld.RECURSE('smbd/notifyd')
+bld.RECURSE('rpcclient')
bld.ENFORCE_GROUP_ORDERING()
bld.CHECK_PROJECT_RULES()
--
2.7.4
From f6be103fee8fb78548aa102c905ff9a62d71eedf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 8 Sep 2016 20:57:05 +0200
Subject: [PATCH 07/12] s3-rpcclient: add getdriverpackagepath command.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source3/rpcclient/cmd_spoolss.c | 69 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 3191e80..91f328e 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1600,6 +1600,74 @@ static WERROR cmd_spoolss_getdriverdir(struct rpc_pipe_client *cli,
/****************************************************************************
****************************************************************************/
+static WERROR cmd_spoolss_getdriverpackagepath(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
+{
+ HRESULT hresult;
+ NTSTATUS status;
+ const char *env = SPOOLSS_ARCHITECTURE_NT_X86;
+ uint32_t offered;
+ uint32_t needed;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
+ const char *package_id = "";
+ const char *cab = NULL;
+
+ if (argc > 4) {
+ printf("Usage: %s [environment] [package_id]\n", argv[0]);
+ return WERR_OK;
+ }
+
+ /* Get the arguments need to open the printer handle */
+
+ if (argc >= 2) {
+ env = argv[1];
+ }
+
+ if (argc == 3) {
+ package_id = argv[2];
+ }
+
+ offered = 1;
+ cab = talloc_array(mem_ctx, char, offered);
+ status = dcerpc_spoolss_GetPrinterDriverPackagePath(b, mem_ctx,
+ cli->srv_name_slash,
+ env,
+ NULL,
+ package_id,
+ cab,
+ offered,
+ &needed,
+ &hresult);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ if (W_ERROR_EQUAL(W_ERROR(WIN32_FROM_HRESULT(hresult)), WERR_INSUFFICIENT_BUFFER)) {
+ offered = needed;
+ cab = talloc_zero_array(mem_ctx, char, offered);
+
+ status = dcerpc_spoolss_GetPrinterDriverPackagePath(b, mem_ctx,
+ cli->srv_name_slash,
+ env,
+ NULL,
+ package_id,
+ cab,
+ offered,
+ &needed,
+ &hresult);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+ }
+
+ return W_ERROR(WIN32_FROM_HRESULT(hresult));
+}
+
+
+/****************************************************************************
+****************************************************************************/
+
static void set_drv_info_3_env(TALLOC_CTX *mem_ctx,
struct spoolss_AddDriverInfo3 *info,
const char *arch)
@@ -3866,6 +3934,7 @@ struct cmd_set spoolss_commands[] = {
{ "getdataex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinterdataex, &ndr_table_spoolss, NULL, "Get printer driver data with keyname", ""},
{ "getdriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriver, &ndr_table_spoolss, NULL, "Get print driver information", "" },
{ "getdriverdir", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriverdir, &ndr_table_spoolss, NULL, "Get print driver upload directory", "" },
+ { "getdriverpackagepath", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriverpackagepath, &ndr_table_spoolss, NULL, "Get print driver package download directory", "" },
{ "getprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinter, &ndr_table_spoolss, NULL, "Get printer info", "" },
{ "openprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_open_printer, &ndr_table_spoolss, NULL, "Open printer handle", "" },
{ "openprinter_ex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_open_printer_ex, &ndr_table_spoolss, NULL, "Open printer handle", "" },
--
2.7.4
From 34bb6b98245b9eea467b20314e3fae22dd15a8fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 8 Sep 2016 21:06:41 +0200
Subject: [PATCH 08/12] s3-spoolss: avoid referencing p->opnum in
_spoolss_AddPrinterDriverEx
When called by another protocol, this call would fail when called with an
unexpected opnum... This change is in preparation for supporting MS-PAR.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source3/rpc_server/spoolss/srv_spoolss_nt.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index aa7e821..90aac33 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -8438,18 +8438,6 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
WERROR err = WERR_OK;
const char *driver_name = NULL;
uint32_t version;
- const char *fn;
-
- switch (p->opnum) {
- case NDR_SPOOLSS_ADDPRINTERDRIVER:
- fn = "_spoolss_AddPrinterDriver";
- break;
- case NDR_SPOOLSS_ADDPRINTERDRIVEREX:
- fn = "_spoolss_AddPrinterDriverEx";
- break;
- default:
- return WERR_INVALID_PARAM;
- }
/*
* we only support the semantics of AddPrinterDriver()
@@ -8468,7 +8456,7 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
if (r->in.info_ctr->level != 3 &&
r->in.info_ctr->level != 6 &&
r->in.info_ctr->level != 8) {
- DEBUG(0,("%s: level %d not yet implemented\n", fn,
+ DEBUG(0,("%s: level %d not yet implemented\n", __func__,
r->in.info_ctr->level));
return WERR_UNKNOWN_LEVEL;
}
@@ -8503,7 +8491,7 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
if (!srv_spoolss_drv_upgrade_printer(driver_name, p->msg_ctx)) {
DEBUG(0,("%s: Failed to send message about upgrading driver [%s]!\n",
- fn, driver_name));
+ __func__, driver_name));
}
done:
--
2.7.4
From b02f8b4c4e2f0704df595378668765e851633f48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 8 Sep 2016 21:09:42 +0200
Subject: [PATCH 09/12] s4-torture: also test NULL servername in
spoolss_GetPrinterDriverPackagePath
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source4/torture/rpc/spoolss.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 23f2b2e..1fcf379 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -8063,6 +8063,25 @@ static bool test_get_printer_driver_package_path(struct torture_context *tctx,
torture_assert_hresult_ok(tctx, r.out.result,
"spoolss_GetPrinterDriverPackagePath failed");
+ r.in.servername = NULL;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_GetPrinterDriverPackagePath_r(b, tctx, &r),
+ "spoolss_GetPrinterDriverPackagePath failed");
+ torture_assert_werr_equal(tctx,
+ W_ERROR(WIN32_FROM_HRESULT(r.out.result)), WERR_INSUFFICIENT_BUFFER,
+ "spoolss_GetPrinterDriverPackagePath failed");
+
+ r.in.driver_package_cab_size = required;
+ r.in.driver_package_cab = talloc_zero_array(tctx, char, required);
+ r.out.driver_package_cab = talloc_zero_array(tctx, char, required);
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_GetPrinterDriverPackagePath_r(b, tctx, &r),
+ "spoolss_GetPrinterDriverPackagePath failed");
+ torture_assert_hresult_ok(tctx, r.out.result,
+ "spoolss_GetPrinterDriverPackagePath failed");
+
}
return true;
--
2.7.4
From d11cd4b6003a858e6af629d9fa363fd26d726d0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 8 Sep 2016 21:22:17 +0200
Subject: [PATCH 10/12] s3-rpc_client: make it more clear printer driver
version is a QWORD not a DWORD.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source3/rpc_client/cli_winreg_spoolss.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index ac4fe86..8014e41 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -563,7 +563,7 @@ static WERROR winreg_printer_write_ver(TALLOC_CTX *mem_ctx,
return result;
}
-static WERROR winreg_printer_ver_to_dword(const char *str, uint64_t *data)
+static WERROR winreg_printer_ver_to_qword(const char *str, uint64_t *data)
{
unsigned int v1, v2, v3, v4;
@@ -3659,7 +3659,7 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
"DriverVersion",
&tmp_str);
if (W_ERROR_IS_OK(result)) {
- result = winreg_printer_ver_to_dword(tmp_str,
+ result = winreg_printer_ver_to_qword(tmp_str,
&info8->driver_version);
}
CHECK_ERROR(result);
@@ -3727,7 +3727,7 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
"MinInboxDriverVerVersion",
&tmp_str);
if (W_ERROR_IS_OK(result)) {
- result = winreg_printer_ver_to_dword(tmp_str,
+ result = winreg_printer_ver_to_qword(tmp_str,
&info8->min_inbox_driver_ver_version);
}
CHECK_ERROR(result);
--
2.7.4
From def22b0c3c64fced182bdff95ca0b55cd5b1348e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 8 Sep 2016 21:28:22 +0200
Subject: [PATCH 11/12] libgpo: accept more boolean matches in
gp_inifile_getbool().
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
libgpo/gpo_ini.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libgpo/gpo_ini.c b/libgpo/gpo_ini.c
index a91bb92..c027612 100644
--- a/libgpo/gpo_ini.c
+++ b/libgpo/gpo_ini.c
@@ -197,12 +197,14 @@ NTSTATUS gp_inifile_getbool(struct gp_inifile_context *ctx, const char *key, boo
return result;
}
- if (strequal(value, "Yes")) {
+ if (strequal(value, "Yes") ||
+ strequal(value, "True")) {
if (ret) {
*ret = true;
}
return NT_STATUS_OK;
- } else if (strequal(value, "No")) {
+ } else if (strequal(value, "No") ||
+ strequal(value, "False")) {
if (ret) {
*ret = false;
}
--
2.7.4
From 2966f4a08f8dca4c5a00cc38af77e1b3bf563241 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Sat, 10 Sep 2016 11:07:54 +0200
Subject: [PATCH 12/12] s3-registry: create winprint print processor entry for
x64 as well.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source3/registry/reg_backend_db.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index bdfe7d2..45d74d5 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -126,6 +126,7 @@ static const char *builtin_registry_paths[] = {
KEY_PRINTING "\\Forms",
KEY_PRINTING "\\Printers",
KEY_PRINTING "\\Environments\\Windows NT x86\\Print Processors\\winprint",
+ KEY_PRINTING "\\Environments\\Windows x64\\Print Processors\\winprint",
KEY_SHARES,
KEY_EVENTLOG,
KEY_SMBCONF,
--
2.7.4
More information about the samba-technical
mailing list