The branch, master has been updated
       via  6760011 s3:dbwrap: change dbwrap_store_uint32() to NTSTATUS return 
type
       via  c9bc1e4 s3:dbwrap: change dbwrap_store_int32() to NTSTATUS return 
type
       via  658f721 s3:dbwrap: change dbwrap_fetch_uint32() to NTSTATUS return 
type (instead of bool)
       via  603c3e1 s3:dbwrap: convert dbwrap_fetch_int32() to NTSTATUS return 
code
       via  ce8626c s3:idmap_tdb2: fix hwm-handling to use uint32 consistently
       via  ba88e4e s3:idmap_tdb: fix hwm-handling to use uint32 consistently
       via  f03e4ae s3:passdb:account_pol: use dbwrap_fetch_uint32, not 
dbwrap_fetch_int32 for the DB version
       via  f8cad3a s3:idmap_autorid: make a debug message more precise
       via  b4e528a s3:idmap_autorid: untangle function from check and log 
status in idmap_autorid_db_init()
       via  8750e3f s3:dbwrap: move definitions of db_record and db_contect 
structs to dbwrap_private.h
       via  6fb5c47 s3:torture: convert torture.c to only use dbwrap wrapper 
functions
       via  311ed56 s3:locking: convert posix.c to use dbwrap wrapper functions 
only
       via  f0ab22e s3:locking: convert locking.c to use dbwrap wrapper 
functions only
       via  5cbc505 s3:locking: convert brlock to only use dbwrap wrapper 
functions
       via  e2328ac s3:messages: convert to use only dbwrap wrapper functions
       via  82428ad s3:groupdb: convert mapping_tdb.c to use dbwrap wrapper 
functions only
       via  3340597 s3:rpc_server: convert srvsvc to only use dbwrap wrapper 
functions
       via  5063498 s3:smbd: convert notify db to use dbwrap wrapper functions
       via  ec057c3 s3:smbd: convert session.c to use dbwrap wrapper functions 
only
       via  43a13b5 s3:smbd: convert connections.c to use only dbrwap wrapper 
functions
       via  608ac61 s3:conn_tdb: convert connections tdb to only use dbwrap 
wrapper functions
       via  4bfda2d s3:vfs: convert the acl_tdb module to use dbwrap wrapper 
functions.
       via  4cb75bd s3:vfs: convert nfs4_acls sidmap db code to use 
dbwrap_wrapper functions
       via  ceb9f57 s3:vfs: change the xattr_tdb module to use dbwrap wrapper 
functions
       via  c7c1a3e s3:printing: convert printer_list to use dbwrap wrapper 
functions
       via  3f21428 s3:secrets: convert to use dbwrap wrapper functions only
       via  8b4845b s3:passdb: convert account_pol to use dbwrap wrapper 
functions only
       via  8b4dd99 s3:passdb: convert machine_sid to use dbwrap wrapper 
functions only
       via  a91f06a s3:passdb: convert pdb_tdb to use dbwrap wrapper functions.
       via  7458aac s3:net: convert net idmap check to use dbwrap wrapper 
functions.
       via  1f57f9e s3:net: convert net idmap to use only dbwrap wrapper 
functions
       via  3d52de3 s3:idmap: convert idmap_tdb to use dbwrap wrapper functions.
       via  f1057ac s3:libnet: convert libnet_dssync_passdb to only use dbwrap 
wrapper functions.
       via  79a4911 s3:privileges: convert privileges.c to use dbwrap wrapper 
functions.
       via  736af26 s3:g_lock: convert to use only dbwrap wrapper functions.
       via  7057b4d s3:registry: convert reg_backend_db to use dbwrap wrapper 
functions
       via  ff79187 s3:talloc_dict: change to only use dbwrap wrapper functions
       via  248cb23 s3:sharesec: convert sharesec.c to use dbwrap wrapper 
functions
       via  bbe7811 s3:sessionid: convert to using dbwrap wrapper functions only
       via  bdee945 s3:sessionid: use dbwrap_travers_read() in 
sessionid_travers_read()
       via  6656de1 s3:sessionid: use dbwrap_travers() in sessionid_traverse()
       via  c8924ec s3:net: convert net serverid to only use dbwrap wrapper 
functions
       via  85ae3c3 s3:serverid: convert to using dbwrap wrapper functions only
       via  5bfdd73 s3:net: fix the exit code of net serverid wipe
       via  8645564 s3:net: fix the exit code of net serverid list
       via  91e77f3 s3:serverid: use dbwrap_traverse_read() in 
serverid_traverse_read()
       via  81258c0 s3:serverid: use dbwrap_traverse() in serverid_traverse()
       via  0b7108b s3:dbwrap_torture: convert to using wrapper functions only
       via  64748e8 s3:dbwrap_tool: convert to using wrapper functions only
       via  f21a66f s3:dbwrap: convert dbwrap_util.c to use dbwrap wrapper 
functions
       via  e39cd86 s3:dbwrap: use dbwrap_fetch_bystring() in 
dbwrap_fetch_[u]int32()
       via  0e28448 s3:dbwrap: convert dbwrap_fetch(), dbwrap_fetch_bystring() 
and dbwrap_fetch_bystring_upper() to NTSTATUS
       via  25a9978 s3:dbwrap: add dbwrap_fetch_locked(), a wrapper for 
db->fetch_locked
       via  4637044 s3:dbwrap: add dbwrap_record_delete(), a wrapper for 
record->delete_rec
       via  b257e83 s3:dbwrap: add dbwrap_record_store(), a wrapper for 
record->store
       via  bfed62c s3:dbwrap: add get-functions for db_record key, value and 
private_data
       via  3ed2fb4 s3:dbwrap: add wrapper function dbwrap_get_seqnum()
       via  373b060 s3:dbwrap: add wrappers for transactions start/cancel/commit
       via  d8ce5bc s3:dbwrap: add wrapper dbwrap_get_flags()
       via  7b9bf28 s3:dbwrap: fix db_rbt_traverse() to return the record count 
on success
       via  ebcb921 s3:dbwrap: add specific dbwrap_wipe() implementation to 
dbwrap_rbt
       via  97fef0c s3:dbwrap: add specific dbwrap_wipe() implementation to 
