[SCM] Samba Shared Repository - branch v3-4-test updated - release-4-0-0alpha7-717-gcd4c88d

Günther Deschner gd at samba.org
Thu Apr 9 23:16:46 GMT 2009


The branch, v3-4-test has been updated
       via  cd4c88dbe6a292d9244165748b9121eae30d93d0 (commit)
       via  0d64245da273bb4452e29bdd01e059ea91625559 (commit)
       via  b2d3a08c8f9f091fb3f9576d892ec2c80bb64a62 (commit)
       via  0f2314f2fc8d78736c009bf6ecab3247e1720672 (commit)
       via  21eee66cd83db85701aafa4db898f85e1d941ec8 (commit)
       via  59638bc290681e4d8bc11faa4cc36b70242b314f (commit)
       via  4c1a5133ab73552fe1be80a50da1c44875e93340 (commit)
      from  fa1ca9ab110d43e1c56c8d28d8143c79891ff8a0 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test


- Log -----------------------------------------------------------------
commit cd4c88dbe6a292d9244165748b9121eae30d93d0
Author: Günther Deschner <gd at samba.org>
Date:   Fri Apr 10 00:44:36 2009 +0200

    s3-selftest: enable the RPC-NTSVCS torture test against Samba3.
    
    Guenther
    (cherry picked from commit f930f504e1d5e78d2f6f36cab9ce36dbeb34e955)

commit 0d64245da273bb4452e29bdd01e059ea91625559
Author: Günther Deschner <gd at samba.org>
Date:   Fri Apr 10 00:43:55 2009 +0200

    s3-ntsvcs: fix _PNP_GetDeviceList and _PNP_GetDeviceListSize.
    
    Guenther
    (cherry picked from commit b7caf138518028507809bd6d356ec53b1564f0a1)

commit b2d3a08c8f9f091fb3f9576d892ec2c80bb64a62
Author: Günther Deschner <gd at samba.org>
Date:   Fri Apr 10 00:42:35 2009 +0200

    s4-smbtorture: perform the ntsvcs devicelist tests against the Spooler service.
    
    Guenther
    (cherry picked from commit c0b71db8e155c1d5e09b5be23ea681fd90955ac7)

commit 0f2314f2fc8d78736c009bf6ecab3247e1720672
Author: Günther Deschner <gd at samba.org>
Date:   Fri Apr 10 00:00:44 2009 +0200

    s3-rpcclient: allow to set flags in cmd_ntsvcs_get_dev_list().
    
    Guenther
    (cherry picked from commit ade9ef19835b6464eeddd351a165eb4b9bf2366c)

commit 21eee66cd83db85701aafa4db898f85e1d941ec8
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 9 23:44:24 2009 +0200

    error-codes: add WERR_CM_INVALID_POINTER.
    
    Guenther
    (cherry picked from commit 43eb50655e71e5f407ffbd7069cc2d45a3b478b6)

commit 59638bc290681e4d8bc11faa4cc36b70242b314f
Author: Günther Deschner <gd at samba.org>
Date:   Fri Apr 10 00:01:41 2009 +0200

    s3: re-run make samba3-idl.
    
    Guenther
    (cherry picked from commit e4b4a07357920756f5bf0ca991ec8f4b38dc7968)

commit 4c1a5133ab73552fe1be80a50da1c44875e93340
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 9 17:53:36 2009 +0200

    ntsvcs: add PNP_GetIdListFlags flags.
    
    Guenther
    (cherry picked from commit 7065b2b2ad604a3faf8df0e123e04ed7f532afda)

-----------------------------------------------------------------------

Summary of changes:
 libcli/util/werror.h                  |    1 +
 librpc/gen_ndr/ndr_ntsvcs.c           |   43 +++++++++++++++++++++---
 librpc/gen_ndr/ndr_ntsvcs.h           |    1 +
 librpc/gen_ndr/ntsvcs.h               |   13 +++++++
 librpc/idl/ntsvcs.idl                 |   19 ++++++++++-
 source3/rpc_server/srv_ntsvcs_nt.c    |   41 ++++++++++++++----------
 source3/rpcclient/cmd_ntsvcs.c        |   12 +++++--
 source3/script/tests/test_posix_s3.sh |    2 +-
 source4/torture/rpc/ntsvcs.c          |   56 ++++++++++++++++++++++----------
 9 files changed, 140 insertions(+), 48 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/werror.h b/libcli/util/werror.h
