summaryrefslogtreecommitdiff
path: root/source3/tdb/tdbutil.c
AgeCommit message (Collapse)AuthorFilesLines
2003-03-14Fresh meat in trusted domains code:Rafal Szczesniak1-7/+146
- packing/unpacking utility functions for trusted domain password struct; can be used to prepare buffer to store in secrets.tdb or (soon) passdb backend - similiar functions for DOM_SID - respectively modified secrets_(fetch|store) routines - new auth mapping code utilising introduced is_trusted_domain function - added tdb (un)packing of single bytes Rafal (This used to be commit 5281ee7e84421b9be746aed2f1718ceaf2a2fe3d)
2003-01-30Add 3 second timeout when terminating server and sending print notifyJeremy Allison1-4/+13
messages. Stops build-up of large numbers of smbd's waiting to terminate on large print throughput. Jeremy. (This used to be commit 4ae130bfa82be60de6a6f357f65207fcb24f45fb)
2003-01-12Keep all the const warnings in one place, by adding a utility function toAndrew Bartlett1-44/+31
make the TDB_DATA. Andrew Bartlett (This used to be commit f087fe546fd0c943dec022c657f849803f4b807e)
2003-01-09tdb_chainlock_with_timeout: Add TODO: If we time out waiting for aMartin Pool1-0/+4
lock, it might be nice to use F_GETLK to get the pid of the process currently holding the lock and print that as part of the debugging message. I'd like to have this in appliance_head, but the code is too different so I won't worry for now. (This used to be commit 575908cb06a653225a2fa79ecd025af0e3dafc05)
2003-01-02BIG patch...Andrew Bartlett1-21/+21
This patch makes Samba compile cleanly with -Wwrite-strings. - That is, all string literals are marked as 'const'. These strings are always read only, this just marks them as such for passing to other functions. What is most supprising is that I didn't need to change more than a few lines of code (all in 'net', which got a small cleanup of net.h and extern variables). The rest is just adding a lot of 'const'. As far as I can tell, I have not added any new warnings - apart from making all of tdbutil.c's function const (so they warn for adding that const string to struct). Andrew Bartlett (This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d)
2002-11-23Lots of fixes for error paths where tdb_fetch() data need freeing.Jeremy Allison1-4/+8
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>. Jeremy. (This used to be commit 19f86f1f72aca924e9e320e20a175b5d21de45ad)
2002-11-09Add chainlock_read functions to get a read lock. Used in *massively*Jeremy Allison1-4/+39
contended tdb's (and I've got one :-). Jeremy. (This used to be commit 064fa201ab73f476a168c40c2b227507e7342ec4)
2002-11-07Merge of scalable printing code fix... Needs testing.Jeremy Allison1-11/+8
Also tidied up some of Richard's code (I don't think he uses the compiler flags -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual like I do :-) :-). Jeremy. (This used to be commit 10024ed06e9d91f24fdc78d59eef2f76bf395438)
2002-10-04Add a timeout to tdb_lock_bystring(). Ensure we never have more thanJeremy Allison1-5/+44
MAX_PRINT_JOBS in a queue. Jeremy. (This used to be commit bb58a08af459b4abae9d53ab98c15f40638ce52b)
2002-06-03Added tdb_delete_by_string() function.Tim Potter1-0/+14
(This used to be commit 0cd3952f408e2fcd2c833b9039dff4392ac16cf7)
2002-04-14Partly based on the work by mimir (Rafal SzczesniakAndrew Bartlett1-0/+72
<mimir@diament.ists.pwr.wroc.pl>) this patch allows samba to correctly enumerate its trusted domains - by exaimining the keys in the secrets.tdb file. This patch has been tested with both NT4 and rpcclient/wbinfo, and adds some extra functionality to talloc and rpc_parse to allow it to deal with already unicode strings. Finally, this cleans up some const warnings that were in net_rpc.c by pushing another dash of const into the rpc client code. Andrew Bartlett (This used to be commit 0bdd94cb992b40942aaf2e5e0efd2868b4686296)
2002-04-13Make our atomic increment code actually do this during its first/second run.Andrew Bartlett1-5/+20
The previous code would return the same value for both the initial and second call, only incrementing on later calls. Andrew Bartlett (This used to be commit a4594d9efeca1f67dea57be8323fb4bd986318ce)
2002-04-09When printing a tdb log message display "unnamed" instead of "unknown" ifTim Potter1-1/+1
the tdb has not been named. (This used to be commit 3e7985c60ee9888285769f1eb0ec81f764c26d91)
2002-04-07uint32 store and fectch functions, a signed int is not enough sometimesSimo Sorce1-0/+96
(This used to be commit f07b2b3d5295202e0c8e530c43fae6d458b2cf2a)
2002-03-21Make winbindd_idmap tdb endian independent. This is very important forJeremy Allison1-93/+0
sharing between machines with rsync. Finally removed tdb_store_int/tdb_fetch_int. Now only tdb_store_int32/tdb_fetch_int32 which are endian independent are allowed. Jeremy. (This used to be commit 1c4a00dcc13f4a7c5876a5cf63ca730190d1132e)
2002-01-30Removed version number from file header.Tim Potter1-2/+1
Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2002-01-22Display tdb name of "unknown" in logging debug when tdb has not been named.Tim Potter1-1/+1
(This used to be commit 96c36e51ee4df4c46e5e9e611844dfa83260f606)
2002-01-20This is another *BIG* change...Andrew Bartlett1-1/+1
Samba now features a pluggable passdb interface, along the same lines as the one in use in the auth subsystem. In this case, only one backend may be active at a time by the 'normal' interface, and only one backend per passdb_context is permitted outside that. This pluggable interface is designed to allow any number of passdb backends to be compiled in, with the selection at runtime. The 'passdb backend' paramater has been created (and documented!) to support this. As such, configure has been modfied to allow (for example) --with-ldap and the old smbpasswd to be selected at the same time. This patch also introduces two new backends: smbpasswd_nua and tdbsam_nua. These two backends accept 'non unix accounts', where the user does *not* exist in /etc/passwd. These accounts' don't have UIDs in the unix sense, but to avoid conflicts in the algroitmic mapping of RIDs, they use the values specified in the 'non unix account range' paramter - in the same way as the winbind ranges are specifed. While I was at it, I cleaned up some of the code in pdb_tdb (code copied directly from smbpasswd and not really considered properly). Most of this was to do with % macro expansion on stored data. It isn't easy to get the macros into the tdb, and the first password change will 'expand' them. tdbsam needs to use a similar system to pdb_ldap in this regard. This patch only makes minor adjustments to pdb_nisplus and pdb_ldap, becouse I don't have the test facilities for these. I plan to incoroprate at least pdb_ldap into this scheme after consultation with Jerry. Each (converted) passdb module now no longer has any 'static' variables, and only exports 1 init function outside its .c file. The non-unix-account support in this patch has been proven! It is now possible to join a win2k machine to a Samba PDC without an account in /etc/passwd! Other changes: Minor interface adjustments: pdb_delete_sam_account() now takes a SAM_ACCOUNT, not a char*. pdb_update_sam_account() no longer takes the 'override' argument that was being ignored so often (every other passdb backend). Extra checks have been added in some places. Minor code changes: smbpasswd no longer attempts to initialise the passdb at startup, this is now done on first use. pdbedit has lost some of its 'machine account' logic, as this behaviour is now controlled by the passdb subsystem directly. The samr subsystem no longer calls 'local password change', but does the pdb interactions directly. This allow the ACB_ flags specifed to be transferred direct to the backend, without interference. Doco: I've updated the doco to reflect some of the changes, and removed some paramters no longer applicable to HEAD. (This used to be commit ff354c99c585068af6dc1ff35a1f109a806b326b)
2002-01-18Ensure we log tdb open fails. Patch from Alexander Bokovoy ↵Jeremy Allison1-4/+2
<a.bokovoy@sam-solutions.net> Jeremy. (This used to be commit eb99e7f29c2d6041054331425cb245da86bedaa4)
2002-01-09Added int32 version of "atomic" update.Jeremy Allison1-0/+35
Jeremy. (This used to be commit 1233b553e78b8d7580b9ea4f1bba62c78b4cd186)
2002-01-09Added int32 versions of the endian-dependent code.Jeremy Allison1-2/+66
Jeremy. (This used to be commit d57fb9a8c25a95e434cb5fb3d63a87d98abeefef)
2002-01-03Fixed nasty cast of tdb_delete in traversals.Jeremy Allison1-0/+11
Jeremy. (This used to be commit a0cdec3acc82d1ce0292fadd4b8dac23638450f3)
2001-12-05changed the DEBUG level of tdb_pack and tdb_unpack. Instead of 8, it's nowJean-François Micouleau1-2/+2
18. when you're looking at a level 10, and it's all clutered with tdb_pack/unpack, it's getting .... And anyway most of our code using tdb_pack/unpack have DEBUG around the call if there is a problem. J.F. (This used to be commit 7e20fad5ed00be4594bfc45603db89d600f46c55)
2001-12-04Tidup.Jeremy Allison1-43/+80
Jeremy. (This used to be commit 837f2b961b1e7dcd6998f36d58d2059290e89e18)
2001-12-04undoMartin Pool1-1/+3
(This used to be commit fc176f15f27686049453552219b56b9de33ceffa)
2001-12-04Better error handling:Martin Pool1-3/+1
- tdb_open api changed so that you now pass an error handling callback when opening the file, so that errors detected during opening have somewhere to go. (All calls from the body of Samba to this function go through a wrapper in tdbutil, which has been updated.) - Clean up logic for deciding how to open tdb. Emit log messages if something goes wrong (e.g. bad magic.) - tdbtool now logs errors to stderr. (This used to be commit 0aa800618eab1043d802c04fb1d125cd07936769)
2001-09-06actually obey the "use mmap" smb.conf optionAndrew Tridgell1-1/+5
(This used to be commit b36c98036bcbaa5545c9637cb632361122033cfd)
2001-05-30merged fix for tdb_unpack from 2_2Andrew Tridgell1-1/+4
(This used to be commit 200b682e9bbe79897343422f7c870382ed6de40a)
2001-05-30- fixed an off-by-1 bug in the delayed deletion code that I believeAndrew Tridgell1-0/+1
was the initial cause of the connections database becoming corrupt. Note that this bug only happens when doing deletions within a traversal, which is why it has only showed up now - added delete within traversal testing to tdbtorture - added a lot more logging to tdb (This used to be commit 6e1277df9d964c615a3ad876d3b89ff8132081c1)
2001-05-30added a tdb_open_log() function that opens a tdb and enables loggingAndrew Tridgell1-0/+33
of messages from the tdb code into the Samba DEBUG() system just call tdb_open_log() instead of tdb_open() to enable this on any tdb (This used to be commit 3ab770484c6775df2c1a6f69427ebe656702c96c)
2001-05-25Added tdb_change_int_atomic() to allow atomic updates of a tdb int value.Jeremy Allison1-3/+32
Jeremy. (This used to be commit cf5015f15935605cf69078bc15251db61ddc48c7)
2001-05-06merge from 2.2Andrew Tridgell1-2/+5
(This used to be commit 13bf966cb8ed8df6b02018dceff94c275def8200)
2001-04-18merge from 2.2Andrew Tridgell1-0/+1
(This used to be commit f52a5014ee325f9d91f266f88eac51b6136a75b9)
2001-04-16Getting medieval with compiler warnings as Jeremy puts it.Tim Potter1-2/+2
(This used to be commit d05c3cf0f47a3c863adbed7ad4ab8f3248cd072d)
2001-04-13Merge of Andrew's changes in 2.2.Jeremy Allison1-48/+2
Jeremy. (This used to be commit fc76681812b1469208ad6c8847afdfc68bc6db49)
2001-04-11Fixed some compiler warnings.Tim Potter1-2/+2
(This used to be commit cda0f211b0dd41ae72ef3d65b9476c11c6f72de3)
2001-04-10Added HAVE_STDARG_H to tdbutil.cJeremy Allison1-5/+51
Jeremy. (This used to be commit e404e001990409eacf2e620d2269c2b162fa938b)
2000-12-06tdb_chainunlock() no longer returns a value.Tim Potter1-2/+2
(This used to be commit 2c9704c3db4014ca43b4b13160b9f53ff5f36e3b)
2000-12-06Changed to sourceforge tdb code. This includes spinlocks (so we now haveJeremy Allison1-2/+2
a --with-spinlocks option to configure, this does mean the on-disk tdb format has changed, so 2.2alphaX sites will need to re-create their tdb's. The upside is no more tdb fragmentation and a +5% on netbench. Swings and roundabouts.... Jeremy. (This used to be commit 9dea7b7c257db487f8ced7dad3fce92fba03ea91)
2000-11-10rpc_parse/parse_spoolss.c: Updated comment for old version of W2K.Jeremy Allison1-1/+1
tdb/tdbutil.c: With varargs uint16 is cast to (int). Jeremy. (This used to be commit 98764c5df9f363780427a423ead0913f7b2a0905)
2000-10-10added tdb_lock_bystring() and tdb_unlock_bystring()Andrew Tridgell1-0/+24
(This used to be commit ca443210c84575d39e60c38a7a12d037386d0e38)
2000-07-31Added John Reilly's enumports/addprinter/delprinter scripting code plus theJeremy Allison1-0/+14
fix for the Win9x printer drivers. Changed command names to add "command" string on the end for some consistancy with the other scripting commands. Added '%P' option to tdbpack/unpack to store long comment string. Made port name be "Samba Printer Port" if no enum port script given. Fixed prs_uint32_pre code to cope with null args. Jeremy. (This used to be commit 902ada63799cf27924c72e24e7593a8c9fb5eba9)
2000-06-08Moved tdb functions that access parse structs into parse_prs.cJeremy Allison1-30/+0
to prevent builkd breaking. Jeremy. (This used to be commit 6c7adeab0f92844ecefbcb923d0d4763d4c3eaa5)
2000-06-07Fixing get/set of security descriptors.Jeremy Allison1-8/+4
Removed ugly hack for NT printing. Fixed up tdb parse stuff memory leaks. Jeremy. (This used to be commit 8ef41f31c53e14ad057d883810a1cd2301fede2a)
2000-06-04added some debug code to track down pack/unpack problemsAndrew Tridgell1-0/+12
(This used to be commit ac9cdab33cddcc5ab00fc21ba79f416f5a9687e7)
2000-05-27getting and setting security descriptors on printers now worksAndrew Tridgell1-10/+42
this needed some fixes in tdb_unpack(). Tim, you'll need to update (This used to be commit 9422719ab4c35e4ce3199b62dd632433bf391283)
2000-05-24added tdb_pack() and tdb_unpack()Andrew Tridgell1-0/+148
(This used to be commit 6c15495b3087c04890af77149c39e823596bb4dd)
2000-05-12While we're all making incompatible tdb changes, I changed the implementationTim Potter1-4/+4
of tdb_{store,get}_int() to store the length of the string key + 1 so the stored key contains the trailing NULL character. This allows normal string library routines to manipulate keys. Also renamed tdb_get_int() to tdb_fetch_int() to keep the set of verbs consistent. (This used to be commit a423c7c5f21dc4046530b85482dee88dcfcbf070)
2000-05-09Added tdb_store_by_string() and tdb_fetch_by_string() functions to storeTim Potter1-0/+27
data with null terminated string keys. (This used to be commit d58146321b6fe50e1cc1a73da80c3d2e8c3412dc)
2000-04-29put tdb utility functions in a separate fileAndrew Tridgell1-0/+67
(This used to be commit 77009422a075300e5c07a3e75806a7dac47e2113)