svn commit: samba r11105 - in branches/SAMBA_4_0/source: librpc/idl
librpc/ndr pidl/lib/Parse/Pidl pidl/lib/Parse/Pidl/Samba/NDR
jelmer at samba.org
jelmer at samba.org
Sun Oct 16 23:47:10 GMT 2005
Author: jelmer
Date: 2005-10-16 23:47:09 +0000 (Sun, 16 Oct 2005)
New Revision: 11105
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11105
Log:
Warn if conformant arrays are not at the end of a struct
Support conformant [string] arrays
Eliminate utf8string
This breaks xattr binary compatibility with previous versions - is that a
problem?
Modified:
branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl
branches/SAMBA_4_0/source/librpc/idl/unixinfo.idl
branches/SAMBA_4_0/source/librpc/idl/xattr.idl
branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl 2005-10-16 23:39:13 UTC (rev 11104)
+++ branches/SAMBA_4_0/source/librpc/idl/drsuapi.idl 2005-10-16 23:47:09 UTC (rev 11105)
@@ -430,7 +430,7 @@
/* UnicodeString values */
typedef struct {
[range(0,10485760)] uint32 length;
- [subcontext(4)] nstring *string;
+ [size_is(length),charset(UTF16)] uint16 *string;
} drsuapi_DsAttributeValueUnicodeString;
typedef struct {
Modified: branches/SAMBA_4_0/source/librpc/idl/unixinfo.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/unixinfo.idl 2005-10-16 23:39:13 UTC (rev 11104)
+++ branches/SAMBA_4_0/source/librpc/idl/unixinfo.idl 2005-10-16 23:47:09 UTC (rev 11105)
@@ -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;
/******************/
Modified: branches/SAMBA_4_0/source/librpc/idl/xattr.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/xattr.idl 2005-10-16 23:39:13 UTC (rev 11104)
+++ branches/SAMBA_4_0/source/librpc/idl/xattr.idl 2005-10-16 23:47:09 UTC (rev 11105)
@@ -41,7 +41,7 @@
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 @@
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 @@
uint32 flags;
udlong size;
udlong alloc_size;
- utf8string name;
+ [charset(UTF8),string] uint8 name[];
} xattr_DosStream;
typedef [public] struct {
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c 2005-10-16 23:39:13 UTC (rev 11104)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c 2005-10-16 23:47:09 UTC (rev 11105)
@@ -675,3 +675,10 @@
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);
+}
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm 2005-10-16 23:39:13 UTC (rev 11104)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm 2005-10-16 23:47:09 UTC (rev 11105)
@@ -373,7 +373,12 @@
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];
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm 2005-10-16 23:39:13 UTC (rev 11104)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm 2005-10-16 23:47:09 UTC (rev 11105)
@@ -292,7 +292,11 @@
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 @@
# 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 {
More information about the samba-cvs
mailing list