summaryrefslogtreecommitdiff
path: root/libcli/nbt
AgeCommit message (Collapse)AuthorFilesLines
2024-07-16libcli:nbt: Initialize struct nbt_name_registerAndreas Schneider1-2/+2
"Error: UNINIT (CWE-457): samba-4.20.0rc2/libcli/nbt/pynbt.c:277: var_decl: Declaring variable ""io"" without initializer. samba-4.20.0rc2/libcli/nbt/pynbt.c:305: uninit_use_in_call: Using uninitialized value ""io.in.nb_flags"" when calling ""nbt_name_register"". 303| return NULL; 304| 305|-> status = nbt_name_register(node->socket, NULL, &io); 306| 307| if (NT_STATUS_IS_ERR(status)) {" Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2024-04-16lib: Give lib/util/util_file.c its own header fileVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2024-04-05libcli/nbt: add nbt_name_send_raw()Stefan Metzmacher2-0/+47
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15620 Signed-off-by: Stefan Metzmacher <metze@samba.org> 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-01librpc:ndr: Introduce ‘ndr_flags_type’ typeJoseph Sutton1-5/+5
Instead of ‘int’ or ‘uint32_t’, neither of which convey much meaning, consistently use a newly added type to hold NDR_ flags. Update the NDR 4.0.0 ABI. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27ndr: Display values for failed range checksJoseph Sutton1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9914 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-07librpc/nbt: Avoid reading invalid member of unionJoseph Sutton1-17/+3
WACK packets use the ‘data’ member of the ‘nbt_rdata’ union, but they claim to be a different type — NBT_QTYPE_NETBIOS — than would normally be used with that union member. This means that if rr_type is equal to NBT_QTYPE_NETBIOS, ndr_push_nbt_res_rec() has to guess which type the structure really is by examining the data member. However, if the structure is actually of a different type, that union member will not be valid and accessing it will invoke undefined behaviour. To fix this, eliminate all the guesswork and introduce a new type, NBT_QTYPE_WACK, which can never appear on the wire, and which indicates that although the ‘data’ union member should be used, the wire type is actually NBT_QTYPE_NETBIOS. This means that as far as NDR is concerned, the ‘netbios’ member of the ‘nbt_rdata’ union will consistently be used for all NBT_QTYPE_NETBIOS structures; we shall no longer access the wrong member of the union. Credit to OSS-Fuzz. REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38480 BUG: https://bugzilla.samba.org/show_bug.cgi?id=15019 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Fri Jul 7 01:14:06 UTC 2023 on atb-devel-224
2023-01-10lib: Remove idtree from samba_util.hVolker Lendecke1-0/+1
No need to recompile the world when only a few files need this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-10lib: Add "starting_id" to idr_get_new_random()Volker Lendecke1-1/+2
To be used in smbXsrv_open.c, for this we need a lower bound. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-10nmblookup: don't ignore unknown optionsRalph Boehme1-0/+5
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14828 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-06-20libcli:nbt: Migrate nmblookup4 to new cmdline option parserAndreas Schneider2-11/+41
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-09-15libcli: nbt: Fix resolve_lmhosts_file_as_sockaddr() to return size_t * count ↵Jeremy Allison2-7/+2
of addresses. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
2020-09-15libcli: nbt: cleanup resolve_lmhosts_file_as_sockaddr() - don't change ↵Jeremy Allison1-10/+21
return values on fail. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
2020-08-04s3/s4: Cleanup. Move TALLOC_CTX * parameter to be first in ↵Jeremy Allison2-6/+8
resolve_lmhosts_file_as_sockaddr() to match modern conventions. No logic changes. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-07-02CVE-2020-14303: s4 nbt: fix busy loop on empty UDP packetGary Lockyer1-1/+16
An empty UDP packet put the nbt server into a busy loop that consumes 100% of a cpu. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14417 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Autobuild-User(master): Karolin Seeger <kseeger@samba.org> Autobuild-Date(master): Thu Jul 2 10:26:24 UTC 2020 on sn-devel-184
2020-05-08Fix clang 9 missing-field-initializer warningsGary Lockyer1-1/+1
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-23py3: Remove #define PyInt_FromLong PyLong_FromLongAndrew Bartlett1-2/+2
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
2020-03-23py3: Remove #define PyInt_AsLong PyLong_AsLongAndrew Bartlett1-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>
2020-03-23py3: Remove #define PyInt_Check PyLong_CheckAndrew Bartlett1-1/+1
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>
2020-02-05libcli/nbt: avoid talloc_reference() in nbt_name_*_send()Stefan Metzmacher1-4/+4
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-11-22build: Do not build selftest binaries for builds without --enable-selftestAndrew Bartlett1-1/+1
Add new for_selftest option to SAMBA_BINARY() and SAMBA3_BINARY() This allows us to be much more consistent (at least in the core Samba) and documents clearly why the binary should not be installed. Not modified are - test_lp_load - notifyd-tests - gendrandperf - test* from examples/libsmbclient - dbwrap_torture - split_tokens - locktest2 - msgtest - msg_sink - msg_source - versiontest - rpc_open_tcp - test_headers As these are not tested in selftest so any change would also be untested. Of course they probably should be added in a different MR. Also not modified (because they are not tests, nor part of the build system) are: - smb2mount - notifydd - log2pacp - debug2html - smbfilter - destroy_netlogon_creds_cli - spotlight2* - tevent_glib_tracker These do however appear to be untested. For now, the source4 forked client tools are left unchanged: - smbclient4 - nmblookup4 Finally, the heimdal binaries are left as install=False as they are either part of the build system or end-user tools that we just don't want to install. These are however tested. The motivation is commit like c34ec003b7d45aa4196ff93a0ac29694b25e5309 and da87fa998ab71328f30bcdf5b41aee8675aee48a, which are both totally correct but are not needed if the selftest is not run on MacOS. There are likely other platforms or build environments where building our test binaries is more pain than valuable, see for example also https://lists.samba.org/archive/samba/2019-November/227137.html Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Isaac Boukris <iboukris@samba.org> Autobuild-User(master): Isaac Boukris <iboukris@samba.org> Autobuild-Date(master): Fri Nov 22 11:48:59 UTC 2019 on sn-devel-184
2019-07-24libcls/nbt: clang: Fix 'initialization value is never read'Noel Power1-1/+1
Fixes: libcli/nbt/nbtsocket.c:65:27: warning: Value stored to 'req' during its initialization is never read <--[clang] struct nbt_name_request *req = nbtsock->send_queue; ^~~ ~~~~~~~~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-06-24py3: Remove duplicated PyUnicode_Check() after the py3 compat macros were ↵Andrew Bartlett1-3/+3
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-24py3: Remove PyStr_AsString() compatability macroAndrew Bartlett1-6/+6
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-24py3: Remove PyStr_FromString() compatability macroAndrew Bartlett1-7/+7
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-24py3: Remove PyStr_Check() compatability macroAndrew Bartlett1-3/+3
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-05-16squash 'cast between incompatible function types' warningNoel Power1-5/+11
To avoid warning above produced by using -Wcast-function-type we; + ensure PyCFunctions of type METH_NOARGS defined dummy arg + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG macro Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-03-21build: Remove bld.gen_python_environments()Andrew Bartlett1-2/+1
This was part of --extra-python support. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-02-01pynbt: catch type errors in PyObject_AsNBTName()Douglas Bagnall1-1/+19
This fixes some known segfaults. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-28libcli:nbt: Use C99 initializer for poptOption in nmblookupAndreas Schneider1-26/+74
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-04-30libcli/nbt: Additionally accept unicode as string param in Py2Noel Power1-3/+3
With the changes to make samba python code Py2/Py3 compatible there now are many instances where string content is decoded. Decoded string variables in Py2 are returned as the unicode type. Many Py2 c-module functions that take string arguments only check for the string type. However now it's quite possibe the content formally passed as a string argument is now passed as unicode after being decoded, such arguments are rejected and code can fail subtly. This only affects places where the type is directly checked e.g. via PyStr_Check etc. arguments that are parsed by ParseTuple* functions generally already accept both string and unicode (if 's', 'z', 's*' format specifiers are used) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2018-04-13libnbt: Align data typesVolker Lendecke1-1/+1
ARRAY_SIZE returns size_t Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-04-13libnbt: Add an explicit "mem_ctx" to name_request_sendVolker Lendecke6-8/+10
Implicitly hanging requests off nbtsock is too inflexible for future use Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-04-13nbt/pynbt: initialize optional parameter in nbt_name_refreshDouglas Bagnall1-0/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2018-04-13nbt/pynbt: initialize optional parameter in nbt_name_registerDouglas Bagnall1-0/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2018-03-23python3 port for netbios moduleNoel Power2-23/+35
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-23libcli/nbt: Fix illegal tuple index access.Noel Power1-1/+1
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-02-27libsocket: Add "mem_ctx" to socket_create()Volker Lendecke1-3/+2
Every caller did a talloc_steal() after socket_create(). Just pass in the correct memory context. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2018-02-13libnbt: Apply some constVolker Lendecke2-2/+6
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2018-02-13libnbt: Use TALLOC_FREEVolker Lendecke1-4/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2017-05-13s4: nmblookup: Allocate event context off NULL instead of ↵Jeremy Allison1-1/+1
talloc_autofree_context(). It's already correctly freed on exit. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Sat May 13 21:01:25 CEST 2017 on sn-devel-144
2017-01-11wscript: remove executable bits for all wscript* filesStefan Metzmacher1-0/+0
These files should not be executable. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 11 20:21:01 CET 2017 on sn-devel-144
2016-12-27lib: Fix whitespace in lmhosts.cVolker Lendecke1-4/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-12-11libnbt: lmhosts xfile->stdioVolker Lendecke2-15/+13
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-11-20lib: Rename fgets_slash to x_fgets_slashVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06dlist: remove unneeded type argument from DLIST_ADD_END()Michael Adam1-4/+3
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-13Add a new header file for functions in lib/util/util.c.Jelmer Vernooij1-0/+2
This allows public headers to not include samba_util.h, but rather specific header files under lib/util. Signed-Off-By: Jelmer Vernooij <jelmer@samba.org> Reviewed-By: Andrew Bartlett <abartlet@samba.org> Reviewed-By: Stefan Metzmacher <metze@samba.org>
2015-02-24nmblookup: Warn user if netbios name is too long.Andreas Schneider1-0/+13
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Feb 24 01:01:10 CET 2015 on sn-devel-104
2014-12-18libcli-dns: Remove obsolete dns_host_file subsystem.Andreas Schneider1-6/+0
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Dec 18 09:09:38 CET 2014 on sn-devel-104
2014-11-14libcli/nbt: use NDR_SCALAR_PTR_PROTO() and fix the prototype of ↵Stefan Metzmacher2-2/+2
ndr_pull_wrepl_nbt_name() This avoids compiler warnings in pidl generated code. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>