1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/pidl
Douglas Bagnall eb480df1ba pidl:Typelist: resolveType(): don't mistake a reference for a name
This function is only used by Python.pm, and was assuming any argument
unrecognised by hasType is a name. It sometimes isn't, resulting in
structures like this:

	{
	  'DATA' => {
		      'TYPE' => 'STRUCT'
		    },
	  'NAME' => {
		      'TYPE' => 'STRUCT',
		      'ALIGN' => undef,
		      'SURROUNDING_ELEMENT' => undef,
		      'ORIGINAL' => {
				      'TYPE' => 'STRUCT',
				      'FILE' => 'source3/librpc/idl/smbXsrv.idl',
				      'LINE' => 101,
				      'NAME' => 'tevent_context'
				    },
		      'ELEMENTS' => undef,
		      'NAME' => 'tevent_context',
		      'PROPERTIES' => undef
		    },
	  'TYPE' => 'TYPEDEF'
      };

The problem with that is we end up with the HASH reference as a name
in Python bindings, like this

      PyErr_SetString(PyExc_TypeError, "Can not convert C Type struct HASH(0x5e2dfe5ee278) from Python");

which makes the build nondeterministic (as well as making the message
a little mysterious).

I think all the structures for which this happens are marked
'[ignore]' in IDL, meaning they are not transmitted on the wire. They
should perhaps also not have useless Python getsetters, but let's call
that a different problem.

Thanks to Freexian and the Debian LTS project for sponsoring this work.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit f3433f60b8)
2024-06-10 13:24:16 +00:00
..
lib/Parse pidl:Typelist: resolveType(): don't mistake a reference for a name 2024-06-10 13:24:16 +00:00
tests pidl: Add new ‘u16string’ type 2023-11-20 21:50:32 +00:00
expr.yp
idl.yp
Makefile.PL
MANIFEST
META.yml
pidl pidl:NDR/ServerCompat: Compat server PIDL parser 2020-03-20 15:36:31 +00:00
README
TODO
wscript pidl: Fix grammar in warning message 2023-11-30 00:02:33 +00:00

Introduction:
=============
This directory contains the source code of the pidl (Perl IDL)
compiler for Samba 4.

The main sources for pidl are available using Git as part of
the Samba source tree. Use:
git clone git://git.samba.org/samba.git

Pidl works by building a parse tree from a .pidl file (a simple
dump of it's internal parse tree) or a .idl file
(a file format mostly like the IDL file format midl uses).
The IDL file parser is in idl.yp (a yacc file converted to
perl code by yapp)

Standalone installation:
========================
Run Makefile.PL to generate the Makefile.

Then run "make install" (as root) to install.

Internals overview:
===================

After a parse tree is present, pidl will call one of it's backends
(which one depends on the options given on the command-line). Here is
a list of current backends:

-- Generic --
Parse::Pidl::Dump - Converts the parse tree back to an IDL file
Parse::Pidl::Samba4::Header - Generates header file with data structures defined in IDL file
Parse::Pidl::NDR - Generates intermediate datastructures for use by NDR parses/generators
Parse::Pidl::ODL - Generates IDL structures from ODL structures for use in the NDR parser generator
Parse::Pidl::Test - Utility functions for use in pidl's testsuite

-- Samba NDR --
Parse::Pidl::Samba4::NDR::Client - Generates client call functions in C using the NDR parser
Parse::Pidl::Samba4::NDR::Parser - Generates pull/push functions for parsing NDR
Parse::Pidl::Samba4::NDR::Server - Generates server side implementation in C
Parse::Pidl::Samba4::TDR - Parser generator for the "Trivial Data Representation"
Parse::Pidl::Samba4::Template - Generates stubs in C for server implementation
Parse::Pidl::Samba4::Python - Generates bindings for Python

-- Samba COM / DCOM --
Parse::Pidl::Samba4::COM::Proxy - Generates proxy object for DCOM (client-side)
Parse::Pidl::Samba4::COM::Stub - Generates stub call handler for DCOM (server-side)
Parse::Pidl::Samba4::COM::Header - Generates headers for COM

-- Wireshark --
Parse::Pidl::Wireshark::NDR - Generates a parser for the Wireshark network sniffer
Parse::Pidl::Wireshark::Conformance - Reads conformance files containing additional data for generating Wireshark parsers

-- Utility modules --
Parse::Pidl::Util - Misc utility functions used by *.pm and pidl.pl
Parse::Pidl::Typelist - Utility functions for keeping track of known types and their representation in C

Tips for hacking on pidl:
 - Inspect pidl's parse tree by using the --keep option and looking at the
   generated .pidl file.
 - The various backends have a lot in common, if you don't understand how one
   implements something, look at the others.
 - See pidl(1) and the documentation on midl
 - See 'info bison' and yapp(1) for information on the file format of idl.yp
 - Run the tests (all in tests/)