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

335 Commits

Author SHA1 Message Date
Martin Schwenke
92cfd1e9b8 torture: Add tests for trim_string()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-06-20 00:47:30 +02:00
Douglas Bagnall
5235f1facf util/binsearch: macro for greater than or equal search
Sometimes you want to find the place where an item would be in a
sorted list, whether or not it is actually there.

The BINARY_ARRAY_SEARCH_GTE macro takes an extra 'next' pointer
argument over the other binsearch macros. This will end up pointing to
the next element in the case where there is not an exact match, or
NULL when there is. That is, searching the list

     { 2, 3, 4, 4, 9}

with a standard integer compare should give the following results:

search term    *result    *next
         1      -          2
         3      3          -
         4      4 [1]      -
         7      -          9
         9      9          -
        10      -          - [2]

Notes
[1] There are two fours, but you will always get the first one.
[2] The both NULL case means the search term is beyond the last list
item.

You can safely use the same pointer for both 'result' and 'next', if
you don't care to distinguish between the 'greater-than' and 'equals'
cases.

There is a torture test for this.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-09 10:32:16 +01:00
Martin Schwenke
e318babace lib/util: Add strv_util.[ch] containing new function strv_split()
strv_split() adds to a strv by splitting a string on separators.

Tests included.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-03-01 05:43:19 +01:00
Martin Schwenke
f3ea162488 lib/util: Add tests for strv
These are blackbox tests against most of the API.

It would be possible to write tests that check the internals of the
strv are as expected but that probably doesn't add much value.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-26 19:27:08 +01:00
Michael Adam
476672b647 dlist: remove unneeded type argument from DLIST_ADD_END()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Tom Schulz
8de1ed6d6e s4: fix linking smbtorture on Solaris.
Don't test getgrouplist if we do not have it.

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

Signed-off-by: Tom Schulz <schulz@adi.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Oct  6 19:15:22 CEST 2015 on sn-devel-104
2015-10-06 19:15:22 +02:00
Tom Schulz
5866fcc164 s4: tests: Fix nss_tests build on Solaris.
Too many arguments for Solaris getpwent_r() and getgrent_r().

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

Signed-off-by: Tom Schulz <schulz@adi.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 17 05:01:07 CEST 2015 on sn-devel-104
2015-09-17 05:01:07 +02:00
Stefan Metzmacher
77c3d504b2 lib/crypto: add aes_ccm_128 tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11451

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-08-27 20:23:20 +02:00
Volker Lendecke
78d7512db9 lib: Remove unused parmlist code
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-08-21 11:43:04 +02:00
Uri Simchoni
6aa0ae50e2 torture: include config.h before any glibc headers
config.h may have some flags which affect glibc behavior, e.g.
_FILE_OFFSET_BITS=64. To make sure these flags have the desired
effect, config.h must be included before any glibc header files.

