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

337 Commits

Author SHA1 Message Date
Noel Power
8d998db788 s4:torture:libnet: fix 'Syscall param writev(vector[...])' valgrind error
smbtorture test  net.api.delshare.api.delshare generates the following
valgrind trace

==29209== Syscall param writev(vector[...]) points to uninitialised byte(s)
==29209==    at 0xFBA2C87: writev (in /lib64/libc-2.19.so)
==29209==    by 0x106CB033: writev_handler (async_sock.c:340)
==29209==    by 0xF67812A: ??? (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xF6765F6: ??? (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xF6727FC: _tevent_loop_once (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xF673ACE: tevent_req_poll (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0x5D19325: tevent_req_poll_ntstatus (tevent_ntstatus.c:109)
==29209==    by 0x88B2E0D: dcerpc_binding_handle_call (binding_handle.c:556)
==29209==    by 0xBC6B4A1: dcerpc_srvsvc_NetShareAdd_r (ndr_srvsvc_c.c:3327)
==29209==    by 0x5990D8: test_addshare (libnet_share.c:194)
==29209==    by 0x5992D5: torture_delshare (libnet_share.c:228)
==29209==    by 0x9553F62: wrap_simple_test (torture.c:632)
==29209==    by 0x955368F: internal_torture_run_test (torture.c:442)
==29209==    by 0x9553A6B: torture_run_test_restricted (torture.c:542)
==29209==    by 0x26013F: run_matching (smbtorture.c:110)
==29209==    by 0x260001: run_matching (smbtorture.c:95)
==29209==    by 0x260260: torture_run_named_tests (smbtorture.c:143)
==29209==    by 0x261EDF: main (smbtorture.c:665)
==29209==  Address 0x1887fd16 is 598 bytes inside a block of size 1,325 alloc'd
==29209==    at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==29209==    by 0xF464A73: _talloc_pooled_object (in /usr/lib64/libtalloc.so.2.1.5)
==29209==    by 0xF67366D: _tevent_req_create (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xB0D49FF: smb1cli_req_create (smbXcli_base.c:1322)
==29209==    by 0xB0E1E6D: smb1cli_trans_send (smb1cli_trans.c:512)
==29209==    by 0xB0ED47D: tstream_smbXcli_np_readv_trans_start (tstream_smbXcli_np.c:901)
==29209==    by 0xB0EC847: tstream_smbXcli_np_writev_write_next (tstream_smbXcli_np.c:578)
==29209==    by 0xB0EC4D7: tstream_smbXcli_np_writev_send (tstream_smbXcli_np.c:505)
==29209==    by 0xC259DFA: tstream_writev_send (tsocket.c:695)
==29209==    by 0xC25AD64: tstream_writev_queue_trigger (tsocket_helpers.c:513)
==29209==    by 0xF673023: tevent_common_loop_immediate (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xF677EED: ??? (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xF6765F6: ??? (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xF6727FC: _tevent_loop_once (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0xF673ACE: tevent_req_poll (in /usr/lib64/libtevent.so.0.9.26)
==29209==    by 0x5D19325: tevent_req_poll_ntstatus (tevent_ntstatus.c:109)
==29209==    by 0x88B2E0D: dcerpc_binding_handle_call (binding_handle.c:556)
==29209==    by 0xBC6B4A1: dcerpc_srvsvc_NetShareAdd_r (ndr_srvsvc_c.c:3327)
==29209==    by 0x5990D8: test_addshare (libnet_share.c:194)
==29209==    by 0x5992D5: torture_delshare (libnet_share.c:228)
==29209==    by 0x9553F62: wrap_simple_test (torture.c:632)
==29209==    by 0x955368F: internal_torture_run_test (torture.c:442)
==29209==    by 0x9553A6B: torture_run_test_restricted (torture.c:542)
==29209==    by 0x26013F: run_matching (smbtorture.c:110)
==29209==    by 0x260001: run_matching (smbtorture.c:95)
==29209==    by 0x260260: torture_run_named_tests (smbtorture.c:143)
==29209==    by 0x261EDF: main (smbtorture.c:665)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-04-25 10:35:16 +02:00
Noel Power
0ae25fff0a s4:torture:libnet: fix 'Conditional jump or move' valgrind error
smbtorture test net.domopen.domopen generated the following valgrind
trace.

==29054== Conditional jump or move depends on uninitialised value(s)
==29054==    at 0x9788D31: libnet_DomainOpen_send (libnet_domain.c:617)
==29054==    by 0x9788E01: libnet_DomainOpen (libnet_domain.c:676)
==29054==    by 0x595F5D: test_domainopen (domain.c:41)
==29054==    by 0x5961AD: torture_domainopen (domain.c:101)
==29054==    by 0x9553F62: wrap_simple_test (torture.c:632)
==29054==    by 0x955368F: internal_torture_run_test (torture.c:442)
==29054==    by 0x9553A6B: torture_run_test_restricted (torture.c:542)
==29054==    by 0x26013F: run_matching (smbtorture.c:110)
==29054==    by 0x260001: run_matching (smbtorture.c:95)
==29054==    by 0x260260: torture_run_named_tests (smbtorture.c:143)
==29054==    by 0x261EDF: main (smbtorture.c:665)
==29054==
==29054== Conditional jump or move depends on uninitialised value(s)
==29054==    at 0x9788D95: libnet_DomainOpen_recv (libnet_domain.c:648)
==29054==    by 0x9788E1D: libnet_DomainOpen (libnet_domain.c:677)
==29054==    by 0x595F5D: test_domainopen (domain.c:41)
==29054==    by 0x5961AD: torture_domainopen (domain.c:101)
==29054==    by 0x9553F62: wrap_simple_test (torture.c:632)
==29054==    by 0x955368F: internal_torture_run_test (torture.c:442)
==29054==    by 0x9553A6B: torture_run_test_restricted (torture.c:542)
==29054==    by 0x26013F: run_matching (smbtorture.c:110)
==29054==    by 0x260001: run_matching (smbtorture.c:95)
==29054==    by 0x260260: torture_run_named_tests (smbtorture.c:143)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-04-25 10:35:16 +02:00
Stefan Metzmacher
d71d0d4a35 s4:torture/libnet: add missing #include "torture/libnet/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
Stefan Metzmacher
4bed466352 s4:torture/libnet: make use of dcerpc_binding_get_string_option("host")
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-13 11:54:18 +01:00
Stefan Metzmacher
1a0eddbe6c s4:torture/libnet: fix compiler warnings in libnet_lookup.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:53 +01:00
Stefan Metzmacher
61a8525c8e s4:torture/libnet: check the result of libnet_LookupName()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:53 +01:00
Stefan Metzmacher
16f4f2f0c7 s4:torture/libnet: remove bogus usage of p->conn->event_ctx
ctx->event_ctx and p->conn->event_ctx already have the same value
as torture->ev.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:52 +01:00
Stefan Metzmacher
d9573ae076 s4:libnet: let libnet_rpc_usermod() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:52 +01:00
Stefan Metzmacher
5bbcec0c2a s4:libnet: let libnet_rpc_userdel() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:52 +01:00
Stefan Metzmacher
adef841a59 s4:libnet: let libnet_rpc_useradd() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:52 +01:00
Stefan Metzmacher
e3b8df2b09 s4:libnet: let libnet_rpc_useradd_send() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:51 +01:00
Stefan Metzmacher
208991e497 s4:libnet: let libnet_rpc_userinfo() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:51 +01:00
Stefan Metzmacher
59fb19ebc4 s4:libnet: let libnet_rpc_userinfo_send() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:51 +01:00
Stefan Metzmacher
7a97662bb5 s4:libnet: let libnet_rpc_groupadd() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:51 +01:00
Stefan Metzmacher
959d94b153 s4:libnet: let libnet_rpc_groupinfo() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-01-16 16:22:51 +01:00
Matthieu Patou
e3b6b465ee Force cast to long as on some platform tv_usec is 32bit long
Autobuild-User(master): Matthieu Patou <mat@samba.org>
Autobuild-Date(master): Mon Sep 10 07:33:50 CEST 2012 on sn-devel-104
2012-09-10 07:33:50 +02:00
Andrew Bartlett
fd2b21fc38 s4-libnet: Add mem_ctx to libnet_rpc_useradd calls (bug #8889) 2012-04-30 13:08:28 +02:00
Stefan Metzmacher
84ae92da6b s4:libnet: pass an explicit mem_ctx to libnet_rpc_userinfo_send() (bug #8889)
This hopefully fixes the flakey autobuild.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Apr 24 16:43:03 CEST 2012 on sn-devel-104
2012-04-24 16:43:03 +02:00
Jelmer Vernooij
1c1b10f1d9 torture/libnet: Include prototype headers. 2012-02-07 01:11:07 +01:00
Andrew Bartlett
c091a92be5 s4-param Remove 'sam database' parameter
This now just relies on the private dir parameter, which remains.

Andrew Bartlett
2011-06-06 15:02:38 +10:00
Andrew Bartlett
7261a9b9f7 s4-libcli Remove resolve_name() as it conflicts with Samba3.
This was just a wrapper around resolve_name_ex(), so just call that
instead.

Andrew Bartlett
2011-05-03 07:37:07 +02:00
Jelmer Vernooij
9fc2e6c352 Use TestCase.get_credentials() where possible. 2011-01-03 01:48:05 +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
1229935aa9 torture/becomedc: Add test for global schema, use samdb_connect().
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Tue Oct 12 18:35:33 UTC 2010 on sn-devel-104
2010-10-12 18:35:33 +00:00
Andrew Tridgell
0009d1771a s4-libnet: print the domain name on domain open failure
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-09-15 15:39:36 +10:00
Kamen Mazdrashki
35aed17b26 s4-test: refactor API-DELETEUSER test a little to:
- fail torture_context in case libnet_DeleteUser() has failed
 - make use of torture_assert_* macros to track down where failur occured
 - use only one memory context internally
2010-09-05 23:34:28 +03:00
Björn Jacke
f222387533 s4: use GetTimeOfDay macro instead of gettimeofday 2010-08-31 11:33:22 +02:00
Stefan Metzmacher
b1a584f9dc s4:torture/libnet: avoid dereferencing dcerpc_binding_handle internals
metze
2010-08-02 17:42:49 +02:00
Andrew Tridgell
6b266b85cf s4-loadparm: 2nd half of lp_ to lpcfg_ conversion
this converts all callers that use the Samba4 loadparm lp_ calling
convention to use the lpcfg_ prefix.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-07-16 18:24:27 +10:00
Andrew Tridgell
4cb423f527 s4-python: python is not always in /usr/bin
Using "#!/usr/bin/env python" is more portable. It still isn't ideal
though, as we should really use the python path found at configure
time. We do that in many places already, but some don't.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-06-24 18:46:57 +10:00
Jelmer Vernooij
c92db7b6dc python: Use samba.tests.TestCase, make sure base class tearDown and
setUp methods are called, fix formatting.
2010-06-19 22:46:45 +02:00
Stefan Metzmacher
6dbcffb51d s4:lib: merge LDB_WRAP and LDBSAMBA and make LDBSAMBA a library.
This is needed to remove samba specifc symbols from the bundled
ldb, in order to get the ABI right.

metze

Signed-off-by: Andreas Schneider <asn@samba.org>
2010-06-16 14:07:28 +02:00
Andrew Bartlett
ecf782da87 s4:torture Rework NET-API-BECOMEDC test to use libnet_vampire callbacks.
The libnet_vampire code was derived from this code in the first place,
but has continued to evolve, while this code has often bitrotted.
This avoids the needless duplication of the callbacks, while keeping
the toture wrapper.

Andrew Bartlett

Signed-off-by: Kamen Mazdrashki <kamenim@samba.org>
2010-06-15 10:51:34 +10:00
Kamen Mazdrashki
c65eb4852c s4/test-libnet: Re-align code a bit - more readable this way IMO 2010-06-11 17:46:36 +03:00
Kamen Mazdrashki
9baa73053e s4/test-libnet: Refactor test_group_create() a little to:
- Close unused policy handle for created group
- re-align code - it is more readable this way IMHO
2010-06-11 17:46:35 +03:00
Kamen Mazdrashki
6eecb968cb s4/test-libnet: Refactor test_user_create() little bit to:
- fix a flaw that user RID is not returned in case
  user is recreated
- close unused policy handle to created user
- do not take into account the result from
  test_samr_close_handle - we don't case
2010-06-11 17:46:35 +03:00
Kamen Mazdrashki
a735c1ade2 s4/test-libnet: add few comments for utility functions 2010-06-11 17:46:35 +03:00
Kamen Mazdrashki
84fb3ed8a5 s4/test-libnet: Move LSA close handle function to a common location 2010-06-11 17:46:34 +03:00
Kamen Mazdrashki
8714f130e5 s4/test-libnet: remove unused code
Pre-connecting SAMR and LSA pipes is implemented in
test_libnet_context_init() function
2010-06-11 17:46:34 +03:00
Kamen Mazdrashki
7168b1c99f s4/test-libnet: Fix compile-time warning 2010-06-11 17:46:34 +03:00
Kamen Mazdrashki
1ceb0dd92f s4/test: use test_libnet_context_init() function to create libnet_context
This way we ensure that LIBNET call will be issued against
the DC we are testing against
2010-06-11 01:20:10 +03:00
Kamen Mazdrashki
d6d8ec80f9 s4/test: fix SEGFAULT in test_group_create when rid is NULL
Caller of this function may not need group RID and
in such case it passes NULL for rid parameter
2010-06-11 01:20:09 +03:00
Kamen Mazdrashki
eda4926120 s4/test-libnet: Helper func to initialize libnet_context
and create rpc connections to SAMR and LSA pipes.
This function should be used in cases where we need
'deterministic' connection to the DC we are testing against.

The problem is that most of the test follow the pattern:
1. Connect to server supplied on command line
2. Create user/group through connection in 1.
3. Use 'fresh' libnet_context to query/alter the object in
   step 2.

In singe-DC environment this work well. But in multiple-DC
environment libnet may connect to another DC (step 3), not
the one we use in step 1 and 2. This leads to false error -
object created in step 2 is not found on DC we are querying
in step 3.
2010-06-11 01:20:09 +03:00
Kamen Mazdrashki
85d7863b2c s4/test: Call test_user_cleanup with original RDN for the user
'name' var is changed during the test execution and should
contain samAccountName for the user, while test_user_cleanup()
expects account RDN to be passed
2010-06-11 01:20:09 +03:00
Kamen Mazdrashki
61e5ac4a5a s4/test: Fix incorrect NTSTATUS comparison
In case group already exists, we should get NT_STATUS_GROUP_EXISTS.
2010-06-11 01:20:09 +03:00
Kamen Mazdrashki
64a71d380c s4/test: remove create/delete group implementation in API-CREATEGROUP test
We already have common implementation for create/delete
group in libnet/utils.c
2010-06-11 01:20:09 +03:00
Kamen Mazdrashki
d02c395abd s4/test: Remove duplicated test_opendomain() functionality
We already have a nice common test_domain_open()
function in libnet/util.c
2010-06-11 01:20:09 +03:00
Kamen Mazdrashki
7135abcd8d s4/test: libnet_user tests should use common test_user_cleanup
implementation instead of not-so-informative test_cleanup()
2010-06-11 01:20:08 +03:00
Kamen Mazdrashki
d1bcc23b2c s4/test: Refactor test_user_cleanup to be more robust
We always call this function with user's account RDN
while samr_LookupNames() searches for samAccountName.
2010-06-11 01:20:08 +03:00
Kamen Mazdrashki
1b8a8ddfe0 s4/test: remove duplicated comment 2010-06-11 01:20:08 +03:00