1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

3015 Commits

Author SHA1 Message Date
Volker Lendecke
a3dad84630 librpc: Fix CID 1452292 Null pointer dereferences (REVERSE_INULL)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-14 07:39:38 +00:00
Samuel Cabrero
959b77988d s4:librpc/rpc: Use generic roh_connect_channel_send/recv
The HTTP connection code is common to in and out channels.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Aug  7 14:12:40 UTC 2019 on sn-devel-184
2019-08-07 14:12:40 +00:00
Samuel Cabrero
7189eb44d7 s4:librpc/rpc: Add roh_connect_channel_send/recv
Generic function to connect a ROH channel. The use comes later to avoid
duplicated code.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-08-07 12:54:40 +00:00
Ralph Boehme
fc0371b932 s4:lib/http: move to the toplevel
This is going to be used from the s3 RPC server soon...

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
2019-08-07 12:54:40 +00:00
Ralph Boehme
5ae515245c s4:lib/http: use http_conn in http_send_request_send() and http_read_response_send()
Works, tested with

  $ bin/smbtorture -W RIVERSIDE --realm=RIVERSIDE.SITE -s /dev/null \
    -U Administrator%Passw0rd \
    ncacn_http:10.10.11.164[HttpProxy=10.10.11.164:593,HttpUseTls=false,HttpAuthOption=basic,HttpConnectOption=UseHttpProxy] \
    rpc.epmapper.epmapper.Lookup_simple

I get an ACCESS_DENIED error, but I get it over HTTP. :)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
2019-08-07 12:54:40 +00:00
Ralph Boehme
53007b7711 s4:librpc/rpc: use http_connect_send/recv in ncacn_http
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
2019-08-07 12:54:40 +00:00
Douglas Bagnall
0348dd4b31 dcerpc: use anon creds for unknown transport
Otherwise we get a segfault when the NULL creds are dereferenced in cli_credentials_is_anonymous()

 $  python3 -c"from samba.dcerpc.dnsserver import dnsserver; d = dnsserver('addc')"

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): Mon Jul 22 23:37:57 UTC 2019 on sn-devel-184
2019-07-22 23:37:56 +00:00
Douglas Bagnall
2d1c269a9e s4/rpc/py_security: don't deref NULL for invalid values
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-22 22:20:25 +00:00
Andrew Bartlett
88bb8fe43a librpc: Do not generate extra unused client or python bindings with PIDL
This sorts out the idl list into the parts that actually need --python and --client specified
and so speeds up the compile and clarifies the code behaviour.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:33 +00:00
Andrew Bartlett
6f9176e649 librpc: Remove frsblobs.idl
We can now dump public structures using ndrdump, so helper dump functions
are not required any more.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:33 +00:00
Andrew Bartlett
21eec4cf3c librpc: Remove unused RPC_NDR_SERVER_ID
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:33 +00:00
Andrew Bartlett
34206deb35 librpc: Remove unused RPC_NDR_NBT
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:33 +00:00
Andrew Bartlett
f4f0db0c8e librpc: Remove unused RPC_NDR_WINSIF
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:33 +00:00
Andrew Bartlett
8e83667fe4 librpc: Remove unused RPC_NDR_XATTR
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:32 +00:00
Andrew Bartlett
27ad784bfb librpc: Remove unused RPC_NDR_DRSBLOBS
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:32 +00:00
Andrew Bartlett
518227b674 librpc: Remove unused RPC_NDR_NTLMSSP
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-06-26 04:12:32 +00:00
Andrew Bartlett
4f32983ea8 py3: Remove duplicated PyUnicode_Check() after the py3 compat macros were removed
This came about because in py2 we had to check for strings and unicode.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>

Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Jun 24 18:48:53 UTC 2019 on sn-devel-184
2019-06-24 18:48:53 +00:00
Andrew Bartlett
f32779b198 py3: Remove PyStr_AsUTF8AndSize() compatability macro
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24 17:24:27 +00:00
Andrew Bartlett
f178daa854 py3: Remove PyStr_AsString() compatability macro
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24 17:24:27 +00:00
Andrew Bartlett
75d87b29f1 py3: Remove PyStr_FromFormat() compatability macro
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24 17:24:27 +00:00
Andrew Bartlett
34f9a089d8 py3: Remove PyStr_FromString() compatability macro
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24 17:24:27 +00:00
Andrew Bartlett
f498c81966 py3: Remove PyStr_Check() compatability macro
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24 17:24:27 +00:00
Gary Lockyer
92d3795076 winsrepl.idl: remove unused decode functions
Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-06 03:30:18 +00:00
Gary Lockyer
2254d0e4b9 sasl_helpers.idl: remove unused decode functions
Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-06 03:30:18 +00:00
Gary Lockyer
883f2fa3d4 ntp_signd.idl: remove unused decode functions
Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-06 03:30:18 +00:00
Gary Lockyer
e1a4fb5291 s4 lib rpc pyrpc: Fix error message
Fix the error message returned when unable to initialise an event context.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-30 07:12:11 +00:00
Gary Lockyer
3e6661fd73 s4 librpc rpc pyrpc: Fix flapping dcerpc.bare tests
Commit d65b7641c8 had the parameters to
talloc_reparent reversed.  This caused the dcerpc.bare tests to flap.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed May 22 03:03:43 UTC 2019 on sn-devel-184
2019-05-22 03:03:43 +00:00
Noel Power
cc60866990 s4/librpc: squash 'cast between incompatible function types' warning
Where possible make PyCFunction definition signature match. Sometimes
this is not possible (e.g. when the c-function is associated with a
python method definition with 'METH_VARARGS|METH_KEYWORDS' in this
case we use the PY_DISCARD_FUNC_SIG macro.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-05-16 17:55:17 +00:00
Gary Lockyer
d65b7641c8 s4 librpc rpc pyrpc: Ensure tevent_context deleted last
Ensure that the tevent_context is deleted after the connection, to
prevent a use after free.

Note: Py_DECREF calls dcerpc_interface_dealloc so the
TALLOC_FREE(ret->mem_ctx) calls in the error paths of
py_dcerpc_interface_init_helper needed removal.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13932

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-10 08:19:16 +00:00
Douglas Bagnall
eb873af9b5 pyrpc: remove crutch for python <= 2.5
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Douglas Bagnall
0606860308 pyrpc: ndr PY_CHECK_TYPE checks for NULL as well as type
Addresses CID 1361477 and others.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Douglas Bagnall
b289cc19b5 s4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273062)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Douglas Bagnall
353d50a81e s4/rpc/dcerpc_roh_channel_out: check ndr_init (CID 1273065)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-09 22:39:27 +00:00
Andrew Bartlett
71cc89833f libnet: Remove unused source4/libnet/libnet_sam{dump,sync}:
The last caller was removed in samba-tool: Remove C version of samba-tool
(e2af384151) by Amitay Isaacs in 2011

