summaryrefslogtreecommitdiff
path: root/source3/registry/reg_db.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-6/+6
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-11Remove bogus commentVolker Lendecke1-5/+0
(This used to be commit 142b80bf1542f212dff66a3661c13f3f6845067f)
2007-10-10r25528: Only do transactions on registry.tdb if anything changesVolker Lendecke1-4/+48
I got annoyed by the fsync calls clobbering my harddrive when smbd started up for debugging. ... things you do on a plane without internet (This used to be commit e0927a7cbf4b806bcc93ad4af9552bc91292e78b)
2007-10-10r25417: Use DBGC_REGISTRY class.Günther Deschner1-1/+1
Guenther (This used to be commit 43ca04918a5a1b2379083dc624b346ceb8476a38)
2007-10-10r23801: The FSF has moved around a lot. This fixes their Mass Ave address.Andrew Tridgell1-2/+1
(This used to be commit 87c91e4362c51819032bfbebbb273c52e203b227)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23512: Fix conflict in #define for SECDESC_PREFIX. Ensure allJeremy Allison1-5/+5
reg #defines use "REG_" prefix. Michael - please check gcc warnings on compiles. Jeremy. (This used to be commit 7885b68bb5df0ebe290feca0e74b4a20ef59e718)
2007-10-10r23509: This activates the global options from the registry in loadparm.Michael Adam1-7/+2
The global options are stored as values in the subkey "global" of the SMBCONF registry key. The activation is accomplished in smb.conf though a new special semantic of the "include" parameter: "include = registry" triggers the processing of the registry global options exactly at the position of the include statement. Options read from the registry take the same precedence as parameters loaded from a file via include. Need to reload the registry globals is detected by watching the tdb sequence number. Registry shares are automatically activated when the registry globals are processed. So a "registry only" configuration can be realized by an smb.conf that looks as follows: ================================ [global] include = registry ================================ The global options and registry shares can be conveniently edited with the "net conf" utility. Caveat: A possible pitfall consists in using "include = registry" together with the "lock directory" directive in the registry. This problem will be addressed in the next time. Note on the code: Processing of the registry options is accomplished by a function process_registry_globals() in loadparm.c The current version is only an interim solution: It is handcoded instead of using the infrastructure of reg_api.c. The reason for this is that using reg_api still has too large linker dependencies, bloating virtually all targets by PASSDB_OBJ, SMBLDAP_OBJ, GROUPDB_OBJ and LDB stuff. A version of process_registry_globals that uses reg_api is included but commented out. The goal is to eventually refactor and restructure the registry code so that one can use the reg_api to access only the registry tdb and not link all the dynamic backends with all their linking implications. (This used to be commit 24b0cbcb3741dd14b04728448a85cc04a057e7d0)
2007-10-10r23507: Split one general function normalize_dbkey from reg_db.c into util_reg.cMichael Adam1-7/+0
(To be used in other place in subsequent commit.) Michael (This used to be commit 6fd71140499e30b8fd0f083301512db7b8c2f236)
2007-10-10r23504: Use tdb_wrap_open (instead of usual tdb_open) in reg_db.Michael Adam1-27/+22
This eliminates the need of maintaining reg_db's own reference counter for the tdb. Maybe as a next step... Michael (This used to be commit 31d64767fc8a73be1f6b81e2712d687897f812a0)
2007-10-10r23468: Open registry.tdb with sequence number.Michael Adam1-3/+15
Add a function to retrieve the registry db sequence number. This is in preparation of loadparm integration of registry global smb.conf options: this will allow to detect changes in order to trigger reload. Michael (This used to be commit ebe2ea8f22bfe0855beee087af771c690db443c1)
2007-10-10r23460: Re-add whitespace to reduce diff between branches.Michael Adam1-1/+1
Sorry for the noise... Michael (This used to be commit c7d004dec4822c0d8e5c7fd6519850f906c7bb1a)
2007-10-10r23459: Remove one superfluous cast.Michael Adam1-1/+1
(This used to be commit beed87550786052891969f6014088c17a5d77157)
2007-10-10r23458: Cosmetic fix in debug output.Michael Adam1-1/+1
(This used to be commit 03dbdb561a16a6e3dbd99ee29aac598457873002)
2007-10-10r23379: Whitespace cosmetics, to reduce irritating diffs...Michael Adam1-1/+1
Michael (This used to be commit df30f8d5c2999590aabe1e87f92fbdbafa7052aa)
2007-10-10r22009: change TDB_DATA from char * to unsigned char *Stefan Metzmacher1-7/+7
and fix all compiler warnings in the users metze (This used to be commit 3a28443079c141a6ce8182c65b56ca210e34f37f)
2007-10-10r21978: make use of tdb_*_bystring()Stefan Metzmacher1-4/+2
to avoid creating the TDB_DATA struct from strings "by hand" metze (This used to be commit 1a0599d7aadef651e4d5b88b59c95e8a118dfa5e)
2007-10-10r21977: little cosmetic change to remove a local var that's not really neededStefan Metzmacher1-4/+2
metze (This used to be commit 71c3880e8924c57dcd60573d628b8eb29cee6055)
2007-10-10r21219: Speed up the initial startup time of smbd on systems with loaded diskVolker Lendecke1-3/+32
subsystems. See the comment in the diff. Volker (This used to be commit 92fdb1193de8e7c857603e4fcd4a92b9a0a0f3bd)
2007-10-10r20020: Arglll... eventlogadm links against reg_db but not the rest of the ↵Volker Lendecke1-79/+86
registry stuff. Revert the last change. This needs better fixing. Volker (This used to be commit ad1e00430bf5c4130023d30e9c8266ecdc640d2b)
2007-10-10r20019: Replace one set of tricky code by calls to another set of tricky code:Volker Lendecke1-86/+79
Initializing the reg_db now uses reg_createkey and reg_setvalue. Volker (This used to be commit cab5ccbbe484795f13531726d68b978073262e33)
2007-10-10r19963: Add 'registry shares = yes' and registry key security descriptors.Volker Lendecke1-3/+89
(This used to be commit 6cab254c49e07b11c170511ec613f0f33914c3e6)
2007-10-10r19841: Wrap regdb_store_keys and regdb_store_values in tdb transactionsVolker Lendecke1-18/+52
(This used to be commit 5ec737922041b723b9e60c08049ace5fa2fa5dec)
2007-10-10r19839: Fix the build, we are not there yet :-)Volker Lendecke1-1/+0
(This used to be commit ff4123c8f2e07e282800c166a4e00b1015ddd45c)
2007-10-10r19838: We have to delete the value record as well, otherwise the old values ↵Volker Lendecke1-0/+4
pop up again if the key is re-created. Volker (This used to be commit f722f3341f65f8737c10eb59048c1263a58afd44)
2007-10-10r19837: Some reformatting (Jerry, I hope you do not mindVolker Lendecke1-4/+9
(This used to be commit 6639f8c1190419e183d92ed0322e1026375717e6)
2007-10-10r17333: Some C++ warningsVolker Lendecke1-2/+2
(This used to be commit be9aaffdaccae06c8c035eaf31862e34b7cfbe38)
2007-10-10r17047: Fix a typo and a possible NULL dereferenceVolker Lendecke1-2/+4
(This used to be commit c0d9114706345c6bc1fa392bbf9ee81b146cba85)
2007-10-10r14247: Fix Coverity bug # 136Volker Lendecke1-1/+3
(This used to be commit 1b247ff2ed380f5b7d28917d74d6ef5609330a45)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-3/+2
realloc can return NULL in one of two cases - (1) the realloc failed, (2) realloc succeeded but the new size requested was zero, in which case this is identical to a free() call. The error paths dealing with these two cases should be different, but mostly weren't. Secondly the standard idiom for dealing with realloc when you know the new size is non-zero is the following : tmp = realloc(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } However, there were *many* *many* places in Samba where we were using the old (broken) idiom of : p = realloc(p, size) if (!p) { return error; } which will leak the memory pointed to by p on realloc fail. This commit (hopefully) fixes all these cases by moving to a standard idiom of : p = SMB_REALLOC(p, size) if (!p) { return error; } Where if the realloc returns null due to the realloc failing or size == 0 we *guarentee* that the storage pointed to by p has been freed. This allows me to remove a lot of code that was dealing with the standard (more verbose) method that required a tmp pointer. This is almost always what you want. When a realloc fails you never usually want the old memory, you want to free it and get into your error processing asap. For the 11 remaining cases where we really do need to keep the old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR, which can be used as follows : tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the pointer p, even on size == 0 or realloc fail. All this is done by a hidden extra argument to Realloc(), BOOL free_old_on_error which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR macros (and their array counterparts). It remains to be seen what this will do to our Coverity bug count :-). Jeremy. (This used to be commit 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r10819: merging a couple of fixes from trunkGerald Carter1-3/+59
* only keep the registry,tdb file open when we have an open key handle * tpot's setup.py fix * removing files that no longer exist in trunk and copying some that were missing in 3.0 (This used to be commit 6c6bf6ca5fd430a7a20bf20ed08050328660e570)
2007-10-10r10656: BIG merge from trunk. Features not copied overGerald Carter1-10/+2
* \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
2007-10-10r9895: fix typo in registry pathGerald Carter1-1/+1
(This used to be commit ef7e0d70c68976766c01e1212e2b8f48f6895f98)
2007-10-10r9894: Add new registry key expected by Windows XP clients.Gerald Carter1-9/+15
HKLM\\SYSTEM\\CurrentControlSet\\Control\\Termininal Server\\DefaultUserConfiguration Apparently this started showing up after the winreg-write support was added in 3.0.20rc1 or so. Also modifed init_registry_data() to always run and add the required keys. Initial values however are only written if they don't already exist. This makes it easier to add new keys without having to rev the tdb version number (which is really unnecessary in this case). Portions of patch reviewed by Thomas Bork on the general samba ml. (This used to be commit b12a05b23782cfcb93fb4811807ef388de97c95c)
2007-10-10r9739: conver the reg_objects (REGSUBKEY_CTR & REGVAL_CTR) to useGerald Carter1-27/+51
the new talloc() features: Note that the REGSUB_CTR and REGVAL_CTR objects *must* be talloc()'d since the methods use the object pointer as the talloc context for internal private data. There is no longer a regXXX_ctr_intit() and regXXX_ctr_destroy() pair of functions. Simply TALLOC_ZERO_P() and TALLOC_FREE() the object. Also had to convert the printer_info_2->NT_PRINTER_DATA field to be talloc()'d as well. This is just a stop on the road to cleaning up the printer memory management. (This used to be commit ef721333ab9639cb5346067497e99fbd0d4425dd)
2007-10-10r9278: Remove unused variable. Bugzilla #2983.Tim Potter1-2/+1
(This used to be commit 5d592691e4d4f1cd47bd062633a54d7892548ee7)
2007-10-10r9115: using #define for reg paths rather than typing the stringGerald Carter1-4/+10
(This used to be commit e9427912a763b0e4bb47724f835b91c2252105e8)
2007-10-10r8501: * disable printer handle object cache (was mostly usedGerald Carter1-2/+2
for NT4 clients enumerating printer data on slow CPUs) * fix pinter and secdesc record upgrade to normalize the key (rev'd printer tdb version) * fixed problem that was normalizing the printername name field in general, this should fix the issues upgrading print servers from 3.0.14a to 3.0.20 (This used to be commit d07179de2f2a6eb1d13d0e25ac10de1a21475559)
2007-10-10r8152: * remove commented out structureGerald Carter1-2/+2
* use SAMBA_PRINTER_PORT_NAME in registry values for builtin printer port (This used to be commit 63bc03536b6d0622005448f0f7be2739e06a432a)
2007-10-10r8064: * add the REG_XXX error codes to the pretty error messagesGerald Carter1-2/+7
* more work on the store_values() functions for the Printers key * add Control\Print\Monitors key to list for reg_db (This used to be commit 89f17b41cee633838b8cbd0d1bf8119a4b8d707e)
2007-10-10r8061: * mostly cleanup and refactoring for better readabilityGerald Carter1-1/+2
* move to registry.tdb for port listing (at least via the winreg ops) If no one opposes on the samba list, we'll move to a registry lookup for enumerating ports rather than the 'enumports command'. This means that there is a bit of a disconnect between EnumPorts() and RegEnumKey('hklm\software\microsoft\windows nt\currentversion\ports'). (This used to be commit 6f654c5741e98abf00c010c5dd38038092c0f7a3)
2007-10-10r8026: * more fixes to the printing registry interfaceGerald Carter1-5/+5
(still not completely back to the read functionality we previously had but the cleanup is progressing) (This used to be commit 04431372a698433b4936392047228908a64ff382)
2007-10-10r8007: * cleanup unused structure from reg_objects.hGerald Carter1-34/+26
* make regdb_store_XXX() and regdb_fetch_XXX() functions non-static * use case sensitive string lookups in reg_dynamic.c since the keys have already been normalized * move to new design for making printing related data available via the winreg pipe (with the intent of allowing writes) (This used to be commit 28c7293ee9e68b913faf8d74d63f73e09087169b)
2007-10-10r7995: * privileges are local except when they're *not*Gerald Carter1-5/+9
printmig.exe assumes that the LUID of the SeBackupPrivlege on the target server matches the LUID of the privilege on the local client. Even though an LUID is never guaranteed to be the same across reboots. How *awful*! My cat could write better code! (more on my cat later....) * Set the privelege LUID in the global PRIVS[] array * Rename RegCreateKey() to RegCreateKeyEx() to better match MSDN * Rename the unknown field in RegCreateKeyEx() to disposition (guess according to MSDN) * Add the capability to define REG_TDB_ONLY for using the reg_db.c functions and stress the RegXXX() rpc functions. (This used to be commit 0d6352da4800aabc04dfd7c65a6afe6af7cd2d4b)
2007-10-10r7938: * move the hardcoded registry value names from _reg_query_value()Gerald Carter1-14/+6
to a thin layer in fetch_reg_values(). Not entirely efficient seeing as the the dynamic value paths are stored in an unsorted array but it is one strequal() per path. If this was really big it should be worked into the reghook_cache(). (This used to be commit 63b81ad3cb484090a181fbd13e04922a5c17e7d9)
2007-10-10r7908: * change REGISTRY_HOOK api to use const (fix compiler warningGerald Carter1-18/+168
in init_registry_data() * Add means of storing registry values in registry.tdb * add builtin_registry_values[] array for REG_DWORD and REG_SZ values needed during startup * Finish up RegDeleteValue() and RegSetValue() * Finish up regdb_store_reg_values() and regdb_fetch_reg_values() I can now create and retrieve values using regedit.exe on Win2k. bin/net -S rain -U% rpc registry enumerate 'hklm\software\samba' Valuename = Version Type = REG_SZ Data = 3.0.20 Next is to do the virtual writes in reg_printing.c and I'll be done with Print Migrator (yeah! finally) (This used to be commit 3d837e58db9ded64d6b85f047012c7d487be4627)
2007-10-10r7890: * add Reg[SG]etKeySec() server stubsGerald Carter1-29/+17
* merge a compile warning fix from trunk to SAMBA_3_0 (This used to be commit 71eb018a05c5012fbd42ba6817aabc0797d38ba1)
2007-10-10r7698: * clean upserver frontend for RegDeleteKey()Gerald Carter1-11/+32
* implement RegDeleteKey() for reg_db backend (This used to be commit 91b81a23b8e2a096747e02fd9392ef590e7f0d61)
2007-10-10r7692: start versioning the registry.tdb file since it can be modified nowGerald Carter1-10/+16
(This used to be commit a091b37d59d1e0228a9c8d4bd2a31e9bbaafde99)
2007-10-10r7691: * add .gdbinit to the svn:ignore filesGerald Carter1-4/+40
* start adding write support to the Samba registry Flesh out the server implementations of RegCreateKey(), RegSetValue(), RegDeleteKey() and RegDeleteValue() I can create a new key using regedit.exe now but the 'New Key #1' key cannot be deleted yet. (This used to be commit e188fdbef8f0ad202b0ecf3c30be2941ebe6d5b1)