1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00
Commit Graph

50 Commits

Author SHA1 Message Date
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 625359b2e2.
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
Matthias Dieter Wallnöfer
828b033345 Registry server LDB backend REG_SZ type: Always use UTF8 encoding
We should save data OS independent in the LDB files.
2008-10-21 14:40:42 +02:00
Matthias Dieter Wallnöfer
47868196b8 Registry server LDB backend REG_SZ type: Fix up the empty string problem
This fixes up the empty string problem in a better way without the need of changing the character conversion code.
2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
f10227958b Registry server: Fixes up the patch with "type" != NULL (used in "EnumValue" and "QueryValue")
This prevents the server to segfault if the input data type is NULL.
2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
083785c091 Registry server "reg_ldb_unpack_value": Tests demonstrate that also "type" doesn't has to be NULL 2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
c26cb44e03 Revert "Registry server "reg_ldb_unpack_value": Let "data" pointer be NULL"
This reverts commit 82f50ea69f3aece4ac654ffdfa627babd8aadc25.
Cause: Windows (2000) doesn't accept the "data" pointer set to NULL
2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
b23c3c24c2 Registry server "reg_ldb_unpack_value": Let "data" pointer be NULL
Prevent segfaults in some client applications (e.g. regdiff)
2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
ac4808c11f Cleanups of server files
Cosmetic corrections
2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
e23e997644 Registry server: More work to be compatible
Some fixup's and assure, that we send only initialized values.
2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
f58f74949d ldb_get_value_by_id: Fix the return of the default value
The return of the values of a certain key has been broken since I've introduced the default value.
Now the behaviour is correct: If no default value exists, start with index zero to fetch the other values. Otherwise let zero be the default value and enumerate the others starting with one.
2008-10-21 14:40:41 +02:00
Matthias Dieter Wallnöfer
036b650ee4 reg_ldb_unpack_value: Change "CH_UTF8" in "CH_UNIX"
It's better to use "CH_UNIX" for unpacking, because the system charset doesn't have to be UTF8 and we should be compatible with "reg_ldb_pack_value".
2008-10-21 14:40:40 +02:00
Matthias Dieter Wallnöfer
1938cb1e83 ldb_del_value: Free key data also when removing the default attribute 2008-10-21 14:40:40 +02:00
Matthias Dieter Wallnöfer
ad778c00e7 Fix for allowing the REG_BINARY type and introducing the default attribute
The REG_BINARY type is converted and stored in the LDB database as a leaf object with string-data.
The default attribute is saved directly in the hive object as the "data"-string.
2008-10-21 14:40:40 +02:00
Simo Sorce
508527890a Merge ldb_search() and ldb_search_exp_fmt() into a simgle function.
The previous ldb_search() interface made it way too easy to leak results,
and being able to use a printf-like expression turns to be really useful.
2008-09-23 18:17:46 -04:00
Jelmer Vernooij
21fc767378 Specify event_context to ldb_wrap_connect explicitly.
(This used to be commit b4e1ae07a2)
2008-04-17 12:23:44 +02:00
Jelmer Vernooij
c7dc53b851 Merge branch 'v4-0-test' into id10ts-registry
(This used to be commit f98b59021a)
2008-03-03 00:23:09 +01:00
Andrew Kroeger
7dac0598ec registry: Implement recursive deletes for ldb-backed registry.
When deleting a registry key that contains subkeys or values, Windows performs a
recursive deletion that removes any subkeys or values.  This update makes
deletes for an ldb-backed registry consistent with Windows.

Under ldb, the deletion is done using an explicit transaction.  If an error
occurs during the deletion the entire transaction is cancelled, leaving the
registry as it was before the deletions started.
(This used to be commit ca796c8fb1)
2008-02-26 19:27:14 -06:00
Jelmer Vernooij
10169a2030 Remove more global_loadparm instance.s
(This used to be commit a1280252ce)
2008-02-21 17:54:24 +01:00
Jelmer Vernooij
7a402da97e registry: Fix warning.
(This used to be commit dad8090304)
2008-02-09 17:18:51 +01:00
Jelmer Vernooij
55ad09a01b registry: Use correct return values.
(This used to be commit 98ebdbe52f)
2008-01-18 03:42:00 +01:00
Andrew Kroeger
e490415e2e When Windows attempts to create a new key, it looks for an available key name
starting with "New Key #1" and iterating up to "New Key #99" before giving up.
ldb_open_key() calls reg_path_to_ldb() to build the appropriate dn from the key
name.  reg_path_to_ldb() was not catching the error returned by
ldb_dn_add_base_fmt() due to the unescaped '#' character, causing the returned
dn to be that of the parent key, not the potential new key.  Additionally,
Windows expects a return value of WERR_BADFILE when a key does not exist, but
WERR_NOT_FOUND was being returned instead.  Correcting the building of the dn
and the providing the expected return value allows new key creation to succeed.

When attempting to delete a key, Windows passes the complete path to the key,
not just the name of the child key to be deleted.  Using reg_path_to_ldb() to
build the correct dn allows key deletion to succeed.
(This used to be commit d57792d67b)
2008-01-18 03:41:59 +01:00
Jelmer Vernooij
85d60d2d09 registry: Improve error codes and update tests.
Rather than map the error returned by the registry to the correct error,
return the correct error in the first place.

