diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/groupdb/mapping.c | 2 | ||||
-rw-r--r-- | source3/lib/account_pol.c | 2 | ||||
-rw-r--r-- | source3/lib/gencache.c | 2 | ||||
-rw-r--r-- | source3/lib/sharesec.c | 2 | ||||
-rw-r--r-- | source3/passdb/pdb_tdb.c | 6 | ||||
-rw-r--r-- | source3/passdb/secrets.c | 4 | ||||
-rw-r--r-- | source3/printing/notify.c | 2 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 2 | ||||
-rw-r--r-- | source3/printing/printing.c | 10 | ||||
-rw-r--r-- | source3/rpc_server/srv_eventlog_lib.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_eventlog_nt.c | 2 | ||||
-rw-r--r-- | source3/tdb/tdbutil.c | 18 |
12 files changed, 32 insertions, 24 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 5569dbf4ed..c701ef165d 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -63,7 +63,7 @@ static BOOL init_group_mapping(void) } /* handle a Samba upgrade */ - tdb_lock_bystring(tdb, vstring, 0); + tdb_lock_bystring(tdb, vstring); /* Cope with byte-reversed older versions of the db. */ vers_id = tdb_fetch_int32(tdb, vstring); diff --git a/source3/lib/account_pol.c b/source3/lib/account_pol.c index 0694b1c3f8..6bf7346fe7 100644 --- a/source3/lib/account_pol.c +++ b/source3/lib/account_pol.c @@ -269,7 +269,7 @@ BOOL init_account_policy(void) } /* handle a Samba upgrade */ - tdb_lock_bystring(tdb, vstring,0); + tdb_lock_bystring(tdb, vstring); if (!tdb_fetch_uint32(tdb, vstring, &version) || version != DATABASE_VERSION) { tdb_store_uint32(tdb, vstring, DATABASE_VERSION); diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 89badcd4f9..6725ed4c12 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -372,7 +372,7 @@ int gencache_lock_entry( const char *key ) if (!gencache_init()) return -1; - return tdb_lock_bystring(cache, key, 0); + return tdb_lock_bystring(cache, key); } /******************************************************************** diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index b98e304582..8105d5c37a 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -55,7 +55,7 @@ BOOL share_info_db_init(void) } /* handle a Samba upgrade */ - tdb_lock_bystring(share_tdb, vstring, 0); + tdb_lock_bystring(share_tdb, vstring); /* Cope with byte-reversed older versions of the db. */ vers_id = tdb_fetch_int32(share_tdb, vstring); diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 94ae328812..ba8124d392 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -694,7 +694,7 @@ static BOOL tdbsam_convert(int32 from) BOOL ret; /* handle a Samba upgrade */ - tdb_lock_bystring(tdbsam, vstring, 0); + tdb_lock_bystring(tdbsam, vstring); /* Enumerate all records and convert them */ key = tdb_firstkey(tdbsam); @@ -1420,7 +1420,7 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods, interim_account = True; - if ( tdb_lock_bystring(tdbsam, newname, 30) == -1 ) { + if ( tdb_lock_bystring_with_timeout(tdbsam, newname, 30) == -1 ) { goto done; } @@ -1492,7 +1492,7 @@ static BOOL init_idmap_tdb(TDB_CONTEXT *tdb) { int32 version; - if (tdb_lock_bystring(tdb, "IDMAP_VERSION", 0) != 0) { + if (tdb_lock_bystring(tdb, "IDMAP_VERSION") != 0) { DEBUG(0, ("Could not lock IDMAP_VERSION\n")); return False; } diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index a288e7d169..32793dea58 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -245,7 +245,7 @@ BOOL secrets_lock_trust_account_password(const char *domain, BOOL dolock) return False; if (dolock) - return (tdb_lock_bystring(tdb, trust_keystr(domain),0) == 0); + return (tdb_lock_bystring(tdb, trust_keystr(domain)) == 0); else tdb_unlock_bystring(tdb, trust_keystr(domain)); return True; @@ -774,7 +774,7 @@ BOOL secrets_named_mutex(const char *name, unsigned int timeout) if (!secrets_init()) return False; - ret = tdb_lock_bystring(tdb, name, timeout); + ret = tdb_lock_bystring_with_timeout(tdb, name, timeout); if (ret == 0) DEBUG(10,("secrets_named_mutex: got mutex for %s\n", name )); diff --git a/source3/printing/notify.c b/source3/printing/notify.c index e71d9e6f25..f27eb2011f 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -520,7 +520,7 @@ BOOL print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t return False; tdb = pdb->tdb; - if (tdb_read_lock_bystring(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { + if (tdb_read_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { DEBUG(0,("print_notify_pid_list: Failed to lock printer %s database\n", printername)); if (pdb) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 727d226e2a..1a664fbb34 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -673,7 +673,7 @@ uint32 update_c_setprinter(BOOL initialize) int32 c_setprinter; int32 printer_count = 0; - tdb_lock_bystring(tdb_printers, GLOBAL_C_SETPRINTER, 0); + tdb_lock_bystring(tdb_printers, GLOBAL_C_SETPRINTER); /* Traverse the tdb, counting the printers */ tdb_traverse(tdb_printers, traverse_counting_printers, (void *)&printer_count); diff --git a/source3/printing/printing.c b/source3/printing/printing.c index d9acd2de72..b131727f8a 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -197,7 +197,7 @@ BOOL print_backend_init(void) pdb = get_print_db_byname(lp_const_servicename(snum)); if (!pdb) continue; - if (tdb_lock_bystring(pdb->tdb, sversion, 0) == -1) { + if (tdb_lock_bystring(pdb->tdb, sversion) == -1) { DEBUG(0,("print_backend_init: Failed to open printer %s database\n", lp_const_servicename(snum) )); release_print_db(pdb); return False; @@ -1291,7 +1291,7 @@ static void print_queue_update_with_lock( const char *sharename, slprintf(keystr, sizeof(keystr) - 1, "LOCK/%s", sharename); /* Only wait 10 seconds for this. */ - if (tdb_lock_bystring(pdb->tdb, keystr, 10) == -1) { + if (tdb_lock_bystring_with_timeout(pdb->tdb, keystr, 10) == -1) { DEBUG(0,("print_queue_update_with_lock: Failed to lock printer %s database\n", sharename)); release_print_db(pdb); return; @@ -1563,7 +1563,7 @@ BOOL print_notify_register_pid(int snum) tdb = pdb->tdb; } - if (tdb_lock_bystring(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { + if (tdb_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { DEBUG(0,("print_notify_register_pid: Failed to lock printer %s\n", printername)); if (pdb) @@ -1653,7 +1653,7 @@ BOOL print_notify_deregister_pid(int snum) tdb = pdb->tdb; } - if (tdb_lock_bystring(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { + if (tdb_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { DEBUG(0,("print_notify_register_pid: Failed to lock \ printer %s database\n", printername)); if (pdb) @@ -2205,7 +2205,7 @@ static BOOL allocate_print_jobid(struct tdb_print_db *pdb, int snum, const char for (i = 0; i < 3; i++) { /* Lock the database - only wait 20 seconds. */ - if (tdb_lock_bystring(pdb->tdb, "INFO/nextjob", 20) == -1) { + if (tdb_lock_bystring_with_timeout(pdb->tdb, "INFO/nextjob", 20) == -1) { DEBUG(0,("allocate_print_jobid: failed to lock printing database %s\n", sharename)); return False; } diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c index b3d94901ba..acae1c94e9 100644 --- a/source3/rpc_server/srv_eventlog_lib.c +++ b/source3/rpc_server/srv_eventlog_lib.c @@ -163,7 +163,7 @@ BOOL make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed, if ( mem_ctx == NULL ) return False; /* can't allocate memory indicates bigger problems */ /* lock */ - tdb_lock_bystring( the_tdb, EVT_NEXT_RECORD, 1 ); + tdb_lock_bystring_with_timeout( the_tdb, EVT_NEXT_RECORD, 1 ); /* read */ end_record = tdb_fetch_int32( the_tdb, EVT_NEXT_RECORD ); start_record = tdb_fetch_int32( the_tdb, EVT_OLDEST_ENTRY ); @@ -489,7 +489,7 @@ int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee ) /* need to read the record number and insert it into the entry here */ /* lock */ - tdb_lock_bystring( the_tdb, EVT_NEXT_RECORD, 1 ); + tdb_lock_bystring_with_timeout( the_tdb, EVT_NEXT_RECORD, 1 ); /* read */ next_record = tdb_fetch_int32( the_tdb, EVT_NEXT_RECORD ); diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c index a8b9c66717..284ee37348 100644 --- a/source3/rpc_server/srv_eventlog_nt.c +++ b/source3/rpc_server/srv_eventlog_nt.c @@ -146,7 +146,7 @@ static BOOL get_num_records_hook( EVENTLOG_INFO * info ) /* lock the tdb since we have to get 2 records */ - tdb_lock_bystring( ELOG_TDB_CTX(info->etdb), EVT_NEXT_RECORD, 1 ); + tdb_lock_bystring_with_timeout( ELOG_TDB_CTX(info->etdb), EVT_NEXT_RECORD, 1 ); next_record = tdb_fetch_int32( ELOG_TDB_CTX(info->etdb), EVT_NEXT_RECORD); oldest_record = tdb_fetch_int32( ELOG_TDB_CTX(info->etdb), EVT_OLDEST_ENTRY); tdb_unlock_bystring( ELOG_TDB_CTX(info->etdb), EVT_NEXT_RECORD); diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c index 09baff072f..f1809229f8 100644 --- a/source3/tdb/tdbutil.c +++ b/source3/tdb/tdbutil.c @@ -104,11 +104,19 @@ int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int tim Lock a chain by string. Return -1 if timeout or lock failed. ****************************************************************************/ -int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) +int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval) { TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); - return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK); + return tdb_chainlock(tdb, key); +} + +int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, + int timeout) +{ + TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); + + return tdb_chainlock_with_timeout(tdb, key, timeout); } /**************************************************************************** @@ -126,7 +134,7 @@ void tdb_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval) Read lock a chain by string. Return -1 if timeout or lock failed. ****************************************************************************/ -int tdb_read_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) +int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) { TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); @@ -311,7 +319,7 @@ int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, const char *keystr, int32 *oldva int32 val; int32 ret = -1; - if (tdb_lock_bystring(tdb, keystr,0) == -1) + if (tdb_lock_bystring(tdb, keystr) == -1) return -1; if ((val = tdb_fetch_int32(tdb, keystr)) == -1) { @@ -352,7 +360,7 @@ BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldv uint32 val; BOOL ret = False; - if (tdb_lock_bystring(tdb, keystr,0) == -1) + if (tdb_lock_bystring(tdb, keystr) == -1) return False; if (!tdb_fetch_uint32(tdb, keystr, &val)) { |