1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00
Commit Graph

1306 Commits

Author SHA1 Message Date
Kai Blin
b1192bbfc9 lib/replace: Don't use StrnCpy inside crypt.c
With this and the int32_t/int64_t change, talloc crossbuilds to android
2010-04-04 13:51:02 +02:00
Kai Blin
781a0c0846 lib/replace: use correct inttypes in crypt.c
This makes the android crossbuild slightly less broken.
2010-04-04 13:42:15 +02:00
Andrew Tridgell
710aa773d5 socket-wrapper: not all systems have FIONREAD defined
tru64 for example
2010-04-03 13:31:12 +11:00
Andrew Tridgell
b81100c710 debug: enable talloc logging
we want to ensure talloc warnings are printed in the log
2010-04-02 18:52:29 +11:00
Andrew Tridgell
fde50c633f talloc: a useful bit of debug code
this is useful when tracking down talloc loops. It is probably too
expensive to have on by default.
2010-04-02 18:52:29 +11:00
Andrew Tridgell
1b4bbec523 talloc: add a define for TALLOC_MAX_DEPTH
Thanks to the suggestion from simo
2010-04-02 18:52:29 +11:00
Andrew Tridgell
5ccd30e9ac talloc: change talloc minor version to 2.0.2
this has the talloc_is_parent() bugfix
2010-04-02 13:15:18 +11:00
Andrew Tridgell
ff2b7d42e6 talloc: limit the depth that talloc will go for talloc_is_parent()
We have a bug in the dcerpc registry code that can cause a talloc loop
that chews unlimited CPU because of talloc_is_parent() during a
talloc_free()
2010-04-02 13:15:18 +11:00
Jelmer Vernooij
36c84854cb subunit: Include remainder of bindings and metadata. 2010-03-31 04:24:04 +02:00
Jelmer Vernooij
6897be7475 testtools: Fix included testtools, for systems that don't have it. 2010-03-31 04:19:36 +02:00
Jelmer Vernooij
a8ac7fda57 Put testtools directly under lib/ to make it easier to install from Samba 4. 2010-03-31 03:19:18 +02:00
Jelmer Vernooij
31094b0e8c smbtorture: Report number of available tests in a testsuite using subunit. 2010-03-31 02:57:47 +02:00
Jelmer Vernooij
197c98292b subunit: Also import copies of filters and perl module. 2010-03-31 02:20:10 +02:00
Andrew Tridgell
08e0d94fae replace: allow memmem() with an empty string to return NULL
This is how FreeBSD behaves. We don't rely on it returning the string
in Samba.
2010-03-30 20:34:17 +11:00
Andrew Tridgell
0f113faea8 charset: look for the codepages in the right place
selftest runs from source3/source4. The codepages when not installed
are in ../codepages
2010-03-30 12:31:03 +11:00
Jelmer Vernooij
082e7f20d7 subunit: Update to newer upstream version. 2010-03-29 18:05:29 +02:00
Jelmer Vernooij
4bbc3ff037 s4-python: Move dnspython to lib/, like the other Python modules
This also avoids it from being installed if it's already present on the
system.
2010-03-29 18:05:29 +02:00
Andrew Tridgell
686221eae2 s4-waf: use the libreplace strerror_r if needed 2010-03-29 21:34:29 +11:00
Andrew Tridgell
7ed349cace pytalloc: allow for using a system libtalloc-dev with pytalloc
When we have a system talloc library, we still need to grab pytalloc.h
from lib/talloc. We don't want to just use -Ilib/talloc, as otherwise
we'll get the in-tree talloc.h which may not be compatible with the
system talloc.h

So we need to give the path to pytalloc.h
2010-03-29 21:34:29 +11:00
Andrew Tridgell
08faa3a43c talloc: testsuite should use <talloc.h> not "talloc.h"
if we are using the system talloc, the testsuite needs to use the
system talloc.h
2010-03-29 21:34:29 +11:00
Simo Sorce
c1f6f61f62 tdb: update exports and signatures files 2010-03-26 15:21:15 -04:00
Volker Lendecke
261c3b4f1b tdb: Add a non-blocking version of tdb_transaction_start 2010-03-26 14:27:47 -04:00
Andreas Schneider
a6f25fc635 s3-smbd: Don't close stdout if we want to log to stdout. 2010-03-26 14:48:54 +01:00
Andrew Tridgell
5609c50433 tevent: added tevent_re_initialise()
This allows us to re-initialise a tevent context without destroying
the pointer. That means that if someone keeps a long term ptr to the
event context across a fork it will still work.

This also brings the memory handling in single and standard process
models much closer together, which means less bugs that we don't find
with make test.
2010-03-26 21:13:27 +11:00
Andrew Tridgell
525a4fb2c4 util: on FreeBSD true is in /usr/bin. Use execvp to find it 2010-03-26 19:03:22 +11:00
Andrew Tridgell
fae84f98e3 libutil: moved the networking defines to util_net.h
These were causing thousands of warnings on solaris8
2010-03-26 17:36:02 +11:00
Andrew Tridgell
c81d2ae3c9 libreplace: strerror_r() is needed by heimdal on solaris8 2010-03-26 16:50:48 +11:00
Andrew Tridgell
63fc397808 tsocket: not all systems have IPV6_V6ONLY 2010-03-26 16:50:48 +11:00
Volker Lendecke
59315887a0 tdb: Fix indentation in tdb_new_database() 2010-03-25 10:30:10 +01:00
Volker Lendecke
ea8e0d5d54 Fix some nonempty blank lines 2010-03-25 10:24:45 +01:00
Andrew Tridgell
088096d1ba python: use '#!/usr/bin/env python' to cope with varying install locations
this should be much more portable
2010-03-25 14:37:19 +11:00
Andrew Tridgell
a599319d0a libreplace: fixed declaration of dprintf() on FreeBSD 2010-03-24 07:11:38 +01:00
Andrew Tridgell
4c4d0a029d build: fixed nss_wrapper on solaris
solaris has different getpwnam_r syntax
2010-03-24 15:50:50 +11:00
Matthias Dieter Wallnöfer
31b4585489 convert_string_talloc_convenience - print out the input buffer in a better way (using dump_data since it isn't always directly readable) 2010-03-22 23:21:17 +01:00
Volker Lendecke
e2c7e5c4f7 tdb: Fix bug 7248, avoid the nanosleep dependency 2010-03-22 21:29:21 +01:00
Stefan Metzmacher
01f2c023f7 lib/util: add allocate_anonymous_shared()
metze
2010-03-22 17:15:10 +01:00
Volker Lendecke
56940a28ff Fix an uninitialized variable 2010-03-21 21:01:28 +01:00
Volker Lendecke
d097d9fb09 Use TALLOC_FREE in talloc_pop() 2010-03-21 17:12:23 +01:00
Volker Lendecke
0f3040a61f Use calloc instead of ZERO_STRUCTP in talloc_stackframe_create() 2010-03-21 17:12:23 +01:00
Volker Lendecke
6695b0e87d Trim an overlong line 2010-03-21 17:12:23 +01:00
Günther Deschner
f06779629d nss_wrapper.pl: allow to specify gid for new users.
Guenther
2010-03-19 09:54:10 +01:00
Andrew Tridgell
55c45110e6 charset: fixed a problem with the global use of the iconv_convenience structure
We had a crash bug where a cached copy of a iconv convenience pointer
was used after being freed when loadparm asked for iconv to
reload. This could happen if a python module used a iconv based
function before loadparm was completed.

The fix is to ensure that any use of this pointer remains valid, by
reusing the pointer itself when it has already been initialised, but
filling in the child elements with the updated values.
2010-03-18 14:18:41 +11:00
Stefan Metzmacher
d23581b4d7 talloc_stack: reset stackframe pointers to NULL
This makes it easier to debug the code in future.

metze
2010-03-15 15:08:24 +01:00
Stefan Metzmacher
10ed809a1a talloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]
In smbd there's a small gab between TALLOC_FREE(frame); before
be call smbd_parent_loop() where we don't have a valid talloc stackframe.

