[SCM] Samba Shared Repository - branch master updated - efc487b80a28caa63c54d6dfd12580636e356dd8

Tim Prouty tprouty at samba.org
Thu Jan 15 22:57:31 GMT 2009


The branch, master has been updated
       via  efc487b80a28caa63c54d6dfd12580636e356dd8 (commit)
       via  c59ec17dddfa98f44baf6a3195b6ebf5cad8f016 (commit)
       via  7c861cac534801dd7938f07eeccd3680c84d3f30 (commit)
      from  3913d0a20547ad9c93255fdbc4fdf6629aa226b9 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit efc487b80a28caa63c54d6dfd12580636e356dd8
Author: Tim Prouty <tprouty at samba.org>
Date:   Thu Jan 15 10:59:49 2009 -0800

    librpc: Re-run make idl_full

commit c59ec17dddfa98f44baf6a3195b6ebf5cad8f016
Author: Tim Prouty <tprouty at samba.org>
Date:   Thu Jan 15 10:57:00 2009 -0800

    librpc: Change a uint16 to use the max property instead of range
    
    This fixes a "comparison is always false due to limited range of data
    type" warning

commit 7c861cac534801dd7938f07eeccd3680c84d3f30
Author: Tim Prouty <tprouty at samba.org>
Date:   Thu Jan 15 10:51:57 2009 -0800

    pidl: Add max property to be used instead of range for unsigned types.
    
    Compilers complain about ranges starting at 0 for unsigned types,
    since an unsigned type is never less than 0.  The max property
    implicitly makes 0 the lower bound when used with unsigned types.

-----------------------------------------------------------------------

Summary of changes:
 librpc/gen_ndr/eventlog.h                |    2 +-
 librpc/gen_ndr/ndr_eventlog.c            |    2 +-
 librpc/idl/eventlog.idl                  |    2 +-
 pidl/lib/Parse/Pidl/Compat.pm            |    1 +
 pidl/lib/Parse/Pidl/NDR.pm               |    1 +
 pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm |    6 ++++++
 6 files changed, 11 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/gen_ndr/eventlog.h b/librpc/gen_ndr/eventlog.h
index 9c9a2ed..65178d2 100644
--- a/librpc/gen_ndr/eventlog.h
+++ b/librpc/gen_ndr/eventlog.h
@@ -47,7 +47,7 @@ struct eventlog_Record {
 	time_t time_written;
 	uint32_t event_id;
 	enum eventlogEventTypes event_type;
-	uint16_t num_of_strings;/* [range(0,256)] */
+	uint16_t num_of_strings;/* [max(256)] */
 	uint16_t event_category;
 	uint16_t reserved_flags;
 	uint32_t closing_record_number;
diff --git a/librpc/gen_ndr/ndr_eventlog.c b/librpc/gen_ndr/ndr_eventlog.c
index 9b64deb..edcdf2e 100644
--- a/librpc/gen_ndr/ndr_eventlog.c
+++ b/librpc/gen_ndr/ndr_eventlog.c
@@ -180,7 +180,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_eventlog_Record(struct ndr_pull *ndr, int nd
 			NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->event_id));
 			NDR_CHECK(ndr_pull_eventlogEventTypes(ndr, NDR_SCALARS, &r->event_type));
 			NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_of_strings));
-			if (r->num_of_strings < 0 || r->num_of_strings > 256) {
+			if (r->num_of_strings > 256) {
 				return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
 			}
 			NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->event_category));
diff --git a/librpc/idl/eventlog.idl b/librpc/idl/eventlog.idl
index 51b3ea7..fbdec28 100644
--- a/librpc/idl/eventlog.idl
+++ b/librpc/idl/eventlog.idl
@@ -40,7 +40,7 @@ import "lsa.idl", "security.idl";
 		time_t time_written;
 		uint32 event_id;
 		eventlogEventTypes event_type;
-		[range(0,256)] uint16 num_of_strings;
+		[max(256)] uint16 num_of_strings;
 		uint16 event_category;
 		uint16 reserved_flags;
 		uint32 closing_record_number;
diff --git a/pidl/lib/Parse/Pidl/Compat.pm b/pidl/lib/Parse/Pidl/Compat.pm
index 1b49c43..58ba136 100644
--- a/pidl/lib/Parse/Pidl/Compat.pm
+++ b/pidl/lib/Parse/Pidl/Compat.pm
@@ -67,6 +67,7 @@ my %supported_properties = (
 
 	# array
 	"range"			=> ["ELEMENT"],
+	"max"			=> ["ELEMENT"],
 	"size_is"		=> ["ELEMENT"],
 	"string"		=> ["ELEMENT"],
 	"noheader"		=> ["ELEMENT"],
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index 5ee26d1..8963243 100644
--- a/pidl/lib/Parse/Pidl/NDR.pm
+++ b/pidl/lib/Parse/Pidl/NDR.pm
@@ -921,6 +921,7 @@ my %property_list = (
 
 	# array
 	"range"			=> ["ELEMENT"],
+	"max"			=> ["ELEMENT"],
 	"size_is"		=> ["ELEMENT"],
 	"string"		=> ["ELEMENT"],
 	"noheader"		=> ["ELEMENT"],
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 0a4e44e..e2b14c1 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -862,6 +862,12 @@ sub ParseDataPull($$$$$$$)
 			$self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
 			$self->pidl("}");
 		}
+		if (my $max = has_property($e, "max")) {
+			$var_name = get_value_of($var_name);
+			$self->pidl("if ($var_name > $max) {");
+			$self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
+			$self->pidl("}");
+		}
 	} else {
 		$self->ParseTypePull($l->{DATA_TYPE}, $ndr, $var_name, $primitives, $deferred);
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list