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

402 Commits

Author SHA1 Message Date
Jeremy Allison
fe2ac3e304 s4: COM: Remove talloc_autofree_context() from (unused) COM code.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-07-26 21:35:21 +02:00
Günther Deschner
a44bce6dfa libndr/compression: pass down compressed length in ndr_pull_compression_start
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-07-19 21:22:13 +02:00
Stefan Metzmacher
81bbfb0105 pidl:NDR/Parser: add missing {start,end}_flags() to ParseElementPrint()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2017-06-27 16:57:43 +02:00
Stefan Metzmacher
823bc4c07a pidl:NDR/Parser: initialize [skip] values in ndr_pull_*
It's too dangerous to leave values uninitialzed!
[skip_noinit] can be used if required.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2017-06-26 08:47:14 +02:00
Stefan Metzmacher
b922472fd6 pidl:NDR/Parser: add "skip_noinit" element
In future "skip" will be changed to initialize the element
with ZERO_STRUCT() on ndr_pull_*.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2017-06-26 08:47:14 +02:00
Stefan Metzmacher
3bc6b55385 pidl:NDR/Parser: fix "skip" for pointers
We should handle the "skip" at the element level before
we traverse trough the element levels.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2017-06-26 08:47:14 +02:00
Volker Lendecke
67040cf612 pidl: Fix array range checks in python output
Without this, we generated code like

if (ndr_table_dnsserver.num_calls < 0) {
        PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_DnssrvOperation_ndr_pack");
        return NULL;
}
call = &ndr_table_dnsserver.calls[0];

This does not really make sense, and Coverity found comparing the unsigned
num_calls against <0 a bit pointless.

Should fix 138 Coverity findings and make the code a bit more correct.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-06-20 18:50:06 +02:00
Petr Viktorin
40e409bf9e python3: Use "y#" instead of "s#" for binary data in PyArg_ParseTuple
The "s#" format code for PyArg_ParseTupleAndKeywords and Py_BuildValue
converts a char* and size to/from Python str (with utf-8 encoding under
Python 3).
In some cases, we want bytes (str on Python 2, bytes on 3) instead. The
code for this is "y#" in Python 3, but that is not available in 2.

Introduce a PYARG_BYTES_LEN macro that expands to "s#" or "y#", and use
that in:
- credentials.get_ntlm_response (for input and output)
- ndr_unpack argument in PIDL generated code

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-05-19 22:20:15 +02:00
Jeremy Allison
9703464b94 pidl: Fix Coverity warnings from duplicate NULL checks.
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat May  6 16:03:17 CEST 2017 on sn-devel-144
2017-05-06 16:03:17 +02:00
Jeremy Allison
306783d6f5 lib: modules: Change XXX_init interface from XXX_init(void) to XXX_init(TALLOC_CTX *)
Not currently used - no logic changes inside.

This will make it possible to pass down a long-lived talloc
context from the loading function for modules to use instead
of having them internally all use talloc_autofree_context()
which is a hidden global.

Updated all known module interface numbers, and added a
WHATSNEW.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Böhme <slow@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 22 01:17:00 CEST 2017 on sn-devel-144
2017-04-22 01:17:00 +02:00
Lumir Balhar
2de5fa45e0 python: pidl: Port Python interface generator
Port PIDL generator of Python interfaces to generate interfaces in
Python 3 compatible form.

Python 2.7 is now required, so we can use PyCapsule in both versions.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Pair-programmed-by: Andrew Bartlett <abartlet@samba.org>
2017-03-10 07:31:11 +01:00
Stefan Metzmacher
2170f55629 pidl:Python: use of pytalloc_GenericObject_reference*() for pyrpc_{ex,im}port_union() wrapping
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12601

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Feb 25 06:33:33 CET 2017 on sn-devel-144
2017-02-25 06:33:33 +01:00
Stefan Metzmacher
1ee0c0f828 pidl:Python: replace pytalloc_CObject_FromTallocPtr() with pytalloc_GenericObject_reference_ex()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12601

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-25 02:39:11 +01:00
Stefan Metzmacher
d62eb3cc9f pidl:Python: make sure print HASH references for STRUCT types
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12601

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-25 02:39:11 +01:00
Günther Deschner
d30b008a64 pidl: use ndr_push_charset_to_null() when [to_null] keyword is used in IDL
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-01-24 10:53:17 +01:00
Andrew Bartlett
ffb8b50e3c s4-rpc_server: Allow each interface to declare if it uses handles
This will allow the NETLOGON server in the AD DC to declare that it does not use
handles, and so allow some more flexibility with association groups

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-12-20 01:11:23 +01:00
Andrew Bartlett
31d625bcd2 s4-rpc_server: Add back support for lsa over \\pipe\\netlogon optionally
The idea here is that perhaps some real client relies on this (and not just Samba torture
commands), so we need a way to support it for the 4.6 release.