smbd_parent_loop() calls talloc_stackframe() only within the while(1) loop.
As DEBUG(2,("waiting for connections")) uses talloc_tos() to construct
the time header for the debug message we crash on some systems.

metze
2010-03-15 15:08:23 +01:00
Matthieu Patou
8306eb1c5f s4: create ../lib/iniparser_build/config.m4
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-03-11 13:31:37 +01:00
Andrew Bartlett
6441a5b0b9 Explain why we don't use certain characters in the generated pw 2010-03-11 15:34:01 +11:00
Endi S. Dewata
a6253a45c0 lib/util - Removed curly braces from generate_random_password(). 2010-03-11 15:31:08 +11:00
Andrew Bartlett
4ab3e220c4 Move prototype to header of common code for set_sockaddr_port 2010-03-11 11:27:47 +11:00
Kamen Mazdrashki
d142d9fb64 doxygen: talloc_get_type name fixed in Doxygen documentation
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-03-10 17:11:55 +01:00
Stefan Metzmacher
6ea3393798 lib/util: change samba_runcmd() to use tevent_req _send/_recv
metze
2010-03-09 21:49:45 +11:00
Andrew Tridgell
f3c738f819 replace: added get_current_dir_name() 2010-03-05 23:07:32 +11:00
Andrew Tridgell
ee4ae0e7ad s4-privs: add root_privileges_original_uid()
This can be used to get the uid we changed away from when we gained 
root privileges

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-03-05 23:07:31 +11:00
Karolin Seeger
340797f3fa Fix typo in comments. 2010-03-03 16:03:13 +01:00
Matthieu Patou
b953c4c67c s3: Move source3/iniparser to lib/iniparser to allow sharing between s3/s4
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-03-03 09:22:39 +01:00
Volker Lendecke
fb98f60594 tdb: If tdb_parse_record does not find a record, return -1 instead of 0 2010-02-28 17:40:59 +01:00
Andreas Schneider
1983256c70 tsocket: Improve the tsocket_address_bsd_sockaddr documentation.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-26 08:57:30 +01:00
Stefan Metzmacher
792dd38d7c lib/util: add generate_random_password()
metze
2010-02-26 08:57:28 +01:00
Andrew Tridgell
b0b857d6ca s4-dns: use a loadparm list for samba_runcmd() commands
This allows commands with multiple arguments and quoting to be used,
while still avoiding running a shell (and this having shell expansion
problems)
2010-02-26 18:19:27 +11:00
Rusty Russell
ec96ea690e tdb: handle processes dying during transaction commit.
tdb transactions were designed to be robust against the machine
powering off, but interestingly were never designed to handle the case
where an administrator kill -9's a process during commit.  Because
recovery is only done on tdb_open, processes with the tdb already
mapped will simply use it despite it being corrupt and needing
recovery.

The solution to this is to check for recovery every time we grab a
data lock: we could have gained the lock because a process just died.
This has no measurable cost: here is the time for tdbtorture -s 0 -n 1
-l 10000:

Before:
	2.75 2.50 2.81 3.19 2.91 2.53 2.72 2.50 2.78 2.77 = Avg 2.75

After:
	2.81 2.57 3.42 2.49 3.02 2.49 2.84 2.48 2.80 2.43 = Avg 2.74

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 13:23:58 +10:30
Rusty Russell
1bf482b9ef patch tdb-refactor-tdb_lock-and-tdb_lock_nonblock.patch 2010-02-24 13:18:06 +10:30
Rusty Russell
ececeffd85 tdb: add -k option to tdbtorture
To test the case of death of a process during transaction commit, add
a -k (kill random) option to tdbtorture.  The easiest way to do this
is to make every worker a child (unless there's only one child), which
is why this patch is bigger than you might expect.

Using -k without -t (always transactions) you expect corruption, though
it doesn't happen every time.  With -t, we currently get corruption but
the next patch fixes that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 10:53:05 +10:30
Rusty Russell
8c3fda4318 tdb: don't truncate tdb on recovery
The current recovery code truncates the tdb file on recovery.  This is
fine if recovery is only done on first open, but is a really bad idea
as we move to allowing recovery on "live" databases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 10:50:41 +10:30
Rusty Russell
9f295eecff tdb: remove lock ops
Now the transaction code uses the standard allrecord lock, that stops
us from trying to grab any per-record locks anyway.  We don't need to
have special noop lock ops for transactions.

This is a nice simplification: if you see brlock, you know it's really
going to grab a lock.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 10:49:22 +10:30
Rusty Russell
a84222bbaf tdb: rename tdb_release_extra_locks() to tdb_release_transaction_locks()
tdb_release_extra_locks() is too general: it carefully skips over the
transaction lock, even though the only caller then drops it.  Change
this, and rename it to show it's clearly transaction-specific.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 11:02:55 +10:30
Rusty Russell
dd1b508c63 tdb: cleanup: remove ltype argument from _tdb_transaction_cancel.
Now the transaction allrecord lock is the standard one, and thus is cleaned
in tdb_release_extra_locks(), _tdb_transaction_cancel() doesn't need to
know what type it is.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 12:42:24 +10:30
Rusty Russell
fca1621965 tdb: tdb_allrecord_lock/tdb_allrecord_unlock/tdb_allrecord_upgrade
Centralize locking of all chains of the tdb; rename _tdb_lockall to
tdb_allrecord_lock and _tdb_unlockall to tdb_allrecord_unlock, and
tdb_brlock_upgrade to tdb_allrecord_upgrade.

Then we use this in the transaction code.  Unfortunately, if the transaction
code records that it has grabbed the allrecord lock read-only, write locks
will fail, so we treat this upgradable lock as a write lock, and mark it
as upgradable using the otherwise-unused offset field.

One subtlety: now the transaction code is using the allrecord_lock, the
tdb_release_extra_locks() function drops it for us, so we no longer need
to do it manually in _tdb_transaction_cancel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 15:42:15 +10:30
Rusty Russell
caaf5c6baa tdb: suppress record write locks when allrecord lock is taken.
Records themselves get (read) locked by the traversal code against delete.
Interestingly, this locking isn't done when the allrecord lock has been
taken, though the allrecord lock until recently didn't cover the actual
records (it now goes to end of file).

The write record lock, grabbed by the delete code, is not suppressed
by the allrecord lock.  This is now bad: it causes us to punch a hole
in the allrecord lock when we release the write record lock.  Make this
consistent: *no* record locks of any kind when the allrecord lock is
taken.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 10:45:26 +10:30
Rusty Russell
9341f230f8 tdb: cleanup: always grab allrecord lock to infinity.
We were previously inconsistent with our "global" lock: the
transaction code grabbed it from FREELIST_TOP to end of file, and the
rest of the code grabbed it from FREELIST_TOP to end of the hash
chains.  Change it to always grab to end of file for simplicity and
so we can merge the two.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 10:45:14 +10:30
Rusty Russell
1ab8776247 tdb: remove num_locks
This was redundant before this patch series: it mirrored num_lockrecs
exactly.  It still does.

Also, skip useless branch when locks == 1: unconditional assignment is
cheaper anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 15:01:07 +10:30
Rusty Russell
d48c3e4982 tdb: use tdb_nest_lock() for seqnum lock.
This is pure overhead, but it centralizes the locking.  Realloc (esp. as
most implementations are lazy) is fast compared to the fnctl anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:40:57 +10:30
Rusty Russell
4738d474c4 tdb: use tdb_nest_lock() for active lock.
Use our newly-generic nested lock tracking for the active lock.

Note that the tdb_have_extra_locks() and tdb_release_extra_locks()
functions have to skip over this lock now it is tracked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 10:44:40 +10:30
Rusty Russell
9136818df3 tdb: use tdb_nest_lock() for open lock.
This never nests, so it's overkill, but it centralizes the locking into
lock.c and removes the ugly flag in the transaction code to track whether
we have the lock or not.

Note that we have a temporary hack so this places a real lock, despite
the fact that we are in a transaction.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-22 13:58:07 +10:30
Rusty Russell
e8fa70a321 tdb: use tdb_nest_lock() for transaction lock.
Rather than a boutique lock and a separate nest count, use our
newly-generic nested lock tracking for the transaction lock.

Note that the tdb_have_extra_locks() and tdb_release_extra_locks()
functions have to skip over this lock now it is tracked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:37:34 +10:30
Rusty Russell
ce41411c84 tdb: cleanup: find_nestlock() helper.
Factor out two loops which find locks; we are going to introduce a couple
more so a helper makes sense.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:35:54 +10:30
Rusty Russell
db270734d8 tdb: cleanup: tdb_release_extra_locks() helper
Move locking intelligence back into lock.c, rather than open-coding the
lock release in transaction.c.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24 10:41:15 +10:30
Rusty Russell
fba42f1fb4 tdb: cleanup: tdb_have_extra_locks() helper
In many places we check whether locks are held: add a helper to do this.

The _tdb_lockall() case has already checked for the allrecord lock, so
the extra work done by tdb_have_extra_locks() is merely redundant.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:34:26 +10:30
Rusty Russell
b754f61d23 tdb: don't suppress the transaction lock because of the allrecord lock.
tdb_transaction_lock() and tdb_transaction_unlock() do nothing if we
hold the allrecord lock.  However, the two locks don't overlap, so
this is wrong.

This simplification makes the transaction lock a straight-forward nested
lock.

There are two callers for these functions:
1) The transaction code, which already makes sure the allrecord_lock
   isn't held.