dbwrap_tdb
       via  3dc607c s3:dbwrap: add a comment
       via  dc4a5f5 s3:dbwrap: add function dbwrap_wipe()
       via  63c5c0e s3:dbwrap: add specific dbwrap_parse_record() 
implementation to dbwrap_rbt
       via  c5d03cb s3:dbwrap: implement dbwrap_fallback_exists() with 
dbwrap_parse_record()
       via  99fa6fa s3:dbwrap: allow NULL parser for dbwrap_parse_record()
       via  f5b7d87 s3:dbwrap: dbwrap_parse_record() should always return -1 on 
"not found"
       via  893805b s3:dbwrap: add function dbwrap_parse_record()
       via  fff09d0 s3:dbwrap: add specific dbwrap_exists() implementation to 
dbwrap_rbt
       via  28e4c41 s3:dbwrap: factor out db_rpt_search_internal()
       via  5953839 s3:dbwrap: add specific dbwrap_exists() implementation to 
dbwrap_tdb
       via  87b68ce s3:dbwrap: add function dbwrap_exists()
       via  87f51bf s3:dbwrap: add a wrapper dbwrap_traverse_read()
       via  8f098a6 s3:dbwrap: change the dbwrap_traverse() wrapper to return 
the count in an additional parameter
       via  6608ba8 s3:dbwrap: reorganize dbwrap.h some
       via  2d52f6f s3:dbwrap: move dbwrap_traverse() to dbwrap.c, the core of 
the dbrwap subsystem
       via  663c661 s3:dbwrap: move dbwrap_store() back to dbwrap.c, the core 
of the dbwrap subsystem
       via  2aa5601 s3:dbwrap: move dbwrap_delete() back to dbwrap.c, the core 
of the dbwrap subsystem
       via  c3868b7 s3:dbwrap: move dbwrap_fetch() back to dbwrap.c, the core 
of the dbwrap subsystem
       via  7a72c84 s3:dbwrap: move the db_open_rbt() prototype to a new header 
dbwrap_rbt.h
       via  c768121 s3:dbwrap: move the db_open_file() prototype to a new 
header dbwrap_file.h
       via  38f7f8e s3:dbwrap: move the db_open_tdb() prototype to a new header 
dbwrap_tdb.h
       via  82bc3fa s3:dbwrap: move the db_open_ctdb() prototype to a new 
header dbwrap_ctdb.h
      from  b3b6906 s3:vfs_acl_common: also parse xattr.NTACL version 1

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 67600117610eda2bd7ad2802bcc7a9147720e659
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 21:29:04 2011 +0200

    s3:dbwrap: change dbwrap_store_uint32() to NTSTATUS return type
    
    for consistency and better error propagation
    
    Autobuild-User: Michael Adam <[email protected]>
    Autobuild-Date: Tue Oct 11 15:51:00 CEST 2011 on sn-devel-104

commit c9bc1e492404077c6b40b5cefe33e859503a4227
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 21:24:07 2011 +0200

    s3:dbwrap: change dbwrap_store_int32() to NTSTATUS return type
    
    for consistency and better error propagation

commit 658f72128ff6950c6a03994198b4464a273fb300
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 21:07:27 2011 +0200

    s3:dbwrap: change dbwrap_fetch_uint32() to NTSTATUS return type (instead of 
bool)
    
    for consistency and better error propagation

commit 603c3e1bcb7b4106afe4aefdfed43e7832ede956
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 20:34:55 2011 +0200

    s3:dbwrap: convert dbwrap_fetch_int32() to NTSTATUS return code
    
    Return the int32 value retrieved from the db by reference.
    Before this, return value "-1" was used as a error indication,
    but it could also be a valid value from the database.

commit ce8626cbbe99b26f4e39ace87221792b468b9c93
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 20:28:39 2011 +0200

    s3:idmap_tdb2: fix hwm-handling to use uint32 consistently
    
    The initialization code user int32, later writes used uint32...

commit ba88e4e0d86302e7efe2398d5be5cfb32c0dbdeb
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 20:19:41 2011 +0200

    s3:idmap_tdb: fix hwm-handling to use uint32 consistently
    
    The initialization code user int32, later writes used uint32...

commit f03e4aea66aa59662a49b3dc60917d7b619d7af2
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 20:00:17 2011 +0200

    s3:passdb:account_pol: use dbwrap_fetch_uint32, not dbwrap_fetch_int32 for 
the DB version
    
    This is also stored as uint32_t.

commit f8cad3a7683c7d026a1a038688c3b7b649db48fc
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 19:22:51 2011 +0200

    s3:idmap_autorid: make a debug message more precise

commit b4e528ab54bbca8968cf8f601dd65e3b80cad9a2
Author: Michael Adam <[email protected]>
Date:   Thu Oct 6 19:17:25 2011 +0200

    s3:idmap_autorid: untangle function from check and log status in 
idmap_autorid_db_init()

commit 8750e3f22c9b62840fd7e90eb99b95204542a592
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 14:53:42 2011 +0200

    s3:dbwrap: move definitions of db_record and db_contect structs to 
dbwrap_private.h
    
    The API and callers now only need the forward declarations.

commit 6fb5c47f21a4b0d5998de37d13b3cab61afd5bac
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 10:59:06 2011 +0200

    s3:torture: convert torture.c to only use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 311ed56afe147634d55b39d00b8c3c26ad961fad
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 01:22:43 2011 +0200

    s3:locking: convert posix.c to use dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit f0ab22e6eccb6bb502094afdf14362641e37f1a5
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:28:12 2011 +0200

    s3:locking: convert locking.c to use dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit 5cbc505e6d6bfcc02b2764a2d9c5310095f4ad4c
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:53:58 2011 +0200

    s3:locking: convert brlock to only use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit e2328ac33cb0e62b0afbf87787ae2a1d23af5be0
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 15:47:46 2011 +0200

    s3:messages: convert to use only dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 82428adee630ce1bba691543562c70ecceb6d7a4
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:18:49 2011 +0200

    s3:groupdb: convert mapping_tdb.c to use dbwrap wrapper functions only

