summaryrefslogtreecommitdiff
path: root/pidl
Commit message (Collapse)AuthorAgeFilesLines
* pypidl: check the result of py_dcerpc_ndr_pointer_deref()Douglas Bagnall2020-07-061-0/+5
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: rpc_server: Remove dead codeSamuel Cabrero2020-05-241-38/+0
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3: rpc_server: Drop s3 rpc handles implementationSamuel Cabrero2020-05-241-8/+0
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl: Set dce_call in pipes_struct before dispatching callSamuel Cabrero2020-05-241-0/+2
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Fix clang 9 missing-field-initializer warningsGary Lockyer2020-05-081-1/+1
| | | | Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
* Fix clang 9 unused-function warningsGary Lockyer2020-05-081-1/+12
| | | | Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
* pidl: Align integer types in scompat filesVolker Lendecke2020-04-181-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:rpc_server: Improve local dispatchingSamuel Cabrero2020-04-081-168/+25
| | | | | | | | | | | | | Craft core structures to dispatch local calls in the same way as remote ones, removing the special handling in the autogenerated code. This is also necessary to drop s3 rpc handles implementation. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Apr 8 22:23:05 UTC 2020 on sn-devel-184
* py3: Remove #define PyInt_FromLong PyLong_FromLongAndrew Bartlett2020-03-231-3/+3
| | | | | | | This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power
* py3: Remove #define PyInt_AsLong PyLong_AsLongAndrew Bartlett2020-03-231-3/+3
| | | | | | | This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* pidl: Remove reference to PyInt_Type from error string when we wanted a ↵Andrew Bartlett2020-03-231-8/+8
| | | | | | | | | | sensible Long PyInt_Type is no longer a thing in Python3, we will remove the compatability reference shortly. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* pidl: Remove duplicate "if (PyLong_Check($cvar)" clausesAndrew Bartlett2020-03-231-26/+0
| | | | | | | | Since we moved to Python3, these have been dead code, and it is clearer now that we have removed the compatability define. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* py3: Remove #define PyInt_Check PyLong_CheckAndrew Bartlett2020-03-231-2/+2
| | | | | | | | This will allow us to remove some unused code in the PIDL-generated python bindings. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* s3:rpc_server: Remove api_structSamuel Cabrero2020-03-201-34/+0
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:NDR/ServerCompat: Generate local dispatching functionSamuel Cabrero2020-03-202-1/+177
| | | | | | | | To be used in rpcint_binding_handle, prepare to remove legacy api_struct and S3 pidl generated code. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:NDR/ServerCompat: Initialize and allocate out varsSamuel Cabrero2020-03-201-1/+110
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:NDR/ServerCompat: Add dispatch, reply, pull and push functions to headerSamuel Cabrero2020-03-201-4/+8
| | | | | | | Will be used by winspool to forward selected opnums to spoolss. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:NDR/ServerCompat: Retrieve and setup pipes struct before dispatchSamuel Cabrero2020-03-201-9/+103
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:NDR/ServerCompat: Register and unregister legacy api_struct cmdsSamuel Cabrero2020-03-201-1/+30
| | | | | | | | | | Next commits will initialize the registered enpoint servers in S3 RPC server, removing the rpc_{interface}_init calls. The legacy api_struct registration will be registered by the enpoint server initialization code generated by PIDL. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:NDR/ServerCompat: Compat server PIDL parserSamuel Cabrero2020-03-202-0/+504
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl: Add recursive depth checks.Gary Lockyer2020-02-272-0/+8
| | | | | | | | | | | | | | Add new parameter to elements "max_recursion" and modify pidl to call NDR_RECURSION_CHECK and NDR_RECURSION_UNWIND for element tagged with that attribute. Credit to OSS-Fuzz REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19820 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14254 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* build: Do not check if system perl modules should be bundledAndrew Bartlett2020-02-041-7/+0
| | | | | | | | | | | | | We do not ship any perl modules in third_party at this time, so this check is pointless and breaks the build for --bundled-libraries=ALL. As reported by aaptel on https://gitlab.com/samba-team/samba/-/merge_requests/1104#note_281050331 This changes our autobuild script to cover this case in the samba-static job. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pidl/wscript: configure should insist on Parse::Yapp::DriverDouglas Bagnall2020-02-021-3/+7
| | | | | | | | | | | | following 83ffe6752d589180eac96d7b8e7d1a54e3476bfd, you get a build error if you lack a system perl Parse::Yapp. Let's make it a configure failure instead. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sun Feb 2 10:09:11 UTC 2020 on sn-devel-184
* libndr: Return enum ndr_err_code from ndr_{pull,push}_steal_switch_value()Andrew Bartlett2019-12-121-4/+4
| | | | | | | | | | | | | | | | This breaks the ABI so we merge this into the unreleased libndr-1.0.0. The advantage of the new functions is there (except for print, which is unchanged) is an error raised when the token is not found, so we can be confident in the changes to the token behaviour. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13876 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Dec 12 03:56:23 UTC 2019 on sn-devel-184
* pidl: Mismatch between set and get of relative base pointersAndrew Bartlett2019-12-121-5/+5
| | | | | | | | | | | The set was within the switch, the get was before the switch. The difference is shown when there is an empty default element. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13876 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pidl: Add and use ndr_print_steal_switch_value(), removing ↵Andrew Bartlett2019-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | ndr_print_get_switch_value() This avoids really long token lists for switch values that will not be needed past this point. The function name is changed to clarify what exactly is being done here, and the old function is removed to ensure it is not being used anywhere else. Merge the removal of ndr_print_get_switch_value into just-tagged librpc/ABI/ndr-1.0.0.sigs as this has not been put into any release yet. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13876 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pidl: Generate and consume the switch level token for both NDR_SCALARS and ↵Andrew Bartlett2019-12-121-15/+36
| | | | | | | | | | | | | | | | | | | | NDR_BUFFERS in ndr_pull() This means what was previously a list becomes a single variable that could be passed as a function paraemter, but this is avoided for now because it would change the ABI and be more intrusive. Before this, a client could cause a NDR token containing the swith level to be allocated for each and every element in the array that they promised they were sending (without having to actually send them). Found by Michael Hanselmann using Honggfuzz and an fuzzer for Samba's NDR layer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13876 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pidl:NDR/Server: Allow to define endpoint server shutdown functionsSamuel Cabrero2019-12-121-0/+10
| | | | | | | | | | | | | | The next commits will register legacy api_struct when the endpoint server is initialized. This commit adds a shutdown function which will be used to unregister the legacy api_struct. The shutdown function will be also used to replace the rpc_srv_callbacks struct shutdown member used, for example, by the spoolss service to cleanup before exiting. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* librpc:core: Add public functions to initialize endpoint serversSamuel Cabrero2019-12-121-0/+3
| | | | | | | | | | | | | | | The dcesrv_init_registered_ep_servers() will be used by the S3 server to initialize all registered endpoint servers (for embedded services), and the dcesrv_init_ep_server() function will be used by the external daemons to initialize the required ones. As serveral S3 services may require to initialize another one before itself (svcctl and eventlog for example require winreg) a boolean flag is added to track the initialization status. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:NDR/Parser: only include structs in ndr_interface_public_structAndrew Bartlett2019-12-101-4/+16
| | | | | | | | | | | | | We only have ndrdump and the fuzzers set up for structures, not BITMAPS, ENUMS etc. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Dec 10 17:45:46 UTC 2019 on sn-devel-184
* lib/fuzzing: add fuzz_ndr_XDouglas Bagnall2019-12-101-0/+25
| | | | | | | | | | | | | | | | | | This NDR fuzzer links with each "interface" in the IDL files to create avsingle binary. This tries to matches what the fuzzing engines desire. It started as a copy of ndrdump but very little of that remains in place. The fancy build rules try to avoid needing a lof of boilerplate in the wscript_build files and ensure new fuzzers are generated and run when new IDL is added automatically. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Pair-programmed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl/tests/samba-ndr.pl: remove duplicate importDouglas Bagnall2019-12-101-1/+0
| | | | | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Dec 10 04:16:31 UTC 2019 on sn-devel-184
* pidl s4::Python: silence warningsDouglas Bagnall2019-12-101-4/+3
| | | | | | | | - do not redeclare variables in the same scope. - use $1 instead of \1, which perl just prefers. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl Parse::Pidl::NDR: silence two warnings about undefined stringsDouglas Bagnall2019-12-101-2/+2
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl Parse::Pidl::NDR: add HRESULT alignmentDouglas Bagnall2019-12-101-1/+2
| | | | | | | this is a guess Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl Parse::Pidl::NDR: warn of unknown scalar alignmentsDouglas Bagnall2019-12-101-1/+6
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl s4::NDR::Parser: silence a warningDouglas Bagnall2019-12-101-1/+1
| | | | | | | At level 0 there is no previous level so $pl is undefined thus so is ->{TYPE} Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl s4::NDR::Parser: correct has_fast_array logicDouglas Bagnall2019-12-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Here we fix two bugs that cancelled each other out completely, so this patch leaves us with exactly the same functionally as before. Bug 1: In perl, return is *syntactically* a function. That means 'return X or Y' is read as 'return(X) or Y', as in the 'open(X) or die "..."' construct -- Y is only evaluated if return returns false. But return never returns, so Y is dead code. If in doubt, try these: perl -e "sub x {return 0 or die;} x" perl -e "sub x {return (0 or die);} x" What we *meant* here is 'return (X or Y)', BUT it turns out we were confused -- the Y case was bogus. Bug 2: string arrays never had "fast array logic" in the first place. The fast array logic is for arrays of bytes, and can be fast (i.e. memcpy) because there is no endianness to worry about. A string array is an array of pointers not bytes. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl s4::NDR::Parser: read hex numbers as numbers for rangesDouglas Bagnall2019-12-102-5/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hex numbers in IDL are not parsed as numbers, resulting in warnings like Argument 0x2000 isn't numeric in numeric lt (<) at /home/douglas/src/samba/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm line 981 not to mention problematic code. We add a utility function to convert these numbers to numbers. A typical difference this makes is: --- old/default/librpc/gen_ndr/ndr_dcerpc.c 2019-11-30 23:40:32.915816967 +1300 +++ new/default/librpc/gen_ndr/ndr_dcerpc.c 2019-11-30 17:00:09.055733660 +1300 @@ -1893,7 +1893,7 @@ if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ReceiveWindowSize)); - if (r->ReceiveWindowSize > 0x40000) { + if (r->ReceiveWindowSize < 8192 || r->ReceiveWindowSize > 262144) { return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); } NDR_CHECK(ndr_pull_trailer_align(ndr, 4)); Where the minimum ("0x2000" == 8192) was read as a string, thus treated as zero. The treatment as zero was introduced in 142b2a61f8a77b3065ce4c78b459ab714d6d190a accidentially, which shows why warnings are important. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl: use perl warningsDouglas Bagnall2019-12-1040-3/+40
| | | | | | | | Warnings are good. If we turn on warnings with 'use warnings', we will see bugs that have lain latent for years. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl: Remove Parse/Yapp/Driver.pmAndreas Schneider2019-12-101-471/+0
| | | | | | | | | | | This file is provided by Parse::Yapp and on install we overwrite the orignal file. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Dec 10 01:54:02 UTC 2019 on sn-devel-184
* pidl: don't export parser class methodsDouglas Bagnall2019-12-045-16/+1
| | | | | | | | | | | | | | | | | | | These methods are not used or usable as exported functions. The correct (and actual) usage is along these lines; require Parse::Pidl::Samba3::ClientNDR; my $generator = new Parse::Pidl::Samba3::ClientNDR(); my ($c_code,$h_code) = $generator->Parse($ndr, $header, $c_header); where the methods are either explicitly referenced (new A::B::C), or are called from the blessed object, neither of which need exporting. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Dec 4 06:35:06 UTC 2019 on sn-devel-184
* pidl s4/TDR: use Parse::Pidl::BaseDouglas Bagnall2019-12-041-5/+3
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl s4/TDR: use conventional ->{res} nameDouglas Bagnall2019-12-042-11/+11
| | | | | | | rather than ->{ret}, meaning this class can be moved to a Pidl::Base subclass Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl: s4/NDR/Parser uses Pidl::BaseDouglas Bagnall2019-12-041-27/+2
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl s4/NDR/Client: use Pidl::BaseDouglas Bagnall2019-12-041-7/+3
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl s4/NDR/Client: fix pidl_both()Douglas Bagnall2019-12-041-1/+1
| | | | | | | | This function was clearly meant to be adding output to both the .c and .h files, but was only adding it to the .h due to a typo. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl s4::Python uses Pidl::BaseDouglas Bagnall2019-12-041-31/+3
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl:: adjust s4::Python pidl_hdr() to be the same as othersDouglas Bagnall2019-12-041-9/+8
| | | | | | | | The common case is for pidl_hdr() to add a "\n", which we can easily do here, allowing this to be merged into the Pidl::Base borg. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pidl Samba3::ClientNDR uses Pidl::BaseDouglas Bagnall2019-12-041-5/+3
| | | | | | | | We need to modify the '@ISA = ' line, because it overwrites the inheritance from Pidl::Base. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>