2) The traverse code, which wants to stop transactions whether it has the
   allrecord lock or not.  There have been deadlocks here before, however
   this should not bring them back (I hope!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:31:49 +10:30
Rusty Russell
5d9de604d9 tdb: cleanup: tdb_nest_lock/tdb_nest_unlock
Because fcntl locks don't nest, we track them in the tdb->lockrecs array
and only place/release them when the count goes to 1/0.  We only do this
for record locks, so we simply place the list number (or -1 for the free
list) in the structure.

To generalize this:

1) Put the offset rather than list number in struct tdb_lock_type.
2) Rename _tdb_lock() to tdb_nest_lock, make it non-static and move the
   allrecord check out to the callers (except the mark case which doesn't
   care).
3) Rename _tdb_unlock() to tdb_nest_unlock(), make it non-static and
   move the allrecord out to the callers (except mark again).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:26:13 +10:30
Rusty Russell
e9114a7585 tdb: cleanup: rename global_lock to allrecord_lock.
The word global is overloaded in tdb.  The global_lock inside struct
tdb_context is used to indicate we hold a lock across all the chains.

Rename it to allrecord_lock.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:19:47 +10:30
Rusty Russell
7ab422d6fb tdb: cleanup: rename GLOBAL_LOCK to OPEN_LOCK.
The word global is overloaded in tdb.  The GLOBAL_LOCK offset is used at
open time to serialize initialization (and by the transaction code to block
open).

Rename it to OPEN_LOCK.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:18:33 +10:30
Rusty Russell
a6e0ef87d2 tdb: make _tdb_transaction_cancel static.
Now tdb_open() calls tdb_transaction_cancel() instead of
_tdb_transaction_cancel, we can make it static.

Signed-off-by: Rusty Russell<rusty@rustcorp.com.au>
2010-02-24 10:39:59 +10:30
Rusty Russell
452b4a5a6e tdb: cleanup: split brlock and brunlock methods.
This is taken from the CCAN code base: rather than using tdb_brlock for
locking and unlocking, we split it into brlock and brunlock functions.

For extra debugging information, brunlock says what kind of lock it is
unlocking (even though fnctl locks don't need this).  This requires an
extra argument to tdb_transaction_unlock() so we know whether the
lock was upgraded to a write lock or not.

We also use a "flags" argument tdb_brlock:
1) TDB_LOCK_NOWAIT replaces lck_type = F_SETLK (vs F_SETLKW).
2) TDB_LOCK_MARK_ONLY replaces setting TDB_MARK_LOCK bit in ltype.
3) TDB_LOCK_PROBE replaces the "probe" argument.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17 12:17:19 +10:30
Andreas Schneider
13e2f5f971 libreplace: Remove the obsolete signal type cast.
AC_SIGNAL_TYPE is already obsolete in autoconf. C89 requires signal
handlers to return void, only K&R returned int.
2010-02-23 12:23:45 +01:00
Andreas Schneider
8ac0c9fc67 libutil: Remove obsolete signal type cast. 2010-02-23 12:23:44 +01:00
Brad Hards
dd89dc2c31 Spelling fixes for libutil
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:35 +01:00
Brad Hards
e4c2f4dc75 Spelling fixes in lib/zlib.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:35 +01:00
Brad Hards
198b17abf0 Spelling fixes for libreplace.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:34 +01:00
Brad Hards
319d3bf9d9 Spelling fixes for tsocket API documentation.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:33 +01:00
Brad Hards
11b211cf98 Spelling fixes for lib/compression.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:33 +01:00
Brad Hards
7863bb1511 Spelling fixes for nss_wrapper.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:33 +01:00
Brad Hards
842fb05b11 Spelling fixes for popt API documentation.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:32 +01:00
Brad Hards
119a8230eb Spelling fixes for tevent.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:32 +01:00
Brad Hards
09e756b1d6 Spelling fixes for tdb.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:31 +01:00
Michael Adam
1a42b020fd nss_wrapper: fix segfault in print_group() in the testsuite
Running
'TESTS=posix_s3 POSIX_SUBTESTS="RPC-SAMR-LARGE-DC LOCAL-NSS-WRAPPER" make test'
from s3 made smbtorture4 crash on my box.

Michael
2010-02-19 00:37:41 +01:00
Günther Deschner
2eb83f2964 s4-smbtorture: add LOCAL-NSS-WRAPPER-DUPLICATES test.
Guenther
2010-02-18 23:25:16 +01:00
Günther Deschner
9b9c9fd175 s4-smbtorture: be more verbose in LOCAL-NSS-WRAPPER.
Guenther
2010-02-18 23:25:16 +01:00
Stefan Metzmacher
c42d9c4ec4 tsocket/bsd: fix comment in tdgram_bsd_recvfrom_handler()
metze
2010-02-18 09:38:00 +01:00
Jeremy Allison
936828de71 Fix commit d07cd37b99
Which was:

    tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD

Metze, this has to have been wrong - you are throwing away the talloc_realloc
pointer returned. Also no error checking. Please review.

Thank goodness for gcc warnings :-).

Jeremy.
2010-02-17 09:24:34 -08:00
Stefan Metzmacher
d07cd37b99 tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD
metze
2010-02-17 14:46:39 +01:00
Stefan Metzmacher
1ffcb991a9 tsocket/bsd: set IPV6_V6ONLY on AF_INET6 sockets
Some system already have this as default. It's easier
to behave the same way on all systems and handle ipv6
and ipv4 sockets separate.

metze
2010-02-17 14:46:39 +01:00
Stefan Metzmacher
8a0949dfc8 tsocket/bsd: fix bug #7140 autodetect ipv4 and ipv6 based on the remote address if the local address is any
metze
2010-02-17 14:46:08 +01:00
Stefan Metzmacher
6637b2f4b0 tsocket/bsd: fix bug #7140 use calculated sa_socklen for bind() in tstream_bsd_connect_send()
This is needed because, we can't use sizeof(sockaddr_storage) for AF_UNIX
sockets. Also some platforms require exact values for AF_INET and AF_INET6.