commit 33405972b233055dbae0e0d88710ce2b7d59c4c3
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:49:17 2011 +0200

    s3:rpc_server: convert srvsvc to only use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 506349832ce2f323313b7f2eb043e0ae8d63e63a
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 01:35:16 2011 +0200

    s3:smbd: convert notify db to use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit ec057c369f64b35853c13c54af94c3bf5bebd630
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:46:42 2011 +0200

    s3:smbd: convert session.c to use dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit 43a13b55fc75c24a4a90c271d5ea6ea8f468b6cf
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:42:10 2011 +0200

    s3:smbd: convert connections.c to use only dbrwap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 608ac61729b96ed301524eb0cd64281fa68ec393
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:01:44 2011 +0200

    s3:conn_tdb: convert connections tdb to only use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 4bfda2d3feca228d83f3dde0f08d66bd4dfe27aa
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 15:40:09 2011 +0200

    s3:vfs: convert the acl_tdb module to use dbwrap wrapper functions.
    
    Avoid direct use of the db_record and db_context structs.

commit 4cb75bdbb1b2e9c40a31992e1ac23125098b2d42
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 15:36:31 2011 +0200

    s3:vfs: convert nfs4_acls sidmap db code to use dbwrap_wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit ceb9f572abda526e01d9b5f35158464768119c96
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 15:32:59 2011 +0200

    s3:vfs: change the xattr_tdb module to use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit c7c1a3e2768c83579069ba0c5667490307d541e0
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:49:59 2011 +0200

    s3:printing: convert printer_list to use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 3f214284c71a07b8153b9c94d97cd869872007c2
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:30:15 2011 +0200

    s3:secrets: convert to use dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit 8b4845bd75805e4bcb9082c798f8d4a48ad24e20
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:38:51 2011 +0200

    s3:passdb: convert account_pol to use dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit 8b4dd99dae73462e019d160c94b9a1e92f30eec4
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:36:05 2011 +0200

    s3:passdb: convert machine_sid to use dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit a91f06a7226812ec5725b05dede78c9f89e315b5
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:58:15 2011 +0200

    s3:passdb: convert pdb_tdb to use dbwrap wrapper functions.
    
    Avoid direct use of the db_record and db_context structs

commit 7458aac0f1e600c55627239c3020bc84ce88356a
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 15:27:00 2011 +0200

    s3:net: convert net idmap check to use dbwrap wrapper functions.
    
    Avoid direct use of the db_record and db_context structs.

commit 1f57f9ed131db5dc4481a88680d7072728671cd1
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:47:48 2011 +0200

    s3:net: convert net idmap to use only dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 3d52de343ae7623f9e1821dc53e06c1bf385d8e9
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:45:31 2011 +0200

    s3:idmap: convert idmap_tdb to use dbwrap wrapper functions.
    
    Avoid direct use of the db_record and db_context structs.

commit f1057ac3dd77989c8f91c4c0aeff9d7af45bc1d9
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 10:50:01 2011 +0200

    s3:libnet: convert libnet_dssync_passdb to only use dbwrap wrapper 
functions.
    
    Avoid direct use of the db_record and db_context structs.

commit 79a4911d755a320557ca1a2d53525a7f56953a68
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:24:09 2011 +0200

    s3:privileges: convert privileges.c to use dbwrap wrapper functions.
    
    Avoid direct use of the db_record and db_context structs.

commit 736af260628aa725aa8c45410722e9fe9db9a80b
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:21:31 2011 +0200

    s3:g_lock: convert to use only dbwrap wrapper functions.
    
    Avoid direct use of the db_record and db_context structs.

commit 7057b4d1ac196907e4fd860a7a6f12fdcfe73606
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:40:50 2011 +0200

    s3:registry: convert reg_backend_db to use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs

commit ff7918770db3be78a22d0be83415698ad03036e0
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:50:31 2011 +0200

    s3:talloc_dict: change to only use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 248cb2310c1b338da60d7849c8006a4a5ad5fa84
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:46:22 2011 +0200

    s3:sharesec: convert sharesec.c to use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs

commit bbe78110194712b5ff06f1420ce628cb78c7e269
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 00:08:36 2011 +0200

    s3:sessionid: convert to using dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit bdee9458f66210a06eb29836a66e14d5d8a7fd33
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:33:58 2011 +0200

    s3:sessionid: use dbwrap_travers_read() in sessionid_travers_read()
    
    This also changes the return code of sessionid_traverse_read() to NTSTATUS.
    It also uses traverse_read instead of traverse.

commit 6656de134612935ed12643064f307cb995cd5cbc
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:20:46 2011 +0200

    s3:sessionid: use dbwrap_travers() in sessionid_traverse()
    
    This also changes sessionid_traverse to NTSTATUS return type.

commit c8924ecc41db8da01d2918c9b82abc2cfce4351f
Author: Michael Adam <[email protected]>
Date:   Thu Aug 25 10:39:53 2011 +0200

    s3:net: convert net serverid to only use dbwrap wrapper functions
    
    Avoid direct use of the db_record and db_context structs.

commit 85ae3c3fd46a1ac6f55cb47a7fc4f83b9d53b3cf
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 22:28:40 2011 +0200

    s3:serverid: convert to using dbwrap wrapper functions only
    
    Avoid direct use of the db_record and db_context structs.

commit 5bfdd73a642616dbeeda30d812f85a0f91f25139
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:10:45 2011 +0200

    s3:net: fix the exit code of net serverid wipe

commit 86455646e32055b7eba6bce42777e05f6b2cebfb
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:09:57 2011 +0200

    s3:net: fix the exit code of net serverid list

commit 91e77f364018eae88344e472516573a51c38170d
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:08:31 2011 +0200

    s3:serverid: use dbwrap_traverse_read() in serverid_traverse_read()
    
    This also fixes the return value: originally the int return value
    of traverse_read which is a count of the records traversed or negative
    upon failure, was simply casted into a bool return value.

commit 81258c01b84de488cb3d33139357fe839c1f3323
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 10:06:07 2011 +0200

    s3:serverid: use dbwrap_traverse() in serverid_traverse()
    
    This also fixes the return value: Originally, the int returned
    by the traverse method, which is the count of the traverse was
    casted into a bool return value.

commit 0b7108b342c5ae6fefdd76b3dad1a7b17f6f835b
Author: Michael Adam <[email protected]>
Date:   Fri Aug 19 10:55:22 2011 +0200

    s3:dbwrap_torture: convert to using wrapper functions only

