The branch, master has been updated
       via  bc0c876a9eb pidl:NDR/Parser: only include structs in 
ndr_interface_public_struct
       via  238d08b07d0 selftest: Confirm that ndrdump struct mode is not 
available for enums
      from  73f43626062 CVE-2019-14870: mit-kdc: enforce delegation_not_allowed 
flag

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


- Log -----------------------------------------------------------------
commit bc0c876a9ebbec1a31856a9e7147a481c69ba434
Author: Andrew Bartlett <[email protected]>
Date:   Thu Dec 5 11:37:05 2019 +1300

    pidl:NDR/Parser: only include structs in ndr_interface_public_struct
    
    We only have ndrdump and the fuzzers set up for structures, not BITMAPS,
    ENUMS etc.
    
    Pair-Programmed-With: Stefan Metzmacher <[email protected]>
    
    Signed-off-by: Andrew Bartlett <[email protected]>
    Signed-off-by: Stefan Metzmacher <[email protected]>
    
    Autobuild-User(master): Stefan Metzmacher <[email protected]>
    Autobuild-Date(master): Tue Dec 10 17:45:46 UTC 2019 on sn-devel-184

commit 238d08b07d0178940c28839518c9f1afbc605378
Author: Andrew Bartlett <[email protected]>
Date:   Fri Dec 6 11:00:57 2019 +1300

    selftest: Confirm that ndrdump struct mode is not available for enums
    
    These are not passed by pointer so the structure dump system does not work
    for these.  It is best to dump the containing structure instead.
    
    Signed-off-by: Andrew Bartlett <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

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

Summary of changes:
 pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 20 ++++++++++++++++----
 python/samba/tests/blackbox/ndrdump.py   | 14 ++++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 
b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 91b5f942994..c2821874db8 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -88,6 +88,18 @@ sub has_fast_array($$)
        return ($t->{NAME} eq "uint8");
 }
 
+sub is_public_struct
+{
+       my ($d) = @_;
+       if (!has_property($d, "public")) {
+               return 0;
+       }
+       my $t = $d;
+       if ($d->{TYPE} eq "TYPEDEF") {
+               $t = $d->{DATA};
+       }
+       return $t->{TYPE} eq "STRUCT";
+}
 
 ####################################
 # defer() is like pidl(), but adds to 
@@ -2794,7 +2806,7 @@ sub FunctionTable($$)
        my $uname = uc $interface->{NAME};
 
        foreach my $d (@{$interface->{TYPES}}) {
-               next unless (has_property($d, "public"));
+               next unless (is_public_struct($d));
                $count_public_structs += 1;
        }
        return if ($#{$interface->{FUNCTIONS}}+1 == 0 and
@@ -2807,8 +2819,8 @@ sub FunctionTable($$)
        $self->pidl("static const struct ndr_interface_public_struct 
$interface->{NAME}\_public_structs[] = {");
 
        foreach my $d (@{$interface->{TYPES}}) {
-               next unless (has_property($d, "public"));
-               $self->StructEntry($d)
+               next unless (is_public_struct($d));
+               $self->StructEntry($d);
        }
        $self->pidl("\t{ .name = NULL }");
        $self->pidl("};");
@@ -3034,7 +3046,7 @@ sub ParseTypePrintFunction($$$)
 
        $self->pidl_hdr("void ".TypeFunctionName("ndr_print", $e)."(struct 
ndr_print *ndr, const char *name, $args);");
 
-       if (has_property($e, "public")) {
+       if (is_public_struct($e)) {
                 $self->pidl("static void ".TypeFunctionName("ndr_print_flags", 
$e).
                              "(struct ndr_print *$ndr, const char *name, int 
unused, $args)"
                              );
diff --git a/python/samba/tests/blackbox/ndrdump.py 
b/python/samba/tests/blackbox/ndrdump.py
index f56858e98ba..5e4b3bfbd8c 100644
--- a/python/samba/tests/blackbox/ndrdump.py
+++ b/python/samba/tests/blackbox/ndrdump.py
@@ -111,6 +111,20 @@ dump OK
         # convert expected to bytes for python 3
         self.assertEqual(actual, expected.encode('utf-8'))
 
+    def test_ndrdump_with_enum_not_struct(self):
+        expected = '''Public structure 'netr_SchannelType' not found
+'''
+        try:
+            actual = self.check_exit_code(
+                "ndrdump misc netr_SchannelType --input=x struct",
+                1)
+        except BlackboxProcessError as e:
+            self.fail(e)
+
+        # check_output will return bytes
+        # convert expected to bytes for python 3
+        self.assertEqual(actual, expected.encode('utf-8'))
+
     def test_ndrdump_input_cmdline_short_struct_name(self):
         expected = '''pull returned Buffer Size Error
 '''


-- 
Samba Shared Repository

Reply via email to