1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
Commit Graph

646 Commits

Author SHA1 Message Date
Volker Lendecke
707265817c pidl: Add headerhelper idl property
Add includes to for example misc.h if needed, so that misc.h can be
directly included without prerequisites

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
2024-08-27 07:19:32 +00:00
Stefan Metzmacher
f10160af89 pidl:Samba4/Header: only include ntstatus.h if required
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
2024-08-27 07:19:32 +00:00
Stefan Metzmacher
282ee7dd3f pidl: add scalarTypeUsed() helper to find if a type was actually used...
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
2024-08-27 07:19:32 +00:00
Volker Lendecke
cca1bf8793 pidl: replace.h is sufficient in ndr_*.c
Avoid a few uses of includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <jsutton@samba.org>
2024-08-27 07:19:32 +00:00
John Thacker
e450ff685b pidl: Wireshark: Another C99 type conversion
Pick up change from Wireshark:

    commit bdb719f846f9d8f7800b9f50dadfde5e7f7a89e1
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sun Jun 23 08:15:45 2024 -0400

        pidl: Another C99 type conversion

        Change an automated sizeof() call in the pidl dissector generation from
        prefixing a "g" to getting the actual C type.

        Ping #19116

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jul 12 11:08:03 UTC 2024 on atb-devel-224
2024-07-12 11:08:03 +00:00
John Thacker
9870457e96 pidl: Wireshark: Don't assign hash undef, assign it an empty array
Pick up change from Wireshark:

    commit ade6577f109e2bf741909226254b758e79a816f1
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Fri Jun 21 20:27:51 2024 -0400

        pidl: Don't assign hash undef, assign it an empty array

        Perl works, but complains if warnings are on, if a hash is
        initialized to undef instead of to empty. Upstream Samba turned on
        warnings in the next commit to catch things like this.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
5b12d3d2e7 pidl: Wireshark: Remove init of proto variables
Pick up change from Wireshark:

    commit 10b046cbdd110dbae8f4cab048e5954bf6955402
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sat Jun 22 20:31:40 2024 -0400

        pidl: Remove init of proto variables

        Remove initialization of proto variables from pidl generated dissectors
        and regenerate.
        Follow up to 2a9bc63325c99653c5da873c273430add3b5e9dd

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
00f5772874 pidl: Wireshark: Convert the pidl dissector generation code to C99 types
Pick up change from Wireshark:

    commit 4df8d2884ddfe72a03d0b322c10ae515a8366ea4
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sat Jun 22 11:21:47 2024 -0400

        pidl: Convert the pidl dissector generation code to C99 types

        Switch the Wireshark.pm pidl dissector generation code to using C99
        types, and regenerated the dcerpc pidl dissectors.

        Ping #19116

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
e60c5b881d pidl: Wireshark: Update test for removal of ett initialization
Pick up change from Wireshark:

    commit 6e4c81b324e9b1752ce6bc253a09355512b5b387
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sat Jun 22 11:10:48 2024 -0400

        pidl: Update test for removal of ett initialization

        Also remove trailing whitespace

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
2f5a388dd1 pidl: Wireshark: Const-ify dcerpc_sub_dissector structures.
Pick up change from Wireshark:

    commit 8a2a42241fd148ce735e776a6a1e6b49b64d215e
    Author: Darius Davis <darius-wireshark@free-range.com.au>
    Date:   Sun May 19 17:39:38 2024 +1000

        Const-ify dcerpc_sub_dissector structures.

        This moves about 56 kBytes of data from a read-write data section to read-only.

        The various dissectors were _not_ regenerated for this commit.  Instead, this
        commit was produced using the following command:

           find * -type f -exec sed -i -e 's/\(["'\'']\|^\)static dcerpc_sub_dissector/\1static const dcerpc_sub_dissector/' \{\} \;

        This updates the generator script and its test, as well as making an identical
        change to all of the dissectors, regardless of whether or not those dissectors
        were produced by the generator script.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
5a5e68c274 pidl: Wireshark: Don't initialise static hf and ett variables.
Pick up change from Wireshark:

    commit 9ca6eff53db29cad7dfc7e57fba4d68e9c838ab5
    Author: Anders Broman <a.broman58@gmail.com>
    Date:   Thu May 2 14:14:29 2024 +0200

        PIDL: Don't initialise static hf and ett variables.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