Also deal with the fact that the right error code is now returned in a
couple of places.
(This used to be commit 1e31fcb8a0)
2008-01-18 03:41:59 +01:00
Andrew Kroeger
4d8a60f617 When Windows initially creates a new value, the value name is "New Value #1".
The '#' character was causing problems, as it was not being escaped for the dn,
but the failure returned by ldb_dn_add_child_fmt() was not being caught.  This
was causing the new value to be added on the parent key, not the current key.
When attempting to delete the new value (now on the parent key) the same
escaping error was returned by ldb_dn_add_child_fmt(), causing the delete to
delete the key and not the value.

When attempting to rename a value, Windows first tries to ensure the new name
does not already exist.  When a value does not exist, Windows expects a return
value of WERR_BADFILE, but WERR_NOT_FOUND was being returned instead.
Providing the WERR_BADFILE that Windows expects allows values to be renamed.
(This used to be commit 94fb39cfd9)
2008-01-18 03:41:59 +01:00
Andrew Kroeger
158a2eed33 registry: Properly check return values from ldb_*() functions.
There were a few cases left that attempted to detect errors from ldb_*()
function calls using "(ret < 0)".  As all LDB_* error codes are greater than
zero, there was no chance any errors would be detected.  Changed all such tests
to use "(ret != LDB_SUCCESS)".
(This used to be commit 0ed6f1b162)
2008-01-18 03:41:59 +01:00
Jelmer Vernooij
73626c266c registry: Check for more specific LDB return codes, handle changing existing values better.
(This used to be commit c8b22ef30c)
2008-01-18 03:41:59 +01:00
Jelmer Vernooij
83a7d865e4 r26692: registry: Treat key and value names case-insensitively.
(This used to be commit 9fc5f098e0)
2008-01-07 17:48:02 -06:00
Jelmer Vernooij
47f6bbf8cf r26689: registry: Return max_subkeynamelen, max_valnamelen and max_valbufsize in getkeyinfo().
(This used to be commit b06896d237)
2008-01-07 08:18:07 -06:00
Jelmer Vernooij
12a513b47b r26518: Fix provision of registry using Python.
(This used to be commit 12eb38e553)
2007-12-21 05:51:25 +01:00
Kai Blin
45015eda24 r26451: Janitorial: fix warnings in lib/registry/
This does not fix the discarded qualifier warnings in tests, as the test data
is currently passed as const. Jelmer wants to provide a test function that
passes non-const test data, thus allowing for a cleaner way to fix those
warnings.
(This used to be commit 46dfa63d4f)
2007-12-21 05:50:16 +01:00
Jelmer Vernooij
96a200511e r26443: Remove global_loadparm instances.
(This used to be commit 8242c69623)
2007-12-21 05:50:11 +01:00
Jelmer Vernooij
d891c0c74a r26429: Avoid use of global_smb_iconv_convenience.
(This used to be commit d37136b7ab)
2007-12-21 05:49:56 +01:00
Jelmer Vernooij
39ee38d9c1 r26316: Use contexts for conversion functions.
(This used to be commit f6420d933b)
2007-12-21 05:48:30 +01:00
Jelmer Vernooij
cb7c72a0ef r26263: Don't assume CH_UNIX is CH_UTF8.
(This used to be commit 69157be9b1)
2007-12-21 05:47:37 +01:00
Jelmer Vernooij
ca0b72a1fd r26003: Split up DB_WRAP, as first step in an attempt to sanitize dependencies.
(This used to be commit 56dfcb4f2f)
2007-12-21 05:45:40 +01:00
Günther Deschner
cc8f4eb3cd r25544: Cleanup some more indents in lib/registry.
Guenther
(This used to be commit 0d9826dc54)
2007-10-10 15:07:51 -05:00
Jelmer Vernooij
2f3551ca7c r25446: Merge some changes I made on the way home from SFO:
2007-09-29 More higher-level passing around of lp_ctx.
2007-09-29 Fix warning.
2007-09-29 Pass loadparm contexts on a higher level.
2007-09-29 Avoid using global loadparm context.
(This used to be commit 3468952e77)
2007-10-10 15:07:34 -05:00
Jelmer Vernooij
033c2c07a3 r24898: Fix LOCAL-REGISTRY, do not silently ignore testcase setup failures.
(This used to be commit 527ea7fccf)
2007-10-10 15:03:33 -05:00
Jelmer Vernooij
6ca1390269 r24684: Be a bit less verbose
(This used to be commit 7a7af62dc4)
2007-10-10 15:02:42 -05:00
Jelmer Vernooij
b409d4120f r24667: Finally merge the registry improvements that Wilco Baan Hofman and I have
been working on for at least half a year now. Contains the following
improvements:

 * proper layering (finally!) for the registry library. Distinction is
   now made between 'real' backends (local, remote, wine, etc) and
   the low-level hive backends (regf, creg, ldb, ...) that are only used
   by the local registry backend
 * tests for all important hive and registry operations
 * re-enable RPC-WINREG tests (still needs more work though, as
							   some return values aren't checked yet)
 * write support for REGF files
 * dir backend now supports setting/reading values, creating keys
 * support for storing security descriptors
 * remove CREG backend as it was incomplete, didn't match the data model
   and wasn't used at all anyway
 * support for parsing ADM files as used by the policy editor (see lib/policy)
 * support for parsing PREG files (format used by .POL files)
 * new streaming interface for registry diffs (improves speed and memory usage
	for regdiff/regpatch significantly)

   ... and fixes a large number of bugs in the registry code
(This used to be commit 7a1eec6358)
2007-10-10 15:02:34 -05:00