summaryrefslogtreecommitdiff
path: root/source4/libcli
AgeCommit message (Collapse)AuthorFilesLines
2024-01-08s4/libcli/raw: implemement RAW_SFILEINFO_LINK_INFORMATIONRalph Boehme1-0/+14
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13688 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-12-21s4:libcli: Fix conversion from HRESULT and WERROR to Python objectsJoseph Sutton1-6/+6
The inner values of HRESULT and WERROR are 32‐bit unsigned integers, which might not be representable in type ‘int’. We must then use the ‘k’ format specifier, which corresponds to ‘unsigned long’, a type guaranteed to be at least 32 bits in size. Commit c81aff362fe99a65385c6f8337ffcb47c9456829 fixed PyErr_FromNTSTATUS(), but it did not attempt to fix the other cases. PyErr_FromHRESULT() might return a tuple like this: (-2147024809, 'One or more arguments are invalid.') which, after this commit, will become this: (2147942487, 'One or more arguments are invalid.') Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-12-21s4:libcli: Remove trailing whitespaceJoseph Sutton1-4/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30s4:libcli: Call correct function to get HMAC output lengthJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30s4:libcli: Remove trailing whitespaceJoseph Sutton1-8/+8
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-15util/charset: Rename utf16_len_n() to utf16_null_terminated_len_n()Joseph Sutton2-3/+3
The new name indicates that — contrary to functions such as strnlen() — the length may include the terminator. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-15s4:libcli: Remove trailing whitespaceJoseph Sutton1-27/+26
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-07libcli: Fix whitespaceVolker Lendecke26-483/+482
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2023-10-25libcli/util: add struct tstream_context to tstream_read_pdu_blob_full_fn_tRalph Boehme1-1/+1
Add struct tstream_context to tstream_read_pdu_blob_full_fn_t and update all callers of tstream_read_pdu_blob_send() to use the correct callback. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-24s4:libcli/wrepl: make use of tstream_bsd_fail_readv_first_error(false)Stefan Metzmacher1-0/+2
As a client we want recv pending responses even if the server already closed the connection. While tstream_bsd_fail_readv_first_error(false) is the default for tstream_bsd, the wins replication protocol is special as it has a way to switch server and client roles on an existing tcp connection. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13s4:libcli: Check return value of convert_string_talloc() (CID 1272839)Joseph Sutton1-3/+8
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13s4:libcli: Remove unnecessary castsJoseph Sutton1-14/+14
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-11s4:libcli: 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:libcli: Fix code spellingAndreas Schneider13-23/+23
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-14s4:libcli: Remove tailing white spacesAndreas Schneider1-35/+35
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08s4:torture/smb2: make it possible to pass existing_conn to smb2_connect_ext()Stefan Metzmacher1-1/+3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15346 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-08-08s4:libcli/smb_composite: Fix code spellingJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08s4:libcli/ldap: Fix code spellingJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-12-16s3-librpc: add ads.idl and convert ads_struct to talloc.Günther Deschner1-0/+1
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-11-09s4: libcli: Ignore errors when getting A records after fetching AAAA records.Jeremy Allison1-6/+8
The target may only be available over IPv6. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15226 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Nov 9 20:34:07 UTC 2022 on sn-devel-184
2022-11-08build: Remove unused dependenciesJoseph Sutton1-1/+0
We don't need to include these any more, and removing them allows us to simplify the build system for system Heimdal builds. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-09-16CVE-2020-25720: s4-acl: Change behavior of Create Children checkNadezhda Ivanova1-0/+1
Up to now, the rights to modify an attribute were not checked during an LDAP add operation. This means that even if a user has no right to modify an attribute, they can still specify any value during object creation, and the validated writes were not checked. This patch changes this behavior. During an add operation, a security descriptor is created that does not include the one provided by the user, and is used to verify that the user has the right to modify the supplied attributes. Exception is made for an object's mandatory attributes, and if the user has Write DACL right, further checks are skipped. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14810 Pair-Programmed-With: Joseph Sutton <josephsutton@catalyst.net.nz> Signed-off-by: Nadezhda Ivanova <nivanova@symas.com> Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-08-26smbXcli: Pass negotiate contexts through smbXcli_negprot_send/recvVolker Lendecke3-6/+9
We already don't allow setting max_credits in the sync wrapper, so omit the contexts there as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Aug 26 19:54:03 UTC 2022 on sn-devel-184
2022-08-23s4/libcli/smb2: avoid using smb2_composite_setpathinfo() in smb2_util_setatr()Ralph Boehme1-7/+30
smb2_composite_setpathinfo() uses SEC_FLAG_MAXIMUM_ALLOWED which can have unwanted side effects like breaking oplocks if the effective access includes [READ|WRITE]_DATA. For changing the DOS attributes we only need SEC_FILE_WRITE_ATTRIBUTE. With this change test_smb2_oplock_batch25() doesn't trigger an oplock break anymore. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15153 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-06-09lib/util: Change function to mem_equal_const_time()Joseph Sutton2-2/+2
Since memcmp_const_time() doesn't act as an exact replacement for memcmp(), and its return value is only ever compared with zero, simplify it and emphasize the intention of checking equality by returning a bool instead. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-06-09auth: Use constant-time memcmp when comparing sensitive buffersJoseph Sutton1-1/+1
This helps to avoid timing attacks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15010 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-05-14s4:libcli: Covscan: unchecked return value for file_save()Pavel Filipenský1-1/+1
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-14s4:libcli: Fix trailing whitespace in browse.cPavel Filipenský1-8/+8
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-14s4:libcli: Covscan: unchecked return value for file_save()Pavel Filipenský1-1/+1
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-14s4:libcli: Fix trailing whitespace in netlogon.cPavel Filipenský1-13/+13
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-03-17dsdb: Return dsdb_password_change control name to ↵Andrew Bartlett1-1/+1
DSDB_CONTROL_PASSWORD_CHANGE_OLD_PW_CHECKED_OID This makes it clearer that the purpose of this control is to indicate that the password was already checked (by an out-of-band mechanism, eg kpasswd) and so can safely be changed subject to ACLs etc. This essentially reverts bbb9dc806e4399c65dee9b5dc2cde0bfaa9609bd Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-02-17util: Drop unused variable num_receivedMartin Schwenke1-6/+0
clang complains: ../../source4/libcli/clilist.c:111:6: error: variable 'num_received' set but not used [-Werror,-Wunused-but-set-variable] int num_received = 0; ^ ../../source4/libcli/clilist.c:268:6: error: variable 'num_received' set but not used [-Werror,-Wunused-but-set-variable] int num_received = 0; ^ That is, the variable is initialised and updated but the value is never used. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
2021-12-09s4: libcli: smbcli_unlink() is no longer used with wildcard patterns.Jeremy Allison1-5/+1
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2021-12-09s4: libcli: In smbcli_deltree() use smbcli_unlink_wcard() in place of ↵Jeremy Allison1-1/+1
smbcli_unlink(). We know we have a wildcard mask here. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2021-12-09s4: libcli: Add smbcli_unlink_wcard().Jeremy Allison2-0/+101
We will use this in place of smbcli_unlink() when we know we are using a wildcard pattern. If can be used to generally replace smbcli_unlink() as it calls down to smbcli_unlink() is no wildcard is detected. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2021-11-11libcli4: Remove outdated README fileVolker Lendecke1-1/+0
This has not materialized since 2005. We can easily add it once we create libsmbclient4. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-11-09CVE-2016-2124: s4:libcli/sesssetup: don't fallback to non spnego ↵Stefan Metzmacher1-0/+14
authentication if we require kerberos We should not send NTLM[v2] data on the wire if the user asked for kerberos only. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12444 Signed-off-by: Stefan Metzmacher <metze@samba.org>
2021-04-28auth:creds: Add obtained arg to cli_credentials_set_gensec_features()Andreas Schneider1-2/+6
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-04-19torture: Move sddl tests to pythonVolker Lendecke1-107/+0
This kind of test is better hosted in python than in C. More lines, but the ones in source4/libcli/security/tests/sddl.c were preeetty long... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-17libcli/smb: pass smb3_capabilities to smbXcli_conn_create()Stefan Metzmacher3-3/+6
Passing NULL means use none. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14512 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-03-17s4:libcli/raw: add smb3_capabilities to struct smbcli_optionsStefan Metzmacher1-0/+2
Currently this will be zeroed in lpcfg_smbcli_options(), but will later allow advanced callers to pass values to smbXcli_conn_create(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14512 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-23smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to NTCREATEX_FLAG_DENY_FCBRalph Boehme1-1/+1
Just a shorter name, no change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-23smb: rename NTCREATEX_OPTIONS_PRIVATE_DENY_DOS to NTCREATEX_FLAG_DENY_DOSRalph Boehme1-1/+1
Just a shorter name, no change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-21libcli: Align integer typesVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-02libcli: Use GUID_to_ndr_buf() in smb2_create_send()Volker Lendecke1-13/+9
Avoid talloc/free Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-02libcli: Use GUID_to_ndr_buf() in smbcli_push_guid()Volker Lendecke1-6/+4
Avoid two talloc/free Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-15lib: addns: Fix ads_dns_lookup_srv() and functions to return size_t * num ↵Jeremy Allison1-4/+11
servers. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
2020-09-15libcli: nbt: Fix resolve_lmhosts_file_as_sockaddr() to return size_t * count ↵Jeremy Allison1-1/+1
of addresses. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
2020-08-28lib/util: remove extra safe_string.h fileMatthew DeVore2-0/+4
lib/util/safe_string.h is similar to source3/include/safe_string.h, but the former has fewer checks. It is missing bcopy, strcasecmp, and strncasecmp. Add the missing elements to lib/util/safe_string.h remove the other safe_string.h which is in the source3-specific path. To accomodate existing uses of str(n?)casecmp, add #undef lines to source files where they are used. Signed-off-by: Matthew DeVore <matvore@google.com> Reviewed-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Aug 28 02:18:40 UTC 2020 on sn-devel-184
2020-08-19s4:libcli: Require signing for SMB encryptionAndreas Schneider1-1/+8
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>