diff options
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/idl/misc.idl | 7 | ||||
-rw-r--r-- | source4/librpc/idl/samr.idl | 43 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 65 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.h | 25 |
4 files changed, 89 insertions, 51 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]; -}; - |