summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/drsuapi.idl2
-rw-r--r--source4/librpc/idl/unixinfo.idl8
-rw-r--r--source4/librpc/idl/xattr.idl6
-rw-r--r--source4/librpc/ndr/ndr_string.c7
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm7
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm19
6 files changed, 37 insertions, 12 deletions
diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl
index f900af9ce2..9711674581 100644
--- a/source4/librpc/idl/drsuapi.idl
+++ b/source4/librpc/idl/drsuapi.idl
@@ -430,7 +430,7 @@ interface drsuapi
/* UnicodeString values */
typedef struct {
[range(0,10485760)] uint32 length;
- [subcontext(4)] nstring *string;
+ [size_is(length),charset(UTF16)] uint16 *string;
} drsuapi_DsAttributeValueUnicodeString;
typedef struct {
diff --git a/source4/librpc/idl/unixinfo.idl b/source4/librpc/idl/unixinfo.idl
index e740368875..ac75430532 100644
--- a/source4/librpc/idl/unixinfo.idl
+++ b/source4/librpc/idl/unixinfo.idl
@@ -40,10 +40,10 @@
[out] dom_sid *sid
);
- typedef struct {
- NTSTATUS status;
- utf8string homedir;
- utf8string shell;
+ typedef struct {
+ NTSTATUS status;
+ [string,charset(UTF8)] uint8 *homedir;
+ [string,charset(UTF8)] uint8 *shell;
} unixinfo_GetPWUidInfo;
/******************/
diff --git a/source4/librpc/idl/xattr.idl b/source4/librpc/idl/xattr.idl
index 48d0c76183..4cb1f75393 100644
--- a/source4/librpc/idl/xattr.idl
+++ b/source4/librpc/idl/xattr.idl
@@ -41,7 +41,7 @@ interface xattr
NTTIME create_time;
NTTIME change_time;
NTTIME write_time; /* only used when sticky write time is set */
- utf8string name; /* will be used for case-insensitive speedup */
+ [string,charset(UTF8)] uint8 *name; /* will be used for case-insensitive speedup */
} xattr_DosInfo2;
typedef [switch_type(uint16)] union {
@@ -59,7 +59,7 @@ interface xattr
const char *XATTR_DOSEAS_NAME = "user.DosEAs";
typedef struct {
- utf8string name;
+ [string,charset(UTF8)] uint8 *name;
DATA_BLOB value;
} xattr_EA;
@@ -85,7 +85,7 @@ interface xattr
uint32 flags;
udlong size;
udlong alloc_size;
- utf8string name;
+ [charset(UTF8),string] uint8 name[];
} xattr_DosStream;
typedef [public] struct {
diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c
index ce035be5dc..684bc047c0 100644
--- a/source4/librpc/ndr/ndr_string.c
+++ b/source4/librpc/ndr/ndr_string.c
@@ -675,3 +675,10 @@ NTSTATUS ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var,
return NT_STATUS_OK;
}
+
+/* Return number of elements in a string in the specified charset */
+uint32_t ndr_charset_length(const void *var, int chset)
+{
+ /* FIXME: Treat special chars special here, taking chset into account */
+ return strlen(var);
+}
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 73104758dd..d0b6708bf6 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -373,7 +373,12 @@ sub ParseStruct($)
foreach my $x (@{$struct->{ELEMENTS}})
{
- push @elements, ParseElement($x);
+ my $e = ParseElement($x);
+ if ($x != $struct->{ELEMENTS}[-1] and
+ $e->{LEVELS}[0]->{IS_SURROUNDING}) {
+ print "$x->{FILE}:$x->{LINE}: error: conformant member not at end of struct\n";
+ }
+ push @elements, $e;
}
my $e = $elements[-1];
diff --git a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
index 2ccbc057fc..d203c4fa43 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
@@ -292,7 +292,11 @@ sub ParseArrayPushHeader($$$$$)
my $length;
if ($l->{IS_ZERO_TERMINATED}) {
- $size = $length = "ndr_string_length($var_name, sizeof(*$var_name))";
+ if (has_property($e, "charset")) {
+ $size = $length = "ndr_charset_length($var_name, CH_$e->{PROPERTIES}->{charset})";
+ } else {
+ $size = $length = "ndr_string_length($var_name, sizeof(*$var_name))";
+ }
} else {
$size = ParseExpr($l->{SIZE_IS}, $env);
$length = ParseExpr($l->{LENGTH_IS}, $env);
@@ -1125,13 +1129,22 @@ sub ParseStructPush($$)
# we need to push the conformant length early, as it fits on
# the wire before the structure (and even before the structure
# alignment)
- my $e = $struct->{ELEMENTS}[-1];
if (defined($struct->{SURROUNDING_ELEMENT})) {
my $e = $struct->{SURROUNDING_ELEMENT};
if (defined($e->{LEVELS}[0]) and
$e->{LEVELS}[0]->{TYPE} eq "ARRAY") {
- my $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env);
+ my $size;
+
+ if ($e->{LEVELS}[0]->{IS_ZERO_TERMINATED}) {
+ if (has_property($e, "charset")) {
+ $size = "ndr_charset_length(r->$e->{NAME}, CH_$e->{PROPERTIES}->{charset})";
+ } else {
+ $size = "ndr_string_length(r->$e->{NAME}, sizeof(*r->$e->{NAME}))";
+ }
+ } else {
+ $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env);
+ }
pidl "NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $size));";
} else {