summaryrefslogtreecommitdiff
path: root/source4/libnet
AgeCommit message (Collapse)AuthorFilesLines
2023-11-20Use python.h from libreplaceAndreas Schneider2-2/+2
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-09-11s4:libnet: Fix code spellingJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-14s4:libnet: Fix code spellingAndreas Schneider3-3/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08s4:libnet: Add missing newlines to logging messagesJoseph Sutton1-3/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-30crypto: Rely on GnuTLS 3.6.13 and gnutls_pbkdf2()Andrew Bartlett1-4/+0
This removes a lot of inline #ifdef and means this feature is always tested. We can do this as we have chosen GnuTLS 3.6.13 as the new minimum version. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-04-03s4:libnet: cleanup py_net_time()Dmitry Antipov1-4/+9
Fix size of buffer passed to and always check the value returned from strftime(), raise PyErr_NoMemory() and return NULL if zero, or use it with PyUnicode_FromStringAndSize() (thus avoiding extra internal call to strlen()) otherwise. Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-03-31librpc/ndr: Unimplement DRSUAPI_COMPRESSION_TYPE_XPRESS and renameAndrew Bartlett1-1/+1
DRSUAPI_COMPRESSION_TYPE_XPRESS is not MS-XCA nor is it implemented by lzexpress_compress(), so disconnect from that algorithm. This avoids someone fixing lzxpress_compress() to work for DRSUAPI and breaking claims support. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-12-14s4:libnet: correctly handle gnutls_pbkdf2() errorsStefan Metzmacher1-1/+4
We should not ignore the error nor should we map GNUTLS_E_UNWANTED_ALGORITHM to NT_STATUS_WRONG_PASSWORD, instead we use NT_STATUS_CRYPTO_SYSTEM_INVALID as in most other places in the same file. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15206 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Björn Baumbach <bbaumbach@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Dec 14 13:35:20 UTC 2022 on sn-devel-184
2022-12-14s4:libnet: fix error string for failing samr_ChangePasswordUser4()Stefan Metzmacher1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15206 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Björn Baumbach <bbaumbach@samba.org>
2022-12-13CVE-2022-37966 s4:libnet: allow python bindings to force setting an nthash ↵Stefan Metzmacher1-3/+15
via SAMR level 18 BUG: https://bugzilla.samba.org/show_bug.cgi?id=15237 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-12-13CVE-2022-37966 s4:libnet: add support LIBNET_SET_PASSWORD_SAMR_HANDLE_18 to ↵Stefan Metzmacher2-0/+80
set nthash only BUG: https://bugzilla.samba.org/show_bug.cgi?id=15237 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-12-13CVE-2022-37966 s4:libnet: initialize libnet_SetPassword() arguments ↵Stefan Metzmacher2-2/+4
explicitly to zero by default. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15237 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-10-27lib/krb5_wrap: remove unused keep_old_entries argument from ↵Stefan Metzmacher1-2/+1
smb_krb5_kt_add_entry() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-10-25s4:libnet: If we successfully changed the password we are doneAndreas Schneider1-14/+18
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15206 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2022-10-25s3:rpcclient: Pass salt down to init_samr_CryptPasswordAES()Andreas Schneider1-6/+7
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15206 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2022-07-28s4:libnet: Add support for samr_ChangePasswordUser4()Andreas Schneider2-0/+117
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-07-28s4:libnet: Move code using RC4 into its own functionAndreas Schneider1-86/+123
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-07-28s4:libnet: Remove unused code in libnet_ChangePassword_samr()Andreas Schneider1-50/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-03-24s4:libnet: avoid using sdb_entry_ex and use sdb_entry directlyStefan Metzmacher1-12/+12
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-03-24s4:kdc: samba_kdc_{first,next}key() only need sdb_entryStefan Metzmacher1-2/+2
sdb_entry_ex will be removed shortly. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-03-24s4:kdc: samba_kdc_fetch() only needs sdb_entryStefan Metzmacher1-1/+1
sdb_entry_ex will be removed shortly. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-03-24s4:libnet: ask for SDB_F_ADMIN_DATA in order to create a keytab entryStefan Metzmacher1-1/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-03-24s4:libnet: sdb_free_entry() already clears everythingStefan Metzmacher1-9/+1
There's no need to know about '.free_entry'. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-01-26s4:libnet: Fix uninitialized value "seq_num"Pavel Filipenský1-1/+1
Found by covscan. Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-01-26s4:libnet: Fix trailing whitespace in libnet_vampire.cPavel Filipenský1-10/+10
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2021-08-03s4:libnet: Allow libnet_SetPassword() for encrypted SMB connectionsAndreas Schneider1-11/+40
This is needed for smbtorture to join a domain in FIPS mode. FYI: The correct way would be to join using LDAP as the s3 code is doing it. But this requires a bigger rewrite. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-08-03s4:libnet: Remove trailing whitespacesAndreas Schneider1-12/+12
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-04-07provision: Decrease the length of random machine passwordsJoseph Sutton1-1/+1
The current length of 128-255 UTF-16 characters currently causes generation of crypt() passwords to typically fail. This commit decreases the length to 120 UTF-16 characters, which is the same as that used by Windows. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14621 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-03-11s4:libnet_rpc: avoid reusing the assoc_group_id of the lsa connectionStefan Metzmacher1-0/+6
This was an unexpected side effect introduced in commit 1b17d9a587bf3600d449c2481fe1191793479e32. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Mar 11 22:50:02 UTC 2021 on sn-devel-184
2020-11-06s4:libnet:py_net - free event context in dealloc fnAndrew Walker1-1/+1
Creation of a new Net() object initializes an event context under a NULL talloc context and then creates a new talloc context as a child of the event context. The deallocation function for the net object only frees the child and not the parent. This leaks an fd for the tevent context and associated memory. Signed-off-by: Andrew Walker <awalker@ixsystems.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Nov 6 04:58:31 UTC 2020 on sn-devel-184
2019-12-10smbdes: convert E_old_pw_hash to use gnutlsIsaac Boukris1-5/+25
Signed-off-by: Isaac Boukris <iboukris@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-26s4:libnet: Use GnuTLS RC4 in libnet_ChangePassword_samr()Andreas Schneider1-6/+104
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-26s4:libnet: Use GnuTLS RC4 in libnet_SetPassword_samr_handle_23()Andreas Schneider1-1/+28
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-26s4:libnet: Use GnuTLS RC4 in libnet_SetPassword_samr_handle_24()Andreas Schneider1-1/+28
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-26s4:libnet: Use encode_rc4_passwd_buffer() in libnet_SetPassword_samr_handle_25()Andreas Schneider1-34/+9
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-26s4:libnet: Use encode_rc4_passwd_buffer() in libnet_SetPassword_samr_handle_26()Andreas Schneider1-36/+11
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-04s4/libnet: Fix joining a Windows pre-2008R2 DCTim Beale1-0/+9
From v4.8 onwards, Samba may not be able join a DC older than 2008R2 because the Windows DC doesn't support GET_TGT. If the dsdb repl_md code can't resolve a link target it returns an error, and the calling code (e.g. drs_util.py) should retry with GET_TGT. However, GET_TGT is only supported on Windows 2008R2 and later, so if you try to join an earlier Windows DC, the join will throw an error that you can't work-around. We can avoid this problem by setting the same DSDB flag that GET_TGT sets to indicate that the link targets are as up-to-date as possible, and so there's no point retrying. Missing targets are still logged, so this at least allows the admin to fix up any problems after the join completed. I've only done this for the join case (problems during periodic replication are probably still worth escalating to an error). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14021 RN: From Samba v4.8 onwards, joining a Windows 2003 or 2008 (non-R2) AD DC may not have worked. When this problem occurred, the following message would be displayed: 'Failed to commit objects: DOS code 0x000021bf' This particular issue has now been resolved. Note that there may still be other potential problems that occur when joining an older Windows DC. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-27lib/crypto: move gnutls error wrapper to own subsystemAndrew Bartlett2-2/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-06-24py3: Remove PyStr_FromString() compatability macroAndrew Bartlett1-1/+1
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-24s3:libnet: Use gnutls_error_to_ntstatus() in libnet_passwdAndreas Schneider1-6/+7
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-21s4:libnet: Use GnuTLS MD5 for samr passwordsAndreas Schneider1-13/+64
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-16s4: squash 'cast between incompatible function types' warningNoel Power2-12/+75
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 + ensure PyCFunctions of type METH_KEYWORDS really actually use the problematic kargs param, if not remove it Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-05-06libnet: Remove unused source4/libnet/libnet_sam{dump,sync}:Andrew Bartlett4-530/+1
The last caller was removed in samba-tool: Remove C version of samba-tool (e2af38415163f248e3dbd5a2abc156761e74b87c) 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-06libnet: Remove unused source4/libnet/libnet_samsync_ldb.cAndrew Bartlett3-1301/+1
The last caller was removed in samba-tool: Remove C version of samba-tool (e2af38415163f248e3dbd5a2abc156761e74b87c) by Amitay Isaacs in 2011 This was a prototype tool to sync a genine NT4 DC (never Samba) into ldb. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-04-08libnet vampire: NULL access bug fixGarming Sam1-1/+6
NULL pointer access bug fix Signed-off-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-21build: Remove bld.gen_python_environments()Andrew Bartlett1-25/+24
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-21build: Remove --extra-pythonAndrew Bartlett1-2/+0
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-02-27libnet: Use dom_sid_str_bufVolker Lendecke1-13/+27
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-02-21s4/param: Fix provision_get_schema leaking python objectNoel Power1-1/+1
provision_get_schema returns a ldb_context object which is stored in a python object. As a result the parent python object is never decrefed and probably not released ever. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-02-13Make sure results from GetAttrString are decref'ed where neededNoel Power1-2/+7
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett abartlet@samba.org Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Wed Feb 13 14:51:12 CET 2019 on sn-devel-144