mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
added 4 more levels to samr_QueryDisplayInfo()
(This used to be commit f4cc593a5c
)
This commit is contained in:
parent
9fc7be869b
commit
38ce2ef4bb
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
@ -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_DispEntry1 *entries;
|
||||
} samr_DispInfo1;
|
||||
[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_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(
|
||||
|
@ -337,6 +337,22 @@ NTSTATUS ndr_push_unistr(struct ndr_push *ndr, const char *s)
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
@ -382,6 +398,29 @@ NTSTATUS ndr_pull_unistr(struct ndr_pull *ndr, const char **s)
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
*/
|
||||
@ -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",
|
||||
|
@ -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];
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user