1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00

88 Commits

Author SHA1 Message Date
Matthias Dieter Wallnöfer
8d0b67b644 s4:registry/ldb.c - Break with "NULL" as an error case when the data doesn't fit in the "reg_ldb_pack_value" function 2010-03-29 21:38:18 +02:00
Matthias Dieter Wallnöfer
e25e60ba2f s4:registry/ldb.c - Always check the "name" attribute for != NULL
If it's NULL return invalid parameter as Windows does. The name is "" if it
refers to the default value.
2010-03-29 20:53:38 +02:00
Matthias Dieter Wallnöfer
90d2902c73 s4:registry - move the UTF16 length calculation for "reg_key_get_info" into the RPC server code
It does fit better there.
2010-03-29 20:36:32 +02:00
Matthias Dieter Wallnöfer
3a2488870f s4:registry - "reg_ldb_pack_value" - provide workarounds when the server receives non-standard data.
For now we reset/delete the "data" attribute. Anyway there is the need to find
a better solution (we probably want to change the format and save all data as
we got it like Windows itself does).

These workarounds are needed since for example the Windows 2000 Registry Editor
initialises empty REG_SZ strings with content '\0' and length 1 (not a valid
UTF16 sequence - "convert_string_talloc" breaks). So we simply reset/delete the
"data" attribute which works (no content).
2010-03-23 16:46:17 +01:00
Matthias Dieter Wallnöfer
0426b5b786 s4:registry - "LDB backend" - fix indentation 2010-03-23 16:46:17 +01:00
Matthias Dieter Wallnöfer
a6f5e495b1 s4:registry - "LDB backend" - revert the length check for UTF16 strings
Let this do the "convert_string_talloc" function as it was before.
2010-03-23 00:26:01 +01:00
Matthias Dieter Wallnöfer
bca353561e s4:registry - "LDB backend" - revert the binary storage of "REG_SZ", "REG_DWORD" and "REG_QWORD"
We agreed that this hack isn't the best of the possible solutions.
2010-03-23 00:16:19 +01:00
Matthias Dieter Wallnöfer
43170dafbc s4:registry - adaptions for "add memory contexts for delete value/key functions" 2010-03-22 22:31:00 +01:00
Matthias Dieter Wallnöfer
61761cbac8 s4:registry - "LDB backend" - "reg_ldb_unpack_value"
When the name isn't found it is the default value. Call it "" to be consistent.
2010-03-21 23:36:09 +01:00
Matthias Dieter Wallnöfer
7b54964a25 s4:registry - "LDB backend" - "reg_key_get_info"
Consider also the default value (if it exists) as value. That means:
- count it when setting "num_values"
- take also his buffer length as a candidate for the maximum value buffer length

This is what Windows does.
2010-03-21 23:19:32 +01:00
Matthias Dieter Wallnöfer
773faa5063 s4:registry - "LDB backend" - "ldb_get_default_value"
There exist also key objects (the hives) which don't contain a "key" entry at
all. This prevented to display their default value (my fault).
2010-03-21 23:02:31 +01:00
Matthias Dieter Wallnöfer
b7f129f5c4 s4:registry - "LDB backend" - make the key argument "const" of ldb_get_default_value 2010-03-21 22:19:12 +01:00
Matthias Dieter Wallnöfer
ea621efee7 s4:registry - "LDB backend" - fix indentation 2010-03-21 22:04:28 +01:00
Matthias Dieter Wallnöfer
ad83995de5 s4:registry - "LDB backend" - reg_key_get_info - adapt max. subkey and value length
Those lengths are measured in UTF8 string lengths and not in UTF16 ones (the
returned strings are generally in this format). Discovered this by checking the
s3 registry code.
Therefore we have to multiply the both numbers by two.