index ede4996..2e6b696 100644
--- a/libcli/util/werror.h
+++ b/libcli/util/werror.h
@@ -198,6 +198,7 @@ typedef uint32_t WERROR;
 /* Configuration Manager Errors */
 /* Basically Win32 errors meanings are specific to the \ntsvcs pipe */
 
+#define WERR_CM_INVALID_POINTER W_ERROR(3)
 #define WERR_CM_BUFFER_SMALL W_ERROR(26)
 #define WERR_CM_NO_MORE_HW_PROFILES W_ERROR(35)
 #define WERR_CM_NO_SUCH_VALUE W_ERROR(37)
diff --git a/librpc/gen_ndr/ndr_ntsvcs.c b/librpc/gen_ndr/ndr_ntsvcs.c
index ef2ecc1..d317c9f 100644
--- a/librpc/gen_ndr/ndr_ntsvcs.c
+++ b/librpc/gen_ndr/ndr_ntsvcs.c
@@ -4,6 +4,37 @@
 #include "../librpc/gen_ndr/ndr_ntsvcs.h"
 
 #include "librpc/gen_ndr/ndr_winreg.h"
+static enum ndr_err_code ndr_push_PNP_GetIdListFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+	NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+	return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_PNP_GetIdListFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+	uint32_t v;
+	NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+	*r = v;
+	return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_PNP_GetIdListFlags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+	ndr_print_uint32(ndr, name, r);
+	ndr->depth++;
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_ENUMERATOR", CM_GETIDLIST_FILTER_ENUMERATOR, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_SERVICE", CM_GETIDLIST_FILTER_SERVICE, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_EJECTRELATIONS", CM_GETIDLIST_FILTER_EJECTRELATIONS, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_REMOVALRELATIONS", CM_GETIDLIST_FILTER_REMOVALRELATIONS, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_POWERRELATIONS", CM_GETIDLIST_FILTER_POWERRELATIONS, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_BUSRELATIONS", CM_GETIDLIST_FILTER_BUSRELATIONS, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_DONOTGENERATE", CM_GETIDLIST_DONOTGENERATE, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_TRANSPORTRELATIONS", CM_GETIDLIST_FILTER_TRANSPORTRELATIONS, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_PRESENT", CM_GETIDLIST_FILTER_PRESENT, r);
+	ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "CM_GETIDLIST_FILTER_CLASS", CM_GETIDLIST_FILTER_CLASS, r);
+	ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_PNP_HwProfInfo(struct ndr_push *ndr, int ndr_flags, const struct PNP_HwProfInfo *r)
 {
 	uint32_t cntr_friendly_name_0;
@@ -522,7 +553,7 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceList(struct ndr_push *ndr, int fl
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
 		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length));
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
+		NDR_CHECK(ndr_push_PNP_GetIdListFlags(ndr, NDR_SCALARS, r->in.flags));
 	}
 	if (flags & NDR_OUT) {
 		if (r->out.buffer == NULL) {
@@ -578,7 +609,7 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceList(struct ndr_pull *ndr, int fl
 		NDR_PULL_SET_MEM_CTX(ndr, r->in.length, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.length));
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+		NDR_CHECK(ndr_pull_PNP_GetIdListFlags(ndr, NDR_SCALARS, &r->in.flags));
 		NDR_PULL_ALLOC_N(ndr, r->out.buffer, *r->in.length);
 		memset(r->out.buffer, 0, (*r->in.length) * sizeof(*r->out.buffer));
 		NDR_PULL_ALLOC(ndr, r->out.length);
@@ -638,7 +669,7 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *nam
 		ndr->depth++;
 		ndr_print_uint32(ndr, "length", *r->in.length);
 		ndr->depth--;
-		ndr_print_uint32(ndr, "flags", r->in.flags);
+		ndr_print_PNP_GetIdListFlags(ndr, "flags", r->in.flags);
 		ndr->depth--;
 	}
 	if (flags & NDR_OUT) {
@@ -677,7 +708,7 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceListSize(struct ndr_push *ndr, in
 			NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.devicename, CH_UTF16)));
 			NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.devicename, ndr_charset_length(r->in.devicename, CH_UTF16), sizeof(uint16_t), CH_UTF16));
 		}
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
+		NDR_CHECK(ndr_push_PNP_GetIdListFlags(ndr, NDR_SCALARS, r->in.flags));
 	}
 	if (flags & NDR_OUT) {
 		if (r->out.size == NULL) {
@@ -715,7 +746,7 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceListSize(struct ndr_pull *ndr, in
 			NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.devicename, ndr_get_array_length(ndr, &r->in.devicename), sizeof(uint16_t), CH_UTF16));
 			NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devicename_0, 0);
 		}
