summaryrefslogtreecommitdiff
path: root/source3/registry
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* lib: Pass mem_ctx to state_path()Volker Lendecke2018-08-172-4/+4
| | | | | | | | Fix a confusing API: Many places TALLOC_FREE the path where it's not clear you have to do it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:registry: Fix possible memory leak in _reg_perfcount_multi_sz_from_tdb()Andreas Schneider2018-08-111-4/+11
| | | | | | | | | | | | | | Found by covscan. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13567 Pair-Programmed-With: Justin Stephenson <jstephen@redhat.com> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Justin Stephenson <jstephen@redhat.com> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Aug 11 04:43:15 CEST 2018 on sn-devel-144
* s3:registry: Fix buffer truncation issues issues with gcc8Andreas Schneider2018-06-201-7/+5
| | | | | | | | | | | ../source3/registry/reg_perfcount.c: In function ‘reg_perfcount_get_hkpd’: ../source3/registry/reg_perfcount.c:337:29: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] snprintf(buf, buflen,"%d%s", key_part1, key_part2); BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* s3:registry: Fix size types and length calculationsAndreas Schneider2018-03-211-7/+9
| | | | | | | | | | This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Mar 21 04:25:39 CET 2018 on sn-devel-144
* s3-rpc_cli: add winreg_add_core_driver()Günther Deschner2017-05-092-0/+2
| | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* Correct "existence" typos.Chris Lamb2017-02-221-2/+2
| | | | | | Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* Correct "perfom" typos.Chris Lamb2017-02-221-1/+1
| | | | | | Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* werror: replace WERR_OBJECT_PATH_INVALID with WERR_BAD_PATHNAME in ↵Günther Deschner2016-09-281-2/+2
| | | | | | | | | source3/registry/reg_api_regf.c Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_REG_FILE_INVALID with WERR_NOT_REGISTRY_FILE in ↵Günther Deschner2016-09-281-1/+1
| | | | | | | | | source3/registry/reg_api_regf.c Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_REG_IO_FAILURE with WERR_REGISTRY_IO_FAILED in ↵Günther Deschner2016-09-283-11/+11
| | | | | | | | | source3/registry/ Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_REG_CORRUPT with WERR_REGISTRY_CORRUPT in ↵Günther Deschner2016-09-281-1/+1
| | | | | | | | | source3/registry/reg_backend_db.c Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_INVALID_PARAM with WERR_INVALID_PARAMETER in ↵Günther Deschner2016-09-285-16/+16
| | | | | | | | | source3/registry/ Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_GENERAL_FAILURE with WERR_GEN_FAILURE in ↵Günther Deschner2016-09-281-1/+1
| | | | | | | | | source3/registry/reg_api_regf.c Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_NOMEM with WERR_NOT_ENOUGH_MEMORY in source3/registry/Günther Deschner2016-09-289-51/+51
| | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* werror: replace WERR_BADFILE with WERR_FILE_NOT_FOUND in source3/registry/Günther Deschner2016-09-284-16/+16
| | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-registry: create winprint print processor entry for x64 as well.Günther Deschner2016-09-111-0/+1
| | | | | | | Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:registry: use dbwrap_purge_bystring instead of dbwrap_delete_bystringMichael Adam2016-03-011-6/+1
| | | | | | | where appropriate Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>