commit 64748e8eecf520d7e32bb37c8743f870bf4a0fc5
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 11:42:45 2011 +0200

    s3:dbwrap_tool: convert to using wrapper functions only

commit f21a66f70bb771a61a353c7e01e89f5873573995
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 01:01:38 2011 +0200

    s3:dbwrap: convert dbwrap_util.c to use dbwrap wrapper functions

commit e39cd86381404f451668967be05c7cfbb1649bbd
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 13:15:48 2011 +0200

    s3:dbwrap: use dbwrap_fetch_bystring() in dbwrap_fetch_[u]int32()

commit 0e28448a780cf231ae38fe03a85cf6e1ea9dded0
Author: Michael Adam <[email protected]>
Date:   Wed Aug 24 13:08:13 2011 +0200

    s3:dbwrap: convert dbwrap_fetch(), dbwrap_fetch_bystring() and 
dbwrap_fetch_bystring_upper() to NTSTATUS

commit 25a9978c2c4d00eb64b212170f64f5cc136e032a
Author: Michael Adam <[email protected]>
Date:   Fri Aug 19 10:53:29 2011 +0200

    s3:dbwrap: add dbwrap_fetch_locked(), a wrapper for db->fetch_locked

commit 46370441b7bc9a205b13b07ab93b97f44bf34b78
Author: Michael Adam <[email protected]>
Date:   Fri Aug 19 10:52:57 2011 +0200

    s3:dbwrap: add dbwrap_record_delete(), a wrapper for record->delete_rec

commit b257e83d898d1e848d3adbed540a7b209943ff34
Author: Michael Adam <[email protected]>
Date:   Fri Aug 19 10:51:27 2011 +0200

    s3:dbwrap: add dbwrap_record_store(), a wrapper for record->store

commit bfed62c1695391076c1d82b312030adca8d971e5
Author: Michael Adam <[email protected]>
Date:   Fri Aug 19 10:50:20 2011 +0200

    s3:dbwrap: add get-functions for db_record key, value and private_data

commit 3ed2fb4a874e8c271fa5976efcc1b0938872c708
Author: Michael Adam <[email protected]>
Date:   Thu Aug 18 14:09:56 2011 +0200

    s3:dbwrap: add wrapper function dbwrap_get_seqnum()

commit 373b0606a35bfb213411dde163058d6ae0486f06
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 22:51:12 2011 +0200

    s3:dbwrap: add wrappers for transactions start/cancel/commit

commit d8ce5bc656a673612f6587fefbe3acb08d5d8fa0
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 22:43:01 2011 +0200

    s3:dbwrap: add wrapper dbwrap_get_flags()

commit 7b9bf285140d937de41945170108d9f193baeefd
Author: Gregor Beck <[email protected]>
Date:   Wed Aug 17 11:44:12 2011 +0200

    s3:dbwrap: fix db_rbt_traverse() to return the record count on success
    
    this makes it consistent with documented behaviour of tdb_traverse()
    
    Signed-off-by: Michael Adam <[email protected]>

commit ebcb92118241a5bd4be92374b1c257236ba3b1db
Author: Gregor Beck <[email protected]>
Date:   Tue Aug 16 14:55:30 2011 +0200

    s3:dbwrap: add specific dbwrap_wipe() implementation to dbwrap_rbt
    
    Signed-off-by: Michael Adam <[email protected]>

commit 97fef0c2fd7dc622bb11cfc374e88f82b77086cf
Author: Gregor Beck <[email protected]>
Date:   Tue Aug 16 14:43:29 2011 +0200

    s3:dbwrap: add specific dbwrap_wipe() implementation to dbwrap_tdb
    
    Signed-off-by: Michael Adam <[email protected]>

commit 3dc607c0c6f5b22c95aa88b334f9c0cd2dc8f226
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 14:42:50 2011 +0200

    s3:dbwrap: add a comment

commit dc4a5f532392bb7e047b11017fa7916a68d67192
Author: Gregor Beck <[email protected]>
Date:   Tue Aug 16 14:39:19 2011 +0200

    s3:dbwrap: add function dbwrap_wipe()
    
    Signed-off-by: Michael Adam <[email protected]>

commit 63c5c0eccf3df89135c4e18f5660e6f94978e3d3
Author: Gregor Beck <[email protected]>
Date:   Tue Jul 5 15:06:05 2011 +0200

    s3:dbwrap: add specific dbwrap_parse_record() implementation to dbwrap_rbt
    
    Signed-off-by: Michael Adam <[email protected]>

commit c5d03cbff806c564d4903277bd2b866ba8bf9c7e
Author: Gregor Beck <[email protected]>
Date:   Tue Jul 5 13:43:59 2011 +0200

    s3:dbwrap: implement dbwrap_fallback_exists() with dbwrap_parse_record()
    
    Signed-off-by: Michael Adam <[email protected]>

commit 99fa6fa4a3845cdb6cbc6be0cdcdf1d8a4b49a3c
Author: Gregor Beck <[email protected]>
Date:   Tue Jul 5 13:42:39 2011 +0200

    s3:dbwrap: allow NULL parser for dbwrap_parse_record()
    
    Signed-off-by: Michael Adam <[email protected]>

commit f5b7d87c2563d0753445da8c1b75e67bd7668967
Author: Gregor Beck <[email protected]>
Date:   Tue Jul 5 13:41:12 2011 +0200

    s3:dbwrap: dbwrap_parse_record() should always return -1 on "not found"
    
    Signed-off-by: Michael Adam <[email protected]>

commit 893805b99caeb6645c0688c9ec5b9466947dc454
Author: Gregor Beck <[email protected]>
Date:   Tue Jul 5 13:10:30 2011 +0200

    s3:dbwrap: add function dbwrap_parse_record()
    
    Signed-off-by: Michael Adam <[email protected]>

commit fff09d066f5b5ba82e268f4251802fd7f3006a5e
Author: Gregor Beck <[email protected]>
Date:   Mon Jul 4 10:22:46 2011 +0200

    s3:dbwrap: add specific dbwrap_exists() implementation to dbwrap_rbt

commit 28e4c41d5b69b126d17b2d9cc7452c051f083878
Author: Gregor Beck <[email protected]>
Date:   Mon Jul 4 09:54:31 2011 +0200

    s3:dbwrap: factor out db_rpt_search_internal()
    
    Signed-off-by: Michael Adam <[email protected]>