f2ed371e1c pidl: Wireshark: Remove init of proto variables
Pick up change from Wireshark as it applies to PIDL:

    commit 2a9bc63325c99653c5da873c273430add3b5e9dd
    Author: Stig Bjørlykke <stig@bjorlykke.org>
    Date:   Mon Nov 20 08:16:40 2023 +0100

        Remove init of proto variables

        Remove init of proto, header field, expert info and subtree variables.
        This will reduces the binary size by approximate 1266320 bytes due to
        using .bss to zero-initialize the fields.

        The conversion is done using the tools/convert-proto-init.py script

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
c3ca2a6575 pidl: Update Wireshark generated DRSUAPI code
Picked from Wireshark:

    commit b1249b0be4badc44cbbb30ff414d32d1b884a668
    Author: hidd3ncod3s Sec <hidd3ncod3s@gmail.com>
    Date:   Tue Aug 15 04:29:08 2023 +0000

        DCERPC: Update DRSUAPI support

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-12 09:59:32 +00:00
John Thacker
2e0c693f78 Revert "pidl: Use non-existent function dissect_ndr_int64()"
This reverts commit a836b433ed.

Wireshark's NDR dissector dissects both signed and unsigned types
of the same size and alignment with the same functions, e.g. see
the handling of "udlong" and "dlong." It is passing the FT_UINT64
vs FT_INT64 field type enum value that determines at the last
moment whether a value is cast to signed. dissect_ndr_uint64()
already has the proper behavior for 8-byte aligned signed 64 bit
integers, and a dissect_ndr_int64() function will not need to be
introduced.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jul  3 14:19:04 UTC 2024 on atb-devel-224
2024-07-03 14:19:04 +00:00
John Thacker
9542071588 pidl:Wireshark Fix the type of array of pointerse to hf_ values
Picked from Wireshark's fork:

    commit e1d9a226a2b8f2824a0eb162a8dc972e6e6c2dd4
    Author: Guy Harris <gharris@sonic.net>
    Date:   Thu Jun 18 18:14:46 2020 -0700

        Fix the type of arrays of pointers to hf_ values for bitfield routines.

        The static arrays are supposed to be arrays of const pointers to int,
        not arrays of non-const pointers to const int.

        Fixing that means some bugs (scribbling on what's *supposed* to be a
        const array) will be caught (see packet-ieee80211-radiotap.c for
        examples, the first of which inspired this change and the second of
        which was discovered while testing compiles with this change), and
        removes the need for some annoying casts.

        Also make some of those arrays static while we're at it.

        Update documentation and dissector-generator tools.

        Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
        Reviewed-on: https://code.wireshark.org/review/37517
        Petri-Dish: Guy Harris <gharris@sonic.net>
        Tested-by: Petri Dish Buildbot
        Reviewed-by: Anders Broman <a.broman58@gmail.com>

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Jul  3 02:35:43 UTC 2024 on atb-devel-224
2024-07-03 02:35:43 +00:00
John Thacker
4a05060132 pidl:Wireshark Rename tvb_new_subset()
Picked from Wireshark's fork:

    commit 7cd6906056922e4b8f68f1216d94eaa0809896fe
    Author: Guy Harris <guy@alum.mit.edu>
    Date:   Mon Jan 9 22:18:49 2017 -0800

        Rename tvb_new_subset() to tvb_new_subset_length_caplen().

        This emphasizes that there is no such thing as *the* routine to
        construct a subset tvbuff; you need to choose one of
        tvb_new_subset_remaining() (if you want a new tvbuff that contains
        everything past a certain point in an existing tvbuff),
        tvb_new_subset_length() (if you want a subset that contains everything
        past a certain point, for some number of bytes, in an existing tvbuff),
        and tvb_new_subset_length_caplen() (for all other cases).

        Many of the calls to tvb_new_subset_length_caplen() should really be
        calling one of the other routines; that's the next step.  (This also
        makes it easier to find the calls that need fixing.)

        Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b
        Reviewed-on: https://code.wireshark.org/review/19597
        Reviewed-by: Guy Harris <guy@alum.mit.edu>

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-03 01:35:31 +00:00
John Thacker
39f0551262 pidl:Wireshark Get rid of Boolean "flags" with no bit set
Picked from Wireshark's fork:

    commit 5ae9af9e50c89d8700e5a166a9c345fc46b3a4ca
    Author: Guy Harris <guy@alum.mit.edu>
    Date:   Sun Nov 6 11:02:51 2016 -0800

        Get rid of Boolean "flags" that don't have any bit set.

        And tweak the Pidl generator for Wireshark not to generate "flags" like
        that.

        (The generator also does field name and true/false strings' case
        differently, so I didn't use it to regenerate the dissectors; that needs
        to be looked at.)

        Change-Id: Ie1657a782ebdb107e58792cedd29bbaa79b17bd4
        Reviewed-on: https://code.wireshark.org/review/18695
        Reviewed-by: Guy Harris <guy@alum.mit.edu>

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-03 01:35:31 +00:00
John Thacker
b8d902df03 pidl:Wireshark Fix array of pointers NULL termination
Picked from Wireshark's PIDL fork:

    commit c07fd447c362099b04eedb445e8fa469643403f7
    Author: Binh Trinh <beango@gmail.com>
    Date:   Fri Jun 17 21:46:11 2016 -0400

        DCE/RPC: fix array of pointers with NULL

        Change-Id: Ie89f8fd4ec744d427d41866206d5a6784c5b224f
        Reviewed-on: https://code.wireshark.org/review/16004
        Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
        Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
        Reviewed-by: Michael Mann <mmann78@netscape.net>

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-03 01:35:31 +00:00
John Thacker
3c97ad41c3 pidl:Wireshark Use proto_tree_add_bitmask_with_flags
Picked from the Wireshark fork:

    commit 9a5e6a6884b2369527638fecd49c4c58d8c10378
    Author: Michael Mann <mmann78@netscape.net>
    Date:   Wed Jun 15 15:35:51 2016 -0400

        DCE/RPC proto_tree_add_boolean -> proto_tree_add_bitmask_with_flags

        Change-Id: I8891ec90244ffd9609d8443df631a7c8e6453b7e
        Reviewed-on: https://code.wireshark.org/review/15942
        Petri-Dish: Michael Mann <mmann78@netscape.net>
        Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
        Reviewed-by: Michael Mann <mmann78@netscape.net>

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-07-03 01:35:31 +00:00
Douglas Bagnall
ea78a5ce83 pidl:python: Exception if unconvertable in ConvertObjectToPythonLevel
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-05-31 00:25:33 +00:00
Douglas Bagnall
f893c100c0 pidl:python: properly raise exception in ConvertObjectFromPythonData
Without the `$self->pidl("$fail");`, the exception is not raised.

