summaryrefslogtreecommitdiffstats
path: root/lib/dbwrap
Commit message (Collapse)AuthorAgeFilesLines
* tdb_wrap: Remove tdb_wrap_open_ againVolker Lendecke2014-03-311-3/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: Avoid passing lp_ctx to tdb_wrap_open in db_open_tdbVolker Lendecke2014-03-311-2/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: completely check validity of lock order in dbwrap_check_lock_order()Michael Adam2014-02-071-1/+1
| | | | | | | | | | | This is currently not strictly necessay, because the only caller catches the DBWRAP_LOCK_ORDER_NONE case, and maximum is already checked, but this seems too dangerous to me. Use the new DBWRAP_LOCK_ORDER_VALID() macro. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add a comment explaining the supported lock ordersMichael Adam2014-02-071-0/+4
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add DBWRAP_LOCK_ORDER_VALID()Michael Adam2014-02-071-0/+4
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add DBWRAP_LOCK_ORDER_MINMichael Adam2014-02-071-0/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: move definition of DBWRAP_LOCK_ORDER_MAX to the private header.Michael Adam2014-02-072-1/+2
| | | | | | | This is only needed internally. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: explicitly use DBWRAP_LOCK_ORDER_NONE in tdb->ntdb conversionMichael Adam2014-02-071-2/+4
| | | | | | | Make lack of lock order checking more visible. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: introduce DBWRAP_LOCK_ORDER_NONE for lock order "0".Michael Adam2014-02-072-1/+2
| | | | | | | | | | | | Ther are still some databases which are opened (locally) with lock oder 0, which means don't do lock oder checking, thereby circumventing this deadlock-prevention mechanism. Add a symbolic constant for this "0" to make this circumvention more explicit. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add dbwrap_flags argument to dbwrap_local_open()Michael Adam2014-02-072-2/+4
| | | | | | | | To be consistent with db_open() and prepare for future possible extensions. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add a dbwrap_flags argument to db_open_ntdb()Michael Adam2014-02-073-4/+7
| | | | | | | | for consistency and to perpare for possible future flags that the ntdb backend might be aware of. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add a dbwrap_flags argument to db_open_tdb()Michael Adam2014-02-073-4/+6
| | | | | | | | ...for consistency and in preparation of future flags that the tdb backend might be aware of. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESSMichael Adam2014-02-071-0/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: add flags DBWRAP_FLAG_NONEMichael Adam2014-02-071-0/+2
| | | | | | | | This is in preparation of adding a dbwrap_flags argument to db_open and firends. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: No lock_order check if not requiredVolker Lendecke2013-12-141-13/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap_cache: Check negative firstVolker Lendecke2013-12-141-3/+3
| | | | | | | | dbwrap_cache is right now used for notify most, and we hope to have very few notifies around. So negative hits will be more likely than positive Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap_cache: Fix dbwrap_cache_validateVolker Lendecke2013-12-141-2/+14
| | | | | | | Classic brown paper bag bug :-( Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: Avoid a stackframe in fetch_locked_internalVolker Lendecke2013-12-141-5/+2
| | | | | | | | This shows in profiles. We call this so often that this is a pretty hot code path. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Revert "dbwrap: dbwrap_fetch_locked_timeout()."Volker Lendecke2013-06-065-160/+0
| | | | | | | | | | This reverts commit f6eb187fdab6b8088bb065e418fe604c4eba7751. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jun 6 14:26:26 CEST 2013 on sn-devel-104
* dbwrap: Fix CID 1002092 Uninitialized scalar variableVolker Lendecke2013-05-121-1/+3
| | | | | | | We don't set saved_errno in the ret==0 case. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* ntdb: remove --disable-ntdb.Rusty Russell2013-04-131-8/+0
| | | | | | | | | | | Remove DISABLE_NTDB option, and --disable-ntdb from waf build. This just means that it will always get built: it isn't used by default yet. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Apr 13 02:01:02 CEST 2013 on sn-devel-104
* dbwrap: Add a comment explaining a restrictionVolker Lendecke2013-03-271-0/+11
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Mar 27 13:40:15 CET 2013 on sn-devel-104
* dbwrap_local_open: never open the .tdb if there is an .ntdbRusty Russell2013-02-201-0/+5
| | | | | | | | | This provides an extra safety check that everyone is using one or the other: you can't create a tdb file if there's an ntdb file. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* dbwrap_local_open: open NTDB if extension is .ntdbRusty Russell2013-02-201-5/+157
| | | | | | | | | | | | | | | | | | | | | | This switches dbwrap_local_open() based on the extension of the database name, so it handles both TDB and NTDB files. Moreover, if asked to open a .ntdb, and there's no ntdb file but there's a .tdb file, it converts that then moves it to .tdb.bak before opening, and turn the .tdb file into a dangling symlink to make sure it's never accidentally re-created or used: $ ls -l secrets.tdb lrwxrwxrwx 1 rusty rusty 23 Feb 11 11:31 secrets.tdb -> This is now in an NTDB This provides transparent upgrade if people decide to use NTDB on a database. Downgrade would be manual, eg: ntdbdump foo.ntdb | tdbrestore foo.tdb && mv foo.ntdb foo.ntdb.bak Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* dbwrap: dbwrap_ntdb.cRusty Russell2013-02-203-10/+734
| | | | | | | | | This is a dbwrap backend for ntdb. It's a fairly straight conversion from the tdb version. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* dbwrap: Prevent transactions on non-persistent dbsVolker Lendecke2013-02-081-0/+5
| | | | | | | | | dbwrap_ctdb does not allow this anyway. This patch will avoid suprises when going non-clustered to clustered. Not everybody is developing against a clustered environment :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib/dbwrap: talloc_strdup() name in db_open_file()Stefan Metzmacher2013-02-041-1/+6
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap: add dbwrap_is_persistent()Michael Adam2013-01-152-0/+6
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* dbwrap: Remove an unnecessary if-statementVolker Lendecke2012-11-291-3/+1
| | | | | | TALLOC_FREE can live with a NULL pointer Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap: No need to NULL out a talloc_zero'ed structure elementVolker Lendecke2012-11-291-1/+0
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap: Use talloc_zero in db_open_rbtVolker Lendecke2012-11-291-5/+1
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap: Use talloc_zero in db_open_cacheVolker Lendecke2012-11-291-6/+1
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap: Use dbwrap_parse_record in dbwrap_fetch_uint32_bystringVolker Lendecke2012-11-291-13/+27
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap: use talloc_stackframe() in db_tdb_log_key()Andrew Bartlett2012-10-251-3/+4
| | | | | | | We can not be sure that there is already a talloc_stackframe() in place so we must create one. Andrew Bartlett
* s3:dbwrap: remove unused args from db_open_file()Gregor Beck2012-09-212-6/+2
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:dbwrap: let dbwrap_fetch_uint32 distinguish between "not found" and ↵Gregor Beck2012-09-211-2/+5
| | | | | | "wrong format" Signed-off-by: Stefan Metzmacher <metze@samba.org>
* lib/dbwrap: rewrite lock order check to ease debuggingGregor Beck2012-08-032-30/+56
| | | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Aug 3 12:52:38 CEST 2012 on sn-devel-104
* ntdb: make --disable-ntdb work properly.Rusty Russell2012-07-041-0/+2
| | | | | | | | | As per bug #9024, make --disable-ntdb work again. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date(master): Wed Jul 4 08:11:33 CEST 2012 on sn-devel-104
* dbwrap: don't ignore the result of dbwrap_parse_record in dbwrap_fetch_int32()Stefan Metzmacher2012-06-221-1/+5
| | | | | | | metze Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Jun 22 17:10:52 CEST 2012 on sn-devel-104
* dbwrap: intialize state.status in dbwrap_fetch_int32()Stefan Metzmacher2012-06-221-0/+2
| | | | | | | This might not be needed, but it makes it more clear that we won't use uninitialized memory, it the callback was not triggered. metze
* dbwrap: Convert fetch_int32 to dbwrap_parse_recordVolker Lendecke2012-06-221-13/+24
| | | | | | | Now dbwrap_fetch_int32 is used in smbd/locking/posix.c is used a lot more often than before. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: Add dbwrap_fetch_int32Volker Lendecke2012-06-222-3/+11
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: Add dbwrap_change_int32_atomicVolker Lendecke2012-06-222-9/+21
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: dbwrap_hash_size().Rusty Russell2012-06-227-0/+12
| | | | | | | Implemented for ntdb and tdb; falls back to 0 for others. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* dbwrap: dbwrap_name().Rusty Russell2012-06-227-1/+11
| | | | | | | | Useful for debug messages: particularly once we start switching between .tdb and .ntdb files. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* dbwrap: dbwrap_transaction_start_nonblock().Rusty Russell2012-06-224-0/+26
| | | | | | | | Implemented for ntdb and tdb; falls back to the blocking variant for others. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* dbwrap: dbwrap_fetch_locked_timeout().Rusty Russell2012-06-224-0/+52
| | | | | | | | Implemented for ntdb and tdb; falls back to the non-timeout variant for others. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* dbwrap: add dbwrap_check() function.Rusty Russell2012-06-224-0/+31
| | | | | Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* dbwrap: dbwrap_local_open()Rusty Russell2012-06-224-0/+92
| | | | | | | | This simply opens a tdb: it will eventually switch depending on the extension. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* dbwrap: remove get_flags().Rusty Russell2012-06-225-24/+0
| | | | | | | | | | | | The flags returned were TDB-specific: this was only used for detecting the endianness of obsolete databases (the conversion code was put in in 2003, with reference to Samba 2.3). It's easier to remove it than to translate the NTDB flags to TDB flags, and it's a really weird thing to ask for anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>