summaryrefslogtreecommitdiff
path: root/pidl/lib
AgeCommit message (Collapse)AuthorFilesLines
2025-11-05wireshark-pidl: Don't warn about unused hfs used in CODE blocksJohn Thacker1-1/+12
From the Wireshark development branch: commit 4f55543f6b6e5c5d15572889a2cac2b0ec28200e Author: John Thacker <johnthacker@gmail.com> Date: Fri Oct 10 11:10:13 2025 -0400 pidl: Check if a hf is used in a CODE block If a field declared in a conformance file appears within a custom CODE block in the conformance file, don't warn about the hf being unused. This theoretically could have false negatives if a field is mentioned only in a comment in the CODE block; we'd have to remove the comments with something like Regexp::Common before searching to avoid that. The current conformance files in the Wireshark distribution don't have any such false negative cases, but there are dozens of false positives prevented by this change. Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Nov 5 11:12:35 UTC 2025 on atb-devel-224
2025-11-05wireshark-pidl: Do not calculate functions replaced by manual codeJohn Thacker1-15/+17
From the Wireshark development branch: commit d2232d7e51640e0e736d7b8df1b21598a21a1c85 Author: John Thacker <johnthacker@gmail.com> Date: Fri Oct 10 23:02:58 2025 -0400 pidl: Do not produce a function that is replaced by MANUAL code If a MANUAL directive in a conformance file causes a function not to be emitted, do not bother calculating the function that will not be used. This is similar to the NOEMIT directive, but has different logic because MANUAL only prevents emitting the function for one level of an element instead of all the functions and variables. This does not change the dissectors produced at all, only skips some unnecessary compilation. In particular, the messages when compiling the pidl-dissectors target: dnsserver.idl:159: error: Inline arrays not supported eventlog.idl:54: error: Inline arrays not supported are no longer inaccurately produced. The inline arrays in those two IDL files have long been supported through the MANUAL code blocks. Expand on the error message to suggest the use of MANUAL directives for implementation. Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-11-05wireshark-pidl: Fix filter names for subcontext length fieldsJohn Thacker1-1/+1
From the Wireshark development branch: commit e3d8636109182d7e243eea6216af7f14edda3227 Author: John Thacker <johnthacker@gmail.com> Date: Thu Oct 9 20:06:43 2025 -0400 pidl: Fix filter names for subcontext length fields The Perl variable $_->{NAME} never exists at the point in the code; $e->{NAME} is almost surely intended instead, which makes the subcontext length field have the same filter name as the parent field with ".subcontext" added. This changes a few fields, including making some fields in the same struct or union that incorrectly shared a filter name now have unique filter names. Also prevents Perl warnings: Use of uninitialized value in concatenation (.) or string at /builds/wireshark/wireshark/tools/pid l/lib/Parse/Pidl/Wireshark/NDR.pm line 438. Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-11-05wireshark-pidl: Check for undefined SwitchType firstJohn Thacker1-13/+15
From the Wireshark development branch: commit edc98c1b537cbd7b8fb35cdb8b61b7dd000a1544 Author: John Thacker <johnthacker@gmail.com> Date: Thu Oct 9 18:31:35 2025 -0400 pidl: Check for undefined SwitchType first If the switch type is not defined (e.g. in a union with no discriminant) check for that first instead of doing a bunch of comparisons with an uninitialized scalar variable. Doesn't change the dissector results, but prevents a bunch of Perl warnings: Use of uninitialized value $t in hash element at /wireshark/tools/pidl/lib/Parse/Pidl/Typelist.pm line 194. Use of uninitialized value in string eq at /wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l ine 480. Use of uninitialized value in string eq at /wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l ine 482. Use of uninitialized value in string eq at /wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l ine 484. Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-11-05wireshark-pidl: Warn appropriately on unsupported switch_is discriminantsJohn Thacker1-1/+4
From the Wireshark development branch: commit 448a0d6a239f3f274d3a3a3a39ea9c6ce7fd2611 Author: John Thacker <johnthacker@gmail.com> Date: Thu Oct 9 10:18:07 2025 -0400 pidl: Warn appropriately on unsupported switch_is discriminants Microsoft's MIDL supports switch_is discriminants which have limited C-language expressions including conditionals, logical, relational, and arithmetic expressions. [1] Some of the distributed IDL files include such expressions. The current handling in PIDL's Wireshark NDR.pm only supports a single identifier (possibly a pointer), which appears to be the way it is defined in the original DCE IDL. [2,3] In addition, the switch_is discriminant may simply be misspelled or otherwise not found when parsing, leading to an empty array reference. Test for the empty array in order to produce a helpful warning message with the filename and line number, instead of unhelpful Perl warnings. This does not provide support for the construct not affect the generated dissectors at all, only reduces 4 unclear warnings into a single useful warning. Before: Use of uninitialized value $name in string ne at /home/johnthacker/wireshark/tools/pidl/lib/Parse/ Pidl/Wireshark/NDR.pm line 516. Use of uninitialized value in string eq at /home/johnthacker/wireshark/tools/pidl/lib/Parse/Pidl/W ireshark/NDR.pm line 525. Use of uninitialized value $name in string ne at /home/johnthacker/wireshark/tools/pidl/lib/Parse/ Pidl/Wireshark/NDR.pm line 527. Use of uninitialized value $name in string ne at /home/johnthacker/wireshark/tools/pidl/lib/Parse/ Pidl/Wireshark/NDR.pm line 531. After: drsuapi.idl:828: warning: ctr switch_is discriminant `level|(type<<16)' not found. (Only single id entifiers are supported, not expressions as in MIDL.) [1] - https://learn.microsoft.com/en-us/windows/win32/midl/switch-is [2] - https://pubs.opengroup.org/onlinepubs/9629399/chap4.htm#tagcjh_08_02_12 [3] - https://pubs.opengroup.org/onlinepubs/9629399/chap4.htm#tagcjh_08_04 Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-11-05wireshark-pidl: Reduce Perl strict warningsJohn Thacker1-1/+1
From the Wireshark git development branch: commit 8dee8601776175a6132bef7ab19f36ee3d589d06 Author: John Thacker <johnthacker@gmail.com> Date: Wed Oct 8 17:15:56 2025 -0400 pidl: Use has_property to avoid comparing undef with the empty string Prevents a bunch of (harmless) warnings when compiling: Use of uninitialized value in string eq at /builds/wireshark/wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm line 521. Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-11-05wireshark-pidl: Reduce false positive warnings when compilingJohn Thacker1-1/+8
From the Wireshark git repository, to reduce false positive warnings when compiling dissectors with pidl: commit 919f15ab2ea313d69cc2578426430f22f65a51b5 Author: John Thacker <johnthacker@gmail.com> Date: Wed Oct 8 16:52:09 2025 -0400 pidl: Don't warn about params that are used The "USED" indicator is never set for params, which results in many bogus "warning: dissector param never used" messages when compiling the pidl dissectors. Set it when used, to reduce the number of messages. Signed-off-by: John Thacker <johnthacker@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-08-27pidl: Validate Python bytes objectsJennifer Sutton1-0/+6
Signed-off-by: Jennifer Sutton <jennifersutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-02-17pidl: Update documentation for DCERPC interface connectionsAndreas Schneider1-5/+24
https://realpython.com/documenting-python-code/ BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-01-29s4:pyrpc: allow connections with raise_result_exceptions=FalseStefan Metzmacher1-2/+1
This is needed in order to do useful tests with specific error codes and still checking all other out parameters. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29pidl:Python: prepare code to avoid NTSTATUS/WERROR exceptionsStefan Metzmacher1-12/+87
They are returned as additional result. It means callers can look at all out params, even if the status is an error. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29pidl:Python: handle NTSTATUS/WERROR exceptions firstStefan Metzmacher1-5/+9
If we raise an exception we should not leak temporary python objects. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29pidl:Python: separate logic to calculate the signature stringStefan Metzmacher1-4/+12
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29pidl:Python: check PyTuple_New() return valueStefan Metzmacher1-0/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29pidl:Python: initialize pointers and add 'result' at the endStefan Metzmacher1-3/+5
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29pidl:Python: introduce $is_raisable_return helper variableStefan Metzmacher1-2/+7
No change in the generated code. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29pidl:Python: generate nicer code for PyNdrRpcMethodDef arraysStefan Metzmacher1-2/+16
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-12-05pidl/Python: allow ndr_print(print_secrets=True)Stefan Metzmacher1-9/+59
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-08-27pidl: Add headerhelper idl propertyVolker Lendecke2-0/+8
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-27pidl:Samba4/Header: only include ntstatus.h if requiredStefan Metzmacher1-10/+16
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-27pidl: add scalarTypeUsed() helper to find if a type was actually used...Stefan Metzmacher1-2/+13
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-27pidl: replace.h is sufficient in ndr_*.cVolker Lendecke1-1/+1
Avoid a few uses of includes.h Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jennifer Sutton <jsutton@samba.org>
2024-07-12pidl: Wireshark: Another C99 type conversionJohn Thacker1-2/+3
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-12pidl: Wireshark: Don't assign hash undef, assign it an empty arrayJohn Thacker1-2/+2
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-12pidl: Wireshark: Remove init of proto variablesJohn Thacker1-1/+1
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-12pidl: Wireshark: Convert the pidl dissector generation code to C99 typesJohn Thacker1-22/+22
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-12pidl: Wireshark: Const-ify dcerpc_sub_dissector structures.John Thacker1-1/+1
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-12pidl: Wireshark: Don't initialise static hf and ett variables.John Thacker1-2/+2
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-12pidl: Update Wireshark generated DRSUAPI codeJohn Thacker1-10/+4
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-03Revert "pidl: Use non-existent function dissect_ndr_int64()"John Thacker1-1/+1
This reverts commit a836b433ed7f0acca546558d2aec359155999f30. 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-03pidl:Wireshark Fix the type of array of pointerse to hf_ valuesJohn Thacker1-1/+1
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-03pidl:Wireshark Rename tvb_new_subset()John Thacker1-1/+1
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-03pidl:Wireshark Get rid of Boolean "flags" with no bit setJohn Thacker1-12/+17
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-03pidl:Wireshark Fix array of pointers NULL terminationJohn Thacker1-0/+1
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-03pidl:Wireshark Use proto_tree_add_bitmask_with_flagsJohn Thacker1-25/+44
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-05-31pidl:python: Exception if unconvertable in ConvertObjectToPythonLevelDouglas Bagnall1-0/+4
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-05-31pidl:python: properly raise exception in ConvertObjectFromPythonDataDouglas Bagnall1-1/+2
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-31pidl:Typelist: resolveType(): don't mistake a reference for a nameDouglas Bagnall1-2/+12
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-03-21pidl: add "return ENOTSUP" for int return type in s3 templateGünther Deschner1-0/+2
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-20pidl: fix trailing double-quote on last line of s3 server stubsGünther Deschner1-1/+1
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-02-16pidl: Do not call mapTypeName() on expressionJo Sutton1-2/+1
$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-08pidl: calculate subcontext_size only once per pullDouglas Bagnall1-2/+3
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
2023-12-21librpc: Change type of ‘u16string’ from ‘const uint16_t *’ to ↵Joseph Sutton2-2/+2
‘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-11-30pidl: Make sure to cast whole expressionsJoseph Sutton1-2/+2
$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-30pidl: Fix subscripts of dereferenced arraysJoseph Sutton1-4/+4
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-30pidl: Remove unneeded castsJoseph Sutton1-6/+6
_pytalloc_get_ptr() returns ‘void *’. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20pidl: Add new ‘u16string’ typeJoseph Sutton3-3/+37
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 c4f281e9ae36c225b6003e0fa1cb8fb2e67bf543. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20pidl: Add a helper function to determine whether a type is a string typeJoseph Sutton4-7/+15
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20Use python.h from libreplaceAndreas Schneider1-1/+1
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-17pidl: include scompat headers and servers in s3 server templateGünther Deschner1-1/+6
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