metze
2010-02-17 14:45:34 +01:00
Stefan Metzmacher
135543b4c3 tsocket/bsd: fix do_bind logic for AF_INET
We want the explicit bind() when we don't use the any address.

metze
2010-02-17 14:13:57 +01:00
Stefan Metzmacher
0b3e950731 socket_wrapper: also ignore AF_INET6 in swrap_setsockopt()
metze
2010-02-17 14:13:55 +01:00
Andrew Tridgell
8756e13009 util: added samba_runcmd()
This allows us to run a child command in an async fashion, with
control over logging of stdout and stderr (which appears in the Samba
log file). This is useful for ensuring we don't miss important
messages from rndc commands (for example).

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-17 19:43:32 +11:00
Andrew Tridgell
0bedb9cf5e s4-dsdb: removed gendb_search_single_extended_dn()
Use dsdb_search_one() instead, which allows for arbitrary controls

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-16 21:10:51 +11:00
Andrew Tridgell
ccfa40fdc3 util: update three other copies of our dlinklist.h macros
ldb and tevent have their own copies of these macros. This brings them
in sync with the master copy of dlinklist.h
2010-02-14 18:44:21 +11:00
Andrew Tridgell
76a7382346 lib: use TYPESAFE_QSORT() in lib/ and libcli/ 2010-02-14 18:44:20 +11:00
Andrew Tridgell
282cc79454 s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code 2010-02-14 18:44:20 +11:00
Volker Lendecke
e371317686 use ZERO_STRUCT 2010-02-13 13:25:32 +01:00
Volker Lendecke
95ca53f3e0 Use ZERO_STRUCTP 2010-02-13 13:25:17 +01:00
Volker Lendecke
1a995ab51e s3: Fix a typo 2010-02-13 13:25:03 +01:00
Andrew Tridgell
1373e748aa tdb: use fdatasync() instead of fsync() in transactions
This might help on some filesystems
2010-02-13 22:36:11 +11:00
Andrew Tridgell
f435538576 libreplace: add fdatasync() if not available 2010-02-13 22:36:11 +11:00
Andrew Tridgell
63844609da util: added TYPESAFE_QSORT() macro
This makes it much harder to get the type of a qsort comparison
function wrong.
2010-02-13 22:36:11 +11:00
Volker Lendecke
6824c6f46b tdb: Apply some const, just for clarity 2010-02-13 12:19:09 +01:00
Volker Lendecke
ebc08b9938 s3: Add tdb_data_equal 2010-02-12 23:12:10 +01:00
Andrew Tridgell
ae95d611b6 util: added file_compare() utility function
file_compare() returns true if two files are the same. It is meant for
small files.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-11 21:04:13 +11:00
Andrew Tridgell
d6fb64c512 libreplace: added replacements for dprintf() and vdprintf()
these are very useful for writing files with formatted writes

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-11 21:04:13 +11:00
Andrew Tridgell
91cb7b7c60 test:local added LOCAL-DLINKLIST testsuite
(cherry picked from commit 95a5bee2c30a67a35604b0456ab7836f6dc67702)
2010-02-10 15:55:34 -08:00
Andrew Tridgell
32809bd8c1 util: rewrite dlinklist.h so that DLIST_ADD_END() is O(1)
This changes the meaning of the ->prev pointer in our doubly linked
lists to point at the end of the list from the front of the list. That
allows us to implement DLIST_ADD_END() and related functions in O(1)
time, which can be a huge saving in many places in Samba.

This also means that the 'type' argument to various DLIST_*() macros
is no longer needed, but I have left it in for now to keep the
patchset small, which will make it easier to revert if any problems
are found. In the future we should remove the 'type' arguments.

(jra. Move the one use of DLIST_TAIL over to the new macros).
2010-02-10 15:53:58 -08:00
Jeremy Allison
32575ed70f Temporary changes to dlinklist to keep the implementation static whilst
uses of (list)->prev are moved over to DLIST_PREV. This will be replaced
when the final (new) version of the dlinklist.h header is added.

Jeremy.
2010-02-10 15:30:59 -08:00
Rusty Russell
b37b452cb8 tdb: fix recovery reuse after crash
If a process (or the machine) dies after just after writing the
recovery head (pointing at the end of file), the recovery record will filled
with 0x42.  This will not invoke a recovery on open, since rec.magic
!= TDB_RECOVERY_MAGIC.

Unfortunately, the first transaction commit will happily reuse that
area: tdb_recovery_allocate() doesn't check the magic.  The recovery
record has length 0x42424242, and it writes that back into the
now-valid-looking transaction header) for the next comer (which
happens to be tdb_wipe_all in my tests).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-10 16:56:14 +10:30
Rusty Russell
6269cdcd15 tdb: give a name to the invalid recovery area constant (0)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-10 16:56:13 +10:30
Simo Sorce
6339de7f4f release-scripts: parametrize scripts
This should make it easier to keep all release scripts alined as it will reduce
the difference between them to ideally a few variables

Also moves the tdb script in the scripts directory.
2010-02-08 10:29:06 -05:00
Simo Sorce
6bf2a821b7 talloc: Fix abi checks in release script
We must perform abi checks against the version we are going to release.
Not against the current tree we are in.
2010-02-08 10:12:50 -05:00
Simo Sorce
1422a94654 talloc: Fix abi checks and ifdefs
teach the abi check scripts to skip the DOXYGEN sections
fix the header to use #ifdef DOXYGEN and not #if DOXYGEN
2010-02-08 10:02:49 -05:00
Stefan Metzmacher
02320cb0e2 libreplace: add check for NSS_WRAPPER_DISABLE similar to SOCKET_WRAPPER_DISABLE
metze
2010-02-08 09:59:23 +01:00
Volker Lendecke
6e7bcaa878 libreplace: Attempt to fix bug 5910, detect a broken getaddrinfo
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-08 09:59:20 +01:00
Bo Yang
8c8bb51de1 s3: signals are processed twice in child.
Signed-off-by: Bo Yang <boyang@samba.org>
2010-02-09 17:05:58 +08:00
Andrew Tridgell
7fed22eb0a talloc: fixed doc typo 2010-02-08 11:04:59 +11:00
Andreas Schneider
da0e396deb Move the talloc details to the mainpage.
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-02-08 11:04:59 +11:00
Andreas Schneider
52c0cd38fa talloc: Added doxygen config file.
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-02-08 11:04:59 +11:00
Andreas Schneider
fbd646a783 talloc: Documented talloc with doxygen.
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-02-08 11:04:59 +11:00
Simo Sorce
70534adee1 tdb: raise version to 1.2.1
after recent fixes we need to raise the version to 1.2.1 so that
we can require also the right patched version.
2010-02-06 10:48:39 -05:00
Matthias Dieter Wallnöfer
e4d29bb4fd s4:UID wrapper - Make it work on older distributions
On my older CentOS 4 installation I had the problem with the missing
substitution prototypes ("uwrap_*"). So I added them to "uid_wrapper.h".

Also, I made the head of the "uid_wrapper.c" file more like the one of
"nss_wrapper.c" - it shouldn't change that much, I did it only to be consistent.

This patch should fix the build on older distributions while keep it running on
newer ones.
2010-02-05 19:47:26 +01:00
Matthias Dieter Wallnöfer
16aa0744c6 s4:UID wrapper - Fix includes
The includes of the UID wrapper headers werent't really efficient according
to metze's post on the technical mailing list (http://lists.samba.org/archive/samba-technical/2010-February/069165.html).
To achieve this move the "uid_wrapper.h" includes into "lib/util/unix_privs.c",
 "lib/util/util.c", "ntvfs/posix/pvfs_acl.c" and "ntvfs/unixuid/vfs_unixuid.c".