We also try to improve the Python message.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-05-31 00:25:33 +00:00
Douglas Bagnall
f3433f60b8 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>
2024-05-31 00:25:33 +00:00
Günther Deschner
8f1a80147d pidl: add "return ENOTSUP" for int return type in s3 template
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar 21 00:45:29 UTC 2024 on atb-devel-224
2024-03-21 00:45:29 +00:00
Günther Deschner
56719a5d10 pidl: fix trailing double-quote on last line of s3 server stubs
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-03-20 23:42:34 +00:00
Jo Sutton
f2a3c186c3 pidl: Do not call mapTypeName() on expression
$var_name is not a type name, but an expression, such as ‘r->in.server’.
mapTypeName() will turn this into ‘struct r->in.server’, which makes no
sense.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-02-16 02:41:36 +00:00
Douglas Bagnall
9811762775 pidl: calculate subcontext_size only once per pull
For security_ace_coda in security.idl, the sub-context size is
involves a slightly non-trivial function call which returns a constant
value.

In all other cases, a constant expression is used, and this makes
no difference.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15574
2024-02-08 02:48:44 +00:00
Joseph Sutton
346844b730 librpc: Change type of ‘u16string’ from ‘const uint16_t *’ to ‘const unsigned char *’
A u16string is supposed to contain UTF‐16 code units, but
ndr_pull_u16string() and ndr_push_u16string() fail to correctly ensure
this on big‐endian systems. Code that relies on the u16string array
containing correct values will then fail.

Fix ndr_pull_u16string() and ndr_push_u16string() to work on big‐endian
systems, ensuring that other code can use these strings without having
to worry about first encoding them to little‐endian.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-12-21 23:48:46 +00:00
Joseph Sutton
e3f81fa71e pidl: Make sure to cast whole expressions
$cvar could be an expression such as ‘1 << 10’. In such cases this cast
presumably was intended to apply to the entire expression, not just to
the ‘1’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30 00:02:33 +00:00
Joseph Sutton
3da132a8df pidl: Fix subscripts of dereferenced arrays
Pidl will generate code like the following:

py_out_2 = PyLong_FromLong((uint16_t)*r->out.out[out_cntr_2]);

As the array subscripting operator has a higher precedence than the
indirection (derference) operator, the argument will be evaluated as
(uint16_t)*(r->out.out[out_cntr_2]), which is wrong.