If no such client emerges, it can be deprecated and removed in the normal way.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-12-15 08:21:12 +01:00
Andrew Bartlett
50dff7e094 pidl: Make dcesrv\_$name\_interface "static const"
This moves it out of the global namespace

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Dec  8 13:25:57 CET 2016 on sn-devel-144
2016-12-08 13:25:57 +01:00
Andrew Bartlett
c6c1463852 pidl: Make static struct api_struct also const
This moves the table to read-only memory

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-12-01 05:54:22 +01:00
Andrew Bartlett
d368ee2298 pidl: Change *_get_pipe_fns() to return const struct api_struct *
This will allow the table to be made static const in the next commit

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-12-01 05:54:22 +01:00
Andrew Bartlett
778fc58eb2 pidl: Use a static const initialised struct in dcerpc_server_$name_init(void)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-12-01 05:54:22 +01:00
Alexis La Goutte
3c9d703d45 Fix typo
Fix (minor) typo found in wireshark with lintian tools
https://code.wireshark.org/review/#/c/18485/

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-12-01 05:54:21 +01:00
Stefan Metzmacher
57539c8441 pidl:Python: add PyTypeObject objects for function structs
They provide get/set methods for the in_* and out_* elements
and the magic __ndr_{push,pull,print}_{in,out}__ hooks to enable
the marshalling via ndr_{push,pull,print}_{in,out}().

This provides an easy way to generate and parse the payload of
DCERPC requests and responses, which is very useful for writing
tests.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:19 +02:00
Stefan Metzmacher
a546124f10 pidl:Python: split out a PythonElementGetSet() helper function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:19 +02:00
Stefan Metzmacher
d5e4707e98 pidl:NDR: add ReturnTypeElement() helper function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:19 +02:00
Stefan Metzmacher
4017561351 pidl:Python: the py_{import,export}_*() functions can be static now.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:19 +02:00
Stefan Metzmacher
f7707c04a5 pidl:Python: make use of the pyrpc_{import,export}_union() functions
This avoids the linking problems at C shared object level.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:19 +02:00
Stefan Metzmacher
e0324c0cf7 pidl:Python: provide a PyTypeObject with METH_CLASS __import__() and __export__() hooks
These are wrappers around the currently public C functions
'py_import_*() and 'py_export_*().

In order to let other python module use these function, we should
resolve the needed type object and call the __import__() or __export__()
hooks instead of linking to the other shared module at C level.

We already do the same for structs.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:19 +02:00
Stefan Metzmacher
3a0ce3e41d pidl:Python: provide the abstract syntax as <module>.<interface>_abstract_syntax
The <module>.abstract_syntax alias is only kept as legacy for
the first interface in a module.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:18 +02:00
Stefan Metzmacher
1bebccaeb9 pidl:Python: prettify names of constants
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:18 +02:00
Stefan Metzmacher
7423d8106e pidl:NDR: keep interface->{ORIGINAL}
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:18 +02:00
Stefan Metzmacher
a560116aa5 pidl:Python: improve the .doc string for the get/set elements
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:18 +02:00
Stefan Metzmacher
47b40ac96a pidl:Python: make use of NDR_ERR_CODE_IS_SUCCESS()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:18 +02:00
Stefan Metzmacher
d4660e8697 pidl:Python: __ndr_print__ functions don't get arguments and need METH_NOARGS
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:18 +02:00
Stefan Metzmacher
b728c63bcb pidl:Python: check the return values of talloc_ptrtype()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-26 11:20:18 +02:00
Günther Deschner
45748aeb59 pidl: in s3 server templates, support default HRESULT error returns.
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-11 19:57:25 +02:00
Günther Deschner
0ee5c9997e pidl: Keep case from fieldnames.
Change-Id: I5626cfa0487cc88eb65cc349c05ae1762bc953f4
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-on: https://code.wireshark.org/review/16720
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-09-07 12:09:17 +02:00
Günther Deschner
d569bda1e5 pidl: support HRESULT as return code in wireshark autogenerated dissectors.
Guenther

