summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
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/librpc/ndr
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/librpc/ndr')
-rw-r--r--source4/librpc/ndr/ndr_basic.c65
-rw-r--r--source4/librpc/ndr/ndr_basic.h25
2 files changed, 44 insertions, 46 deletions
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];
-};
-