1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

4248 Commits

Author SHA1 Message Date
Volker Lendecke
379cbb6397 lib: Align nt_time_to_unix_timespec with unix_timespec_to_nt_time
Both take and return values now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-30 22:28:14 +02:00
Volker Lendecke
dcd6373613 lib: Align unix_timespec_to_nt_time with nt_time_to_unix_timespec
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-30 22:28:14 +02:00
Michael Adam
55ff3a3b91 tdb: defragment the freelist in tdb_allocate_from_freelist()
While we are traversing the freelist anyways, merge a record
with the left if it is also a free list record.

That partially makes up for the fragmentation introduced by
the lack of merging with right records in tdb_free().

Note there is a potential slight downside:
If the left record we merge the current record into was earlier
in the chain and has hence already been met in traverse,
then we can not use the enlarged record even if it might be
a new best fit.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jun 26 12:16:03 CEST 2014 on sn-devel-104
2014-06-26 12:16:03 +02:00
Michael Adam
6502df5839 tdb: add "freelist_size" sub-command to tdbtool
With the new code, this has the side effect of
merging adjacent records in the freelist if the
database is not read-only.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
56f9231c8e tdb: use tdb_freelist_merge_adjacent in tdb_freelist_size()
So that we automatically defragment the free list when freelist_size is called
(unless the database is read only).

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
843a8a5c7b tdb: add tdb_freelist_merge_adjacent()
This is intended to be called to reduce the fragmentation in the
freelist. This is to make up the deficiency of the freelist
to be not doubly linked. If the freelist were doubly linked,
we could easily avoid the creation of adjacent freelist entries.
But with the current singly linked list, it is only possible
to cheaply merge a new free record into a freelist entry on the left,
not on the right...

This can be called periodically, e.g. in the vacuuming process
of a ctdb cluster.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
73c439f581 tdb: add utility function check_merge_ptr_with_left_record()
Variant of check_merge_with_left_record() that reads the record
itself if necessary.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
4bec28bfa9 tdb: simplify tdb_free() using check_merge_with_left_record()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
117807cd2d tdb: add utility function check_merge_with_left_record()
Check whether the record left of a given freelist record is
also a freelist record, and if so, merge the two records.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
66f3330be8 tdb: improve comments for tdb_free().
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
8be5c8a6db tdb: factor merge_with_left_record() out of tdb_free()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
63673aea9f tdb: fix debug message in tdb_free()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
08a76aabe9 tdb: reduce indentation in tdb_free() for merging left
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
87ac4ac523 tdb: increase readability of read_record_on_left()
by using early returns and better variable names,
and reducing indentation.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Michael Adam
f5a777a36c tdb: factor read_record_on_left() out of tdb_free()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-26 10:00:11 +02:00
Volker Lendecke
159d1dde3a nss_wrapper: Fix some "discarding const" warnings
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-21 12:42:10 +02:00
Volker Lendecke
9a936f9698 nss_wrapper: Align indentation with the rest of Samba
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-21 12:42:10 +02:00
Michael Adam
09b991b79b ldb:build: improve detection of srcdir
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Michael Adam
2c50c25d02 replace:build: improve detection of srcdir
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Michael Adam
e2888852ef ntdb:build: improve detection of srcdir
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Michael Adam
cc86b4107a talloc:build: improve detection of srcdir
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Michael Adam
befb39441f tevent:build: improve detection of srcdir
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Michael Adam
47328f535e tdb:build: improve detection of srcdir.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Volker Lendecke
32b45bfa98 lib: Apply const to nt_time_to_unix_timespec
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Jun 18 16:35:26 CEST 2014 on sn-devel-104
2014-06-18 16:35:26 +02:00
Volker Lendecke
f0e1a8e1e2 lib: Use server_id_str_buf in server_id_str
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-17 07:00:14 +02:00
Volker Lendecke
7a3bda54b0 lib: Add server_id_str_buf
This is usable in a DEBUG statement without talloc_tos()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-17 07:00:14 +02:00
Jeremy Allison
536c799f00 lib: tevent: make TEVENT_SIG_INCREMENT atomic.
On arm platforms incrementing a variable is not
an atomic operation, so may be interrupted by
signal processing (if a signal interrupts another
signal handler).

Use compiler built-ins to make this atomic.
__sync_fetch_and_add() works on gcc, llvm,
IBM xlC on AIX, and Intel icc (10.1 and
above).

atomic_add_32() works on Oracle Solaris.

Based on an inital patch from kamei@osstech.co.jp.

Bug #10640 - smbd is not responding - tevent_common_signal_handler() increments non-atomic variables

https://bugzilla.samba.org/show_bug.cgi?id=10640

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
2014-06-07 03:15:14 +02:00
Michael Adam
fae59b494b lib: Bump socket_wrapper version to 1.1.1.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
064592d9cb swrap: Disable incomplete bind checks (and tests) for EADDRINUSE.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
f6023bbd67 lib: Bump socket_wrapper version to 1.1.0. 2014-06-05 23:57:10 +02:00
Michael Adam
b9d6ad85a8 swrap: check whether an address:port is already in use in swrap_bind()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-06-05 23:57:10 +02:00
Michael Adam
05c1e2db22 swrap: implement check_addr_port_in_use()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-06-05 23:57:10 +02:00
Michael Adam
f9ddd20c2d swrap: fix AF_UNSPEC special case in swrap_bind()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-06-05 23:57:10 +02:00
Michael Adam
8f28674b50 swrap: extend input checks in swrap_bind()
Not only check family, but depending on family, also check the length.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-06-05 23:57:10 +02:00
Michael Adam
3700a4625c swrap: add check for rpc/rpc.h - needed on freebsd for bindresvport
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
6e6c817fd0 swrap: Add support for bindresvport().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
1b949b5d6c swrap: Add missing family check in bind().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
5ee936d7e2 swrap: Setup myname in swrap_socket() for getsockname().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
1f03de017b swrap: Make sure cmbuf is not NULL.
CID 63532

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
74ade40e3e swrap: We need to pass a pointer-pointer to not leak memory.
CID 63533

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
353709b3f3 swrap: Support more socket options in getsockopt().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
3689addffb swrap: Call swrap_msghdr_filter_cmsghdr in swrap_sendmsg_before().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
efe4eb2385 swrap: Add swrap_msghdr_filter_cmsg_pktinfo().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
6a35c6777d swrap: Add swrap_sendmsg_filter_cmsg_socket().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
2fe9612436 swrap: Add swrap_sendmsg_copy_cmsg().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
c704966f79 swrap: Add swrap_sendmsg_filter_cmsghdr().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
0247bdbbc8 swrap: Implement support for IP_RECVDSTADDR on BSD.
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
aa1e24ead4 swrap: Check if the in_pktinfo structure is available.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Andreas Schneider
7556e1388f swrap: Silence a warning on OpenIndiana.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00
Pino Toscano
7a386b3308 swrap: Properly cache the handle also in LIBC_SO case.
Small regression introduced by me in commit
0fa56909442c3cfea6a697681ea0e89ba5a0aa0f.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10572

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-06-05 23:57:10 +02:00