-		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+		NDR_CHECK(ndr_pull_PNP_GetIdListFlags(ndr, NDR_SCALARS, &r->in.flags));
 		NDR_PULL_ALLOC(ndr, r->out.size);
 		ZERO_STRUCTP(r->out.size);
 	}
@@ -748,7 +779,7 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceListSize(struct ndr_print *ndr, const char
 			ndr_print_string(ndr, "devicename", r->in.devicename);
 		}
 		ndr->depth--;
-		ndr_print_uint32(ndr, "flags", r->in.flags);
+		ndr_print_PNP_GetIdListFlags(ndr, "flags", r->in.flags);
 		ndr->depth--;
 	}
 	if (flags & NDR_OUT) {
diff --git a/librpc/gen_ndr/ndr_ntsvcs.h b/librpc/gen_ndr/ndr_ntsvcs.h
index b70c383..a5ad373 100644
--- a/librpc/gen_ndr/ndr_ntsvcs.h
+++ b/librpc/gen_ndr/ndr_ntsvcs.h
@@ -142,6 +142,7 @@ extern const struct ndr_interface_table ndr_table_ntsvcs;
 #define NDR_PNP_GETSERVERSIDEDEVICEINSTALLFLAGS (0x40)
 
 #define NDR_NTSVCS_CALL_COUNT (65)
+void ndr_print_PNP_GetIdListFlags(struct ndr_print *ndr, const char *name, uint32_t r);
 void ndr_print_PNP_HwProfInfo(struct ndr_print *ndr, const char *name, const struct PNP_HwProfInfo *r);
 void ndr_print_PNP_Disconnect(struct ndr_print *ndr, const char *name, int flags, const struct PNP_Disconnect *r);
 void ndr_print_PNP_Connect(struct ndr_print *ndr, const char *name, int flags, const struct PNP_Connect *r);
diff --git a/librpc/gen_ndr/ntsvcs.h b/librpc/gen_ndr/ntsvcs.h
index 804c452..f59fcae 100644
--- a/librpc/gen_ndr/ntsvcs.h
+++ b/librpc/gen_ndr/ntsvcs.h
@@ -8,7 +8,20 @@
 #ifndef _HEADER_ntsvcs
 #define _HEADER_ntsvcs
 
+#define CM_GETIDLIST_FILTER_NONE	( 0x00000000 )
 #define DEV_REGPROP_DESC	( 1 )
+/* bitmap PNP_GetIdListFlags */
+#define CM_GETIDLIST_FILTER_ENUMERATOR ( 0x00000001 )
+#define CM_GETIDLIST_FILTER_SERVICE ( 0x00000002 )
+#define CM_GETIDLIST_FILTER_EJECTRELATIONS ( 0x00000004 )
+#define CM_GETIDLIST_FILTER_REMOVALRELATIONS ( 0x00000008 )
+#define CM_GETIDLIST_FILTER_POWERRELATIONS ( 0x00000010 )
+#define CM_GETIDLIST_FILTER_BUSRELATIONS ( 0x00000020 )
+#define CM_GETIDLIST_DONOTGENERATE ( 0x10000040 )
+#define CM_GETIDLIST_FILTER_TRANSPORTRELATIONS ( 0x00000080 )
+#define CM_GETIDLIST_FILTER_PRESENT ( 0x00000100 )
+#define CM_GETIDLIST_FILTER_CLASS ( 0x00000200 )
+
 struct PNP_HwProfInfo {
 	uint32_t profile_handle;
 	uint16_t friendly_name[80];
diff --git a/librpc/idl/ntsvcs.idl b/librpc/idl/ntsvcs.idl
index be7fcdf..b1a3b78 100644
--- a/librpc/idl/ntsvcs.idl
+++ b/librpc/idl/ntsvcs.idl
@@ -70,11 +70,26 @@ interface ntsvcs
 	/******************/
 	/* Function: 0x0a */
 
+	const int CM_GETIDLIST_FILTER_NONE	= 0x00000000;
+
+	typedef [bitmap32bit] bitmap {
+		CM_GETIDLIST_FILTER_ENUMERATOR		= 0x00000001,
+		CM_GETIDLIST_FILTER_SERVICE		= 0x00000002,
+		CM_GETIDLIST_FILTER_EJECTRELATIONS	= 0x00000004,
+		CM_GETIDLIST_FILTER_REMOVALRELATIONS	= 0x00000008,
+		CM_GETIDLIST_FILTER_POWERRELATIONS	= 0x00000010,
+		CM_GETIDLIST_FILTER_BUSRELATIONS	= 0x00000020,
+		CM_GETIDLIST_DONOTGENERATE		= 0x10000040,
+		CM_GETIDLIST_FILTER_TRANSPORTRELATIONS	= 0x00000080,
+		CM_GETIDLIST_FILTER_PRESENT		= 0x00000100,
+		CM_GETIDLIST_FILTER_CLASS		= 0x00000200
+	} PNP_GetIdListFlags;
+
 	WERROR PNP_GetDeviceList(
 		[in,unique] [string,charset(UTF16)] uint16 *filter,
 		[out,ref] [size_is(*length),length_is(*length)] uint16 *buffer,
 		[in,out,ref] uint32 *length,
-		[in] uint32 flags
+		[in] PNP_GetIdListFlags flags
 		);
 
 	/******************/
@@ -83,7 +98,7 @@ interface ntsvcs
 	WERROR PNP_GetDeviceListSize(
 		[in,unique] [string,charset(UTF16)] uint16 *devicename,
 		[out,ref] uint32 *size,
-		[in] uint32 flags
+		[in] PNP_GetIdListFlags flags
 		);
 
 	/******************/
diff --git a/source3/rpc_server/srv_ntsvcs_nt.c b/source3/rpc_server/srv_ntsvcs_nt.c
index 681c543..7b8dc93 100644
--- a/source3/rpc_server/srv_ntsvcs_nt.c
+++ b/source3/rpc_server/srv_ntsvcs_nt.c
@@ -3,6 +3,7 @@
  *  RPC Pipe client / server routines
  *
  *  Copyright (C) Gerald (Jerry) Carter             2005.
+ *  Copyright (C) Guenther Deschner                 2008,2009.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -50,8 +51,9 @@ WERROR _PNP_GetDeviceListSize(pipes_struct *p,
 {
 	char *devicepath;
 
-	if (!r->in.devicename) {
-		return WERR_ACCESS_DENIED;
+	if ((r->in.flags & CM_GETIDLIST_FILTER_SERVICE) &&
+	    (!r->in.devicename)) {
+		return WERR_CM_INVALID_POINTER;
 	}
 
 	if (!(devicepath = get_device_path(p->mem_ctx, r->in.devicename))) {
@@ -74,13 +76,14 @@ WERROR _PNP_GetDeviceList(pipes_struct *p,
 {
 	char *devicepath;
 	uint32_t size = 0;
+	char **multi_sz = NULL;
+	size_t multi_sz_len;
+	uint16_t *multi_sz_buf;
 
-	DATA_BLOB blob;
-	struct lsa_StringLarge s;
-	enum ndr_err_code ndr_err;
-
-	if ( !r->in.filter )
-		return WERR_ACCESS_DENIED;
+	if ((r->in.flags & CM_GETIDLIST_FILTER_SERVICE) &&
+	    (!r->in.filter)) {
+		return WERR_CM_INVALID_POINTER;
+	}
 
 	if (!(devicepath = get_device_path(p->mem_ctx, r->in.filter))) {
 		return WERR_NOMEM;
@@ -92,20 +95,24 @@ WERROR _PNP_GetDeviceList(pipes_struct *p,
 		return WERR_CM_BUFFER_SMALL;
 	}
 
-	s.string = r->in.filter;
-
-	/* This has to be DOUBLE NULL terminated */
-	ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL, &s,
-			(ndr_push_flags_fn_t)ndr_push_lsa_StringLarge);
-	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-		return ntstatus_to_werror(ndr_map_error2ntstatus(ndr_err));
+	multi_sz = talloc_zero_array(p->mem_ctx, char *, 2);
+	if (!multi_sz) {
+		return WERR_NOMEM;
 	}
 
-	r->out.buffer = (uint16_t *)talloc_memdup(p->mem_ctx, blob.data, blob.length);
-	if (!r->out.buffer) {
+	multi_sz[0] = devicepath;
+
+	multi_sz_len = regval_build_multi_sz(multi_sz, &multi_sz_buf);
+	if (!multi_sz_len) {
 		return WERR_NOMEM;
 	}
 
+	if (*r->in.length < multi_sz_len/2) {
+		return WERR_CM_BUFFER_SMALL;
+	}
+
+	memcpy(r->out.buffer, multi_sz_buf, multi_sz_len);
+
 	return WERR_OK;
 }
 
diff --git a/source3/rpcclient/cmd_ntsvcs.c b/source3/rpcclient/cmd_ntsvcs.c
index eb620d0..a345cdc 100644
--- a/source3/rpcclient/cmd_ntsvcs.c
+++ b/source3/rpcclient/cmd_ntsvcs.c
@@ -235,17 +235,21 @@ static WERROR cmd_ntsvcs_get_dev_list(struct rpc_pipe_client *cli,
 	uint32_t length = 0;
 	uint32_t flags = 0;
 
-	if (argc > 3) {
-		printf("usage: %s [length] [filter]\n", argv[0]);
+	if (argc > 4) {
+		printf("usage: %s [filter] [length] [flags]\n", argv[0]);
 		return WERR_OK;
 	}
 
 	if (argc >= 2) {
-		length = atoi(argv[1]);
+		filter = argv[1];
 	}
 
 	if (argc >= 3) {
-		filter = argv[2];
+		length = atoi(argv[2]);
+	}
+
+	if (argc >= 4) {
+		flags = atoi(argv[3]);
 	}
 
 	buffer = talloc(mem_ctx, uint16_t);
diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index 18e8ef7..b3a66e1 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -40,7 +40,7 @@ raw="$raw RAW-SAMBA3ROOTDIRFID"
 rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC"
 rpc="$rpc RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC"
 rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME"
-rpc="$rpc RPC-SVCCTL RPC-SPOOLSS-WIN"
+rpc="$rpc RPC-SVCCTL RPC-SPOOLSS-WIN RPC-NTSVCS"
 
 # NOTE: to enable the UNIX-WHOAMI test, we need to change the default share
 # config to allow guest access. I'm not sure whether this would break other
diff --git a/source4/torture/rpc/ntsvcs.c b/source4/torture/rpc/ntsvcs.c
index 5453102..04494b3 100644
--- a/source4/torture/rpc/ntsvcs.c
+++ b/source4/torture/rpc/ntsvcs.c
@@ -47,18 +47,26 @@ static bool test_PNP_GetVersion(struct torture_context *tctx,
 static bool test_PNP_GetDeviceListSize(struct torture_context *tctx,
 				       struct dcerpc_pipe *p)
 {
-	NTSTATUS status;
 	struct PNP_GetDeviceListSize r;
 	uint32_t size = 0;
 
 	r.in.devicename = NULL;
-	r.in.flags = 0;
+	r.in.flags = CM_GETIDLIST_FILTER_SERVICE;
 	r.out.size = &size;
 
-	status = dcerpc_PNP_GetDeviceListSize(p, tctx, &r);
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_PNP_GetDeviceListSize(p, tctx, &r),
+		"PNP_GetDeviceListSize");
+	torture_assert_werr_equal(tctx, r.out.result, WERR_CM_INVALID_POINTER,
+		"PNP_GetDeviceListSize");
+
+	r.in.devicename = "Spooler";
 
-	torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceListSize");
-	torture_assert_werr_ok(tctx, r.out.result, "PNP_GetDeviceListSize");
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_PNP_GetDeviceListSize(p, tctx, &r),
+		"PNP_GetDeviceListSize");
+	torture_assert_werr_ok(tctx, r.out.result,
+		"PNP_GetDeviceListSize");
 
 	return true;
 }
@@ -66,7 +74,6 @@ static bool test_PNP_GetDeviceListSize(struct torture_context *tctx,
 static bool test_PNP_GetDeviceList(struct torture_context *tctx,
 				   struct dcerpc_pipe *p)
 {
-	NTSTATUS status;
 	struct PNP_GetDeviceList r;
 	uint16_t *buffer = NULL;
 	uint32_t length = 0;
@@ -74,25 +81,35 @@ static bool test_PNP_GetDeviceList(struct torture_context *tctx,
 	buffer = talloc_array(tctx, uint16_t, 0);
 
 	r.in.filter = NULL;
-	r.in.flags = 0;
+	r.in.flags = CM_GETIDLIST_FILTER_SERVICE;
 	r.in.length = &length;
 	r.out.length = &length;
 	r.out.buffer = buffer;
 
-	status = dcerpc_PNP_GetDeviceList(p, tctx, &r);
-	torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceList");
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_PNP_GetDeviceList(p, tctx, &r),
+		"PNP_GetDeviceList failed");
+	torture_assert_werr_equal(tctx, r.out.result, WERR_CM_INVALID_POINTER,
+		"PNP_GetDeviceList failed");
+
+	r.in.filter = "Spooler";
+
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_PNP_GetDeviceList(p, tctx, &r),
+		"PNP_GetDeviceList failed");
 
 	if (W_ERROR_EQUAL(r.out.result, WERR_CM_BUFFER_SMALL)) {
 		struct PNP_GetDeviceListSize s;
 
-		s.in.devicename = NULL;
-		s.in.flags = 0;
+		s.in.devicename = "Spooler";
+		s.in.flags = CM_GETIDLIST_FILTER_SERVICE;
 		s.out.size = &length;
 
-		status = dcerpc_PNP_GetDeviceListSize(p, tctx, &s);
-
-		torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceListSize");
-		torture_assert_werr_ok(tctx, s.out.result, "PNP_GetDeviceListSize");
+		torture_assert_ntstatus_ok(tctx,
+			dcerpc_PNP_GetDeviceListSize(p, tctx, &s),
+			"PNP_GetDeviceListSize failed");
+		torture_assert_werr_ok(tctx, s.out.result,
+			"PNP_GetDeviceListSize failed");
 	}
 
 	buffer = talloc_array(tctx, uint16_t, length);
@@ -101,9 +118,12 @@ static bool test_PNP_GetDeviceList(struct torture_context *tctx,
 	r.out.length = &length;
 	r.out.buffer = buffer;
 
-	status = dcerpc_PNP_GetDeviceList(p, tctx, &r);
-	torture_assert_ntstatus_ok(tctx, status, "PNP_GetDeviceList");
-	torture_assert_werr_ok(tctx, r.out.result, "PNP_GetDeviceList");
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_PNP_GetDeviceList(p, tctx, &r),
+		"PNP_GetDeviceList failed");
+
+	torture_assert_werr_ok(tctx, r.out.result,
+		"PNP_GetDeviceList failed");
 
 	return true;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list