1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00
Commit Graph

37 Commits

Author SHA1 Message Date
Michael Adam
ae58ff981d s3:dbwrap: add dbwrap_trans_change_int32_atomic()
A transaction wrapper for dbwrap_change_int32_atomic().

Michael
2009-07-29 16:26:29 +02:00
Michael Adam
fac81b3750 s3:dbwrap: export logic of dbwrap_change_int32_atomic into an action function
to prepare for adding a transaction wrapper to dbwrap_change_int32_atomic()

Michael
2009-07-29 16:26:28 +02:00
Michael Adam
a86e163c1b s3:dbwrap: change dbwrap_change_int32_atomic() to take int32_t, not int32
Michael
2009-07-29 16:26:27 +02:00
Michael Adam
0579438039 s3:dbwrap: add dbwrap_trans_change_uint32_atomic()
A transaction wrapper for dbwrap_change_uint32_atomic().

Michael
2009-07-29 16:26:25 +02:00
Michael Adam
14c2bc91b9 s3:dbwrap: export logic of dbwrap_change_uint32_atomic into an action function
to prepare for adding a transaction wrapper to dbwrap_change_uint32_atomic()

Michael
2009-07-29 16:26:24 +02:00
Michael Adam
6abcdaad28 s3:dbwrap: untangle assignment and check in dbwrap_change_int32_atomic()
Michael
2009-07-29 16:26:23 +02:00
Michael Adam
8b0993e085 s3:dbwrap: untangle assignemend and check in dbwrap_change_uint32_atomic()
Michael
2009-07-29 16:26:23 +02:00
Michael Adam
de2846012b s3:dbwrap: don't leak in dbwrap_change_int32_atomic().
Michael
2009-07-29 16:26:22 +02:00
Michael Adam
80abb95ead s3:dbwrap: don't leak in dbwrap_change_uint32_atomic()
Michael
2009-07-29 16:26:22 +02:00
Michael Adam
aa4e5a32a7 s3:dbwrap: change dbwrap_change_int32_atomic() to return NTSTATUS not int32.
Michael
2009-07-29 16:26:21 +02:00
Michael Adam
ded0ce8345 s3:dbwrap: change dbwrap_change_uint32_atomic() to return NTSTATUS not uint32_t.
Michael
2009-07-29 16:26:21 +02:00
Michael Adam
319a97bce9 s3:dbwrap: use the transaction wrapper in dbwrap_trans_store().
Now dbwrap_util.c contains only one call to each of
transaction_start, transaction_commit and transaction_cancel.

Michael
2009-07-21 12:40:34 +02:00
Michael Adam
d5efb38151 s3:dbwrap: use the transaction wrapper in dbwrap_trans_delete().
Michael
2009-07-21 12:40:34 +02:00
Michael Adam
7bd4699228 s3:dbwrap: fix embarrassing typo :-)
Michael
2009-07-15 17:10:47 +02:00
Michael Adam
3071b07122 s3:dbwrap_util: add my C
Michael
2009-07-15 14:01:40 +02:00
Michael Adam
3b3125fc23 s3:dbwrap: add dbwrap_fetch_bystring_upper().
To fetch a key whose name is stored but not given in upper case.

Michael
2009-07-15 14:01:39 +02:00
Michael Adam
32a3275344 s3:dbwrap: add dbwrap_store_bystring_upper().
This stores a key under the uppercase version of the given keyname.

Michael
2009-07-15 14:01:38 +02:00
Michael Adam
804d3f897b s3:dbwrap: add dbwrap_delete_bystring_upper()
To delete a key whose name is not given in but stored in uppercase.

Michael
2009-07-15 14:01:38 +02:00
Michael Adam
5b594c6958 s3:dbwrap: add a wrapper dbwrap_trans_do()
This function wraps the action() callback into a db
transaction and the transaction is either committed
or cancelled, depending on the return value of
the action function.

Michael
2009-07-15 14:00:43 +02:00
Stefan Metzmacher
a255f9ce71 s3:dbwrap: fix dbwrap_store_uint32() to match dbwrap_store_int32()
All callers expect 0 an success and -1 on error.

