[PATCH] Increase the OS version which spoolss announces
Günther Deschner
gd at samba.org
Fri Nov 18 14:31:25 UTC 2016
Hi,
On 17/11/16 00:30, Jeremy Allison wrote:
> On Wed, Nov 16, 2016 at 05:58:24PM +0100, Andreas Schneider wrote:
>> Hello,
>>
>> the attached patch increases the spoolss OS version to:
>>
>> Windows Server 2003R2 SP2 (5.2.3790)
>>
>>
>> Please review and push!
>
> LGTM - pushed !
Once this is really pushed, we also need the following three patches,
I'd say.
Please review and also push.
Thanks,
Guenther
--
Günther Deschner GPG-ID: 8EE11688
Red Hat gdeschner at redhat.com
Samba Team gd at samba.org
-------------- next part --------------
From 1f4382149de9adc3849b7e4b17736d873aea39a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 16 Nov 2016 19:17:55 +0100
Subject: [PATCH 1/3] s3-spoolss: also set new os_major,minor,build values in
printer info 0
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source3/rpc_server/spoolss/srv_spoolss_nt.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 8a32db8..7f9f59b 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -3870,6 +3870,7 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx,
struct timeval setuptime;
print_status_struct status;
WERROR result;
+ int os_major, os_minor, os_build;
result = create_printername(mem_ctx, servername, info2->printername, &r->printername);
if (!W_ERROR_IS_OK(result)) {
@@ -3916,9 +3917,20 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx,
*/
r->global_counter = session_counter->counter;
r->total_pages = 0;
+
/* in 2.2 we reported ourselves as 0x0004 and 0x0565 */
- SSVAL(&r->version, 0, 0x0005); /* NT 5 */
- SSVAL(&r->version, 2, 0x0893); /* build 2195 */
+
+ os_major = lp_parm_int(GLOBAL_SECTION_SNUM,
+ "spoolss", "os_major", 5);
+ os_minor = lp_parm_int(GLOBAL_SECTION_SNUM,
+ "spoolss", "os_minor", 2);
+ os_build = lp_parm_int(GLOBAL_SECTION_SNUM,
+ "spoolss", "os_build", 3790);
+
+ SCVAL(&r->version, 0, os_major);
+ SCVAL(&r->version, 1, os_minor);
+ SSVAL(&r->version, 2, os_build);
+
r->free_build = SPOOLSS_RELEASE_BUILD;
r->spooling = 0;
r->max_spooling = 0;
--
2.7.4
From 6160de0f96413f62a3f3f8e4c29ab0b2398b8cda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 16 Nov 2016 19:24:37 +0100
Subject: [PATCH 2/3] s3-spoolss: set the defaults for os_version defines
globally.
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source3/rpc_server/spoolss/srv_spoolss_nt.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 7f9f59b..1dcb227 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -76,6 +76,10 @@
#define MAX_OPEN_PRINTER_EXS 50
#endif
+#define GLOBAL_SPOOLSS_OS_MAJOR_DEFAULT 5
+#define GLOBAL_SPOOLSS_OS_MINOR_DEFAULT 2
+#define GLOBAL_SPOOLSS_OS_BUILD_DEFAULT 3790
+
struct notify_back_channel;
/* structure to store the printer handles */
@@ -2352,11 +2356,14 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
* used to be Windows 2000 (5.0.2195)
*/
os.major = lp_parm_int(GLOBAL_SECTION_SNUM,
- "spoolss", "os_major", 5);
+ "spoolss", "os_major",
+ GLOBAL_SPOOLSS_OS_MAJOR_DEFAULT);
os.minor = lp_parm_int(GLOBAL_SECTION_SNUM,
- "spoolss", "os_minor", 2);
+ "spoolss", "os_minor",
+ GLOBAL_SPOOLSS_OS_MINOR_DEFAULT);
os.build = lp_parm_int(GLOBAL_SECTION_SNUM,
- "spoolss", "os_build", 3790);
+ "spoolss", "os_build",
+ GLOBAL_SPOOLSS_OS_BUILD_DEFAULT);
os.extra_string = ""; /* leave extra string empty */
ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &os,
@@ -3919,13 +3926,15 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx,
r->total_pages = 0;
/* in 2.2 we reported ourselves as 0x0004 and 0x0565 */
-
os_major = lp_parm_int(GLOBAL_SECTION_SNUM,
- "spoolss", "os_major", 5);
+ "spoolss", "os_major",
+ GLOBAL_SPOOLSS_OS_MAJOR_DEFAULT);
os_minor = lp_parm_int(GLOBAL_SECTION_SNUM,
- "spoolss", "os_minor", 2);
+ "spoolss", "os_minor",
+ GLOBAL_SPOOLSS_OS_MINOR_DEFAULT);
os_build = lp_parm_int(GLOBAL_SECTION_SNUM,
- "spoolss", "os_build", 3790);
+ "spoolss", "os_build",
+ GLOBAL_SPOOLSS_OS_BUILD_DEFAULT);
SCVAL(&r->version, 0, os_major);
SCVAL(&r->version, 1, os_minor);
--
2.7.4
From 4227be41d4d100bb441fd32b66976fb2fd9e854d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Fri, 18 Nov 2016 11:59:05 +0100
Subject: [PATCH 3/3] s4-torture: add test to compare PRINTER_INFO_STRESS
version and OSVersion
Guenther
Signed-off-by: Guenther Deschner <gd at samba.org>
---
source4/torture/rpc/spoolss.c | 53 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 5045c87..178feb7 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -9427,6 +9427,58 @@ static bool test_printer_log_jobinfo(struct torture_context *tctx,
return true;
}
+static bool test_printer_os_versions(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;
+ union spoolss_PrinterInfo info;
+ DATA_BLOB blob;
+ uint8_t *data;
+ uint32_t length;
+ struct spoolss_OSVersion osversion;
+ uint8_t os_major, os_minor;
+ uint16_t os_build;
+ struct policy_handle server_handle;
+
+ torture_comment(tctx, "Testing OSVersion vs. PRINTER_INFO_STRESS\n");
+
+ torture_assert(tctx,
+ test_GetPrinter_level(tctx, b, &t->handle, 0, &info),
+ "failed to get level 0 printer info");
+
+ torture_assert(tctx,
+ test_OpenPrinter_server(tctx, p, &server_handle),
+ "failed to open printserver");
+
+ torture_assert(tctx,
+ test_GetPrinterData_checktype(tctx, b, &server_handle, "OSVersion",
+ NULL, NULL, &data, &length),
+ "failed to fetch OSVersion printer data");
+
+ test_ClosePrinter(tctx, b, &server_handle);
+
+ blob = data_blob_const(data, length);
+
+ torture_assert_ndr_success(tctx,
+ ndr_pull_struct_blob(&blob, tctx, &osversion,
+ (ndr_pull_flags_fn_t)ndr_pull_spoolss_OSVersion),
+ "failed to pull OSVersion");
+
+ os_major = CVAL(&info.info0.version, 0);
+ os_minor = CVAL(&info.info0.version, 1);
+ os_build = SVAL(&info.info0.version, 2);
+
+ torture_assert_int_equal(tctx, os_major, osversion.major, "major");
+ torture_assert_int_equal(tctx, os_minor, osversion.minor, "minor");
+ torture_assert_int_equal(tctx, os_build, osversion.build, "build");
+
+ return true;
+}
+
+
void torture_tcase_printer(struct torture_tcase *tcase)
{
torture_tcase_add_simple_test(tcase, "openprinter", test_openprinter_wrap);
@@ -9456,6 +9508,7 @@ void torture_tcase_printer(struct torture_tcase *tcase)
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);
+ torture_tcase_add_simple_test(tcase, "os_versions", test_printer_os_versions);
}
struct torture_suite *torture_rpc_spoolss_printer(TALLOC_CTX *mem_ctx)
--
2.7.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 201 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20161118/ad0e766a/signature.sig>
More information about the samba-technical
mailing list