commit 5953839b1890eaf36a3d9a3fd7febe65524a9980
Author: Gregor Beck <[email protected]>
Date:   Mon Jul 4 10:27:17 2011 +0200

    s3:dbwrap: add specific dbwrap_exists() implementation to dbwrap_tdb
    
    Signed-off-by: Michael Adam <[email protected]>

commit 87b68cea5bdec1849a275b37ea8a80a73d036734
Author: Gregor Beck <[email protected]>
Date:   Mon Jul 4 10:15:44 2011 +0200

    s3:dbwrap: add function dbwrap_exists()
    
    Signed-off-by: Michael Adam <[email protected]>

commit 87f51bfa99889c4700697556466cc694e2e6644d
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 09:59:25 2011 +0200

    s3:dbwrap: add a wrapper dbwrap_traverse_read()

commit 8f098a635f713652c4846d71e24c0a199c25b8b7
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 09:51:12 2011 +0200

    s3:dbwrap: change the dbwrap_traverse() wrapper to return the count in an 
additional parameter

commit 6608ba850b45e2f47cd1c2c4b1ad676150a1deea
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 08:45:09 2011 +0200

    s3:dbwrap: reorganize dbwrap.h some

commit 2d52f6f8f5ea579fbbfff2d42a4ba9ed897a60ff
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 08:40:53 2011 +0200

    s3:dbwrap: move dbwrap_traverse() to dbwrap.c, the core of the dbrwap 
subsystem

commit 663c661b11396076a079a99d1f66fafb732af1d8
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 08:38:39 2011 +0200

    s3:dbwrap: move dbwrap_store() back to dbwrap.c, the core of the dbwrap 
subsystem

commit 2aa5601c0aa1c38e2cb3b86331b746261e74b2ce
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 08:36:52 2011 +0200

    s3:dbwrap: move dbwrap_delete() back to dbwrap.c, the core of the dbwrap 
subsystem

commit c3868b74889ccce800557a64d2a5ae6a8891a8ee
Author: Michael Adam <[email protected]>
Date:   Wed Aug 17 08:35:21 2011 +0200

    s3:dbwrap: move dbwrap_fetch() back to dbwrap.c, the core of the dbwrap 
subsystem

commit 7a72c84ee74cb91fd9e98b1edc74e6b3c2ba1c36
Author: Michael Adam <[email protected]>
Date:   Tue Aug 16 16:20:14 2011 +0200

    s3:dbwrap: move the db_open_rbt() prototype to a new header dbwrap_rbt.h

commit c768121661cf5e845ceca3b04181937c36106484
Author: Michael Adam <[email protected]>
Date:   Tue Aug 16 16:02:19 2011 +0200

    s3:dbwrap: move the db_open_file() prototype to a new header dbwrap_file.h

commit 38f7f8e44dd4392097f780175f8599076002f461
Author: Michael Adam <[email protected]>
Date:   Tue Aug 16 15:58:27 2011 +0200

    s3:dbwrap: move the db_open_tdb() prototype to a new header dbwrap_tdb.h

commit 82bc3fa81cc1037e004b94dde7050efc50722294
Author: Michael Adam <[email protected]>
Date:   Tue Aug 16 15:51:58 2011 +0200

    s3:dbwrap: move the db_open_ctdb() prototype to a new header dbwrap_ctdb.h

-----------------------------------------------------------------------

Summary of changes:
 source3/groupdb/mapping_tdb.c                      |   61 ++++---
 source3/include/proto.h                            |   10 +-
 source3/lib/conn_tdb.c                             |   58 +++++--
 source3/lib/dbwrap/dbwrap.c                        |  209 +++++++++++++++++++-
 source3/lib/dbwrap/dbwrap.h                        |  120 +++++-------
 source3/lib/dbwrap/dbwrap_ctdb.c                   |    2 +
 .../winbindd_async.c => lib/dbwrap/dbwrap_ctdb.h}  |   32 ++--
 source3/lib/dbwrap/dbwrap_file.c                   |    1 +
 .../lib/dbwrap/dbwrap_file.h                       |   28 ++--
 source3/lib/dbwrap/dbwrap_open.c                   |    5 +
 source3/lib/dbwrap/dbwrap_private.h                |   37 ++++
 source3/lib/dbwrap/dbwrap_rbt.c                    |  141 +++++++++-----
 .../{passdb/pdb_ipa.h => lib/dbwrap/dbwrap_rbt.h}  |   17 +-
 source3/lib/dbwrap/dbwrap_tdb.c                    |   18 ++
 .../lib/dbwrap/dbwrap_tdb.h                        |   27 ++--
 source3/lib/dbwrap/dbwrap_util.c                   |  196 ++++++++-----------
 source3/lib/g_lock.c                               |   45 +++--
 source3/lib/messages.c                             |    2 +-
 source3/lib/privileges.c                           |   35 +++-
 source3/lib/serverid.c                             |   51 +++--
 source3/lib/sessionid_tdb.c                        |   56 ++++--
 source3/lib/sharesec.c                             |   84 +++++---
 source3/lib/talloc_dict.c                          |   57 ++++--
 source3/libnet/libnet_dssync_passdb.c              |   81 +++++---
 source3/locking/brlock.c                           |   43 +++--
 source3/locking/locking.c                          |   43 +++--
 source3/locking/posix.c                            |   70 ++++---
 source3/modules/nfs4_acls.c                        |    6 +-
 source3/modules/vfs_acl_tdb.c                      |   27 ++--
 source3/modules/vfs_xattr_tdb.c                    |   29 ++-
 source3/param/loadparm.c                           |   22 ++-
 source3/passdb/account_pol.c                       |   33 +++-
 source3/passdb/machine_account_secrets.c           |    2 +-
 source3/passdb/machine_sid.c                       |    6 +-
 source3/passdb/pdb_tdb.c                           |  162 +++++++++-------
 source3/passdb/secrets.c                           |   19 ++-
 source3/printing/printer_list.c                    |   41 +++--
 source3/registry/reg_backend_db.c                  |  107 ++++++----
 source3/registry/reg_objects.c                     |    7 +-
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c          |    7 +-
 source3/smbd/connection.c                          |    6 +-
 source3/smbd/notify_internal.c                     |   58 +++---
 source3/smbd/session.c                             |   24 ++-
 source3/torture/torture.c                          |   56 ++++--
 source3/utils/dbwrap_tool.c                        |   34 ++--
 source3/utils/dbwrap_torture.c                     |   16 +-
 source3/utils/net_idmap.c                          |   69 ++++---
 source3/utils/net_idmap_check.c                    |  105 +++++++----
 source3/utils/net_serverid.c                       |   10 +-
 source3/winbindd/idmap_autorid.c                   |   65 ++++--
 source3/winbindd/idmap_tdb.c                       |  130 ++++++++-----
 source3/winbindd/idmap_tdb2.c                      |   32 ++--
 52 files changed, 1655 insertions(+), 947 deletions(-)
 copy source3/{winbindd/winbindd_async.c => lib/dbwrap/dbwrap_ctdb.h} (61%)
 copy source4/winbind/wb_async_helpers.h => source3/lib/dbwrap/dbwrap_file.h 