Change-Id: I68b7c579c5a519e429d2f4c2b3f63247e02f24e3
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-on: https://code.wireshark.org/review/16718
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-09-06 23:17:21 +02:00
Aurelien Aptel
2d348bdb8d pidl/ws: fix missing $name when generating MAPI dissector
Port Wireshark commit 0e80176

Author: Alexis La Goutte <alexis.lagoutte@gmail.com>
Date:   Fri Mar 4 19:28:26 2016 +0100

    PIDL (NDR): fix missing $name when regenerate MAPI dissector

    Issue coming from ge41f08858b

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun 20 16:20:00 CEST 2016 on sn-devel-144
2016-06-20 16:20:00 +02:00
Aurelien Aptel
0757c57d99 pidl/ws: fix failing tests
This commit fixes 2 test failures in Pidl test suite.

- commit 02cd7808 changed the error the test was expecting
  => update expected output in the test
- commit c76b65e changed whitespaces in the output
  => revert to the old output in the generator

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
8a691e5aff pidl/s4/python: typo in comment
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
deabf7ab07 pidl/ws: directly use di param instead of casting private_data member.
As in Wireshark repo.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
97eda222d0 pidl/ws: Document CODE_START and HEADER_START
Port Wireshark commit 833d315

Author: Guy Harris <guy@alum.mit.edu>
Date:   Mon Jan 13 21:18:29 2014 +0000

    Document {CODE,HEADER} {START,END}.

    Clean up indentation.

    svn path=/trunk/; revision=54721

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
b18d075e5c pidl/ws: whitespace cleanup
Imported from the WS repo.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
372b41eede pidl/ws: Add HEADER START/HEADER END in ws dissector
Port Wireshark commit a297950

Author: Guy Harris <guy@alum.mit.edu>
Date:   Mon Jan 13 21:05:44 2014 +0000

    Add HEADER START and HEADER END, similar to CODE START and CODE END, to
    allow stuff to be put into the .h file; that way, if you put helper
    functions into the .c file, for use by dissectors other than the one
    being generated, you can put declarations for them into the .h file.

    Do some checks for mis-nesting of CODE and HEADER blocks.

    Clean up the "this is generated code" header.

    svn path=/trunk/; revision=54720

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
0d209ea24b pidl/ws: dereference pointers when passing name param.
Port parts of Wireshark commit a58c986f to the samba repo.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
57bc1ced67 pidl/ws: Remove pinfo->private_data from DCERPC dissectors.
Sort of re-apply Wireshark commit 79cd356 which was never sync with
samba. It was reverted then reintroduced in the WS repo (yes this is
quite convulted).

Original commit message:

Author: Michael Mann <mmann78@netscape.net>
Date:   Wed Nov 6 12:36:09 2013 +0000

    Remove pinfo->private_data from DCERPC dissectors.  Bug 9387 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9387)

    This is the PIDL input file changes necessary to support removing pinfo->private_data from the DCERPC dissectors in favor of passing it through function parameters.  I didn't regenerate the dissector source, so this is just a "good faith" effort to mimic the manual changes.

    svn path=/trunk/; revision=53098

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
498189087b pidl/ws: remove any starting _ in WS field names
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:21 +02:00
Aurelien Aptel
cafb68fdc4 pidl/ws: avoid trailing tabs
Port Wireshark commit 4f04a3c

Author: Stefan Metzmacher <metze@samba.org>
Date:   Thu Oct 29 08:32:52 2015 +0100

    tools/pidl: avoid trailing tabs

    Change-Id: I293dd6f2d7ff3b0e27bc3cc49e69977604f12260
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Reviewed-on: https://code.wireshark.org/review/11433
    Reviewed-by: Anders Broman <a.broman58@gmail.com>

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:20 +02:00
Aurelien Aptel
bce85437b6 pidl: use https urls and update dead msdn link
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-06-20 12:08:20 +02:00