1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

dbwrap: add a dbwrap_flags argument to db_open()

This is in preparation to support handing flags to backends,
in particular activating read only record support for ctdb
databases. For a start, this does nothing but adding the
parameter, and all databases use DBWRAP_FLAG_NONE.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Michael Adam
2014-01-27 14:49:12 +01:00
committed by Stefan Metzmacher
parent 229dcfd350
commit cf0cb0add9
34 changed files with 56 additions and 43 deletions

View File

@ -54,7 +54,7 @@ static bool init_group_mapping(void)
db = db_open(NULL, state_path("group_mapping.tdb"), 0, db = db_open(NULL, state_path("group_mapping.tdb"), 0,
TDB_DEFAULT, O_RDWR|O_CREAT, 0600, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
DEBUG(0, ("Failed to open group mapping database: %s\n", DEBUG(0, ("Failed to open group mapping database: %s\n",
strerror(errno))); strerror(errno)));

View File

@ -60,7 +60,8 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
const char *name, const char *name,
int hash_size, int tdb_flags, int hash_size, int tdb_flags,
int open_flags, mode_t mode, int open_flags, mode_t mode,
enum dbwrap_lock_order lock_order) enum dbwrap_lock_order lock_order,
uint64_t dbwrap_flags)
{ {
struct db_context *result = NULL; struct db_context *result = NULL;
#ifdef CLUSTER_SUPPORT #ifdef CLUSTER_SUPPORT

View File

@ -39,6 +39,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
const char *name, const char *name,
int hash_size, int tdb_flags, int hash_size, int tdb_flags,
int open_flags, mode_t mode, int open_flags, mode_t mode,
enum dbwrap_lock_order lock_order); enum dbwrap_lock_order lock_order,
uint64_t dbwrap_flags);
#endif /* __DBWRAP_OPEN_H__ */ #endif /* __DBWRAP_OPEN_H__ */

View File

@ -33,7 +33,8 @@ static struct db_context *dbwrap_record_watchers_db(void)
watchers_db = db_open( watchers_db = db_open(
NULL, lock_path("dbwrap_watchers.tdb"), 0, NULL, lock_path("dbwrap_watchers.tdb"), 0,
TDB_CLEAR_IF_FIRST | TDB_INCOMPATIBLE_HASH, TDB_CLEAR_IF_FIRST | TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_3); O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_3,
DBWRAP_FLAG_NONE);
} }
return watchers_db; return watchers_db;
} }

View File

@ -61,7 +61,8 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
result->db = db_open(result, lock_path("g_lock.tdb"), 0, result->db = db_open(result, lock_path("g_lock.tdb"), 0,
TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0600, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_2); DBWRAP_LOCK_ORDER_2,
DBWRAP_FLAG_NONE);
if (result->db == NULL) { if (result->db == NULL) {
DEBUG(1, ("g_lock_init: Could not open g_lock.tdb\n")); DEBUG(1, ("g_lock_init: Could not open g_lock.tdb\n"));
TALLOC_FREE(result); TALLOC_FREE(result);

View File

@ -77,7 +77,8 @@ static struct db_context *serverid_db(void)
} }
db = db_open(NULL, lock_path("serverid.tdb"), 0, db = db_open(NULL, lock_path("serverid.tdb"), 0,
TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_2); O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_2,
DBWRAP_FLAG_NONE);
return db; return db;
} }

View File