Fix Pidl to generate the following code instead:

py_out_2 = PyLong_FromLong((uint16_t)(*r->out.out)[out_cntr_2]);

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30 00:02:33 +00:00
Joseph Sutton
dbc9c9bd12 pidl: Remove unneeded casts
_pytalloc_get_ptr() returns ‘void *’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30 00:02:33 +00:00
Joseph Sutton
561537adbb pidl: Fix grammar in warning message
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30 00:02:33 +00:00
Joseph Sutton
25988f5d25 pidl: Remove trailing whitespace
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30 00:02:33 +00:00
Joseph Sutton
9d7bce5bbb pidl: Remove unused imports
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30 00:02:33 +00:00
Joseph Sutton
f94b981e86 pidl: Add new ‘u16string’ type
This type represents a UTF‐16–encoded string. These strings are kept
UTF‐16–encoded rather than converted to the Unix charset to be stored in
memory; this avoids issues regarding NULL termination and conversion
between character sets. We want to be able to handle strings that are
not valid UTF‐16.

Not bumping the NDR ABI version, because there hasn’t been an NDR
release since commit c4f281e9ae.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20 21:50:32 +00:00
Joseph Sutton
436814572d pidl: Add a helper function to determine whether a type is a string type
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20 21:50:32 +00:00
Andreas Schneider
9621a3d7a6 Use python.h from libreplace
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15513

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20 15:37:33 +00:00
Günther Deschner
82f021d43d pidl: include scompat headers and servers in s3 server template
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Nov 17 00:39:18 UTC 2023 on atb-devel-224
2023-11-17 00:39:18 +00:00
Joseph Sutton
7a9ad61022 pidl: Don’t overwrite exception set by PyUnicode_AsEncodedString()
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-16 05:18:36 +00:00
Joseph Sutton
ddb98e7d61 pidl: Remove trailing whitespace
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-16 05:18:36 +00:00
Joseph Sutton
c75be6c326 librpc:ndr: Increase size of ‘libndr_flags’ type to 64 bits
This gives us thirty‐two new LIBNDR_ flags to play with.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-01 20:10:45 +00:00
Joseph Sutton
a396b705c8 librpc:ndr: Introduce ‘ndr_flags_type’ type
Instead of ‘int’ or ‘uint32_t’, neither of which convey much meaning,
consistently use a newly added type to hold NDR_ flags.

Update the NDR 4.0.0 ABI.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-01 20:10:45 +00:00
Joseph Sutton
c4f281e9ae librpc:ndr: Introduce ‘libndr_flags’ type
The LIBNDR_FLAG_ namespace is getting dangerously full, with only a
single flag value (1 << 9) remaining for use. After that flag is put
into use, we won’t be able to add any new flags without increasing the
flag width to 64‐bit.

Up to now we’ve used a haphazard mix of int, unsigned, and uint32_t to
store these flags. Introduce a new type, ‘libndr_flags’, to be used
consistently to hold LIBNDR flags. If in the future we find we need to
move to 64‐bit flags, this type gives us an opportunity to do that.

Bump the NDR version to 4.0.0 — an major version increment, for we’re
changing the function ABI and adding the new symbol
ndr_print_libndr_flags.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-01 20:10:45 +00:00
Joseph Sutton
c36163c315 pidl: Fix code spelling
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-25 22:23:37 +00:00
Joseph Sutton
773c36baa0 pidl: Parenthesize expression to be cast
We must parenthesize each expression that is to be cast to a specific
type, otherwise the cast will apply to only part of the full expression.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-01 22:45:38 +00:00
Joseph Sutton
26e40717aa ndr: Parenthesize expressions to be cast
We must parenthesize each expression that is to be cast to a specific
type, otherwise the cast will apply to only part of the full expression.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-01 22:45:38 +00:00
Joseph Sutton
464d86cac5 pidl: Use INT_MAX as enum constant for portability
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27 02:43:28 +00:00
Joseph Sutton
fb39bb1953 pidl: Use portable format specifiers
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27 02:43:28 +00:00
Joseph Sutton
ce43dd0571 ndr: Display values for failed range checks
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9914

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27 02:43:28 +00:00
Joseph Sutton
c87504289f pidl: Fix code spelling
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-11 02:42:41 +00:00
Noel Power
d3f3c40141 pidl/tests: Add tests for hang with nested struct.
make sure hang test calls Parse::Pidl::Typelist::LoadIdl which triggers
part of the hang

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-05 21:18:32 +00:00