2010-02-05 19:47:26 +01:00
Matt Kraai
a7250eb142 Change uint_t to unsigned int in lib/util
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-02 07:18:17 +01:00
Matt Kraai
2cb2d5317f Change uint_t to unsigned int in lib/talloc
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-02 07:18:16 +01:00
Matt Kraai
d4fc2e8201 Change uint_t to unsigned int in lib/crypto
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-02 07:18:16 +01:00
Matt Kraai
a2c95a5d96 Change uint_t to unsigned int in lib/replace
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-02 07:18:16 +01:00
Volker Lendecke
531059696e tdb: fix an early release of the global lock that can cause data corruption
There was a bug in tdb where the

                tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);

(ending the transaction-"mutex") was done before the

                        /* remove the recovery marker */

This means that when a transaction is committed there is a window where another
opener of the file sees the transaction marker while the transaction committer
is still fully functional and working on it. This led to transaction being
rolled back by that second opener of the file while transaction_commit() gave
no error to the caller.

This patch moves the F_UNLCK to after the recovery marker was removed, closing
this window.
2010-02-01 15:06:29 +01:00
Stefan Metzmacher
ad6ea7b189 lib/util: remove data_blob_talloc_reference()
We want to avoid the usage of talloc_reference() in Samba.

metze
2010-01-29 11:16:44 +01:00
Kai Blin
88099bcc93 tsocket: Fix the description of tstream_writev_queue_send/recv 2010-01-28 11:16:24 +01:00
Kai Blin
9184f524f0 tsocket: Fix description for tstream_readv_pdu_queue_send/recv 2010-01-28 11:11:33 +01:00
Björn Jacke
e87adf523b Revert "libreplace: fix unused varibale warning on IRIX"
this one was broken
2010-01-26 01:16:37 +01:00
Björn Jacke
b6839e1bfd libreplace: fix unused varibale warning on IRIX 2010-01-26 00:19:10 +01:00
Karolin Seeger
463aa06442 lib/popt: Fix typo in README.
Karolin
2010-01-25 19:54:24 +01:00
Volker Lendecke
a771c184b1 libreplace: Fix a C++ warning 2010-01-23 14:35:38 +01:00
Jelmer Vernooij
c42242d132 s4: Include Python.h early to avoid double definition errors. 2010-01-21 16:15:10 +13:00
Lars Müller
9e318129e0 Work around bad use of autoconf interna
Merge fix made by Andreas Schwab <schwab@linux-m68k.org>.  This change
had been in use by SUSE since 2008-07-03.
2010-01-18 11:49:01 +01:00
Jelmer Vernooij
2ec5792a4b subunit/testtools: Include newer version. 2010-01-16 19:56:21 +13:00
Jelmer Vernooij
28577aae92 Import testtools as well, required for subunit. 2010-01-16 19:53:49 +13:00
Jelmer Vernooij
b6b46b4978 subunit: Import new version. 2010-01-16 19:53:49 +13:00
Jelmer Vernooij
2e38cb2cbb Add README about subunit. 2010-01-16 19:53:49 +13:00
Jelmer Vernooij
664b74d366 Add script for updating the copy of subunit. 2010-01-16 19:53:49 +13:00
Andreas Schneider
04f3f27f7e tsocket: Added doxygen config file.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-01-11 11:23:04 +01:00
Andreas Schneider
574f77f89e tsocket: Added complete doxygen documentation.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-01-11 11:22:59 +01:00
Andrew Tridgell
273a4d9803 s4-debug: removed debug_ctx(). It didn't catch on :-)
There was only one user, which isn't worth it for the overhead.
2010-01-09 10:15:13 +11:00
Björn Jacke
571ee54b79 lib/util: move TIME_T_MIN/MAX defines into header file 2010-01-07 00:50:29 +01:00
Stefan Metzmacher
c01f443ebc tdb: fix standalone 'make installdocs'
metze
2010-01-06 14:43:39 +01:00
Brian Lu
0a3a6bb8f9 tdb: create symbol links to shared libraries see https://bugzilla.samba.org/show_bug.cgi?id=6991 for details
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-01-06 14:27:50 +01:00
Brian Lu
eff6022d51 talloc: create symbol links to shared libraries see https://bugzilla.samba.org/show_bug.cgi?id=6991 for details
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-01-06 14:27:44 +01:00
Brian Lu
f408d58d95 tevent: create symbol links to shared libraries see https://bugzilla.samba.org/show_bug.cgi?id=6991 for details
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-01-06 14:27:38 +01:00
Andrew Tridgell
fef3c910da libreplace: some systems don't have memmem()
added rep_memmem() and a testsuite
2010-01-02 10:08:12 +11:00
Stefan Metzmacher
17c804a675 tsocket: only copy the specific part of sockaddr*
This makes sure we fill the unspefic bytes with 0
and have zero termination for sockaddr_un.

metze
2009-12-24 17:38:29 +01:00
Stefan Metzmacher
4784c8c3be tsocket: allow AF_UNIX sockaddrs smaller than sizeof(sockaddr_un)
This is needed as getpeername() truncates the length to 2 if the
peer socket has no name.

metze
2009-12-24 17:38:04 +01:00
Jelmer Vernooij
0110990f01 tdb: Also build and install tdb manpages from standalone tdb. 2009-12-21 23:40:12 +01:00
Jelmer Vernooij
8b278e6dc1 tdb: Fix formatting of API check file. 2009-12-21 23:40:12 +01:00
Stefan Metzmacher
4b7a6b1f8f tevent: prefix types and defined with tevent_ and TEVENT_
This fixes the build warnings on some build-farm hosts.

metze
2009-12-20 14:21:50 +01:00
Peter Rosin
590f7c262d Output %p as unsigned in snprintf replacement. 2009-12-19 19:43:52 +01:00
Brendan Powers
027cba6a49 Return NULL in strlower_talloc if src is NULL
Prevents strlower_talloc from segfaulting if you pass it a NULL string.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2009-12-18 14:27:43 +11:00
Günther Deschner
a23084e1e8 tdbtool: avoid using c++ reserved words.
Guenther
2009-12-17 15:40:42 +01:00
Andreas Schneider
a5bdab8b32 tsocket: Fixed tsocket_guide.txt asciidoc syntax. 2009-12-15 23:34:23 +01:00
Andreas Schneider
e33ae22b87 tsocket: Fixed documentation for tsocket_address_bsd_sockaddr(). 2009-12-15 23:34:22 +01:00
Andreas Schneider
ab04dd3be7 tsocket: Fixed typo in LGPL header. 2009-12-15 23:34:22 +01:00
Stefan Metzmacher
edbf2caa6f tsocket: add tsocket_address_bsd_sockaddr() and tsocket_address_bsd_from_sockaddr()
metze
2009-12-15 23:34:22 +01:00
Simo Sorce
7f956869ff Fix release script to work with recent git versions 2009-12-15 09:17:25 -05:00
Andrew Tridgell
71943e8858 util: added binsearch.h for binary array searches
This was moved from the schema_query code. It will now be used in more
than one place, so best to make it a library macro. I think there are
quite a few places that could benefit from this.
2009-12-10 17:51:29 +11:00
Kamen Mazdrashki
4653d05fef tdr-test: Fix 'push_charset' test
4 bytes of 'bloe' string are pushed, so we should
check only for the first 4 caracters

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-08 12:39:10 +11:00
Kamen Mazdrashki
8efabcc8a5 talloc: Fix write behind memory block
If ALWASY_REALLOC is defined and we are to 'shrink' memory block,
memcpy() will write outside memory just allocated.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-08 12:39:10 +11:00
Simo Sorce
4334092cba Fix release script with newer versins of git 2009-12-07 09:25:03 -05:00
Matthias Dieter Wallnöfer
012494b800 util/util_strlist - add a call "const_str_list" for making "unconst" lists "const" 2009-12-01 16:46:29 +11:00
Volker Lendecke
4d8118f145 tevent: Fix a comment 2009-11-26 17:22:56 +01:00
Matthias Dieter Wallnöfer
c1cb1f7724 charset/tests/iconv - Remove the "const" from "ptr_in" to prevent "discard_const_p" use
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-20 16:50:49 +01:00
Matthias Dieter Wallnöfer
9776cb0345 tdb tools: Mostly cosmetic adaptions
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-20 16:50:48 +01:00
Matthias Dieter Wallnöfer
94c33bdd72 util/strlist: Fix up "const" warnings in the string list and test code
This work I did using suggestions by Jelmer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-20 16:50:47 +01:00
Stefan Metzmacher
5ca0a4bfd6 tdb: change version to 1.2.0 after adding TDB_*ALLOW_NESTING
metze
2009-11-20 09:45:43 +01:00
Stefan Metzmacher
3b9f19ed91 tdb: add TDB_DISALLOW_NESTING and make TDB_ALLOW_NESTING the default behavior
We need to keep TDB_ALLOW_NESTING as default behavior,
so that existing code continues to work.