This was a tool to dump a genine NT4 DC (never Samba) into smbpasswd file.

It did work against Windows AD, but DRS replication is much
more comprehensive.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Mon May  6 07:11:51 UTC 2019 on sn-devel-184
2019-05-06 07:11:51 +00:00
Andrew Bartlett
fdb6305c86 build: Remove bld.gen_python_environments()
This was part of --extra-python support.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-03-21 04:06:14 +00:00
Andrew Bartlett
270d04e4ea build: Remove --extra-python
This option is quite invasive in waf and was mainly for the python3 transition.

Testing with multiple python versions can be done by testing a full compile against
multiple versions, likewise multiple different binding versions can be created
the same way.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:14 +00:00
Andreas Schneider
bf469343f5 s4:librpc: Fix installation of Samba
This breaks installation of Samba 4.10 on Fedora.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Mar 20 13:11:28 UTC 2019 on sn-devel-144
2019-03-20 13:11:28 +00:00
Douglas Bagnall
1e8d0d80d9 s4/librpc/py_misc: ParseTuple format should match actual types
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
2019-02-08 13:31:39 +01:00
Noel Power
61670169d5 Clean up reference used with PyDict_Setxxx
PyDictSetxxx methods don't steal reference so if the items added
to the dictionary were created just for the purpose of inserting
into the dict then we need to decref them.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Feb  7 17:17:46 CET 2019 on sn-devel-144
2019-02-07 17:17:46 +01:00
Noel Power
53d973f59c Cleanup references to module objects returned from PyImport_ImportModule
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-02-07 13:44:30 +01:00
Douglas Bagnall
a3aa5af3d5 s4/pyrpc_util: catch alloc failure in py_dcerpc_interface_init_helper()
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
2019-01-29 13:45:32 +01:00
Douglas Bagnall
e23b9f88cc s4/pyrpc_util: appropriately decrement refcounts on failure
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
2019-01-29 13:45:32 +01:00
Douglas Bagnall
1c4ba8e93a pyrpc: typo in transfer syntax docstring
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-01-28 10:29:26 +01:00
Andreas Schneider
7017f245d5 s4:librpc: Use C99 initializer for PyGetSetDef in pyrpc
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:20 +01:00
Andreas Schneider
48285a9c60 s4:librpc: Use C99 initializer for PyGetSetDef in py_auth
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-17 11:35:12 +01:00
Stefan Metzmacher
8bd0f4405a s4:pyrpc: add py_dcerpc_ndr_pointer_deref/wrap() infrastructure
Some idl files use more than one layer of unique pointers. e.g.

    NTSTATUS lsa_GetUserName(
            [in,unique] [string,charset(UTF16)] uint16 *system_name,
            [in,out,ref] lsa_String **account_name,
            [in,out,unique] lsa_String **authority_name
            );

In order to specify *io.in.authority_name = NULL,
we need to wrap the pointer value (lsa_String or None)
into an base.ndr_pointer() object.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-12 03:13:41 +01:00
Stefan Metzmacher
ae467704f3 s4:pyrpc: make use of pytalloc_get_type() in py_dcerpc_syntax_init_helper()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-12 03:13:41 +01:00
Volker Lendecke
6f4b2cc965 pysecurity: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-08 03:40:28 +01:00
Stefan Metzmacher
e27b62762d s4:librpc: add python winspool bindings
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-12-23 18:15:19 +01:00
Stefan Metzmacher
8b153f8440 s4:librpc: add python spoolss bindings
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-12-23 18:15:19 +01:00