2006-06-26 15:33:37 +04:00
/*
Unix SMB / CIFS implementation .
local testing of torture
Copyright ( C ) Jelmer Vernooij 2006
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2006-06-26 15:33:37 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2006-06-26 15:33:37 +04:00
*/
# include "includes.h"
2006-06-26 23:30:00 +04:00
# include "system/wait.h"
2006-07-12 06:02:07 +04:00
# include "libcli/raw/libcliraw.h"
2008-02-15 17:53:06 +03:00
# include "torture/util.h"
2014-02-27 12:08:17 +04:00
# include "torture/local/proto.h"
2008-04-09 05:23:13 +04:00
# include "param/provision.h"
2006-06-26 15:33:37 +04:00
2006-10-16 17:06:41 +04:00
static bool test_tempdir ( struct torture_context * tctx )
2006-06-26 15:33:37 +04:00
{
char * location = NULL ;
2006-10-16 17:06:41 +04:00
TALLOC_CTX * mem_ctx = tctx ;
2006-06-26 15:33:37 +04:00
2006-10-16 17:06:41 +04:00
torture_assert_ntstatus_ok ( tctx , torture_temp_dir ( mem_ctx , " tempdir " , & location ) ,
2006-06-26 15:33:37 +04:00
" torture_temp_dir should return NT_STATUS_OK " ) ;
2006-10-16 17:06:41 +04:00
torture_assert ( tctx , directory_exist ( location ) ,
2006-06-26 15:33:37 +04:00
" created dir doesn't exist " ) ;
2006-10-16 17:06:41 +04:00
return true ;
2006-06-26 15:33:37 +04:00
}
2008-02-15 03:37:57 +03:00
static bool test_provision ( struct torture_context * tctx )
{
NTSTATUS status ;
2008-04-11 05:09:34 +04:00
struct provision_settings * settings = talloc_zero ( tctx , struct provision_settings ) ;
2008-04-10 07:23:17 +04:00
struct provision_result result ;
2008-04-08 11:26:55 +04:00
char * targetdir = NULL ;
torture_assert_ntstatus_ok ( tctx , torture_temp_dir ( tctx , " torture_provision " , & targetdir ) ,
Make Samba4 pass the NET-API-BECOMEDC test against Win2k3 (again).
To make Samba4, using the python provision system, pass this test
required some major rework. Untested code is broken code, and some of
the refactoring for a seperate provision test (which also now passes)
broke things.
Similarly, the iconv work has compiled, but these codepaths have never
been run (NULL pointer de-reference).
In working to use a local, rather than global, loadparm context, and
to support using a target directory, a few things needed to be
reworked, particularly around path handling.
Andrew Bartlett
(This used to be commit 1169e8d7bee20477b0efbfea3534ac63c83fb3d6)
2008-03-06 13:55:26 +03:00
" torture_temp_dir should return NT_STATUS_OK " ) ;
2008-04-08 11:26:55 +04:00
settings - > targetdir = talloc_steal ( settings , targetdir ) ;
2008-02-15 03:37:57 +03:00
2008-04-08 11:26:55 +04:00
settings - > site_name = " SOME-SITE-NAME " ;
settings - > root_dn_str = " DC=EXAMPLE,DC=COM " ;
settings - > domain_dn_str = " DC=EXAMPLE,DC=COM " ;
settings - > config_dn_str = NULL ;
settings - > schema_dn_str = NULL ;
settings - > invocation_id = NULL ;
settings - > netbios_name = " FOO " ;
settings - > realm = " EXAMPLE.COM " ;
settings - > domain = " EXAMPLE " ;
2008-04-11 05:09:34 +04:00
settings - > netbios_name = " torture " ;
2008-04-08 11:26:55 +04:00
settings - > ntds_dn_str = NULL ;
settings - > machine_password = " geheim " ;
2012-08-21 13:58:18 +04:00
settings - > use_ntvfs = true ;
2008-02-15 03:37:57 +03:00
2008-04-10 07:23:17 +04:00
status = provision_bare ( settings , tctx - > lp_ctx , settings , & result ) ;
2008-02-15 17:14:55 +03:00
2008-02-15 03:37:57 +03:00
torture_assert_ntstatus_ok ( tctx , status , " provision " ) ;
2008-04-10 07:23:17 +04:00
torture_assert_str_equal ( tctx , result . domaindn , " DC=EXAMPLE,DC=COM " ,
" domaindn incorrect " ) ;
2008-02-15 03:37:57 +03:00
return true ;
}
2006-06-26 15:33:37 +04:00
struct torture_suite * torture_local_torture ( TALLOC_CTX * mem_ctx )
{
2010-12-11 05:26:31 +03:00
struct torture_suite * suite = torture_suite_create ( mem_ctx , " torture " ) ;
2006-06-26 15:33:37 +04:00
2006-10-16 17:06:41 +04:00
torture_suite_add_simple_test ( suite , " tempdir " , test_tempdir ) ;
2008-02-15 03:37:57 +03:00
torture_suite_add_simple_test ( suite , " provision " , test_provision ) ;
2006-06-26 15:33:37 +04:00
return suite ;
}