Bug 15168 - Registry tools: mkkey and set not working anymore (error lseeking in regf file)
Summary: Registry tools: mkkey and set not working anymore (error lseeking in regf file)
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.17.0rc5
Hardware: x64 Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-12 11:42 UTC by Peter Gerritsen
Modified: 2022-09-12 11:42 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Gerritsen 2022-09-12 11:42:43 UTC
I've found a problem that seems to exist in all registry tools. No matter which tool you use when adding a key or setting a value an error shows up: "error lseeking in regf file". Happens with Regshell but also when using python bindings. I've checked with versions ranging from prebuild packages atleast from 4.12 until the latest 4.18git1 manually compiled. The problem seems to be in regf.c, specifically in the regf_save_hbin function. I've have tried finding a solution myself but I ain't that great at C and filehandling. Looks to me that the file descripter is already closed or something.

root@builder:/usr/src/samba# /usr/local/samba/bin/regshell -F SECURITY
DEBUG LEVEL 10:
pm_process() returned Yes
Attempting to load registry file
9 HBIN blocks read
\> mkkey Test
Subkeys in LH list
Found free block of size 104 (needing 88) in middle of HBIN
Storing key Test
Error lseeking in regf file
Open/Creation of key Test failed: WERR_GEN_FAILURE
Error adding new subkey 'Test': WERR_GEN_FAILURE

After adding the printing of the error code to the source and recompiling I get:

root@builder:/usr/src/samba# /usr/local/samba/bin/regshell -F SECURITY
DEBUG LEVEL 10:
pm_process() returned Yes
Attempting to load registry file
9 HBIN blocks read
\> mkkey Test
Subkeys in LH list
Found free block of size 104 (needing 88) in middle of HBIN
Storing key Test
Error lseeking in regf file: 9, Bad file descriptor
Open/Creation of key Test failed: WERR_GEN_FAILURE
Error adding new subkey 'Test': WERR_GEN_FAILURE

It looks like an easy fix, but just not for me. Hope someone can fix this. I can use manually compiled samba so a patch would enough for now.

Best Regards,
Peter