However we may change the default together with a major version
number change in future.

metze
2009-11-20 09:45:36 +01:00
Ronnie Sahlberg
436b55db1f New attempt at TDB transaction nesting allow/disallow.
Make the default be that transaction is not allowed and any attempt to create a nested transaction will fail with TDB_ERR_NESTING.

If an application can cope with transaction nesting and the implicit
semantics of tdb_transaction_commit(), it can enable transaction nesting
by using the TDB_ALLOW_NESTING flag.
(cherry picked from ctdb commit 3e49e41c21eb8c53084aa8cc7fd3557bdd8eb7b6)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-20 09:45:34 +01:00
Stefan Metzmacher
85449b7bcc tdb: always set tdb->tracefd to -1 to be safe on goto fail
metze
2009-11-20 09:45:34 +01:00
Andrew Tridgell
e73b790c04 fixed the build
whoever pushed 15d93a5d8e, please check
that what you push compiles and passes tests. In this case it didn't
compile.
2009-11-18 12:46:45 +11:00
Aravind Srinivasan
f7e3809d66 s4/torture: add a new ulong parameteric torture option 2009-11-17 17:06:26 -08:00
Volker Lendecke
4a777ec4d7 Attempt to fix the s4 build -- we can not use map_nt_error_from_unix in lib/ 2009-11-14 11:32:38 +01:00
Volker Lendecke
f38edcd61a Introduce tevent_req_poll_ntstatus 2009-11-14 11:03:28 +01:00
Volker Lendecke
c254349261 Introduce tevent_req_simple_finish_ntstatus 2009-11-14 11:03:28 +01:00
Kamen Mazdrashki
5b75201dbb util: str_list_unique() bugfix
j is actually the index of the last element in the list
size of the list though is j+1 <- to make room for the
terminating NULL element
2009-11-13 23:19:06 +11:00
Kamen Mazdrashki
b7839b73b1 util: str_list_unique_2() test implementation
Difference with previous test for str_list_unique() is
that this test allows number of elements and number
of duplicates to be supplied on command line using
--option="list_unique:count=47"
--option="list_unique:dups=7"
2009-11-13 23:19:06 +11:00
Andrew Bartlett
fd5174e88c lib/util Split data_blob_hex_string() into upper and lower
Rather than have a repeat of the bugs we found at the plugfest where
hexidecimal strings must be in upper or lower case in particular
places, ensure that each caller chooses which case they want.

This reverts most of the callers back to upper case, as things were
before tridge's patch.  The critical call in the extended DN code is
of course handled in lower case.

Andrew Bartlett
2009-11-12 16:34:01 +11:00
Volker Lendecke
be88a126ea tdb: Fix a C++ warning 2009-11-08 00:28:22 +01:00
Andrew Bartlett
5a8f21cb88 lib/util Fix comments in rfc1738.c.
The Samba version does not use static buffers

Andrew Bartlett
2009-11-04 14:58:24 +11:00
Stefan Metzmacher
97a32035be tsocket: rewrite tsocket_guide.txt to reflect the current APIs
metze
2009-11-03 18:26:30 +01:00
Stefan Metzmacher
eb39f66940 tsocket_bsd: return -1 and set errno to ENAMETOOLONG if the unix path is too long
metze
2009-11-03 18:24:44 +01:00
Stefan Metzmacher
9b5d1e9e35 tsocket: remove prototype of non-existing tsocket_address_inet_set_broadcast()
metze
2009-11-03 18:14:23 +01:00
Andrew Bartlett
7a290130bd lib/util Use rfc1738.c from Squid for all our URL encode/decode needs.
Andrew Bartlett
2009-11-02 16:36:52 +11:00
Andrew Bartlett
87195f55de lib/util Add rfc1738 escape/unescape code from Squid
This is intended to replace our rfc1738_unescape(), and give us an
rfc1738_escape implementation (and hopefully is better tested and more
secure).

Andrew Bartlett
2009-11-02 16:36:52 +11:00
Kirill Smelkov
83de5c8263 tdb: update README a bit
While studying tdb, I've noticed a couple of mismatches between readme
and actual code:

- tdb_open_ex changed it's log_fn argument to log_ctx
- there is now no tdb_update(), which it seems was transformed into
  non-exported tdb_update_hash()

There were other mismatches, but I don't remember them now, sorry.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29 10:14:34 +10:30
Kirill Smelkov
71a21393dd tdb: add tests for double .close() in pytdb
The reason I do it is that when using older python-tdb as shipped in
Debian Lenny, python interpreter crashes on this test:

    (gdb) bt
    #0  0xb7f8c424 in __kernel_vsyscall ()
    #1  0xb7df5640 in raise () from /lib/i686/cmov/libc.so.6
    #2  0xb7df7018 in abort () from /lib/i686/cmov/libc.so.6
    #3  0xb7e3234d in __libc_message () from /lib/i686/cmov/libc.so.6
    #4  0xb7e38624 in malloc_printerr () from /lib/i686/cmov/libc.so.6
    #5  0xb7e3a826 in free () from /lib/i686/cmov/libc.so.6
    #6  0xb7b39c84 in tdb_close () from /usr/lib/libtdb.so.1
    #7  0xb7b43e14 in ?? () from /var/lib/python-support/python2.5/_tdb.so
    #8  0x0a038d08 in ?? ()
    #9  0x00000000 in ?? ()

master's pytdb does not (we have a check for self->closed in obj_close()),
but still...

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29 10:14:33 +10:30
Kirill Smelkov
b4424f8234 tdb: reset tdb->fd to -1 in tdb_close()
So that erroneous double tdb_close() calls do not try to close() same
fd again. This is like SAFE_FREE() but for fd.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29 10:14:33 +10:30
Kirill Smelkov
cfed5f946d tdb: fix typo in python's Tdb.get() docstring
It's Tdb.get(), not Tdb.fetch().

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29 10:14:33 +10:30
Kirill Smelkov
ecbe5ebd8d tdb: kill last bits from swig
We no longer use swig for pytdb, so there is no need for swig make
rules. Also pytdb.c header should be updated.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29 10:14:33 +10:30
Andrew Tridgell
d4c0e8fdf0 tdb: detect tdb store of identical records and skip
This can help with ldb where we rewrite the index records
2009-10-25 13:15:18 +11:00
Stefan Metzmacher
3b62e250c0 tdb: rename 'struct list_struct' into 'struct tdb_record'
metze
2009-10-23 18:27:20 +02:00
Andrew Bartlett
44a727479e util:ldb Allow multiple entries to be added in one LDIF snippit 2009-10-23 15:41:25 +11:00
Andrew Tridgell
dfa0b74516 util: fixed place where we could look one byte past end of string
We need to check the length before the value
2009-10-22 12:47:54 +11:00
Rusty Russell
0944931159 lib/tdb: make tdbtool use tdb_check() for "check" command
Also, set logging function so we get more informative messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22 00:11:34 +10:30
Rusty Russell
022b4d4aa6 lib/tdb: add tdb_check()
ctdb wants a quick way to detect corrupt tdbs; particularly, tdbs with
loops in their hash chains.  tdb_check() provides this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22 00:10:34 +10:30
Rusty Russell
0fc6800005 lib/tdb: add -t (always use transactions) option to tdbtorture
This means you can kill it at any time and expect no corruption.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22 00:10:54 +10:30
Rusty Russell
b77f41d58b lib/tdb: wean off TDB_ERRCODE.
It was a regrettable hack which I used to reduce line count in tdb; in fact it caused confusion as can be seen in this patch.
In particular, ecode now needs to be set before TDB_LOG anyway, and having it exposed in
the header is useless (the struct tdb_context isn't defined, so it's doubly useless).
Also, we should never set errno, as io.c was doing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22 00:09:43 +10:30
Rusty Russell
703004340c lib/tdb: TDB_TRACE support (for developers)
When TDB_TRACE is defined (in tdb_private.h), verbose tracing of tdb operations is enabled.
This can be replayed using "replay_trace" from http://ccan.ozlabs.org/info/tdb.

