2006-06-17 06:20:39 +04:00
/*
Unix SMB / CIFS implementation .
SMB torture tester
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-17 06:20:39 +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-17 06:20:39 +04:00
*/
# include "includes.h"
2008-09-23 10:06:33 +04:00
# include "../libcli/nbt/libnbt.h"
2006-06-17 06:20:39 +04:00
# include "torture/torture.h"
# include "torture/nbt/proto.h"
2008-04-27 17:02:46 +04:00
# include "torture/smbtorture.h"
2006-10-16 17:06:41 +04:00
# include "libcli/resolve/resolve.h"
2007-12-03 20:47:35 +03:00
# include "param/param.h"
2006-10-16 17:06:41 +04:00
2008-06-06 00:02:41 +04:00
struct nbt_name_socket * torture_init_nbt_socket ( struct torture_context * tctx )
{
2010-05-09 19:20:01 +04:00
return nbt_name_socket_init ( tctx , tctx - > ev ) ;
2008-06-06 00:02:41 +04:00
}
2006-10-16 17:06:41 +04:00
bool torture_nbt_get_name ( struct torture_context * tctx ,
2007-07-10 15:54:49 +04:00
struct nbt_name * name ,
const char * * address )
2006-10-16 17:06:41 +04:00
{
make_nbt_name_server ( name , strupper_talloc ( tctx ,
2007-09-07 20:27:57 +04:00
torture_setting_string ( tctx , " host " , NULL ) ) ) ;
2006-10-16 17:06:41 +04:00
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok ( tctx ,
2011-05-02 10:36:48 +04:00
resolve_name_ex ( lpcfg_resolve_context ( tctx - > lp_ctx ) ,
0 , 0 ,
name , tctx , address , tctx - > ev ) ,
2007-07-10 15:54:49 +04:00
talloc_asprintf ( tctx ,
" Failed to resolve %s " , name - > name ) ) ;
2006-10-16 17:06:41 +04:00
return true ;
}
2006-06-17 06:20:39 +04:00
2017-04-20 22:24:43 +03:00
NTSTATUS torture_nbt_init ( TALLOC_CTX * ctx )
2006-06-17 06:20:39 +04:00
{
2006-10-16 17:06:41 +04:00
struct torture_suite * suite = torture_suite_create (
2017-04-25 00:41:26 +03:00
ctx , " nbt " ) ;
2006-06-17 06:20:39 +04:00
/* nbt tests */
2007-09-07 20:27:57 +04:00
torture_suite_add_suite ( suite , torture_nbt_register ( suite ) ) ;
torture_suite_add_suite ( suite , torture_nbt_wins ( suite ) ) ;
torture_suite_add_suite ( suite , torture_nbt_dgram ( suite ) ) ;
torture_suite_add_suite ( suite , torture_nbt_winsreplication ( suite ) ) ;
torture_suite_add_suite ( suite , torture_bench_nbt ( suite ) ) ;
torture_suite_add_suite ( suite , torture_bench_wins ( suite ) ) ;
2006-10-16 17:06:41 +04:00
suite - > description = talloc_strdup ( suite ,
2007-09-07 20:27:57 +04:00
" NetBIOS over TCP/IP and WINS tests " ) ;
2006-10-16 17:06:41 +04:00
2017-04-25 00:41:26 +03:00
torture_register_suite ( ctx , suite ) ;
2006-10-16 17:06:41 +04:00
2006-06-17 06:20:39 +04:00
return NT_STATUS_OK ;
}