summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* VERSION: Disable GIT_SNAPSHOT for the 4.11.13 release.samba-4.11.13Karolin Seeger2020-09-181-1/+1
| | | | Signed-off-by: Karolin Seeger <kseeger@samba.org>
* WHATSNEW: Add release notes for Samba 4.11.13.Karolin Seeger2020-09-181-2/+105
| | | | | | CVE-2020-1472: Samba impact of "ZeroLogon". Signed-off-by: Karolin Seeger <kseeger@samba.org>
* CVE-2020-1472(ZeroLogon): s4 torture rpc: repeated bytes in client challengeGary Lockyer2020-09-181-0/+335
| | | | | | | | | | | Ensure that client challenges with the first 5 bytes identical are rejected. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> [abartlet@samba.org: backported from master as test order was flipped]
* CVE-2020-1472(ZeroLogon): s4 torture rpc: Test empty machine acct pwdGary Lockyer2020-09-181-35/+29
| | | | | | | | | Ensure that an empty machine account password can't be set by netr_ServerPasswordSet2 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
* CVE-2020-1472(ZeroLogon): docs-xml: document 'server require ↵Stefan Metzmacher2020-09-181-15/+54
| | | | | | | | schannel:COMPUTERACCOUNT' BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s3:rpc_server/netlogon: log warnings about ↵Günther Deschner2020-09-181-4/+66
| | | | | | | | | | | unsecure configurations BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Günther Deschner <gd@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s3:rpc_server/netlogon: support "server require ↵Günther Deschner2020-09-181-1/+6
| | | | | | | | | | | | | | schannel:WORKSTATION$ = no" This allows to add expections for individual workstations, when using "server schannel = yes". "server schannel = auto" is very insecure and will be removed soon. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Günther Deschner <gd@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s3:rpc_server/netlogon: refactor ↵Günther Deschner2020-09-181-8/+35
| | | | | | | | | | | | | dcesrv_netr_creds_server_step_check() We should debug more details about the failing request. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Günther Deschner <gd@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s4:rpc_server/netlogon: log warnings about ↵Stefan Metzmacher2020-09-181-3/+63
| | | | | | | | | | | | | unsecure configurations This should give admins wawrnings until they have a secure configuration. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
* CVE-2020-1472(ZeroLogon): s4:rpc_server/netlogon: support "server require ↵Stefan Metzmacher2020-09-181-1/+8
| | | | | | | | | | | schannel:WORKSTATION$ = no" This allows to add expections for individual workstations, when using "server schannel = yes". "server schannel = auto" is very insecure and will be removed soon. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s4:rpc_server/netlogon: refactor ↵Stefan Metzmacher2020-09-181-12/+33
| | | | | | | | | | dcesrv_netr_creds_server_step_check() We should debug more details about the failing request. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s3:rpc_server/netlogon: protect ↵Jeremy Allison2020-09-181-6/+92
| | | | | | | | | | | netr_ServerPasswordSet2 against unencrypted passwords BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s3:rpc_server/netlogon: Fix mem leak onto ↵Jeremy Allison2020-09-181-0/+1
| | | | | | | | | | | p->mem_ctx in error path of _netr_ServerPasswordSet2(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Jeremy Allison <jra@samba.org> [dbagnall@samba.org, abartlet@samba.org: adapt for indentation changes]
* CVE-2020-1472(ZeroLogon): s4:rpc_server/netlogon: protect ↵Stefan Metzmacher2020-09-181-1/+59
| | | | | | | | netr_ServerPasswordSet2 against unencrypted passwords BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): libcli/auth: reject weak client challenges in ↵Stefan Metzmacher2020-09-182-1/+17
| | | | | | | | | | | | | | | | | | netlogon_creds_server_init() This implements the note from MS-NRPC 3.1.4.1 Session-Key Negotiation: 7. If none of the first 5 bytes of the client challenge is unique, the server MUST fail session-key negotiation without further processing of the following steps. It lets ./zerologon_tester.py from https://github.com/SecuraBV/CVE-2020-1472.git report: "Attack failed. Target is probably patched." BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): libcli/auth: add ↵Stefan Metzmacher2020-09-182-1/+23
| | | | | | | | | | | netlogon_creds_is_random_challenge() to avoid weak values This is the check Windows is using, so we won't generate challenges, which are rejected by Windows DCs (and future Samba DCs). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s4:rpc_server:netlogon: make use of ↵Stefan Metzmacher2020-09-181-2/+1
| | | | | | | | | | netlogon_creds_random_challenge() This is not strictly needed, but makes things more clear. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s3:rpc_server:netlogon: make use of ↵Stefan Metzmacher2020-09-181-2/+1
| | | | | | | | | | netlogon_creds_random_challenge() This is not strictly needed, but makes things more clear. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): libcli/auth: make use of ↵Stefan Metzmacher2020-09-181-2/+1
| | | | | | | | | | | netlogon_creds_random_challenge() in netlogon_creds_cli.c This will avoid getting rejected by the server if we generate a weak challenge. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): s4:torture/rpc: make use of ↵Stefan Metzmacher2020-09-182-23/+13
| | | | | | | | | | | netlogon_creds_random_challenge() This will avoid getting flakey tests once our server starts to reject weak challenges. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2020-1472(ZeroLogon): libcli/auth: add netlogon_creds_random_challenge()Stefan Metzmacher2020-09-182-0/+10
| | | | | | | | | | It's good to have just a single isolated function that will generate random challenges, in future we can add some logic in order to avoid weak values, which are likely to be rejected by a server. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* VERSION: Bump version up to 4.11.13...Karolin Seeger2020-08-251-2/+2
| | | | | | and re-enable GIT_SNAPSHOT. Signed-off-by: Karolin Seeger <kseeger@samba.org>
* VERSION: Disable GIT_SNAPSHOT for the 4.11.12 release.samba-4.11.12Karolin Seeger2020-08-251-1/+1
| | | | Signed-off-by: Karolin Seeger <kseeger@samba.org>
* WHATSNEW: Add release notes for Samba 4.11.12.Karolin Seeger2020-08-251-2/+71
| | | | Signed-off-by: Karolin Seeger <kseeger@samba.org>
* util: Add cmocka unit test for directory_create_or_existsChristof Schmitt2020-08-173-0/+241
| | | | | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14166 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sun Aug 16 07:06:59 UTC 2020 on sn-devel-184 (cherry picked from commit e89ec78e9a262a6e7bb9082323083eb5f1609655) Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Mon Aug 17 14:27:37 UTC 2020 on sn-devel-184
* util: Allow symlinks in directory_create_or_existChristof Schmitt2020-08-171-2/+16
| | | | | | | | | | | | | Commit 9f60a77e0b updated the check to avoid having files or other objects instead of a directory. This missed the valid case that there might be a symlink to a directory. Updated the check accordingly to allow symlinks to directories. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14166 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 672212cecdd7a7de40acdc81c56e2996ea82c090)
* dbcheck: Allow a dangling forward link outside our known NCsAndrew Bartlett2020-08-062-1/+62
| | | | | | | | | | | | | | | | If we do not have the NC of the target object we can not be really sure that the object is redundent and so we want to keep it for now and not (as happened until now) break the dbcheck run made during the replication stage of a "samba-tool domain backup rename". BUG: https://bugzilla.samba.org/show_bug.cgi?id=14450 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> (cherry picked from commit 05228c4e07013c0e6f78f1330b3b787271282ca8) Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Thu Aug 6 13:32:29 UTC 2020 on sn-devel-184
* s3:smbd: check for stale pid in delay_for_oplock_fn() when leases_db_get() failsStefan Metzmacher2020-08-061-1/+33
| | | | | | | | | | | | | | | | | | | | | | If leases_db_get() failed the leases_db record might have been cleaned up for stale processes. Check if the share-mode-entry owner is stale in this case and return ignore the entry. In any other case, log a debug messages and panic. Commit 05d4466a6d1ad048fa86aea09ec0a56a7b961369 "smbd: check for stale pid in get_lease_type()" fixed only one half of this. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 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): Tue Jul 7 02:47:46 UTC 2020 on sn-devel-184 (backported from commit 58adf349edfd3001ad071cc7ed8cfc551f67f8a2) [metze@samba.org: use share_mode_stale_pid() instead of share_entry_stale_pid()] [metze@samba.org: use file_id_string_tos() instead of file_id_str_buf()]
* s3:leases: log errors with level 0 in leases_db_do_locked_fn()Stefan Metzmacher2020-08-061-4/+4
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 217693682d5bbd0f2d6b5331f47b2a6348840898)
* smbd: check for stale pid in get_lease_type()Ralph Boehme2020-08-061-2/+27
| | | | | | | | | | | | | | | | | If leases_db_get() failed the leases_db record might have been cleaned up for stale processes. Check if the share-mode-entry owner is stale in this case and return a 0 lease state. In any other case, log a debug messages and panic. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Jul 2 16:45:42 UTC 2020 on sn-devel-184 (backported from commit 05d4466a6d1ad048fa86aea09ec0a56a7b961369) [slow@samba.org: use share_mode_stale_pid() instead of share_entry_stale_pid()] [metze@samba.org: use file_id_string_tos() instead of file_id_str_buf()]
* smbd: let get_lease_type() take a non-const share_mode_entryRalph Boehme2020-08-062-4/+4
| | | | | | | | | | | | We're going to add a call to share_entry_stale_pid(share_mode_entry) which takes a non-const pointer (in order to eventually set e->state = true). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (backported from commit 3f4a865821da27efbed4f7c38ad3efbcaae77a02) [slow@samba.org: get_lease_type() takes arg d in 4.11]
* smbd: inverse if/else logic in get_lease_type()Ralph Boehme2020-08-061-17/+17
| | | | | | | | | | | No change in behaviour. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (backported from commit e4328db1c94837a8ea5652971cea20055d3d24ff) [slow@samba.org: take id from d as it's not passed as arg]
* s3/leases: log NDR decoding failure with level 0 in leases_db_get_fn()Ralph Boehme2020-08-061-2/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 383a2457bd6cbe0acd571a8d601f8bdc5365f0b4)
* smbd: increase loglevel when leases_db_del() with anything then ↵Ralph Boehme2020-08-061-2/+5
| | | | | | | | | | | NT_STATUS_NOT_FOUND BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (backported from commit fbb8bbe1243eb2a0351dc2422929278f85a99e26) [slow@samba.org: remove_lease_if_stale() does not exist in 4.11]
* docs: Fix documentation for require_membership_of of pam_winbind.confAndreas Schneider2020-08-061-3/+6
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14358 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Isaac Boukris <iboukris@samba.org> (cherry picked from commit 71b7140fd0a33e7e8c5bf37c2897cea8224b3f01)
* docs: Fix documentation for require_membership_of of pam_winbindAndreas Schneider2020-08-061-3/+5
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14358 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit 4c74db6978c682f8ba4e74a6ee8157cfcbb54971)
* lib/debug: set the correct default backend loglevel to MAX_DEBUG_LEVELRalph Boehme2020-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixed a regression introduced by commit c83ce5f4f99aef94530411ec82cc03e9935b352d for bug #14345. The backend loglevel globally restricts logging of a particular backend. If this value is smaller then any explicitly configured logging class, logging for this class is skipped. Eg, given the following logging config in smb.conf: log level = 1 auth_json_audit:3@/var/log/samba/samba_auth_audit.log the default class loglevel of 1 (dbgc_config[DBGC_ALL].loglevel) will be assigned to the backend loglevel. So even though the logging class auth_json_audit is configured at level 3, this doesn't become effective as the file backend drops all log messages with a level below 1. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14426 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Jul 2 13:25:29 UTC 2020 on sn-devel-184 (cherry picked from commit 71488b812fe737df2d3439a6ff3f95bb69b4a5bd) Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Thu Jul 9 11:40:15 UTC 2020 on sn-devel-184
* lib/debug: assert file backendRalph Boehme2020-07-091-6/+6
| | | | | | | | | | | The debug file backend is a built-in default, if it's missing we're totally screwed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14426 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit 5aeaa6959da326095e98f0369b6d91dc5667415e)
* lib:util: Fix smbclient -l basename dirAmit Kumar2020-07-092-2/+7
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14345 Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Amit Kumar <amitkuma@redhat.com> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit c83ce5f4f99aef94530411ec82cc03e9935b352d)
* Add a test for smbclient -l basenameAmit Kumar2020-07-093-0/+40
| | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14345 Signed-off-by: Amit Kumar <amitkuma@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit 2a7fc40fb3f3ca994cecad3e2957433d7a411208)
* s3:winbind:idmap_ad - make failure to get attrnames for schema mode fatalAndrew2020-07-091-0/+8
| | | | | | | | | | | Add check for failure to resolve the OID array for the schema mode into names. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14425 Signed-off-by: Andrew <awalker@ixsystems.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit b5b801026edd3a8fd8d0ba1752e891453cf675c9)
* lib/util: do not install "test_util_paths"Günther Deschner2020-07-071-1/+2
| | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14370 Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Tue Jul 7 08:16:40 UTC 2020 on sn-devel-184
* selftest: Run test of how userPassword / crypt() style passwords are stored ↵Andrew Bartlett2020-07-061-0/+3
| | | | | | | | | | | | | | | | in quicktest This ensures that the crypt_r()/crypt_rn()/crypt() behaviour is tested in all the samba-o3 builds and so is checked on RHEL7 in GitLab CI. https://bugzilla.samba.org/show_bug.cgi?id=14424 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit cabf873b75b1d4d456190358bc3ed051bca16978) Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Mon Jul 6 15:10:27 UTC 2020 on sn-devel-184
* selftest: Split samba.tests.samba_tool.user_virtualCryptSHA into GPG and not ↵Andrew Bartlett2020-07-064-1/+566
| | | | | | | | | | | | | GPG parts This allows the userPassword (not GPG) part of the test to run on hosts without python3-gpg (eg RHEL7) while still testing the userPassword handling. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14424 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit 2c4ecf002a3fbbe8be061814468529c8bd6bb7aa)
* dsdb: Allow "password hash userPassword schemes = CryptSHA256" to work on RHEL7Andrew Bartlett2020-07-062-7/+31
| | | | | | | | | | | | | | On RHEL7 crypt_r() will set errno. This is a problem because the implementation of crypt_r() in RHEL8 and elsewhere in libcrypt will return non-NULL but set errno on failure. The workaround is to use crypt_rn(), provided only by libcrypt, which will return NULL on failure, and so avoid checking errno in the non-failure case. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14424 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit 91453f110fa72062291eb59ad9d95fab0f423557)
* util: fix build on AIX by fixing the order of replace.h includeBjoern Jacke2020-07-061-1/+1
| | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14422 Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit d93a6d2663a25bca072cd5623aea16e21ed650b8)
* util: Reallocate larger buffer if getpwuid_r() returns ERANGEMartin Schwenke2020-07-061-0/+13
| | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Bjoern Jacke <bjacke@samba.org> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Jun 9 21:07:24 UTC 2020 on sn-devel-184 (cherry picked from commit ddac6b2eb4adaec8fc5e25ca07387d2b9417764c)
* util: Fix build on FreeBSD by avoiding NSS_BUFLEN_PASSWDMartin Schwenke2020-07-061-5/+22
| | | | | | | | | | | | | | NSS_BUFLEN_PASSWD is not defined on FreeBSD. Use sysconf(_SC_GETPW_R_SIZE_MAX) instead, as per POSIX. Use a dynamically allocated buffer instead of trying to cram all of the logic into the declarations. This will come in useful later anyway. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Bjoern Jacke <bjacke@samba.org> (cherry picked from commit 847208cd8ac68c4c7d1dae63767820db1c69292b)
* util: Simplify input validationMartin Schwenke2020-07-061-5/+4
| | | | | | | | | | | | | | | It appears that snprintf(3) is being used for input validation. However, this seems like overkill because it causes szPath to be copied an extra time. The mostly likely protections being sought here, according to https://cwe.mitre.org/data/definitions/20.html, look to be DoS attacks involving CPU and memory usage. A simpler check that uses strnlen(3) can mitigate against both of these and is simpler. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Bjoern Jacke <bjacke@samba.org> (cherry picked from commit 922bce2668994dd2a5988c17060f977e9bb0c229)
* s3: libsmb: Fix SMB2 client rename bug to a Windows server.Jeremy Allison2020-07-061-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix bug where renaming to a target name of one UCS2 character (name length 2 bytes) fails to a Windows 10 SMB2 server. The Windows 10 SMB2 server has a minimum length for a SMB2_FILE_RENAME_INFORMATION buffer of 24 bytes. It returns NT_STATUS_INFO_LENGTH_MISMATCH if the length is less. This isn't an alignment issue as Windows client happily 2-byte align for larget target name sizes. Also the Windows 10 SMB1 server doesn't have this restriction. If the name length is too short, pad out with zeros to 24 bytes. Hard to add a test for this as we don't want to add this silly restriction to the Samba server as it would break all non-Windows clients. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14403 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jul 1 18:59:53 UTC 2020 on sn-devel-184 (cherry picked from commit f59490dc2d07107d32d6e888f2814011ab2845b7)