CVE-2020-25717: s3:auth: Fallback to a SID/UID based mapping if the named based looku...
commit0a546be05295a7e4a552f9f4f0c74aeb2e9a0d6e
authorAndrew Bartlett <abartlet@samba.org>
Fri, 12 Nov 2021 03:10:31 +0000 (12 16:10 +1300)
committerRalph Boehme <slow@samba.org>
Mon, 15 Nov 2021 19:01:56 +0000 (15 19:01 +0000)
tree20e3152d53dfba2c7c280f0ff03ba10d2002b157
parent494bf7de6ff3e9abeb3753df0635737b80ce5bb7
CVE-2020-25717: s3:auth: Fallback to a SID/UID based mapping if the named based lookup fails

Before the CVE-2020-25717 fixes we had a fallback from
getpwnam('DOMAIN\user') to getpwnam('user') which was very dangerous and
unpredictable.

Now we do the fallback based on sid_to_uid() followed by
getpwuid() on the returned uid.

This obsoletes 'username map [script]' based workaround adviced
for CVE-2020-25717, when nss_winbindd is not used or
idmap_nss is actually used.

In future we may decide to prefer or only do the SID/UID based
lookup, but for now we want to keep this unchanged as much as possible.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14901

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
[metze@samba.org moved the new logic into the fallback codepath only
 in order to avoid behavior changes as much as possible]
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Nov 15 19:01:56 UTC 2021 on sn-devel-184
selftest/knownfail.d/idmap_nss_sid_mapping [deleted file]
source3/auth/auth_util.c