(66%)
 copy source3/{passdb/pdb_ipa.h => lib/dbwrap/dbwrap_rbt.h} (71%)
 copy source4/winbind/wb_async_helpers.h => source3/lib/dbwrap/dbwrap_tdb.h 
(65%)


Changeset truncated at 500 lines:

diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index 47f743d..447f187 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -173,6 +173,7 @@ static bool get_group_map_from_sid(struct dom_sid sid, 
GROUP_MAP *map)
        TDB_DATA dbuf;
        char *key;
        int ret = 0;
+       NTSTATUS status;
 
        /* the key is the SID, retrieving is direct */
 
@@ -181,8 +182,8 @@ static bool get_group_map_from_sid(struct dom_sid sid, 
GROUP_MAP *map)
                return false;
        }
 
-       dbuf = dbwrap_fetch_bystring(db, key, key);
-       if (dbuf.dptr == NULL) {
+       status = dbwrap_fetch_bystring(db, key, key, &dbuf);
+       if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(key);
                return false;
        }
@@ -205,18 +206,21 @@ static bool get_group_map_from_sid(struct dom_sid sid, 
GROUP_MAP *map)
 
 static bool dbrec2map(const struct db_record *rec, GROUP_MAP *map)
 {
-       if ((rec->key.dsize < strlen(GROUP_PREFIX))
-           || (strncmp((char *)rec->key.dptr, GROUP_PREFIX,
+       TDB_DATA key = dbwrap_record_get_key(rec);
+       TDB_DATA value = dbwrap_record_get_value(rec);
+
+       if ((key.dsize < strlen(GROUP_PREFIX))
+           || (strncmp((char *)key.dptr, GROUP_PREFIX,
                        GROUP_PREFIX_LEN) != 0)) {
                return False;
        }
 
-       if (!string_to_sid(&map->sid, (const char *)rec->key.dptr
+       if (!string_to_sid(&map->sid, (const char *)key.dptr
                           + GROUP_PREFIX_LEN)) {
                return False;
        }
 
-       return tdb_unpack(rec->value.dptr, rec->value.dsize, "ddff",
+       return tdb_unpack(value.dptr, value.dsize, "ddff",
                          &map->gid, &map->sid_name_use, &map->nt_name,
                          &map->comment) != -1;
 }
@@ -266,7 +270,7 @@ static bool get_group_map_from_gid(gid_t gid, GROUP_MAP 
*map)
        state.gid = gid;
        state.map = map;
 
-       db->traverse_read(db, find_map, (void *)&state);
+       dbwrap_traverse_read(db, find_map, (void *)&state, NULL);
 
        return state.found;
 }
@@ -283,7 +287,7 @@ static bool get_group_map_from_ntname(const char *name, 
GROUP_MAP *map)
        state.name = name;
        state.map = map;
 
-       db->traverse_read(db, find_map, (void *)&state);
+       dbwrap_traverse_read(db, find_map, (void *)&state, NULL);
 
        return state.found;
 }
@@ -370,6 +374,7 @@ static bool enum_group_mapping(const struct dom_sid *domsid,
                               size_t *p_num_entries, bool unix_only)
 {
        struct enum_map_state state;
+       NTSTATUS status;
 
        state.domsid = domsid;
        state.sid_name_use = sid_name_use;
@@ -377,7 +382,8 @@ static bool enum_group_mapping(const struct dom_sid *domsid,
        state.num_maps = 0;
        state.maps = NULL;
 
-       if (db->traverse_read(db, collect_map, (void *)&state) < 0) {
+       status = dbwrap_traverse_read(db, collect_map, (void *)&state, NULL);
+       if (!NT_STATUS_IS_OK(status)) {
                return false;
        }
 
@@ -404,8 +410,8 @@ static NTSTATUS one_alias_membership(const struct dom_sid 
*member,
        slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX,
                 sid_to_fstring(tmp, member));
 
-       dbuf = dbwrap_fetch_bystring(db, frame, key);
-       if (dbuf.dptr == NULL) {
+       status = dbwrap_fetch_bystring(db, frame, key, &dbuf);
+       if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(frame);
                return NT_STATUS_OK;
        }
@@ -478,6 +484,7 @@ static NTSTATUS add_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
        char *new_memberstring;
        struct db_record *rec;
        NTSTATUS status;
+       TDB_DATA value;
 
        if (!get_group_map_from_sid(*alias, &map))
                return NT_STATUS_NO_SUCH_ALIAS;
@@ -497,12 +504,12 @@ static NTSTATUS add_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
                return NT_STATUS_NO_MEMORY;
        }
 
-       if (db->transaction_start(db) != 0) {
+       if (dbwrap_transaction_start(db) != 0) {
                DEBUG(0, ("transaction_start failed\n"));
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
-       rec = db->fetch_locked(db, key, string_term_tdb_data(key));
+       rec = dbwrap_fetch_locked(db, key, string_term_tdb_data(key));
 
        if (rec == NULL) {
                DEBUG(10, ("fetch_lock failed\n"));
@@ -511,11 +518,13 @@ static NTSTATUS add_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
                goto cancel;
        }
 
+       value = dbwrap_record_get_value(rec);
+
        sid_to_fstring(string_sid, alias);
 
-       if (rec->value.dptr != NULL) {
+       if (value.dptr != NULL) {
                new_memberstring = talloc_asprintf(
-                       key, "%s %s", (char *)(rec->value.dptr), string_sid);
+                       key, "%s %s", (char *)(value.dptr), string_sid);
        } else {
                new_memberstring = talloc_strdup(key, string_sid);
        }
@@ -526,7 +535,7 @@ static NTSTATUS add_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
                goto cancel;
        }
 
-       status = rec->store(rec, string_term_tdb_data(new_memberstring), 0);
+       status = dbwrap_record_store(rec, 
string_term_tdb_data(new_memberstring), 0);
 
        TALLOC_FREE(key);
 
@@ -535,7 +544,7 @@ static NTSTATUS add_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
                goto cancel;
        }
 
-       if (db->transaction_commit(db) != 0) {
+       if (dbwrap_transaction_commit(db) != 0) {
                DEBUG(0, ("transaction_commit failed\n"));
                status = NT_STATUS_INTERNAL_DB_CORRUPTION;
                return status;
@@ -544,7 +553,7 @@ static NTSTATUS add_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
        return NT_STATUS_OK;
 
  cancel:
-       if (db->transaction_cancel(db) != 0) {
+       if (dbwrap_transaction_cancel(db) != 0) {
                smb_panic("transaction_cancel failed");
        }
 
@@ -564,12 +573,14 @@ static int collect_aliasmem(struct db_record *rec, void 
*priv)
        const char *p;
        char *alias_string;
        TALLOC_CTX *frame;
+       TDB_DATA key = dbwrap_record_get_key(rec);
+       TDB_DATA value = dbwrap_record_get_value(rec);
 
-       if (strncmp((const char *)rec->key.dptr, MEMBEROF_PREFIX,
+       if (strncmp((const char *)key.dptr, MEMBEROF_PREFIX,
                    MEMBEROF_PREFIX_LEN) != 0)
                return 0;
 
-       p = (const char *)rec->value.dptr;
+       p = (const char *)value.dptr;
 
        frame = talloc_stackframe();
 
@@ -588,7 +599,7 @@ static int collect_aliasmem(struct db_record *rec, void 
*priv)
                 * list currently scanned. The key represents the alias
                 * member. Add that. */
 
-               member_string = strchr((const char *)rec->key.dptr, '/');
+               member_string = strchr((const char *)key.dptr, '/');
 
                /* Above we tested for MEMBEROF_PREFIX which includes the
                 * slash. */
@@ -635,7 +646,7 @@ static NTSTATUS enum_aliasmem(const struct dom_sid *alias, 
TALLOC_CTX *mem_ctx,
        state.num = num;
        state.mem_ctx = mem_ctx;
 
-       db->traverse_read(db, collect_aliasmem, &state);
+       dbwrap_traverse_read(db, collect_aliasmem, &state, NULL);
        return NT_STATUS_OK;
 }
 
@@ -649,7 +660,7 @@ static NTSTATUS del_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
        char *key;
        fstring sid_string;
 
-       if (db->transaction_start(db) != 0) {
+       if (dbwrap_transaction_start(db) != 0) {
                DEBUG(0, ("transaction_start failed\n"));
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
@@ -724,7 +735,7 @@ static NTSTATUS del_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
                goto cancel;
        }
 
-       if (db->transaction_commit(db) != 0) {
+       if (dbwrap_transaction_commit(db) != 0) {
                DEBUG(0, ("transaction_commit failed\n"));
                status = NT_STATUS_INTERNAL_DB_CORRUPTION;
                return status;
@@ -733,7 +744,7 @@ static NTSTATUS del_aliasmem(const struct dom_sid *alias, 
const struct dom_sid *
        return NT_STATUS_OK;
 
  cancel:
-       if (db->transaction_cancel(db) != 0) {
+       if (dbwrap_transaction_cancel(db) != 0) {
                smb_panic("transaction_cancel failed");
        }
        return status;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ffc90ff..0fd2281 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1675,14 +1675,14 @@ void server_messaging_context_free(void);
 struct sessionid;
 bool sessionid_init(void);
 struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
-int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
-                                struct sessionid *session,
-                                void *private_data),
-                      void *private_data);
-int sessionid_traverse_read(int (*fn)(const char *key,
+NTSTATUS sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
                                      struct sessionid *session,
                                      void *private_data),
                            void *private_data);
+NTSTATUS sessionid_traverse_read(int (*fn)(const char *key,
+                                          struct sessionid *session,
+                                          void *private_data),
+                                void *private_data);
 
 /* The following definitions come from utils/passwd_util.c  */
 
diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c
index f458480..72ba7c6 100644
--- a/source3/lib/conn_tdb.c
+++ b/source3/lib/conn_tdb.c
@@ -48,7 +48,7 @@ static struct db_record *connections_fetch_record(TALLOC_CTX 
*mem_ctx,
                return NULL;
        }
 
-       return ctx->fetch_locked(ctx, mem_ctx, key);
+       return dbwrap_fetch_locked(ctx, mem_ctx, key);
 }
 
 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
@@ -79,16 +79,21 @@ struct conn_traverse_state {
 
 static int conn_traverse_fn(struct db_record *rec, void *private_data)
 {
+       TDB_DATA key;
+       TDB_DATA value;
        struct conn_traverse_state *state =
                (struct conn_traverse_state *)private_data;
 
-       if ((rec->key.dsize != sizeof(struct connections_key))
-           || (rec->value.dsize != sizeof(struct connections_data))) {
+       key = dbwrap_record_get_key(rec);
+       value = dbwrap_record_get_value(rec);
+
+       if ((key.dsize != sizeof(struct connections_key))
+           || (value.dsize != sizeof(struct connections_data))) {
                return 0;
        }
 
-       return state->fn(rec, (const struct connections_key *)rec->key.dptr,
-                        (const struct connections_data *)rec->value.dptr,
+       return state->fn(rec, (const struct connections_key *)key.dptr,
+                        (const struct connections_data *)value.dptr,
                         state->private_data);
 }
 
@@ -96,13 +101,20 @@ int connections_traverse(int (*fn)(struct db_record *rec,
                                   void *private_data),
                         void *private_data)
 {
+       NTSTATUS status;
+       int count;
        struct db_context *ctx = connections_db_ctx(False);
 
        if (ctx == NULL) {
                return -1;
        }
 
-       return ctx->traverse(ctx, fn, private_data);
+       status = dbwrap_traverse(ctx, fn, private_data, &count);
+       if (!NT_STATUS_IS_OK(status)) {
+               return -1;
+       }
+
+       return count;
 }
 
 int connections_forall(int (*fn)(struct db_record *rec,
@@ -113,6 +125,8 @@ int connections_forall(int (*fn)(struct db_record *rec,
 {
        struct db_context *ctx;
        struct conn_traverse_state state;
+       NTSTATUS status;
+       int count;
 
        ctx = connections_db_ctx(true);
        if (ctx == NULL) {
@@ -122,7 +136,12 @@ int connections_forall(int (*fn)(struct db_record *rec,
        state.fn = fn;
        state.private_data = private_data;
 
-       return ctx->traverse(ctx, conn_traverse_fn, (void *)&state);
+       status = dbwrap_traverse(ctx, conn_traverse_fn, (void *)&state, &count);
+       if (!NT_STATUS_IS_OK(status)) {
+               return -1;
+       }
+
+       return count;
 }
 
 struct conn_traverse_read_state {
@@ -135,15 +154,20 @@ struct conn_traverse_read_state {
 static int connections_forall_read_fn(struct db_record *rec,
                                      void *private_data)
 {
+       TDB_DATA key;
+       TDB_DATA value;
        struct conn_traverse_read_state *state =
                (struct conn_traverse_read_state *)private_data;
 
-       if ((rec->key.dsize != sizeof(struct connections_key))
-           || (rec->value.dsize != sizeof(struct connections_data))) {
+       key = dbwrap_record_get_key(rec);
+       value = dbwrap_record_get_value(rec);
+
+       if ((key.dsize != sizeof(struct connections_key))
+           || (value.dsize != sizeof(struct connections_data))) {
                return 0;
        }
-       return state->fn((const struct connections_key *)rec->key.dptr,
-                        (const struct connections_data *)rec->value.dptr,
+       return state->fn((const struct connections_key *)key.dptr,
+                        (const struct connections_data *)value.dptr,
                         state->private_data);
 }
 
@@ -154,6 +178,8 @@ int connections_forall_read(int (*fn)(const struct 
connections_key *key,
 {
        struct db_context *ctx;
        struct conn_traverse_read_state state;
+       NTSTATUS status;
+       int count;
 
        ctx = connections_db_ctx(false);
        if (ctx == NULL) {
@@ -163,8 +189,14 @@ int connections_forall_read(int (*fn)(const struct 
connections_key *key,
        state.fn = fn;
        state.private_data = private_data;
 
-       return ctx->traverse_read(ctx, connections_forall_read_fn,
-                                 (void *)&state);
+       status = dbwrap_traverse_read(ctx, connections_forall_read_fn,
+                                     (void *)&state, &count);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return -1;
+       }
+
+       return count;
 }
 
 bool connections_init(bool rw)
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c
index 6a6d4c6..38404a8 100644
--- a/source3/lib/dbwrap/dbwrap.c
+++ b/source3/lib/dbwrap/dbwrap.c
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "dbwrap/dbwrap.h"
 #include "dbwrap/dbwrap_private.h"
+#include "util_tdb.h"
 
 /*
  * Fall back using fetch_locked if no genuine fetch operation is provided
@@ -43,6 +44,16 @@ int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX 
*mem_ctx,
 }
 
 /*
+ * Fall back using fetch if no genuine exists operation is provided
+ */
+
+static int dbwrap_fallback_exists(struct db_context *db, TDB_DATA key)
+{
+       int res = dbwrap_parse_record(db, key, NULL, NULL);
+       return  ( res == -1) ? 0 : 1;
+}
+
+/*
  * Fall back using fetch if no genuine parse operation is provided
  */
 
@@ -57,10 +68,206 @@ int dbwrap_fallback_parse_record(struct db_context *db, 
TDB_DATA key,
 
        res = db->fetch(db, talloc_tos(), key, &data);
        if (res != 0) {
-               return res;
+               return -1;
        }
 
        res = parser(key, data, private_data);
        TALLOC_FREE(data.dptr);
        return res;
 }
+
+
+static int delete_record(struct db_record *rec, void *data)
+{
+       NTSTATUS status = rec->delete_rec(rec);
+       return NT_STATUS_IS_OK(status) ? 0 : -1;
+}
+
+/*
+ * Fallback wipe ipmlementation using traverse and delete if no genuine
+ * wipe operation is provided
+ */
+int dbwrap_fallback_wipe(struct db_context *db)
+{
+       NTSTATUS status = dbwrap_trans_traverse(db, &delete_record, NULL);
+       return NT_STATUS_IS_OK(status) ? 0 : -1;
+}
+
+
+/*
+ * Wrapper functions for the backend methods
+ */
+
+TDB_DATA dbwrap_record_get_key(const struct db_record *rec)
+{
+       return rec->key;
+}
+
+TDB_DATA dbwrap_record_get_value(const struct db_record *rec)
+{
+       return rec->value;
+}
+
+void *dbwrap_record_get_private_data(const struct db_record *rec)
+{
+       return rec->private_data;
+}
+
+NTSTATUS dbwrap_record_store(struct db_record *rec, TDB_DATA data, int flags)
+{
+       return rec->store(rec, data, flags);
+}
+
+NTSTATUS dbwrap_record_delete(struct db_record *rec)
+{
+       return rec->delete_rec(rec);
+}
+
+struct db_record *dbwrap_fetch_locked(struct db_context *db,
+                                     TALLOC_CTX *mem_ctx,
+                                     TDB_DATA key)
+{
+       return db->fetch_locked(db, mem_ctx, key);
+}
+
+NTSTATUS dbwrap_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
+                     TDB_DATA key, TDB_DATA *value)
+{
+       if (value == NULL) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       if (db->fetch(db, mem_ctx, key, value) != 0) {
+               return NT_STATUS_NOT_FOUND;
+       }
+
+       return NT_STATUS_OK;
+}
+
+bool dbwrap_exists(struct db_context *db, TDB_DATA key)
+{
+       int result;
+       if (db->exists != NULL) {
+               result = db->exists(db, key);
+       } else {
+               result = dbwrap_fallback_exists(db,key);


-- 
Samba Shared Repository

Reply via email to