summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/spoolss.idl22
-rw-r--r--source4/ntptr/simple_ldb/ntptr_simple_ldb.c47
-rw-r--r--source4/torture/rpc/spoolss.c3
3 files changed, 72 insertions, 0 deletions
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index 0dec162763..f0f18088c6 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -724,15 +724,37 @@
/* Function: 0x1a */
const string SPOOLSS_ARCHITECTURE_NT_X86 = "Windows NT x86";
+ typedef [public,gensize] struct {
+ [value(ndr_size_spoolss_OSVersion(r,ndr->flags))] uint32 _ndr_size;
+ uint32 major;
+ uint32 minor;
+ uint32 build;
+ [value(2)] uint32 unknown;
+ [subcontext(0),subcontext_size(256)] nstring extra_string;
+ } spoolss_OSVersion;
+
+ typedef [public,gensize] struct {
+ [value(ndr_size_spoolss_OSVersionEx(r,ndr->flags))] uint32 _ndr_size;
+ uint32 major;
+ uint32 minor;
+ uint32 build;
+ [value(2)] uint32 unknown1;
+ [subcontext(0),subcontext_size(256)] nstring extra_string;
+ uint32 unknown2;/* service pack number? I saw 0 from w2k3 and 1 from winxp sp1*/
+ uint32 unknown3;/* hmm? w2k3: 131346(0x20112) winxp sp1: 503382272 0x1E010100 */
+ } spoolss_OSVersionEx;
+
typedef [v1_enum] enum {
SPOOLSS_PRINTER_DATA_TYPE_NULL = 0,
SPOOLSS_PRINTER_DATA_TYPE_STRING = 1,
+ SPOOLSS_PRINTER_DATA_TYPE_BINARY = 3,
SPOOLSS_PRINTER_DATA_TYPE_UINT32 = 4
} spoolss_PrinterDataType;
typedef [nodiscriminant,gensize] union {
[case(SPOOLSS_PRINTER_DATA_TYPE_NULL)];
[case(SPOOLSS_PRINTER_DATA_TYPE_STRING)] nstring string;
+ [case(SPOOLSS_PRINTER_DATA_TYPE_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
[case(SPOOLSS_PRINTER_DATA_TYPE_UINT32)] uint32 value;
[default,flag(NDR_REMAINING)] DATA_BLOB data;
} spoolss_PrinterData;
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index c83cac4440..27c13346b0 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -160,6 +160,53 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC
r->out.type = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
r->out.data.value = 1;
return WERR_OK;
+ } else if (strcmp("OSVersion", r->in.value_name) == 0) {
+ DATA_BLOB blob;
+ NTSTATUS status;
+ struct spoolss_OSVersion os;
+
+ os.major = dcesrv_common_get_version_major(mem_ctx, NULL);
+ os.minor = dcesrv_common_get_version_minor(mem_ctx, NULL);
+ os.build = dcesrv_common_get_version_build(mem_ctx, NULL);
+ os.extra_string = "";
+
+ status = ndr_push_struct_blob(&blob, mem_ctx, &os, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion);
+ if (!NT_STATUS_IS_OK(status)) {
+ return WERR_GENERAL_FAILURE;
+ }
+
+ r->out.type = SPOOLSS_PRINTER_DATA_TYPE_BINARY;
+ r->out.data.binary = blob;
+ return WERR_OK;
+ } else if (strcmp("OSVersionEx", r->in.value_name) == 0) {
+ DATA_BLOB blob;
+ NTSTATUS status;
+ struct spoolss_OSVersionEx os_ex;
+
+ os_ex.major = dcesrv_common_get_version_major(mem_ctx, NULL);
+ os_ex.minor = dcesrv_common_get_version_minor(mem_ctx, NULL);
+ os_ex.build = dcesrv_common_get_version_build(mem_ctx, NULL);
+ os_ex.extra_string = "";
+ os_ex.unknown2 = 0;
+ os_ex.unknown3 = 0;
+
+ status = ndr_push_struct_blob(&blob, mem_ctx, &os_ex, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersionEx);
+ if (!NT_STATUS_IS_OK(status)) {
+ return WERR_GENERAL_FAILURE;
+ }
+
+ r->out.type = SPOOLSS_PRINTER_DATA_TYPE_BINARY;
+ r->out.data.binary = blob;
+ return WERR_OK;
+ } else if (strcmp("DNSMachineName", r->in.value_name) == 0) {
+ if (!lp_realm()) return WERR_INVALID_PARAM;
+
+ r->out.type = SPOOLSS_PRINTER_DATA_TYPE_STRING;
+ r->out.data.string = talloc_asprintf(mem_ctx, "%s.%s",
+ lp_netbios_name(),
+ lp_realm());
+ W_ERROR_HAVE_NO_MEMORY(r->out.data.string);
+ return WERR_OK;
}
return WERR_INVALID_PARAM;
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 07a8addada..33e84a5276 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -2085,6 +2085,9 @@ BOOL torture_rpc_spoolss(void)
ret &= test_GetPrinterData(ctx->p, ctx, &ctx->server_handle, "DefaultSpoolDirectory");
ret &= test_GetPrinterData(ctx->p, ctx, &ctx->server_handle, "Architecture");
ret &= test_GetPrinterData(ctx->p, ctx, &ctx->server_handle, "DsPresent");
+ ret &= test_GetPrinterData(ctx->p, ctx, &ctx->server_handle, "OSVersion");
+ ret &= test_GetPrinterData(ctx->p, ctx, &ctx->server_handle, "OSVersionEx");
+ ret &= test_GetPrinterData(ctx->p, ctx, &ctx->server_handle, "DNSMachineName");
ret &= test_EnumForms(ctx->p, ctx, &ctx->server_handle, True);