summaryrefslogtreecommitdiff
path: root/source3/registry/reg_db.c
AgeCommit message (Collapse)AuthorFilesLines
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)
2007-10-10r7648: adding REGISTRY_HOOK->reg_access_check() for authprization checks on ↵Gerald Carter1-1/+2
RegOpenKey(); passing it off to the backend code for a given path (This used to be commit 867fd3052bbfdd45856886999619e2ebc6552675)
2007-10-10r6942: * merging the registry changes back to the 3.0 treeGerald Carter1-157/+96
* removing the testprns tool (This used to be commit 81ffb0dbbbd244623507880c323a3c37e2b8dc4d)
2007-10-10r6680: event log patches from MarcinGerald Carter1-10/+106
(This used to be commit a71e104af84810f488f42cb0843976961e6f6ebe)
2007-10-10r6232: more cleanups; remove BUFFER3; rename BUFFER4 -> RPC_DATA_BLOB; ↵Gerald Carter1-0/+7
rename REG_CREATE_VALE -> REG_SET_VALUE (This used to be commit 28d433351cf813c7fb57ebac0e0f4973c85f73e8)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-2/+2
allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
2003-07-10i guess i'm the only one this ever annyoed...Gerald Carter1-1/+1
fix the confusion when we tdb_lock_bystring() but we retrieve an entry using tdb_fetch_by_string. It's now always tdb.*bystring() (This used to be commit 66359531b89368939f0e8f584a45844b5f2f99e7)
2002-08-11Merge of case fixes from APPLIANCE_HEAD.Tim Potter1-5/+5
(This used to be commit f8072d964f527dcb9b520ec06c3522524d47644f)
2002-08-06Back out idra's change (at his request) - the values in the tdb *should* beAndrew Bartlett1-1/+1
upper cased already. However, if you created your registry tdb in the very early versions of jerry's patch, you could find that usrmgr doesn't function. Simply delete the registry.tdb, it will be recreated on startup. Andrew Bartlett (This used to be commit 17136a88c326bf338f948a67c92bb048c5a148af)
2002-08-04commented out strupper before key check against internal db, it's no goodSimo Sorce1-1/+1
to check for uppercased strings when we store them not uppercased. jerry, this fix is needed to make usrmgr.exe work again. meanwhile we found out that NT_STATUS code may not be appropriate there. In particular it seem that an NT PDC will send back 02 as error (ERRbadfile) not 0xc000000f (NT_STATUS_NO_SUCH_FILE NT) I think further investigation is need to understand which are aprropriate return codes here. (This used to be commit 2ad0e81c8da62b7e15ab3e414b5e15a94fe5de87)
2002-07-263 things:Gerald Carter1-1/+5
* normalize all registry key strings before storing or looking up paths in the registry tdb * return the current buffer size for REG_INFO even when not returning actual data * fix a segfault report by metze on #samba-technical so that the user/group object picker works again (was the "ProductType" key lookup that was failing). (This used to be commit 5640e6cdb213502d95fff33e06eaeed5ce3aeb76)
2002-07-24* fix return code so we don't let a client just open any key it wantsGerald Carter1-2/+2
(even nonexistent ones). This gets rid of the Scheduling Agent icon. * fix NT_STATUS return code for bad registry path (NT_STATUS_NO_SUCH_FILE) (This used to be commit 915ee5c0ec0467fea23be8f309bcaa085c6ed9dd)
2002-07-24several changes in this checkinGerald Carter1-0/+9
* added REG_OPEN_HKCR for supporting regedit.exe * All data n a REGISTRY_VALUE is stored to a pointer now * fixed REG_INFO to correctly display data when double clicking on and entry in the registry editor * Will now enumerate installed driver_info_3 data * fixed numerous bugs related to pointer offsets, memory issues, etc.. in the registry routines * added a simple caching mechanism to fetch_reg_[keys|values]_specific() All that is left now is to enumerate PrinterData and I will have finished what I started out to do.... (This used to be commit 419d7208e8384e4ad2c4dd328ad5e630971bc76c)
2002-07-20enumeration of printers keys ( no data yet ) via the registryGerald Carter1-4/+4
functions now works :-) (This used to be commit c5768538f6cf6ee824bc6e105a3391bbc2ea8e46)
2002-07-19fixed seg fault in registry frontend caused by trying toGerald Carter1-0/+6
use a destroyed TALLOC_CTX* (This used to be commit 432b9f8d7c20fbf3b2a0906c8a93272abbe43fb6)
2002-07-19* refactored registry operations some. subkey lists andGerald Carter1-82/+63
registry values are now passed around in containers (REGSUBKEY_CTR & REGVAL_CTR) which each possess a TALLOC_CTX. * removed subkey_specific_fn() from REGISTRY_OPS. Is implemented in the form of a wrapper * temporarily broke the printing registry ops. * implemented inheritence for the data_p of nodes in a SORTED_TREE * All REGISTRY_KEY instances now store a valid REGISTRY_HOOK since the default REGOSTRY_OPS structure is stored in the root of the cache_tree. * Probably some other change I forgot.... T (This used to be commit e7b55e8f017e638342d9c8c1a9259000745a0298)
2002-07-18virtual registry framework with initial printing hooks.Gerald Carter1-0/+311
(This used to be commit a43d9788fa8823d678ee72470421b980165ec2b0)