Discovered with the "regedt32" (old NT registry editor).
2010-03-21 15:33:52 +01:00
Matthias Dieter Wallnöfer
cc4e5c8beb s4:registry - "LDB backend" - don't test for "0" as string termination on binary and unknown typed values 2010-03-21 14:10:17 +01:00
Matthias Dieter Wallnöfer
2f79217964 s4:registry - handle type "DWORD_BIG_ENDIAN" as type "DWORD"
Further tests show that (at least per default) there aren't any differences
between them.
2010-03-21 14:03:57 +01:00
Matthias Dieter Wallnöfer
a55031792d s4:registry - "LDB backend" - fix up memory allocation for dynamic integers
We don't need to reserve memory for NULL termination when storing data as
integers.
2010-03-21 14:03:55 +01:00
Matthias Dieter Wallnöfer
1d49a266ab s4:registry - "LDB backend" - Fix up the storage of binary REG_SZ/REG_EXPAND_SZ values
There seem to exist also UTF16 sequences which have byte sizes of a multiple of
two but are invalid (gd's winreg test shows this).
2010-03-21 14:03:23 +01:00
Matthias Dieter Wallnöfer
abe75a5c8c s4:registry - use a macro for reverse byte order 2010-03-16 09:41:03 +01:00
Matthias Dieter Wallnöfer
2f686d8523 s4:registry - introduce the "REG_DWORD_BIG_ENDIAN" datatype
It's like the normal REG_DWORD type but the byte order swapped
2010-03-16 08:58:31 +01:00
Matthias Dieter Wallnöfer
00934d4c2f s4:registry - fix up the output of hexadecimal values
Use a fixed-length representation to avoid platform-specific issues.
2010-03-15 13:27:35 +01:00
Matthias Dieter Wallnöfer
80300af278 s4:registry - add support for REG_QWORD values
Basically the same as REG_DWORD but these are eight byte long.
2010-03-15 13:27:34 +01:00
Matthias Dieter Wallnöfer
bb1ac0c75c s4:registry - ldb.c - provide a mechanism for storing UTF8/binary REG_DWORD values
We need to support this as gd's WINREG torture test shows.
2010-03-14 18:46:22 +01:00
Matthias Dieter Wallnöfer
fbce5ded30 s4:registry - ldb.c - provide a mechansim for storing UTF8/binary REG_SZ/REG_EXPAND_SZ values
We need to support this as gd's WINREG torture test shows.
2010-03-14 18:46:22 +01:00
Matthias Dieter Wallnöfer
95bfd17e08 s4:registry - ldb.c - fix up a strange LDB filter 2010-03-14 18:46:21 +01:00
Matthias Dieter Wallnöfer
f72790daaa s4:registry - ldb.c - fix up the memory handling in "reg_ldb_unpack_value"
Don't substitute existing data blobs with new ones and make sure, that the
result objects in the data blob don't have memory dependencies of the LDB value
input.
2010-03-14 18:46:21 +01:00
Matthias Dieter Wallnöfer
33eb1c95e5 s4:registry - ldb.c - check more for possible "Out of memory" circumstances 2010-03-14 18:46:21 +01:00
Matthias Dieter Wallnöfer
9b3c45754e s4:registry - ldb.c - remove superfluous "query" variable 2010-03-14 18:46:21 +01:00
Matthias Dieter Wallnöfer
cd3c870333 s4:registry - ldb.c - Consider result values in "reg_ldb_pack_value"
Break on errors and return NULL and otherwise the message pointer.
2010-03-14 18:46:20 +01:00
Matthias Dieter Wallnöfer
3c6792bc76 s4:registry - ldb.c - Move the "val" structure
Move it into the REG_SZ/REG_EXPAND_SZ case block since it's used only there.
Plus convert it from static into dynamic talloc'ed.
2010-03-14 18:46:20 +01:00
Matthias Dieter Wallnöfer
490c0cefeb s4:registry/ldb.c - if "name" isn't set we should return WERR_INVALID_PARAM 2010-03-10 18:50:00 +01:00
Matthias Dieter Wallnöfer
bb507d1d49 s4:lib/registry/ldb.c - fix up registry backend to be more robust
This should let the new WINREG tests written by gd at least pass against us.
2010-03-10 09:26:09 +01:00
Matthias Dieter Wallnöfer
6870313db5 s4:lib/registry/ldb.c - fix trailing whitespaces 2010-03-06 19:59:10 +01:00
Matthias Dieter Wallnöfer
ed678a2234 s4:registry library - fix up "reg_ldb_set_value"
The previous logic was wrong since it tried to add empty data in some cases
which always ended in an error. This problem should be fixed with the new logic.
2010-03-06 19:59:04 +01:00
Matthias Dieter Wallnöfer
f5b86cdac5 s4:registry library - make "reg_ldb_pack/unpack_value" more robust
This to prevent segmentation faults, wrong server inputs ecc.
2010-03-06 19:58:57 +01:00
Matthias Dieter Wallnöfer
89ab6818e1 s4:libregistry - change counters to be "unsigned"
Also the s4 registry library has to have "unsigned" counters like the Windows
one.
2010-03-06 17:48:25 +01:00
Brad Hards
3eacc83b35 Spelling fixes for source4/lib/registry.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:37 +01:00
Andrew Tridgell
5ab6a8d077 s4-registry: fixed byte order assumptions
the registry tests were broken on big-endian systems
2010-02-07 18:41:59 +11:00
Andrew Tridgell
4ad0397d8a s4-ldbwrap: added re-use of ldb contexts in ldb_wrap_connect()
This allows us to reuse a ldb context if it is open twice, instead
of going through the expensive process of a full ldb open. We can
reuse it if all of the parameters are the same.

The change relies on callers using talloc_unlink() or free of a parent
to close a ldb context.
2009-10-23 14:52:17 +11:00
Jelmer Vernooij
94069bd274 s4: Use same function signature for convert_* as s3. 2009-03-01 19:55:46 +01:00
Jelmer Vernooij
9ffb6d2d9e Add allow_badcharcnv argument to all conversion function, for
consistency with Samba 3.
2009-03-01 06:33:40 +01:00
Stefan Metzmacher
183c379fe5 s4:lib/tevent: rename structs
list=""
list="$list event_context:tevent_context"
list="$list fd_event:tevent_fd"
list="$list timed_event:tevent_timer"

for s in $list; do
	o=`echo $s | cut -d ':' -f1`
	n=`echo $s | cut -d ':' -f2`
	r=`git grep "struct $o" |cut -d ':' -f1 |sort -u`
	files=`echo "$r" | grep -v source3 | grep -v nsswitch | grep -v packaging4`
	for f in $files; do
		cat $f | sed -e "s/struct $o/struct $n/g" > $f.tmp
		mv $f.tmp $f
	done
done

metze
2008-12-29 20:46:40 +01:00
Jelmer Vernooij
56a0b035c6 Remove more uses of global_loadparm. 2008-10-24 14:31:16 +02:00
Jelmer Vernooij
37d885c51a Remove iconv_convenience argument from convert_string{,talloc}() but
make them wrappers around convert_string{,talloc}_convenience().
2008-10-24 14:26:46 +02:00
Jelmer Vernooij
fdf0d9bbb8 Fix double free. 2008-10-21 15:51:04 +02:00
Jelmer Vernooij
19aec78aec Fix the build. 2008-10-21 15:47:34 +02:00
Jelmer Vernooij
d4d4a9da83 Revert "Registry server LDB backend: Don't make copies of the same type"
The original data pointer may go away so we do want to make copies in
this case.

This reverts commit 625359b2e266105022309df8985720108ecd6f67.
2008-10-21 14:57:41 +02:00
Jelmer Vernooij
5209a846a9 Merge branch 'master' of ssh://git.samba.org/data/git/samba into regsrv
Conflicts:
	source4/lib/registry/ldb.c
	source4/rpc_server/winreg/rpc_winreg.c
2008-10-21 14:51:13 +02:00
Matthias Dieter Wallnöfer
625359b2e2 Registry server LDB backend: Don't make copies of the same type 2008-10-21 14:40:42 +02:00
Matthias Dieter Wallnöfer
fcc93f68a0 Registry server LDB backend REG_BINARY type: Save it directly in LDB
With this patch the REG_BINARY type is saved directly in a LDB registry database rather than converted in a hex-string.
2008-10-21 14:40:42 +02:00