summaryrefslogtreecommitdiff
path: root/source3/registry
AgeCommit message (Collapse)AuthorFilesLines
2025-11-10s3: talloc_destroy() -> TALLOC_FREE()Volker Lendecke1-1/+1
Sweeping change, I know. Should not change compiled code in most cases, the compiler should be smart enough to elide the assignment right before a return. In the cases where this is not right before the return, TALLOC_FREE() is safer as it makes use-after-free crash. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-07-01rpc registry: add ProductType for AD DCMichael Saxl1-0/+1
HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions contains a key ProductType The value of that key should be LanmanNT on a domain controller (of any type). The switch had no case for ROLE_ACTIVE_DIRECTORY_DC BUG: https://bugzilla.samba.org/show_bug.cgi?id=15863 Signed-off-by: Michael Saxl <mike@mwsys.mine.bz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Jul 1 09:17:08 UTC 2025 on atb-devel-224
2025-05-15lib: Save lines by avoiding explicit ZERO_STRUCTP callsVolker Lendecke1-2/+1
SMB_CALLOC_ARRAY(..., 1) does this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-08-27lib: Add a few explicit includesVolker Lendecke1-0/+1
Required to trim down includes from gen_ndr/*security* Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jennifer Sutton <jsutton@samba.org>
2024-07-08s3:registry: Use correct integer sizesAndreas Schneider1-2/+2
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-07-08s3:registry: Check for integer overflowAndreas Schneider1-0/+4
"Error: INTEGER_OVERFLOW (CWE-190): samba-4.20.0rc2/source3/registry/regfio.c:175: tainted_data_argument: The check ""bytes_read < block_size"" contains the tainted expression ""bytes_read"" which causes ""block_size"" to be considered tainted. samba-4.20.0rc2/source3/registry/regfio.c:176: overflow: The expression ""block_size - bytes_read"" is deemed overflowed because at least one of its arguments has overflowed. samba-4.20.0rc2/source3/registry/regfio.c:176: overflow_sink: ""block_size - bytes_read"", which might have underflowed, is passed to ""read(file->fd, buffer + bytes_read, block_size - bytes_read)"". [Note: The source code implementation of the function has been overridden by a builtin model.] 174| 175| while ( bytes_read < block_size ) { 176|-> if ( (returned = read( file->fd, buffer+bytes_read, block_size-bytes_read )) == -1 ) { 177| DEBUG(0,(""read_block: read() failed (%s)\n"", strerror(errno) )); 178| return False;" Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-07-05s3:registry: Initialize struct security_ace ace[]Pavel Filipenský1-1/+1
Error: UNINIT (CWE-457): samba-4.20.0rc2/source3/registry/reg_dispatcher.c:43: var_decl: Declaring variable "ace" without initializer. samba-4.20.0rc2/source3/registry/reg_dispatcher.c:66: uninit_use_in_call: Using uninitialized value "*ace". Field "ace->object" is uninitialized when calling "make_sec_acl". 64| /* create the security descriptor */ 65| 66|-> theacl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace); 67| if (theacl == NULL) { 68| return WERR_NOT_ENOUGH_MEMORY; Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-06-24s3:registry: Add missing return value checksAndreas Schneider1-0/+9
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2024-06-24s3:registry: Avoid possible double freesAndreas Schneider1-0/+3
Found by Covscan. "Error: USE_AFTER_FREE (CWE-416): samba-4.20.0rc2/source3/registry/reg_perfcount.c:309: freed_arg: ""_reg_perfcount_multi_sz_from_tdb"" frees ""*retbuf"". samba-4.20.0rc2/source3/registry/reg_perfcount.c:313: double_free: Calling ""_reg_perfcount_multi_sz_from_tdb"" frees pointer ""*retbuf"" which has already been freed. 311| for(i = 1; i <= base_index; i++) 312| { 313|-> buffer_size = _reg_perfcount_multi_sz_from_tdb(names, i*2, retbuf, buffer_size); 314| } 315| tdb_close(names);" Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2024-06-24s3:registry: Remove trailing spaces in reg_perfcount.cAndreas Schneider1-14/+14
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2023-09-26libcli/security: Rename dup_nt_token() -> security_token_duplicate()Andrew Bartlett1-1/+1
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-09-11s3:registry: Fix code spellingJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-14s3:registry: Fix code spellingJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08s3:registry: Add missing newlines to logging messagesJoseph Sutton2-7/+7
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-19s3:registry: Fix code spellingAndreas Schneider10-25/+25
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-01-10lib: Move tab_depth() to reg_parse_prs.cVolker Lendecke1-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>
2022-09-19source3: A few whitespace fixesVolker Lendecke1-180/+179
review with git sh -w Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-09-19registry3: Move registry_value_cmp() to its only userVolker Lendecke2-10/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-09-19registry3: Remove some unused functionsVolker Lendecke2-167/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-07-25registry3: Align an integer typeVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2022-07-25registry3: Align function types to what is returnedVolker Lendecke2-4/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2022-05-20registry3: Align some integer typesVolker Lendecke2-5/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-11-09CVE-2020-25717: Add FreeIPA domain controller roleAlexander Bokovoy1-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>
2021-09-22registry: skip root check when running with uid-wrapper enabledRalph Boehme1-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
2021-08-17registry: check for running as root in clustering modeRalph Boehme1-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
2021-04-19registry: Fix a typoVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-02-10s3:registry Renaming get_charset() to smbreg_get_charset()xzhao93-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
2021-02-01s4:registry: Mark fall through switch statementAndreas Schneider1-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>
2021-02-01s4:registry: Add missing break in switch statementAndreas Schneider1-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>
2020-08-28s3: safe_string: do not include string_wrappers.hMatthew DeVore1-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>
2020-06-10registry3: Fix a typoVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-05-05registry3: Align a few integer typesVolker Lendecke1-4/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-31source3/registry/reg_parse.h: typo fixesBjörn Jacke1-4/+4
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-31source3/registry/reg_import.h: typo fixesBjörn Jacke1-8/+8
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-31source3/registry/reg_format.h: typo fixesBjörn Jacke1-1/+1
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-18regfio: Allow ignoring of checksumMichael Hanselmann2-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>
2019-09-01Spelling fixes s/preceeding/preceding/Mathieu Parent1-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>
2019-09-01Spelling fixes s/withing/within/Mathieu Parent1-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>
2019-09-01Spelling fixes s/emtpy/empty/Mathieu Parent1-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>
2019-07-16s3/registry: clang: Fix 'initialization value is never read'Noel Power1-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>
2019-07-16s3/registry: clang: Fix 'initialization value is never read'Noel Power1-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>
2019-06-20regfio: Return instead of assert for short blocksMichael Hanselmann1-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>
2019-06-11s3: net: Consider unprocessed in input bufferSamuel Cabrero1-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>
2019-05-27registry: add a missing includeRalph Boehme1-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
2019-05-15s3: net: Rewrite of reg_parse_fd() to harden against buffer overwrites.Jeremy Allison1-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>
2019-05-15s3: net: Harden act_val_hex() act_val_sz() against errors.Jeremy Allison1-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>
2019-05-15s3: net: Harden guess_charset() against overflow errors.Jeremy Allison1-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>
2019-05-15test_regfio.c: include stdint.h before cmoka.hFabrice Fontaine1-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>
2019-05-10s3/registry: fix various 'cast between incompatible function' warningsNoel Power1-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>
2019-05-10s3/registry: Fix incompatible func castsNoel Power1-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>