summaryrefslogtreecommitdiff
path: root/pidl
Commit message (Collapse)AuthorAgeFilesLines
* librpc: Always call ndr_push_compression_state_init() for compressionAndrew Bartlett2023-05-051-3/+3
| | | | | | | | | | | | | | | | | | This allows the push routine to cache the chosen compression algorithm in the struct ndr_compression_state in ndr->cstate and so, in claims, avoid calling ndr_size_CLAIMS_SET_NDR() three times per compression (more in the overall push). As claims is now the primary use of the libndr compression code, this is a reasonable tradeoff compared to the other callers who have more static algorithm selections. By removing the struct ndr_compression_state **state argument from ndr_push_compression_state_init() we make clear that the ndr->cstate belongs to this NDR context, and this context alone. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
* librpc/ndr: Make ndr_push_compression_state_free() a talloc destructorAndrew Bartlett2023-03-311-1/+1
| | | | | | | This means that the generic_mszip_free() will still be called on failure. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* pidl: Automatically manage creating and freeing the compression state in ↵Andrew Bartlett2023-03-311-0/+2
| | | | | | | | | | generated code Manually written code will handle this differently, but for generated code this will create and free the context. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* libndr/ndr: Remove unused argument from ndr_push_compression_{start,end}()Andrew Bartlett2023-03-311-4/+2
| | | | | | | | Removing the unused arguments avoids thier value being calculated in the PIDL generated code, which can be expensive. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* pidl: Allow variable expansion (eg of a value() attribute) in ↵Andrew Bartlett2023-03-311-7/+7
| | | | | | | compression_alg argument Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* pidl: avoid py compile issues with --pidl-developerDouglas Bagnall2023-02-031-4/+4
| | | | | | | | | | | | | | | | We get these warnings-as-errors: librpc/gen_ndr/py_netlogon.c:61903:53: error: stray ‘\’ in program 61903 | PyErr_Format(PyExc_TypeError, "Expected type %s",\ //<PIDL> Parse::Pidl::Samba4::Python::ConvertObjectFromPythonData lib/Parse/Pidl/Samba4/Python.pm:2005 but the '\' is unnecessary and unconventional anyway, since we're in a function argument list. 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): Fri Feb 3 03:27:54 UTC 2023 on atb-devel-224
* rpc_server3: Remove pipes_struct->authVolker Lendecke2022-01-051-6/+0
| | | | | | | Replace with a call to dcesrv_call_auth_info(p->dce_call) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* rpc_server3: Remove pipes_struct->session_infoVolker Lendecke2022-01-051-7/+1
| | | | | | | | | This is a big patch, but all it does is replace all "p->session_info" with "session_info" after introducing a local variable from dcesrv_call_session_info(p->dce_call). Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* rpc_server3: Remove pipes_struct->pipe_boundVolker Lendecke2022-01-051-5/+0
| | | | | | | Only used in pipe_access_check(), superseded by dcesrv_call_auth_info() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:rpc_server: Activate samba-dcerpcdVolker Lendecke2021-12-101-96/+1
| | | | | | | | | | | | | | This is the big switch to use samba-dcerpcd for the RPC services in source3/. It is a pretty big and unordered patch, but I don't see a good way to split this up into more manageable pieces without sacrificing bisectability even more. Probably I could cut out a few small ones, but a major architechtural switch like this will always be messy. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* rpc_server3: Remove "pipes_struct->opnum"Volker Lendecke2021-10-081-2/+0
| | | | | | | Also available via dce_call->pkt.u.request.opnum Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:rpc_server: Do not use the default ncalrpc endpoint for external servicesSamuel Cabrero2021-09-211-2/+52
| | | | | | | | | | | | | | | | | | | | | In samba3 it is possible to run some services externally, for example: rpc_daemon:lsasd = fork rpc_server:netlogon = disabled rpc_server:samr = external rpc_server:lsarpc = external The external services running in separate processes have to use its own dedicated ncalrpc endpoint, otherwise will race with main smbd serving the embedded services to accept connections on ncalrpc default socket. If the connection ends in an external process and the client tries to bind to an interface not registered there (like winreg for example) the bind will fail. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Sep 21 11:00:01 UTC 2021 on sn-devel-184
* pidl:NDR/ServerCompat.pm: Do not register disabled servicesSamuel Cabrero2021-09-211-0/+8
| | | | | | | | | | | | In samba3 it is possible to disable RPC services, for exapmle: rpc_server:netlogon = disabled If a service is disabled do not register the interface neither create its endpoint. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* pidl: Avoid leaving array_size NDR tokens aroundAndrew Bartlett2021-06-021-2/+15
| | | | | | | | | | | | | | | | | | In many cases these can and should be consumed as soon as they are used. This is not a complete fix, we don't clean up the array_size token after using it split between an NDR_SCALARS and an NDR_BUFFERS pass, but it is much better than it was and helps the winbind case with a large number of groups (eg 100,000) as otherwise we hit the 65535 NDR token limit. (This is an arbitary Samba-only limit to avoid DoS conditions) BUG: https://bugzilla.samba.org/show_bug.cgi?id=14710 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* pidl: Avoid leaving array_length NDR tokens aroundAndrew Bartlett2021-06-021-3/+8
| | | | | | | | | | In many cases these can and should be consumed as soon as they are used. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14710 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* libndr: Return error code from ndr_token_peek()Andrew Bartlett2021-06-021-6/+7
| | | | | | | | | | | | | This makes it safer to change our code to remove tokens after use if failing to obtain a token would result in an error. This means changing ndr_get_array_size() and ndr_get_array_length() to also return an error code. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14710 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* pidl: Handle assigning to an inline array from PythonJoseph Sutton2021-05-281-1/+5
| | | | | | | | | | | | | | | | When obtaining a reference to items in an assigned-from list, ensure that we do not try to use the first element of the inline array as a talloc context, but instead use the talloc context associated with the Python object. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14065 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri May 28 09:50:02 UTC 2021 on sn-devel-184
* pidl: set the per-request memory context in the pidl generatorRalph Boehme2021-03-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | The talloc memory context referenced by the pipe_struct mem_ctx member is used as talloc parent for RPC response data by the RPC service implementations. In Samba versions up to 4.10 all talloc children of p->mem_ctx were freed after a RPC response was delivered by calling talloc_free_children(p->mem_ctx). Commit 60fa8e255254d38e9443bf96f2c0f31430be6ab8 removed this call which resulted in all memory allocations on this context not getting released, which can consume significant memory in long running RPC connections. Instead of putting the talloc_free_children(p->mem_ctx) back, just use the mem_ctx argument of the ${pipename}_op_dispatch_internal() function which is a dcesrv_call_state object created by dcesrv_process_ncacn_packet() and released by the RPC server when the RPC request processing is finished. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14675 CI: https://gitlab.com/samba-team/samba/-/merge_requests/1861 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* pidl: use unused attribute only if supported by feature macroBjörn Jacke2020-11-101-1/+3
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* 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>