summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-21 02:19:47 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-21 02:19:47 +0000
commit38ce2ef4bb05b463f1a3484665c88ae55bbd7b72 (patch)
tree419214273bcf0371b39842dabe87487924d85e8d /source4
parent9fc7be869be366bb19e163b8c317489abca5ae36 (diff)
downloadsamba-38ce2ef4bb05b463f1a3484665c88ae55bbd7b72.tar.gz
samba-38ce2ef4bb05b463f1a3484665c88ae55bbd7b72.tar.bz2
samba-38ce2ef4bb05b463f1a3484665c88ae55bbd7b72.zip
added 4 more levels to samr_QueryDisplayInfo()
(This used to be commit f4cc593a5c7d75adaced2c33dd83c2ec741751be)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/misc.idl7
-rw-r--r--source4/librpc/idl/samr.idl43
-rw-r--r--source4/librpc/ndr/ndr_basic.c65
-rw-r--r--source4/librpc/ndr/ndr_basic.h25
-rw-r--r--source4/torture/rpc/samr.c28
5 files changed, 106 insertions, 62 deletions
diff --git a/source4/librpc/idl/misc.idl b/source4/librpc/idl/misc.idl
index 925896fbe1..031ca89821 100644
--- a/source4/librpc/idl/misc.idl
+++ b/source4/librpc/idl/misc.idl
@@ -48,4 +48,11 @@ interface misc
[relative] security_acl *dacl; /* user (discretionary) ACL */
} security_descriptor;
+ /* we declare this noprint so we can supply
+ a nicer pretty-print routine */
+ typedef [public, noprint] struct {
+ uint8 data[20];
+ } policy_handle;
+
+
}
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl
index d639af82db..29ba402503 100644
--- a/source4/librpc/idl/samr.idl
+++ b/source4/librpc/idl/samr.idl
@@ -657,18 +657,51 @@
uint32 idx;
uint32 rid;
uint32 acct_flags;
- samr_Name username;
+ samr_Name account_name;
samr_Name full_name;
samr_Name description;
- } samr_DispEntry1;
+ } samr_DispEntryGeneral;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_DispEntryGeneral *entries;
+ } samr_DispInfoGeneral;
+
+ typedef struct {
+ uint32 idx;
+ uint32 rid;
+ uint32 acct_flags;
+ samr_Name account_name;
+ samr_Name description;
+ } samr_DispEntryFull;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_DispEntryFull *entries;
+ } samr_DispInfoFull;
+
+ typedef struct {
+ [value(strlen_m(r->name))] uint16 name_len;
+ [value(strlen_m(r->name))] uint16 name_size;
+ ascstr *name;
+ } samr_AsciiName;
+
+ typedef struct {
+ uint32 idx;
+ samr_AsciiName account_name;
+ } samr_DispEntryAscii;
typedef struct {
uint32 count;
- [size_is(count)] samr_DispEntry1 *entries;
- } samr_DispInfo1;
+ [size_is(count)] samr_DispEntryAscii *entries;
+ } samr_DispInfoAscii;
typedef union {
- [case(1)] samr_DispInfo1 info1;
+ [case(1)] samr_DispInfoGeneral info1;/* users */
+ [case(2)] samr_DispInfoFull info2; /* trust accounts? */
+ [case(3)] samr_DispInfoFull info3; /* groups */
+ [case(4)] samr_DispInfoAscii info4; /* users */
+ [case(5)] samr_DispInfoAscii info5; /* groups */
} samr_DispInfo;
NTSTATUS samr_QueryDisplayInfo(
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 0cb4456399..49cff11480 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -338,6 +338,22 @@ NTSTATUS ndr_push_unistr(struct ndr_push *ndr, const char *s)
}
/*
+ push a comformant, variable ascii string onto the wire from a C string
+ TODO: need to look at what charset this should be in
+*/
+NTSTATUS ndr_push_ascstr(struct ndr_push *ndr, const char *s)
+{
+ ssize_t len = s?strlen(s):0;
+ NDR_CHECK(ndr_push_uint32(ndr, len));
+ NDR_CHECK(ndr_push_uint32(ndr, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, len?len+1:0));
+ if (s) {
+ NDR_CHECK(ndr_push_bytes(ndr, s, len));
+ }
+ return NT_STATUS_OK;
+}
+
+/*
push a comformant, variable ucs2 string onto the wire from a C string
don't send the null
*/
@@ -383,6 +399,29 @@ NTSTATUS ndr_pull_unistr(struct ndr_pull *ndr, const char **s)
}
/*
+ pull a comformant, variable ascii string from the wire into a C string
+ TODO: check what charset this is in
+*/
+NTSTATUS ndr_pull_ascstr(struct ndr_pull *ndr, const char **s)
+{
+ uint32 len1, ofs, len2;
+ char *as;
+
+ NDR_CHECK(ndr_pull_uint32(ndr, &len1));
+ NDR_CHECK(ndr_pull_uint32(ndr, &ofs));
+ NDR_CHECK(ndr_pull_uint32(ndr, &len2));
+ if (len2 > len1) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ NDR_ALLOC_N(ndr, as, (len1+1));
+ NDR_CHECK(ndr_pull_bytes(ndr, as, len2));
+ as[len2] = 0;
+ as[len1] = 0;
+ (*s) = as;
+ return NT_STATUS_OK;
+}
+
+/*
pull a comformant, variable ucs2 string from the wire into a C string
*/
NTSTATUS ndr_pull_unistr_noterm(struct ndr_pull *ndr, const char **s)
@@ -498,6 +537,11 @@ void ndr_print_unistr_noterm(struct ndr_print *ndr, const char *name, const char
ndr_print_unistr(ndr, name, s);
}
+void ndr_print_ascstr(struct ndr_print *ndr, const char *name, const char *s)
+{
+ ndr_print_unistr(ndr, name, s);
+}
+
void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t)
{
ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr->mem_ctx, &t));
@@ -705,27 +749,6 @@ NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, DATA_BLOB *blob)
}
-/*
- parse a policy handle
-*/
-NTSTATUS ndr_pull_policy_handle(struct ndr_pull *ndr,
- struct policy_handle *r)
-{
- NDR_CHECK(ndr_pull_bytes(ndr, r->data, 20));
- return NT_STATUS_OK;
-}
-
-/*
- push a policy handle
-*/
-NTSTATUS ndr_push_policy_handle(struct ndr_push *ndr,
- struct policy_handle *r)
-{
- NDR_CHECK(ndr_push_bytes(ndr, r->data, 20));
- return NT_STATUS_OK;
-}
-
-
void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, struct policy_handle *r)
{
ndr->print(ndr, "%-25s: policy_handle %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
diff --git a/source4/librpc/ndr/ndr_basic.h b/source4/librpc/ndr/ndr_basic.h
index 38f1252236..e69de29bb2 100644
--- a/source4/librpc/ndr/ndr_basic.h
+++ b/source4/librpc/ndr/ndr_basic.h
@@ -1,25 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- rpc interface definitions - basic types
- Copyright (C) Andrew Tridgell 2003
-
- 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-
-struct policy_handle {
- uint8 data[20];
-};
-
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 345347a344..047da518b3 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -21,6 +21,7 @@
#include "includes.h"
+#define TEST_USERNAME "samrtorturetest"
static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle);
@@ -278,7 +279,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct samr_Name name;
BOOL ret = True;
- init_samr_Name(&name, "samrtorturetest");
+ init_samr_Name(&name, TEST_USERNAME);
r.in.handle = handle;
r.in.username = &name;
@@ -657,19 +658,24 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
NTSTATUS status;
struct samr_QueryDisplayInfo r;
BOOL ret = True;
+ uint16 levels[] = {1, 2, 3, 4, 5};
+ int i;
- printf("Testing QueryDisplayInfo\n");
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ printf("Testing QueryDisplayInfo level %u\n", levels[i]);
- r.in.handle = handle;
- r.in.level = 1;
- r.in.start_idx = 0;
- r.in.max_entries = 100;
- r.in.buf_size = (uint32)-1;
+ r.in.handle = handle;
+ r.in.level = levels[i];
+ r.in.start_idx = 0;
+ r.in.max_entries = 1000;
+ r.in.buf_size = (uint32)-1;
- status = dcerpc_samr_QueryDisplayInfo(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("QueryDisplayInfo failed - %s\n", nt_errstr(status));
- return False;
+ status = dcerpc_samr_QueryDisplayInfo(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryDisplayInfo level %u failed - %s\n",
+ levels[i], nt_errstr(status));
+ ret = False;
+ }
}
return ret;