pidl: Generate compatability wrappers for ndr_print functions
authorAndrew Bartlett <abartlet@samba.org>
Sun, 3 Nov 2019 23:15:26 +0000 (12:15 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 13 Nov 2019 00:32:37 +0000 (00:32 +0000)
This creates wrappers that are compatible with the functions called by
ndrdump which have an extra "int flags" parameter for NDR_IN and
NDR_OUT.  This will make ndrdump of public structures work again.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14191

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Pair-progammed-with: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index f73d54973bf6f70f0eeaa2a5500c969a9e301ded..222a8b8c7b475a10f237ccca365fb60340a2c721 100644 (file)
@@ -2768,7 +2768,7 @@ sub StructEntry($$)
        $self->pidl("\t\t.struct_size = sizeof($type_decl),");
        $self->pidl("\t\t.ndr_push = (ndr_push_flags_fn_t) ndr_push_$d->{NAME},");
        $self->pidl("\t\t.ndr_pull = (ndr_pull_flags_fn_t) ndr_pull_$d->{NAME},");
-       $self->pidl("\t\t.ndr_print = (ndr_print_function_t) ndr_print_$d->{NAME},");
+       $self->pidl("\t\t.ndr_print = (ndr_print_function_t) ndr_print_flags_$d->{NAME},");
        $self->pidl("\t},");
        return 1;
 }
@@ -3023,6 +3023,18 @@ sub ParseTypePrintFunction($$$)
 
        $self->pidl_hdr("void ".TypeFunctionName("ndr_print", $e)."(struct ndr_print *ndr, const char *name, $args);");
 
+       if (has_property($e, "public")) {
+                $self->pidl("static void ".TypeFunctionName("ndr_print_flags", $e).
+                             "(struct ndr_print *$ndr, const char *name, int unused, $args)"
+                             );
+               $self->pidl("{");
+               $self->indent;
+               $self->pidl(TypeFunctionName("ndr_print", $e)."($ndr, name, $varname);");
+               $self->deindent;
+               $self->pidl("}");
+               $self->pidl("");
+       }
+
        return if (has_property($e, "noprint"));
 
        $self->pidl("_PUBLIC_ void ".TypeFunctionName("ndr_print", $e)."(struct ndr_print *$ndr, const char *name, $args)");