The majority of this patch comes from moving internal functions to _<funcname> to
avoid double-tracing.  There should be no additional overhead for the normal (!TDB_TRACE)
case.

Note that the verbose traces compress really well with rzip.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22 00:00:12 +10:30
Andrew Tridgell
f49818e422 lib-util: check for too many combinations in generate_unique_strs() 2009-10-20 11:34:49 +11:00
Andrew Tridgell
5dcf0069b6 tdb: fixed the intermittent failure of tdbtorture in the build farm
There was a race condition that caused the torture.tdb to be left in a
state that needed recovery. The torture code thought that any message
from the tdb code was an error, so the "recovered" message, which is a
TDB_DEBUG_TRACE message, marked the run as being an error when it
isn't.
2009-10-20 10:59:40 +11:00
Andrew Tridgell
d680729dfb util: fixed generate_unique_strs() to be portable
'place' was going negative, and giving undefined results. The result
was duplicate names which gave errors in SMB2-DIR on PPC and other
systems.
2009-10-19 22:47:45 +11:00
Kamen Mazdrashki
f11cdc19d1 s4/asn1: Use explicite TALLOC_CTX in ber_write_OID functions 2009-10-16 12:54:13 +03:00
Simo Sorce
6618a062a1 talloc: Fix exports and increment talloc version 2009-10-14 11:05:52 -04:00
Simo Sorce
8fb483b296 talloc: Make abi checks in release script
Make always sure the exports and signature files are up to date before
shipping a release.
2009-10-14 11:05:52 -04:00
Simo Sorce
8e6df560b7 talloc: Move release script under /script too 2009-10-14 11:05:52 -04:00
Simo Sorce
2d6d6bcb5d talloc: Change the way mksysms work
Make sure we always have a sorted (per file) export file.
This way we can directly compare the real export and the check file w/o having
to further sort things.

Also return error code from abi_checks.sh if warnings were reported
2009-10-14 11:05:51 -04:00
Simo Sorce
7bce1ab5e8 Fix builds with external tdb
Make sure we do not reference our internal tdb directly.
Let configure define what tdb.h file to use so that builds that use an
extrenal tdb do not include 2 different versions of the tdb header.
2009-10-11 09:48:53 -04:00
Simo Sorce
99cdbe3571 Fix builds with external talloc
Make sure we do not reference our internal talloc directly.
Let configure define what talloc.h file to use so that builds that use an
extrenal talloc do not include 2 different versions of the talloc header.
2009-10-09 13:14:08 -04:00
Karolin Seeger
fc2604ed26 asn1_tests: Fix typo in comment.
Karolin
2009-10-09 11:27:06 +02:00
Andrew Tridgell
1d0fb1e0fb tdr: teach TDR about uint1632 enums
TDB doesn't have NDR64, but it needs to know how to map the new types
from pidl
2009-10-07 09:56:23 +11:00
Günther Deschner
ab8a16c77f lib/tdr: get rid of build warning when using TDR_ALLOC macro.
Guenther
2009-10-05 11:15:45 +02:00
Jeremy Allison
295fec2b46 NULL is not a valid event context.
Jeremy.
2009-10-01 16:18:33 -07:00
Kamen Mazdrashki
a58bc2c9a9 s4/asn1: ber_read_OID_String() to be based on _ber_read_OID_String_impl() 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
a96c8c2355 s4/asn1: local TALLOC_CTX should be child of torture_context 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
a51571bf41 s4/asn1: fixed typo in torture messages 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
97e7f48f75 s4/asn1: Added test for ber_read_partial_OID_String() 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
5021301a0e s4/asn1: Added test for ber_read_OID_String() 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
681064e66e s4/asn1: Added test for ber_write_partial_OID_String() 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
3c3ef94ab3 s4/asn1: Added test for ber_write_OID_String() 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
bd5343924f s4/asn1: Added torture suite for ASN1 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
8330d78b21 util: strhex_to_str() fixed to handle '0x' correctly 2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
154ab0b047 util: fixed compile time "discards qualifiers" warning 2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
540759ec4d s4/drsuapi: ber_read_partial_OID_String() implementation 2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
55dfc116f4 s4/drsuapi: Internal implementation for ber_read_OID_String
Modified implementation _ber_read_OID_String_impl()
returns how much bytes are converted.
The intentation is to use this implementation both for
reading OIDs and partial-OIDs in the future
2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
715c790600 s4/drsuapi: ber_write_partial_OID_String() implementation 2009-10-01 23:12:57 +02:00
Andrew Kroeger
c5dba4a82e s4:torture: data_blob_hex_string() output is now lowercase.
Based on the change in commit fb84edabbe, these
tests needs to expect lowercase output.
2009-09-30 16:02:14 +02:00
Jelmer Vernooij
830adcd58d pidl: Avoid using talloc_free as function pointer, since it may be a
macro.
2009-09-28 15:03:17 +02:00
Jelmer Vernooij
d9ada600cc parmlist: Add more tests. 2009-09-27 17:37:53 +02:00
Jelmer Vernooij
db55ea08bc parmlist: Add basic tests for test_get_int(). 2009-09-27 14:39:58 +02:00
Jelmer Vernooij
c145888cec util/parmlist: Add some more comments. 2009-09-27 14:13:38 +02:00
Jelmer Vernooij
2dd7c9bc34 libutil: Add separate utility code for dealing with settings as a
collection of key/value pairs.
2009-09-26 23:59:35 +02:00
Simo Sorce
76d836570e Fixing timeval calculation
The code was always doubling microseconds when attempting to round up.
2009-09-25 11:00:19 -04:00
Günther Deschner
014a3a9926 lib/util: fix build warning.
Guenther
2009-09-25 15:19:07 +02:00
Jeremy Allison
d1aa7d4796 Remove the const from the str_list_XXX functions that
allocate both list and containing strings. This fixes
problems that people have tried to cast away and are
not needed.
Jeremy.
2009-09-24 15:52:58 -07:00
Andrew Tridgell
bb3bdb3a62 s4-ldb: added a bunch more debug for DC join
These additional debug messages were added to help us track down
w2k8->s4 domain join
2009-09-22 17:10:06 -07:00
Andrew Tridgell
fb84edabbe s4-util: windows only accepts lowercase hex encodings for extended DNs 2009-09-22 17:10:05 -07:00
Rusty Russell
455d44d961 lib/tevent: a cleaner fix for be4ac22784 segv
Revert 23abcd2318 and fix logic bug.

The current code loops through the event contexts, when it sees a different
one, it notifies the current one (ev) and updates ev to point to the new one.

This is dumb, because:
(1) ev starts as NULL, so this code crashes, and
(2) The final context will not be notified.