metze
2008-12-29 09:05:15 +01:00
Andrew Tridgell
312a04528c don't leave a dangling transaction on retry error
(This used to be commit ddf3022595)
2008-08-13 11:54:10 +02:00
Michael Adam
7b35eec609 dbwrap: add comment describing behaviour of dbwrap_change_int32_atomic().
Michael
(This used to be commit f8f21c8e39)
2008-08-05 23:44:07 +02:00
Michael Adam
4c5752d40f secrets: fix replacemend random seed generator (security issue).
This is a regression introduced by the change to dbwrap.
The replacement dbwrap_change_int32_atomic() does not
correctly mimic the behaviour of tdb_change_int32_atomic():
The intended behaviour is to use *oldval  as an initial
value when the entry does not yet exist in the db and to
return the old value in *oldval.

The effect was that:
1. get_rand_seed() always returns sys_getpid() in *new_seed
   instead of the incremented seed from the secrets.tdb.
2. the seed stored in the tdb is always starting at 0 instead
   of sys_getpid() + 1 and incremented in subsequent calls.

In principle this is a security issue, but i think the danger is
low, since this is only used as a fallback when there is no useable
/dev/urandom, and this is at most called on startup or via
reinit_after_fork.

Michael
(This used to be commit bfc5d34a19)
2008-08-05 23:44:00 +02:00
Michael Adam
149e1ae25a dbwrap: add comment describing behaviour of dbwrap_change_uint32_atomic().
Michael
(This used to be commit 7edfb54c86)
2008-08-05 23:43:59 +02:00
Michael Adam
b59ed9c05f idmap_tdb2: fix a race condition in idmap_tdb2_allocate_id().
The race is a regression introduced by the change to dbwrap.
It might have led to two concurrent processes returning the same id.

This fix is achieved by changing dbwrap_change_uint32_atomic() to
match the original behaviour of tdb_change_uint32_atomic(), which
is the following: *oldval is used as initial value when
the value does not yet exist and that the old value should be
returned in *oldval.

dbwrap_change_uint32_atomic() is used (only) in idmap_tdb2.c,
to get new ids.

Michael
(This used to be commit 72bd83fea7)
2008-08-05 23:43:53 +02:00
Michael Adam
2c2379b321 dbwrap: fix more "tdb_chainunlock failed" messages
TALLOC_FREE(rec) before transaction_cancel also in dbwrap_trans_delete().

Michael
(This used to be commit 04cd914a1f)
2008-04-07 23:40:18 +02:00
Stefan Metzmacher
20dc21f474 dbwrap: fix a confusing "tdb_chainunlock failed" message
Unlock before we cancel the transaction...

metze
(This used to be commit d70a8e9c41)
2008-04-01 14:04:23 +02:00
Stefan Metzmacher
3f076ab773 dbwrap: add dbwrap_trans_store_uint32()
metze
(This used to be commit 9e739b4c99)
2008-04-01 14:04:23 +02:00
Volker Lendecke
92e6d07ad9 Add dbwrap_trans_*_bystring
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit 2cf2684a11)
2008-04-01 14:04:22 +02:00
Volker Lendecke
16198dc51e Convert dbwrap_trans_delete to NTSTATUS
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit dead193f46)
2008-04-01 14:04:22 +02:00
Volker Lendecke
fcdfff1cc8 Convert dbwrap_trans_store to NTSTATUS
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit 5f4de856af)
2008-04-01 14:04:22 +02:00
Volker Lendecke
d20f88c603 Add dbwrap_[fetch|store]_uint32
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit f1dd915ce8)
2008-04-01 14:04:22 +02:00
Michael Adam
04ae7b85ea dbwrap: fix dbwrap_trans_[delete|store]() to stop when transaction_start() failed.
Michael
(This used to be commit ab0aaed907)
2008-03-27 18:14:57 +01:00
Stefan Metzmacher
32e7cc5193 dbwrap: add dbwrap_trans_store_int32()
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit f05e889bc0)
2008-03-27 18:14:56 +01:00
Volker Lendecke
fe0e5d292d Add dbwrap_trans_store and dbwrap_trans_delete
(This used to be commit e66e502bee)
2008-03-10 21:08:44 +01:00
Volker Lendecke
69d67122b2 add dbwrap_change_int32_atomic
(This used to be commit 4ee21a98bc)
2008-03-10 21:08:44 +01:00
Alexander Bokovoy
68694369fc Merge CTDB-related fixes from samba-ctdb 3.0 branch (http://samba.org/~tridge/3_0-ctdb)
Signed-off-by: Alexander Bokovoy <ab@samba.org>(This used to be commit 0c8e23afbb)
2008-01-16 12:09:48 +03:00