Also remove inclusion of some system files, relying on
replace/system/*.h instead.

This commit does not fix a specific known bug. It changes the code to
comply with coding conventions.

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: "Stefan Metzmacher" <metze@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul 17 04:41:14 CEST 2015 on sn-devel-104
2015-07-17 04:41:13 +02:00
Stefan Metzmacher
86f29d62a6 s4:torture/local: add more torture_assert() checks
We need to make sure we return when torture_assert_passwd_equal()
or torture_assert_group_equal() fails.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-04-09 16:58:23 +02:00
David Disseldorp
13fa1b8776 torture: add local FSRVP server state tests
Test the storage and retrieval of FSRVP server state, with varying
shadow-copy set, shadow copy and share map hierarchies.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-31 18:40:24 +02:00
Volker Lendecke
de811f14af lib: Remove tdb_compat
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-17 11:30:52 +01:00
Volker Lendecke
cf368cbdc5 lib: Remove tdb_fetch_compat
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-17 11:30:52 +01:00
Günther Deschner
975073adc1 s4-torture: cleanup nsswrapper test a little by removing nwrap references.
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-02 17:17:09 +01:00
Günther Deschner
64e0231c52 s4-torture: re-add nss-wrapper torture testsuite.
(The testsuite got removed with 5bb410f853).

Although nss_wrapper now also has an upstream testsuite, it is still important
to run the older torture testsuite within Samba so we have some testing on
nss_winbind correctnes and consistency.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-03-02 17:17:09 +01:00
Stefan Metzmacher
03bf8fe4fc lib/crypto: add aes_gcm_128 support.
Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-10-16 19:30:04 +02:00
Andreas Schneider
5de011be3f s4-torture: Remove socket_wrapper testsuite.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-17 14:56:06 +02:00
Andreas Schneider
f95e86828a s4-torture: Remove nss_wrapper testsuite.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-17 14:56:06 +02:00
David Disseldorp
1e1b7b1021 torture: add local verification trailer parsing test
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr  9 03:44:15 CEST 2014 on sn-devel-104
2014-04-09 03:44:15 +02:00
Stefan Metzmacher
2f0f7af39c s4:torture/local: only pass prefix strings to tdb_add_record() in dbspeed.c
This way the compiler has a chance to check the format string.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-04-02 09:03:45 +02:00
Stefan Metzmacher
e794206ed0 s4:torture/local: add missing #include "torture/local/proto.h"
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-04-02 09:03:45 +02:00
Volker Lendecke
d6db35d7a5 tdb_wrap: Remove tdb_wrap_open_ again
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:14 +02:00
Volker Lendecke
2ae3565a55 torture: Avoid passing lp_ctx to tdb_wrap_open in test_tdb_speed
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:13 +02:00
Andrew Bartlett
502135df9f lib/replace: Try to fix build on HP-UX for os2_delete test
The issue is that this file is both used in an autoconf test, and
later in a smbtorture test.  Because os2_delete.c does not include
replace.h, bool may not be defined.

So, instead we shift the need for bool to a different header.

(The readdir tests in repdir.m4 are not yet in the waf configure).

Andrew Bartlett
2012-09-23 14:31:01 +10:00
Andrew Bartlett
b5c2747cad s4-provision: pass use_ntvfs from C wrappers and set to true in tests/vampire
None of these cases need the complexity of the s3fs backend.

Andrew Bartlett
2012-08-22 01:31:57 +02:00
Jelmer Vernooij
ce4531ee31 tdb_wrap: Move to specific directory.
It's a bit confusing to mix low-level and high-level libraries.  We had
multiple libraries in one directory, and there were have circular
dependencies with other libraries outside that directory (in this case,
samba-hostconfig).

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Mar 10 23:13:01 CET 2012 on sn-devel-104
2012-03-10 23:13:01 +01:00
Stefan Metzmacher
7102eafc26 lib/crypto: add aes_cmac_128_test.c as local.crypto.aes_cmac_128 test
metze
2012-02-29 03:16:22 +01:00
Andrew Bartlett
01c934c81e lib/util: Add back control of mmap and hash size in tdb for top level build
This passes down a struct loadparm_context to allow these
parameters to be checked.  This may be s3 or s4 context, allowing the
#if _SAMBA_BUILD_ macro to go away safely.

Andrew Bartlett
2011-10-13 14:06:07 +02:00
Andrew Bartlett
561d834123 auth: move credentials layer to the top level
This will allow gensec_start.c to move to the top level.  This does not change
what code uses the cli_credentials code, but allows the gensec code to be
more broadly.

Andrew Bartlett
2011-10-11 13:41:36 +11:00
Rusty Russell
058c4f8492 tdb_fetch_compat: use instead of tdb_fetch.
This is a noop for tdb1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Rusty Russell
0e4c358e27 tdb_compat.h: divert every tdb build and includes to tdb_compat
We change all the headers and wscript files to use tdb_compat; this
means we have one place to decide whether to use TDB1 or TDB2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:34 +02:00
Andrew Bartlett
1475013963 lib/util Move source3 tdb_wrap_open() into the common code.
This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in
the top level build, these options are not available for these
databases.  However, having two different tdb_wrap lists is a worse
fate, so this will do for now.

Andrew Bartlett
2011-05-06 07:51:24 +02:00
Andrew Tridgell
887fdb7ba1 s4-test: added a test for E_deshash()
this particularly checks the boundary conditions near passwords of
length 14 characters

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Wed Apr 13 07:31:55 CEST 2011 on sn-devel-104
2011-04-13 07:31:55 +02:00
Andrew Bartlett
d335b635c2 lib/util/charset Add many more charset tests
This confirms that the behaviour of the convert_string() API (with the
process-wide iconv handle).

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
a2c691ab9a lib/util/charset Rename convert_string test to allow a 'non_handle' test
A future commit will test (with a subset of tests) the varient of this
function without _handle.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13 14:47:08 +10:00
Andrew Bartlett
620921b36b lib/util/charset Add tests for strcasecmp_m(), talloc_strupper() et al
This adds tests for:
 strncasecmp_m
 strcasecmp_m
 strupper_talloc_n
 strlower_talloc
 strhaslower
 strhasupper

The tests can certainly be improved with pre-calculated upper and
lower case text, but this at least puts them though their paces.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Thu Mar 31 14:24:22 CEST 2011 on sn-devel-104
2011-03-31 14:24:22 +02:00
Andrew Bartlett
43e364e61b lib/util/charset Add tests for convert_string_talloc_handle()
Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Mar 30 13:02:47 CEST 2011 on sn-devel-104
2011-03-30 13:02:47 +02:00
Jelmer Vernooij
136c160064 Use <tdb.h> to include tdb, so the system include file gets used when building against
system tdb.
2011-02-28 21:11:21 +01:00
Andrew Tridgell
8dc92c8f71 ldb: use #include <ldb.h> for ldb
thi ensures we are using the header corresponding to the version of
ldb we're linking against. Otherwise we could use the system ldb for
link and the in-tree one for include

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-02-10 06:51:07 +01:00
Stefan Metzmacher
c9e6bf047d lib/util: add tests for anonymous_shared_allocate/free()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Jan 20 06:25:03 CET 2011 on sn-devel-104
2011-01-20 06:25:03 +01:00
Jelmer Vernooij
35fbc7bbda s4-smbtorture: Make test names lowercase and dot-separated.
This is consistent with the test names used by selftest, should
make the names less confusing and easier to integrate with other tools.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Dec 11 04:16:13 CET 2010 on sn-devel-104
2010-12-11 04:16:13 +01:00
Jelmer Vernooij
5a482a641e torture: Only add in tests for socket_wrapper/nss_wrapper when they have been enabled. 2010-11-12 17:42:13 +00:00
Jelmer Vernooij
0878399bd5 samdb: Lowercase library name. 2010-11-07 01:52:13 +01:00
Jelmer Vernooij
3deece5591 s4: Remove the old perl/m4/make/mk-based build system.
The new waf-based build system now has all the same functionality, and
the old build system has been broken for quite some time.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Oct 31 02:01:44 UTC 2010 on sn-devel-104
2010-10-31 02:01:44 +00:00
Andrew Tridgell
d6299d2667 replace: create a private replace-test library
used by replace_testuite and smbtorture
2010-10-30 23:48:59 +11:00
Jelmer Vernooij
b2af2fd3de torture_local: Add missing dependency on socket_wrapper. 2010-10-26 10:17:17 -07:00
Jelmer Vernooij
a6611c16a8 torture/local: Depend on NSS_WRAPPER, even if it wasn't enabled.
torture_local tests nss_wrapper.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Oct 24 01:02:00 UTC 2010 on sn-devel-104
2010-10-24 01:02:00 +00:00
Jelmer Vernooij
2933fac7c7 s4: Rename NSS_WRAPPER to nss_wrapper.
Only link to nss_wrapper when it is enabled.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Oct 23 23:05:44 UTC 2010 on sn-devel-104
2010-10-23 23:05:43 +00:00
Jelmer Vernooij
c529317fe2 Lowercase socket_wrapper name.
Avoid linking against socket_wrapper outside of developer mode.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Thu Oct 21 20:26:11 UTC 2010 on sn-devel-104
2010-10-21 20:26:11 +00:00