summaryrefslogtreecommitdiff
path: root/source3/registry
Commit message (Collapse)AuthorAgeFilesLines
* lib: Move tab_depth() to reg_parse_prs.cVolker Lendecke2023-01-101-0/+8
| | | | | | | Wow, I did not know we still use prs_struct... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* source3: A few whitespace fixesVolker Lendecke2022-09-191-180/+179
| | | | | | | review with git sh -w Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry3: Move registry_value_cmp() to its only userVolker Lendecke2022-09-192-10/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry3: Remove some unused functionsVolker Lendecke2022-09-192-167/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry3: Align an integer typeVolker Lendecke2022-07-251-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* registry3: Align function types to what is returnedVolker Lendecke2022-07-252-4/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* registry3: Align some integer typesVolker Lendecke2022-05-202-5/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* CVE-2020-25717: Add FreeIPA domain controller roleAlexander Bokovoy2021-11-091-0/+1
| | | | | | | | | | | | | | | | | As we want to reduce use of 'classic domain controller' role but FreeIPA relies on it internally, add a separate role to mark FreeIPA domain controller role. It means that role won't result in ROLE_STANDALONE. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14801 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14556 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Alexander Bokovoy <ab@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* registry: skip root check when running with uid-wrapper enabledRalph Boehme2021-09-221-1/+1
| | | | | | | | | | | | | Currently registry config is not used in the clustered testenv, so currently there's no problem. But once we do add that, the check would be triggered. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14787 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed Sep 22 16:57:25 UTC 2021 on sn-devel-184
* registry: check for running as root in clustering modeRalph Boehme2021-08-171-0/+9
| | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14787 RN: net conf list crashes when run as normal user Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Tue Aug 17 11:23:15 UTC 2021 on sn-devel-184
* registry: Fix a typoVolker Lendecke2021-04-191-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:registry Renaming get_charset() to smbreg_get_charset()xzhao92021-02-103-5/+5
| | | | | | | | | | | | Rename to smbreg_get_charset() function to avoid naming conflict with MariaDB. Signed-off-by: xzhao9 <i@xuzhao.net> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Feb 10 21:00:28 UTC 2021 on sn-devel-184
* s4:registry: Mark fall through switch statementAndreas Schneider2021-02-011-0/+1
| | | | | | | error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4:registry: Add missing break in switch statementAndreas Schneider2021-02-011-0/+1
| | | | | | | error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: safe_string: do not include string_wrappers.hMatthew DeVore2020-08-281-0/+1
| | | | | | | | | | | | | Rather than have safe_string.h #include string_wrappers.h, make users of string_wrappers.h include it explicitly. includes.h now no longer includes string_wrappers.h transitively. Still allow includes.h to #include safe_string.h for now so that as many modules as possible get the safety checks in it. Signed-off-by: Matthew DeVore <matvore@google.com> Reviewed-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry3: Fix a typoVolker Lendecke2020-06-101-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry3: Align a few integer typesVolker Lendecke2020-05-051-4/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* source3/registry/reg_parse.h: typo fixesBjörn Jacke2019-10-311-4/+4
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* source3/registry/reg_import.h: typo fixesBjörn Jacke2019-10-311-8/+8
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* source3/registry/reg_format.h: typo fixesBjörn Jacke2019-10-311-1/+1
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* regfio: Allow ignoring of checksumMichael Hanselmann2019-10-182-1/+9
| | | | | | | | | | | In order to get good coverage fuzzing code has to either calculate checksums correctly or to disable their verification. This change implements the latter for the "REGF_FILE" structure used by the "regfio_*" family of functions. Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
* Spelling fixes s/preceeding/preceding/Mathieu Parent2019-09-011-1/+1
| | | | | | Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* Spelling fixes s/withing/within/Mathieu Parent2019-09-011-2/+2
| | | | | | Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* Spelling fixes s/emtpy/empty/Mathieu Parent2019-09-011-1/+1
| | | | | | Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s3/registry: clang: Fix 'initialization value is never read'Noel Power2019-07-161-10/+11
| | | | | | | | | | | | | | | | Fixes: source3/registry/reg_backend_db.c:853:9: warning: Value stored to 'result' during its initialization is never read <--[clang] WERROR result = WERR_OK; ^~~~~~ ~~~~~~~ source3/registry/reg_backend_db.c:1677:2: warning: Value stored to 'len' is never read <--[clang] len = 0; ^ ~ 2 warnings generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s3/registry: clang: Fix 'initialization value is never read'Noel Power2019-07-161-2/+2
| | | | | | | | | | | | | | | Fixes: source3/registry/reg_api.c:139:14: warning: Value stored to 'result' during its initialization is never read <--[clang] WERROR result = WERR_OK; ^~~~~~ ~~~~~~~ ource3/registry/reg_api.c:958:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ 2 warnings generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* regfio: Return instead of assert for short blocksMichael Hanselmann2019-06-201-1/+2
| | | | | | | | | | | Assertions should only be used when there's absolutely no recovery or to verify data structure invariants. In this case the supplied registry hive file may have a malformed block with a size of zero. Such a block should not terminate the whole program. Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s3: net: Consider unprocessed in input bufferSamuel Cabrero2019-06-111-1/+1
| | | | | | | | | If there is unprocessed data in the input buffer (ilen > 0), place new data read after the unprocessed one. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* registry: add a missing includeRalph Boehme2019-05-271-0/+1
| | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13840 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Mon May 27 14:29:36 UTC 2019 on sn-devel-184
* s3: net: Rewrite of reg_parse_fd() to harden against buffer overwrites.Jeremy Allison2019-05-151-99/+203
| | | | | | | | | | | Remove unused handle_iconv_errno(). Fix leaks of iconv handles. Found by Michael Hanselmann using fuzzing tools BUG: https://bugzilla.samba.org/show_bug.cgi?id=13842 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3: net: Harden act_val_hex() act_val_sz() against errors.Jeremy Allison2019-05-151-0/+2
| | | | | | | | | Found by Michael Hanselmann using fuzzing tools BUG: https://bugzilla.samba.org/show_bug.cgi?id=13842 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3: net: Harden guess_charset() against overflow errors.Jeremy Allison2019-05-151-1/+9
| | | | | | | | | Found by Michael Hanselmann using fuzzing tools BUG: https://bugzilla.samba.org/show_bug.cgi?id=13842 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* test_regfio.c: include stdint.h before cmoka.hFabrice Fontaine2019-05-151-0/+1
| | | | | | | | | | | | | | | | | This fix the following build failure on mips64el: /usr/lfs/v0/rc-buildroot-test/scripts/instance-2/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/stdint.h:122:27: error: conflicting types for 'uintptr_t' typedef unsigned long int uintptr_t; ^ In file included from ../source3/registry/tests/test_regfio.c:23:0: ../third_party/cmocka/cmocka.h:126:28: note: previous declaration of 'uintptr_t' was here typedef unsigned int uintptr_t; Fixes: - http://autobuild.buildroot.org/results/bae0508e84c905dc23ad7cf1153cd1e9d8e4d734 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3/registry: fix various 'cast between incompatible function' warningsNoel Power2019-05-101-16/+45
| | | | | | | | | | | | | | | | | | | | | | | [3395/3524] Compiling source3/registry/reg_import.c ../../source3/registry/reg_import.c: In function ‘reg_import_adapter’: ../../source3/registry/reg_import.c:237:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **)’} [-Werror=cast-function-type] cb.openkey = (reg_import_callback_openkey_t)&nop; ^ ../../source3/registry/reg_import.c:240:17: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *)’ {aka ‘struct <anonymous> (*)(void *, void *)’} [-Werror=cast-function-type] cb.closekey = (reg_import_callback_closekey_t)&nop; ^ ../../source3/registry/reg_import.c:243:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *, void **, _Bool *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *, void **, _Bool *)’} [-Werror=cast-function-type] cb.createkey = (reg_import_callback_createkey_t)&nop; ^ ../../source3/registry/reg_import.c:246:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type] cb.deletekey = (reg_import_callback_deletekey_t)&nop; ^ ../../source3/registry/reg_import.c:249:18: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘WERROR (*)(void *, void *, const char *)’ {aka ‘struct <anonymous> (*)(void *, void *, const char *)’} [-Werror=cast-function-type] cb.deleteval = (reg_import_callback_deleteval_t)&nop; Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3/registry: Fix incompatible func castsNoel Power2019-05-101-5/+22
| | | | | | | | | | | | | | | | | | | | [3425/3524] Compiling source3/registry/reg_parse.c ../../source3/registry/reg_parse.c: In function ‘reg_parse_new’: ../../source3/registry/reg_parse.c:223:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char **, size_t, _Bool)’ {aka ‘int (*)(void *, const char **, long unsigned int, _Bool)’} [-Werror=cast-function-type] cb.key = (reg_parse_callback_key_t)&nop; ^ ../../source3/registry/reg_parse.c:226:12: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *, uint32_t, const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int, const unsigned char *, unsigned int)’} [-Werror=cast-function-type] cb.val = (reg_parse_callback_val_t)&nop; ^ ../../source3/registry/reg_parse.c:229:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type] cb.val_del = (reg_parse_callback_val_del_t)&nop; ^ ../../source3/registry/reg_parse.c:232:16: error: cast between incompatible function types from ‘int (*)(void *)’ to ‘int (*)(void *, const char *)’ [-Werror=cast-function-type] cb.comment = (reg_parse_callback_comment_t)&nop; Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3/registry: Fix func cast error (diff in params size_t vs uint32)Noel Power2019-05-101-1/+1
| | | | | | | | | | | | | | | | | reg_parse_callback_key_t alread has size_t for number of elemens in key but reg_parse_callback_val_t uses uint32_t for length of value data. Many internal function seem to take size_t as data len (see reg_format_value etc.) It seems changing the signature of the callback aligns it more closely with the existing api. ../../source3/registry/reg_format.c:438:10: error: cast between incompatible function types from ‘int (*)(reg_format *, const char *, uint32_t, const uint8_t *, size_t)’ {aka ‘int (*)(struct reg_format *, const char *, unsigned int, const unsigned char *, long unsigned int)’} to ‘int (*)(void *, const char *, uint32_t, const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int, const unsigned char *, unsigned int)’} [-Werror=cast-function-type] .val = (reg_parse_callback_val_t)&reg_format_value, Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* CVE-2019-3880 s3: rpc: winreg: Remove implementations of SaveKey/RestoreKey.Jeremy Allison2019-04-082-337/+0
| | | | | | | | | | | | | | Remove the now unused code implementations of registry file io. As reported by Michael Hanselmann. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13851 Signed-off-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Karolin Seeger <kseeger@samba.org> Autobuild-Date(master): Mon Apr 8 11:43:31 UTC 2019 on sn-devel-144
* regfio tests: Update comment style to match README.CodingAndrew Bartlett2019-03-201-1/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13840 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* regfio: Update code near recent changes to match README.CodingAndrew Bartlett2019-03-201-8/+14
| | | | | | | | | This file long predates our current code conventions. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13840 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* regfio: Improve handling of malformed registry hive filesMichael Hanselmann2019-03-202-1/+51
| | | | | | | | | | | | | | | * next_record: A malformed file can lead to an endless loop. * regfio_rootkey: Supplying a malformed registry hive file to the registry hive I/O code can lead to out-of-bounds reads. Test cases are included. Both issues resolved have been identified using AddressSanitizer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13840 Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* regfio: Add trivial unit testMichael Hanselmann2019-03-201-0/+139
| | | | | | | | | | | An upcoming commit will resolve two cases of insufficient handling of mangled registry hive files and will include unit tests. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13840 Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* regfio: Use correct function names in debug informationMichael Hanselmann2019-03-201-3/+3
| | | | | | Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Fix typos in "valid"Michael Hanselmann2019-03-201-1/+1
| | | | | | | | s/vald/valid/ Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:registry: Use C99 initializer for BOMAndreas Schneider2019-01-281-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* s3:registry: Avoid a double-free in reg_perfcountAndreas Schneider2018-10-191-2/+2
| | | | | | | Found by covscan. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry: Don't use an uninitialized valueVolker Lendecke2018-10-081-3/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry: Print failure of regdb_unpack_valuesVolker Lendecke2018-10-081-1/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry: Add error checks to regdb_unpack_valuesVolker Lendecke2018-10-081-8/+28
| | | | | | | | | | | This makes "regdb_unpack_values" take a size_t as buflen. The only caller calls it with TDB_DATA.dsize, which *is* size_t. Convert the internal "len" variable to the unsigned size_t as well and add overflow checks. This depends on tdb_unpack to either return -1 or a positive value less than or equal to the passed-in "size_t" buflen; Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry: Add error checks to regdb_fetch_keys_internalVolker Lendecke2018-10-081-1/+17
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* registry: Fix a typoVolker Lendecke2018-10-081-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>