The correct fix for this is to update ev to the new one, then notify it.
Volker's fix works because we currently always have one event context.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-09-22 10:50:28 +02:00
Michael Adam
e440a2e11e tdb:tdbtool: fix indentation.
Michael
2009-09-21 17:47:51 +02:00
Michael Adam
91e1bab2e9 tdb:tdbtool: add transaction_start/_commit/_cancel commands.
So one can perform tdbtool operations protected by transactions.

Michael
2009-09-21 17:47:51 +02:00
Michael Adam
817383d88d tdb:tdbtool: add the "speed" command to the help text.
Michael
2009-09-21 17:47:51 +02:00
Stefan Metzmacher
f0d6e61977 async_sock: return -1/EPIPE if we're getting an end of file on read.
This makes the error handling in the callers easier.

metze
2009-09-21 06:04:53 +02:00
Stefan Metzmacher
d13dfbeb6c tevent: make sure we don't set errno within the signal handler function.
metze
2009-09-21 05:54:41 +02:00
Andrew Tridgell
3c5d763962 talloc: fixed talloc_disable_null_tracking()
When we disable null tracking, we need to move any existing objects
that are under the null_context to be parented by the true NULL
context.

We also need a new talloc_enable_null_tracking_no_autofree() function,
as the talloc testsuite cannot cope with the moving of the autofree
context under the null_context as it wants to check exact counts of
objects under the null_context, and smbtorture has a large number of
objects in the autofree_context from .init functions
2009-09-20 13:14:40 -07:00
Andrew Tridgell
9c69795626 tdb: increase minor version
we depend on reads in transactions for s4 replication
2009-09-19 14:12:00 -07:00
Andrew Tridgell
78338d431c talloc: don't crash if f is NULL in talloc_report_*
It's annoying when you use 
  p talloc_report_full(ctx, fopen("/tmp/xx","w"))
in gdb, and if you don't have write permission on the file then
you get a segv.
2009-09-17 21:52:28 -07:00
Andrew Tridgell
d27140ab76 libreplace: added likely()/unlikely() macros for gcc
These macros allow the compile to better optimise code that has a lot
of if statements. I particularly want to use this for our low level
generated NDR code.
2009-09-17 21:52:23 -07:00
Kouhei Sutou
f8dae40fc8 spnego: Support ASN.1 BIT STRING and use it in SPNEGO.
Signed-off-by: Günther Deschner <gd@samba.org>
2009-09-17 20:10:54 +02:00
Stefan Metzmacher
8f482ae663 lib/crypto: include aes.h into crypto.h
metze
2009-09-16 12:29:05 +02:00
Andrew Tridgell
654672008c tdb: allow reads after prepare commit
We previously only allowed a commit to happen after a prepare
commit. It is in fact safe to allow reads between a prepare and a
commit, and the s4 replication code can make use of that, so allow it.
2009-09-15 18:45:43 -07:00
Andrew Tridgell
00fb6705ff talloc: when we enable NULL tracking, reparent the autofree context
If NULL tracking is enabled after the autofree context is initialised
then autofree ends up separate from the null_context. This means that
talloc_report_full() doesn't report the autofree context. Fix this by
reparenting the autofree context when we create the null_context.
2009-09-15 18:45:41 -07:00
Günther Deschner
310051c79d lib/crypto: link in AES crypto for s4 as well.
Guenther
2009-09-16 02:09:59 +02:00
Günther Deschner
87acb96fc3 lib/crypto: add aes encryption routines to main cryto lib.
Guenther
2009-09-16 00:11:23 +02:00
Björn Jacke
8703d9f5bf libreplace: white space cleanups 2009-09-15 20:26:24 +02:00
Andrew Bartlett
5a01071692 libcli:nbt put util_net.c protos in new header file
This fixed a very odd build problem due to util.h importing
system/network.h being imported before the uid_wapper code.

Andrew Bartlett
2009-09-15 10:38:53 -07:00
Andrew Bartlett
668470c992 libcli:nbt make the lmhosts parsing code and dependicies common
This starts the process to have Samba4 use lmhosts.

Andrew Bartlett
2009-09-15 07:42:54 -07:00
Matt Kraai
bd40feb1eb Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ 2009-09-14 22:08:12 +02:00
Michael Adam
64bfa26f99 tevent:mksyms: fix spelling...
Michael
2009-09-11 15:39:52 +02:00
Michael Adam
ea2b9e0fb1 talloc:mksigs: allow PRINTF_ATTRIBUTE(..) macros function types as funcion args
Michael
2009-09-11 15:31:35 +02:00
Michael Adam
56c09d2fb2 talloc:mksigs: normalize bool -> _Bool
Michael
2009-09-11 15:31:35 +02:00
Michael Adam
82404ad3e4 talloc:mksigs: ignore symbols (like _DEPRECATED_) after closing function parentheses
Michael
2009-09-11 15:31:33 +02:00
Michael Adam
629ff2b6e2 talloc:mksigs: correctly ignode multiline function typedefs
by first concatenating multilint parentheses and removing typefes afterwards.

Michael
2009-09-11 15:31:33 +02:00
Michael Adam
7b0e072631 talloc:mksigs: ignore struct forward declarations.
Michael
2009-09-11 15:31:32 +02:00
Michael Adam
e60c775835 talloc:mksyms: allow characters after closing functions parenthesis.
Michael
2009-09-11 15:31:32 +02:00
Michael Adam
fd55479981 talloc:mksyms: allow double pointer return value of functions.
Michael
2009-09-11 15:31:32 +02:00
Michael Adam
55dcf928eb tdb:mksigs: allow PRINTF_ATTRIBUTE(..) macros function types as funcion args
Michael
2009-09-11 15:31:31 +02:00
Michael Adam
cfa4e7ec75 tdb:mksigs: normalize bool -> _Bool
Michael
2009-09-11 15:31:31 +02:00
Michael Adam
25939a627f tdb:mksigs: ignore symbols (like _DEPRECATED_) after closing function parentheses
Michael
2009-09-11 15:31:30 +02:00
Michael Adam
13bfcd5a93 tdb:mksigs: correctly ignode multiline function typedefs
by first concatenating multilint parentheses and removing typefes afterwards.

Michael
2009-09-11 15:31:30 +02:00
Michael Adam
ecd12bfb38 tdb:mksigs: ignore struct forward declarations.
Michael
2009-09-11 15:31:30 +02:00
Michael Adam
400f08450b tdb:mksyms: allow characters after closing functions parenthesis.
Michael
2009-09-11 15:31:29 +02:00
Michael Adam
907e05595f tdb:mksyms: allow double pointer return value of functions.
Michael
2009-09-11 15:31:29 +02:00
Michael Adam
6b9298191a tevent:signatures: add _tevent_req_cancel and tevent_req_set_cancel_fn
introduced in 45e4be0d96

Michael
2009-09-11 15:31:29 +02:00
Michael Adam
7165f29aea tevent:exports: add _tevent_req_cancel and tevent_req_set_cancel_fn.
These were added in 45e4be0d96

Michael
2009-09-11 15:31:28 +02:00
Michael Adam
f98470e3a4 tevent:mksigs: allow PRINTF_ATTRIBUTE(..) macros function types as funcion args
Michael
2009-09-11 15:31:28 +02:00
Michael Adam
085c07b743 tevent:mksigs: normalize bool -> _Bool
Michael
2009-09-11 15:31:28 +02:00
Michael Adam
636f8b5e5b tevent:mksigs: ignore symbols (like _DEPRECATED_) after closing function parentheses
Michael
2009-09-11 15:31:27 +02:00
Michael Adam
aa7748484f tevent:mksigs: correctly ignode multiline function typedefs
by first concatenating multilint parentheses and removing typefes afterwards.

Michael
2009-09-11 15:31:27 +02:00
Michael Adam
1e2393c178 tevent:mksigs: ignore struct forward declarations.
Michael
2009-09-11 15:31:27 +02:00