@ -149,7 +149,7 @@ bool share_info_db_init(void)
share_db = db_open(NULL, state_path("share_info.tdb"), 0, share_db = db_open(NULL, state_path("share_info.tdb"), 0,
TDB_DEFAULT, O_RDWR|O_CREAT, 0600, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (share_db == NULL) { if (share_db == NULL) {
DEBUG(0,("Failed to open share info database %s (%s)\n", DEBUG(0,("Failed to open share info database %s (%s)\n",
state_path("share_info.tdb"), strerror(errno) )); state_path("share_info.tdb"), strerror(errno) ));

View File

@ -328,7 +328,7 @@ void brl_init(bool read_only)
brlock_db = db_open(NULL, lock_path("brlock.tdb"), brlock_db = db_open(NULL, lock_path("brlock.tdb"),
SMB_OPEN_DATABASE_TDB_HASH_SIZE, tdb_flags, SMB_OPEN_DATABASE_TDB_HASH_SIZE, tdb_flags,
read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644, read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644,
DBWRAP_LOCK_ORDER_2); DBWRAP_LOCK_ORDER_2, DBWRAP_FLAG_NONE);
if (!brlock_db) { if (!brlock_db) {
DEBUG(0,("Failed to open byte range locking database %s\n", DEBUG(0,("Failed to open byte range locking database %s\n",
lock_path("brlock.tdb"))); lock_path("brlock.tdb")));

View File

@ -67,7 +67,7 @@ static bool locking_init_internal(bool read_only)
SMB_OPEN_DATABASE_TDB_HASH_SIZE, SMB_OPEN_DATABASE_TDB_HASH_SIZE,
TDB_DEFAULT|TDB_VOLATILE|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, TDB_DEFAULT|TDB_VOLATILE|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
read_only?O_RDONLY:O_RDWR|O_CREAT, 0644, read_only?O_RDONLY:O_RDWR|O_CREAT, 0644,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (!lock_db) { if (!lock_db) {
DEBUG(0,("ERROR: Failed to initialise locking database\n")); DEBUG(0,("ERROR: Failed to initialise locking database\n"));

View File

@ -60,7 +60,7 @@ static bool acl_tdb_init(void)
become_root(); become_root();
acl_db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600, acl_db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
unbecome_root(); unbecome_root();
if (acl_db == NULL) { if (acl_db == NULL) {

View File

@ -320,7 +320,7 @@ static bool xattr_tdb_init(int snum, TALLOC_CTX *mem_ctx, struct db_context **p_
become_root(); become_root();
db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600, db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_2); DBWRAP_LOCK_ORDER_2, DBWRAP_FLAG_NONE);
unbecome_root(); unbecome_root();
if (db == NULL) { if (db == NULL) {

View File

@ -220,13 +220,13 @@ bool init_account_policy(void)
} }
db = db_open(NULL, state_path("account_policy.tdb"), 0, TDB_DEFAULT, db = db_open(NULL, state_path("account_policy.tdb"), 0, TDB_DEFAULT,
O_RDWR, 0600, DBWRAP_LOCK_ORDER_1); O_RDWR, 0600, DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { /* the account policies files does not exist or open if (db == NULL) { /* the account policies files does not exist or open
* failed, try to create a new one */ * failed, try to create a new one */
db = db_open(NULL, state_path("account_policy.tdb"), 0, db = db_open(NULL, state_path("account_policy.tdb"), 0,
TDB_DEFAULT, O_RDWR|O_CREAT, 0600, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
DEBUG(0,("Failed to open account policy database\n")); DEBUG(0,("Failed to open account policy database\n"));
return False; return False;

View File

@ -226,7 +226,7 @@ static bool tdbsam_convert_backup(const char *dbname, struct db_context **pp_db)
tmp_db = db_open(NULL, tmp_fname, 0, tmp_db = db_open(NULL, tmp_fname, 0,
TDB_DEFAULT, O_CREAT|O_RDWR, 0600, TDB_DEFAULT, O_CREAT|O_RDWR, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (tmp_db == NULL) { if (tmp_db == NULL) {
DEBUG(0, ("tdbsam_convert_backup: Failed to create backup TDB passwd " DEBUG(0, ("tdbsam_convert_backup: Failed to create backup TDB passwd "
"[%s]\n", tmp_fname)); "[%s]\n", tmp_fname));
@ -293,7 +293,7 @@ static bool tdbsam_convert_backup(const char *dbname, struct db_context **pp_db)
orig_db = db_open(NULL, dbname, 0, orig_db = db_open(NULL, dbname, 0,
TDB_DEFAULT, O_CREAT|O_RDWR, 0600, TDB_DEFAULT, O_CREAT|O_RDWR, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (orig_db == NULL) { if (orig_db == NULL) {
DEBUG(0, ("tdbsam_convert_backup: Failed to re-open " DEBUG(0, ("tdbsam_convert_backup: Failed to re-open "
"converted passdb TDB [%s]\n", dbname)); "converted passdb TDB [%s]\n", dbname));
@ -444,7 +444,7 @@ static bool tdbsam_open( const char *name )
/* Try to open tdb passwd. Create a new one if necessary */ /* Try to open tdb passwd. Create a new one if necessary */
db_sam = db_open(NULL, name, 0, TDB_DEFAULT, O_CREAT|O_RDWR, 0600, db_sam = db_open(NULL, name, 0, TDB_DEFAULT, O_CREAT|O_RDWR, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db_sam == NULL) { if (db_sam == NULL) {
DEBUG(0, ("tdbsam_open: Failed to open/create TDB passwd " DEBUG(0, ("tdbsam_open: Failed to open/create TDB passwd "
"[%s]\n", name)); "[%s]\n", name));

View File

@ -79,7 +79,7 @@ bool secrets_init_path(const char *private_dir, bool use_ntdb)
db_ctx = db_open(NULL, fname, 0, db_ctx = db_open(NULL, fname, 0,
TDB_DEFAULT, O_RDWR|O_CREAT, 0600, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db_ctx == NULL) { if (db_ctx == NULL) {
DEBUG(0,("Failed to open %s\n", fname)); DEBUG(0,("Failed to open %s\n", fname));

View File

@ -40,7 +40,8 @@ static struct db_context *get_printer_list_db(void)
} }
db = db_open(NULL, PL_DB_NAME(), 0, db = db_open(NULL, PL_DB_NAME(), 0,
TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_1); O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_1,
DBWRAP_FLAG_NONE);
return db; return db;
} }

View File

@ -732,11 +732,11 @@ WERROR regdb_init(void)
regdb = db_open(NULL, state_path("registry.tdb"), 0, regdb = db_open(NULL, state_path("registry.tdb"), 0,
REG_TDB_FLAGS, O_RDWR, 0600, REG_TDB_FLAGS, O_RDWR, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (!regdb) { if (!regdb) {
regdb = db_open(NULL, state_path("registry.tdb"), 0, regdb = db_open(NULL, state_path("registry.tdb"), 0,
REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600, REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (!regdb) { if (!regdb) {
werr = ntstatus_to_werror(map_nt_error_from_unix(errno)); werr = ntstatus_to_werror(map_nt_error_from_unix(errno));
DEBUG(1,("regdb_init: Failed to open registry %s (%s)\n", DEBUG(1,("regdb_init: Failed to open registry %s (%s)\n",
@ -852,7 +852,7 @@ WERROR regdb_open( void )
regdb = db_open(NULL, state_path("registry.tdb"), 0, regdb = db_open(NULL, state_path("registry.tdb"), 0,
REG_TDB_FLAGS, O_RDWR, 0600, REG_TDB_FLAGS, O_RDWR, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if ( !regdb ) { if ( !regdb ) {
result = ntstatus_to_werror( map_nt_error_from_unix( errno ) ); result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", DEBUG(0,("regdb_open: Failed to open %s! (%s)\n",

View File

@ -69,7 +69,8 @@ NTSTATUS rpccli_pre_open_netlogon_creds(void)
global_db = db_open(talloc_autofree_context(), fname, global_db = db_open(talloc_autofree_context(), fname,
0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2); O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2,
DBWRAP_FLAG_NONE);
if (global_db == NULL) { if (global_db == NULL) {
TALLOC_FREE(frame); TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -145,7 +145,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
notify->db_index = db_open( notify->db_index = db_open(
notify, lock_path("notify_index.tdb"), notify, lock_path("notify_index.tdb"),
0, TDB_SEQNUM|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, 0, TDB_SEQNUM|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_3); O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_3, DBWRAP_FLAG_NONE);
if (notify->db_index == NULL) { if (notify->db_index == NULL) {
goto fail; goto fail;
} }

View File

@ -64,7 +64,8 @@ NTSTATUS smbXsrv_open_global_init(void)
TDB_CLEAR_IF_FIRST | TDB_CLEAR_IF_FIRST |
TDB_INCOMPATIBLE_HASH, TDB_INCOMPATIBLE_HASH,
O_RDWR | O_CREAT, 0600, O_RDWR | O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1,
DBWRAP_FLAG_NONE);
if (db_ctx == NULL) { if (db_ctx == NULL) {
NTSTATUS status; NTSTATUS status;

View File

@ -73,7 +73,8 @@ NTSTATUS smbXsrv_session_global_init(void)
TDB_CLEAR_IF_FIRST | TDB_CLEAR_IF_FIRST |
TDB_INCOMPATIBLE_HASH, TDB_INCOMPATIBLE_HASH,
O_RDWR | O_CREAT, 0600, O_RDWR | O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1,
DBWRAP_FLAG_NONE);
if (db_ctx == NULL) { if (db_ctx == NULL) {
NTSTATUS status; NTSTATUS status;

View File

@ -62,7 +62,8 @@ NTSTATUS smbXsrv_tcon_global_init(void)
TDB_CLEAR_IF_FIRST | TDB_CLEAR_IF_FIRST |
TDB_INCOMPATIBLE_HASH, TDB_INCOMPATIBLE_HASH,
O_RDWR | O_CREAT, 0600, O_RDWR | O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1,
DBWRAP_FLAG_NONE);
if (db_ctx == NULL) { if (db_ctx == NULL) {
NTSTATUS status; NTSTATUS status;

View File

@ -80,7 +80,8 @@ NTSTATUS smbXsrv_version_global_init(const struct server_id *server_id)
TDB_CLEAR_IF_FIRST | TDB_CLEAR_IF_FIRST |
TDB_INCOMPATIBLE_HASH, TDB_INCOMPATIBLE_HASH,
O_RDWR | O_CREAT, 0600, O_RDWR | O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1,
DBWRAP_FLAG_NONE);
if (db_ctx == NULL) { if (db_ctx == NULL) {
status = map_nt_error_from_unix_common(errno); status = map_nt_error_from_unix_common(errno);
DEBUG(0,("smbXsrv_version_global_init: " DEBUG(0,("smbXsrv_version_global_init: "

View File

@ -48,7 +48,8 @@ bool run_dbwrap_watch1(int dummy)
goto fail; goto fail;
} }
db = db_open(msg, "test_watch.tdb", 0, TDB_DEFAULT, db = db_open(msg, "test_watch.tdb", 0, TDB_DEFAULT,
O_CREAT|O_RDWR, 0644, DBWRAP_LOCK_ORDER_1); O_CREAT|O_RDWR, 0644, DBWRAP_LOCK_ORDER_1,
DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
fprintf(stderr, "db_open failed: %s\n", strerror(errno)); fprintf(stderr, "db_open failed: %s\n", strerror(errno));
goto fail; goto fail;

View File

@ -86,7 +86,7 @@ static bool open_db(struct idmap_tdb_common_context *ctx)
ctx->db = db_open(ctx, db_path, 0, TDB_DEFAULT, ctx->db = db_open(ctx, db_path, 0, TDB_DEFAULT,
O_RDWR | O_CREAT, 0600, O_RDWR | O_CREAT, 0600,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if(!ctx->db) { if(!ctx->db) {
DEBUG(0, ("Failed to open database: %s\n", strerror(errno))); DEBUG(0, ("Failed to open database: %s\n", strerror(errno)));

View File

@ -9066,7 +9066,8 @@ static bool run_local_dbtrans(int dummy)
TDB_DATA value; TDB_DATA value;
db = db_open(talloc_tos(), "transtest.tdb", 0, TDB_DEFAULT, db = db_open(talloc_tos(), "transtest.tdb", 0, TDB_DEFAULT,
O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_1); O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_1,
DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
printf("Could not open transtest.db\n"); printf("Could not open transtest.db\n");
return false; return false;

View File

@ -588,7 +588,7 @@ int main(int argc, const char **argv)
case OP_LISTKEYS: case OP_LISTKEYS:
case OP_EXISTS: case OP_EXISTS:
db = db_open(mem_ctx, dbname, 0, tdb_flags, O_RDWR | O_CREAT, db = db_open(mem_ctx, dbname, 0, tdb_flags, O_RDWR | O_CREAT,
0644, DBWRAP_LOCK_ORDER_1); 0644, DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
d_fprintf(stderr, "ERROR: could not open dbname\n"); d_fprintf(stderr, "ERROR: could not open dbname\n");
goto done; goto done;

View File

@ -309,7 +309,7 @@ int main(int argc, const char *argv[])
} }
db = db_open(mem_ctx, db_name, 0, tdb_flags, O_RDWR | O_CREAT, 0644, db = db_open(mem_ctx, db_name, 0, tdb_flags, O_RDWR | O_CREAT, 0644,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
d_fprintf(stderr, "failed to open db '%s': %s\n", db_name, d_fprintf(stderr, "failed to open db '%s': %s\n", db_name,

View File

@ -206,7 +206,7 @@ static bool net_idmap_opendb_autorid(TALLOC_CTX *mem_ctx,
if (readonly) { if (readonly) {
*db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDONLY, 0, *db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDONLY, 0,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (*db == NULL) { if (*db == NULL) {
d_fprintf(stderr, d_fprintf(stderr,
_("Could not open autorid db (%s): %s\n"), _("Could not open autorid db (%s): %s\n"),
@ -261,7 +261,7 @@ static int net_idmap_dump(struct net_context *c, int argc, const char **argv)
d_fprintf(stderr, _("dumping id mapping from %s\n"), dbfile); d_fprintf(stderr, _("dumping id mapping from %s\n"), dbfile);
db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDONLY, 0, db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDONLY, 0,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"), d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"),
dbfile, strerror(errno)); dbfile, strerror(errno));
@ -387,7 +387,7 @@ static int net_idmap_restore(struct net_context *c, int argc, const char **argv)
} }
db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644, db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"), d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"),
dbfile, strerror(errno)); dbfile, strerror(errno));
@ -598,7 +598,7 @@ static int net_idmap_delete_mapping(struct net_context *c, int argc,
d_fprintf(stderr, _("deleting id mapping from %s\n"), dbfile); d_fprintf(stderr, _("deleting id mapping from %s\n"), dbfile);
db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR, 0, db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR, 0,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (db == NULL) { if (db == NULL) {
d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"), d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"),
dbfile, strerror(errno)); dbfile, strerror(errno));

View File

@ -790,7 +790,7 @@ static bool check_open_db(struct check_ctx* ctx, const char* name, int oflags)
} }
ctx->db = db_open(ctx, name, 0, TDB_DEFAULT, oflags, 0, ctx->db = db_open(ctx, name, 0, TDB_DEFAULT, oflags, 0,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (ctx->db == NULL) { if (ctx->db == NULL) {
d_fprintf(stderr, d_fprintf(stderr,
_("Could not open idmap db (%s) for writing: %s\n"), _("Could not open idmap db (%s) for writing: %s\n"),

View File

@ -338,7 +338,7 @@ static bool check_ctx_open_output(struct check_ctx *ctx)
} }
ctx->odb = db_open(ctx, ctx->opt.output, 0, TDB_DEFAULT, oflags, 0644, ctx->odb = db_open(ctx, ctx->opt.output, 0, TDB_DEFAULT, oflags, 0644,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (ctx->odb == NULL) { if (ctx->odb == NULL) {
d_fprintf(stderr, d_fprintf(stderr,
_("Could not open db (%s) for writing: %s\n"), _("Could not open db (%s) for writing: %s\n"),
@ -351,7 +351,7 @@ static bool check_ctx_open_output(struct check_ctx *ctx)
static bool check_ctx_open_input(struct check_ctx *ctx) { static bool check_ctx_open_input(struct check_ctx *ctx) {
ctx->idb = db_open(ctx, ctx->fname, 0, TDB_DEFAULT, O_RDONLY, 0, ctx->idb = db_open(ctx, ctx->fname, 0, TDB_DEFAULT, O_RDONLY, 0,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (ctx->idb == NULL) { if (ctx->idb == NULL) {
d_fprintf(stderr, d_fprintf(stderr,
_("Could not open db (%s) for reading: %s\n"), _("Could not open db (%s) for reading: %s\n"),

View File

@ -508,7 +508,7 @@ static void print_notify_recs(const char *path,
struct db_context *db; struct db_context *db;
db = db_open(NULL, lock_path("locking.tdb"), 0, db = db_open(NULL, lock_path("locking.tdb"), 0,
TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDONLY, 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDONLY, 0,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (!db) { if (!db) {
d_printf("%s not initialised\n", d_printf("%s not initialised\n",

View File

@ -666,7 +666,7 @@ NTSTATUS idmap_autorid_db_init(const char *path,
/* Open idmap repository */ /* Open idmap repository */
*db = db_open(mem_ctx, path, 0, TDB_DEFAULT, O_RDWR | O_CREAT, 0644, *db = db_open(mem_ctx, path, 0, TDB_DEFAULT, O_RDWR | O_CREAT, 0644,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (*db == NULL) { if (*db == NULL) {
DEBUG(0, ("Unable to open idmap_autorid database '%s'\n", path)); DEBUG(0, ("Unable to open idmap_autorid database '%s'\n", path));

View File

@ -321,7 +321,7 @@ static NTSTATUS idmap_tdb_open_db(struct idmap_domain *dom)
/* Open idmap repository */ /* Open idmap repository */
db = db_open(mem_ctx, tdbfile, 0, TDB_DEFAULT, O_RDWR | O_CREAT, 0644, db = db_open(mem_ctx, tdbfile, 0, TDB_DEFAULT, O_RDWR | O_CREAT, 0644,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
if (!db) { if (!db) {
DEBUG(0, ("Unable to open idmap database\n")); DEBUG(0, ("Unable to open idmap database\n"));
ret = NT_STATUS_UNSUCCESSFUL; ret = NT_STATUS_UNSUCCESSFUL;

View File

@ -114,7 +114,7 @@ static NTSTATUS idmap_tdb2_open_db(struct idmap_domain *dom)
/* Open idmap repository */ /* Open idmap repository */
ctx->db = db_open(ctx, db_path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644, ctx->db = db_open(ctx, db_path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644,
DBWRAP_LOCK_ORDER_1); DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
TALLOC_FREE(db_path); TALLOC_FREE(db_path);
if (ctx->db == NULL) { if (ctx->db == NULL) {