2005-02-10 06:22:47 +03:00
/*
Unix SMB / CIFS implementation .
NBT WINS server testing
Copyright ( C ) Andrew Tridgell 2005
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
2005-02-10 06:22:47 +03: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/>.
2005-02-10 06:22:47 +03:00
*/
# include "includes.h"
2005-02-10 09:59:29 +03:00
# include "lib/socket/socket.h"
2006-03-07 14:07:23 +03:00
# include "libcli/resolve/resolve.h"
# include "system/network.h"
2006-08-17 17:37:04 +04:00
# include "lib/socket/netif.h"
2006-03-16 03:23:11 +03:00
# include "librpc/gen_ndr/ndr_nbt.h"
2006-03-25 19:01:28 +03:00
# include "torture/torture.h"
2006-10-16 17:06:41 +04:00
# include "torture/nbt/proto.h"
2007-12-06 18:26:56 +03:00
# include "param/param.h"
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
# define CHECK_VALUE(tctx, v, correct) \
torture_assert_int_equal ( tctx , v , correct , " Incorrect value " )
# define CHECK_STRING(tctx, v, correct) \
torture_assert_casestr_equal ( tctx , v , correct , " Incorrect value " )
# define CHECK_NAME(tctx, _name, correct) do { \
CHECK_STRING ( tctx , ( _name ) . name , ( correct ) . name ) ; \
CHECK_VALUE ( tctx , ( uint8_t ) ( _name ) . type , ( uint8_t ) ( correct ) . type ) ; \
CHECK_STRING ( tctx , ( _name ) . scope , ( correct ) . scope ) ; \
2005-02-11 09:58:07 +03:00
} while ( 0 )
2005-02-10 06:22:47 +03:00
2005-02-14 06:39:25 +03:00
2005-02-10 06:22:47 +03:00
/*
test operations against a WINS server
*/
2006-10-16 17:06:41 +04:00
static bool nbt_test_wins_name ( struct torture_context * tctx , const char * address ,
2008-01-11 21:10:30 +03:00
struct nbt_name * name , uint16_t nb_flags ,
bool try_low_port )
2005-02-10 06:22:47 +03:00
{
struct nbt_name_register_wins io ;
struct nbt_name_query query ;
struct nbt_name_refresh_wins refresh ;
struct nbt_name_release release ;
NTSTATUS status ;
2008-06-06 00:02:41 +04:00
struct nbt_name_socket * nbtsock = torture_init_nbt_socket ( tctx ) ;
2007-12-12 00:23:14 +03:00
const char * myaddress ;
2006-01-10 01:12:53 +03:00
struct socket_address * socket_address ;
2007-12-12 00:23:14 +03:00
struct interface * ifaces ;
2008-01-11 21:10:30 +03:00
bool low_port = try_low_port ;
2007-12-12 00:23:14 +03:00
2007-12-12 00:23:20 +03:00
load_interfaces ( tctx , lp_interfaces ( tctx - > lp_ctx ) , & ifaces ) ;
2007-12-12 00:23:14 +03:00
myaddress = talloc_strdup ( tctx , iface_best_ip ( ifaces , address ) ) ;
2006-01-10 01:12:53 +03:00
2006-10-16 17:06:41 +04:00
socket_address = socket_address_from_strings ( tctx ,
2006-01-10 01:12:53 +03:00
nbtsock - > sock - > backend_name ,
2008-01-11 21:01:50 +03:00
myaddress , lp_nbt_port ( tctx - > lp_ctx ) ) ;
2006-10-16 17:06:41 +04:00
torture_assert ( tctx , socket_address ! = NULL ,
" Error getting address " ) ;
2005-02-10 06:22:47 +03:00
/* we do the listen here to ensure the WINS server receives the packets from
the right IP */
2006-01-10 01:12:53 +03:00
status = socket_listen ( nbtsock - > sock , socket_address , 0 , 0 ) ;
talloc_free ( socket_address ) ;
2008-01-11 21:01:50 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
low_port = false ;
socket_address = socket_address_from_strings ( tctx ,
nbtsock - > sock - > backend_name ,
myaddress , 0 ) ;
torture_assert ( tctx , socket_address ! = NULL ,
" Error getting address " ) ;
status = socket_listen ( nbtsock - > sock , socket_address , 0 , 0 ) ;
talloc_free ( socket_address ) ;
torture_assert_ntstatus_ok ( tctx , status ,
" socket_listen for WINS failed " ) ;
}
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " Testing name registration to WINS with name %s at %s nb_flags=0x%x \n " ,
nbt_name_string ( tctx , name ) , myaddress , nb_flags ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " release the name \n " ) ;
2005-02-11 13:37:59 +03:00
release . in . name = * name ;
2007-12-12 04:15:20 +03:00
release . in . dest_port = lp_nbt_port ( tctx - > lp_ctx ) ;
2005-02-11 13:37:59 +03:00
release . in . dest_addr = address ;
release . in . address = myaddress ;
2005-02-14 06:39:25 +03:00
release . in . nb_flags = nb_flags ;
2007-10-07 02:28:14 +04:00
release . in . broadcast = false ;
2005-02-11 13:37:59 +03:00
release . in . timeout = 3 ;
release . in . retries = 0 ;
2006-10-16 17:06:41 +04:00
status = nbt_name_release ( nbtsock , tctx , & release ) ;
torture_assert_ntstatus_ok ( tctx , status , talloc_asprintf ( tctx , " Bad response from %s for name query " , address ) ) ;
CHECK_VALUE ( tctx , release . out . rcode , 0 ) ;
2005-02-11 13:37:59 +03:00
2008-01-11 21:05:33 +03:00
if ( nb_flags & NBT_NM_GROUP ) {
/* ignore this for group names */
} else if ( ! low_port ) {
torture_comment ( tctx , " no low port - skip: register the name with a wrong address \n " ) ;
} else {
torture_comment ( tctx , " register the name with a wrong address (makes the next request slow!) \n " ) ;
io . in . name = * name ;
io . in . wins_port = lp_nbt_port ( tctx - > lp_ctx ) ;
io . in . wins_servers = str_list_make ( tctx , address , NULL ) ;
io . in . addresses = str_list_make ( tctx , " 127.64.64.1 " , NULL ) ;
io . in . nb_flags = nb_flags ;
io . in . ttl = 300000 ;
status = nbt_name_register_wins ( nbtsock , tctx , & io ) ;
if ( NT_STATUS_EQUAL ( status , NT_STATUS_IO_TIMEOUT ) ) {
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " No response from %s for name register \n " ,
address ) ) ;
}
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " Bad response from %s for name register \n " ,
address ) ) ;
CHECK_STRING ( tctx , io . out . wins_server , address ) ;
CHECK_VALUE ( tctx , io . out . rcode , 0 ) ;
}
torture_comment ( tctx , " register the name correct address \n " ) ;
2005-02-11 09:58:07 +03:00
io . in . name = * name ;
2007-12-12 04:15:29 +03:00
io . in . wins_port = lp_nbt_port ( tctx - > lp_ctx ) ;
2008-10-12 02:56:56 +04:00
io . in . wins_servers = ( const char * * ) str_list_make ( tctx , address , NULL ) ;
io . in . addresses = ( const char * * ) str_list_make ( tctx , myaddress , NULL ) ;
2005-02-14 06:39:25 +03:00
io . in . nb_flags = nb_flags ;
2005-02-10 06:22:47 +03:00
io . in . ttl = 300000 ;
2006-10-16 17:06:41 +04:00
status = nbt_name_register_wins ( nbtsock , tctx , & io ) ;
torture_assert_ntstatus_ok ( tctx , status , talloc_asprintf ( tctx , " Bad response from %s for name register " , address ) ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
CHECK_STRING ( tctx , io . out . wins_server , address ) ;
CHECK_VALUE ( tctx , io . out . rcode , 0 ) ;
2005-02-10 06:22:47 +03:00
2005-12-22 02:05:32 +03:00
if ( name - > type ! = NBT_NAME_MASTER & &
2005-02-15 14:14:04 +03:00
name - > type ! = NBT_NAME_LOGON & &
2005-12-22 02:05:32 +03:00
name - > type ! = NBT_NAME_BROWSER & &
2005-02-15 14:14:04 +03:00
( nb_flags & NBT_NM_GROUP ) ) {
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " Try to register as non-group \n " ) ;
2005-02-14 06:39:25 +03:00
io . in . nb_flags & = ~ NBT_NM_GROUP ;
2006-10-16 17:06:41 +04:00
status = nbt_name_register_wins ( nbtsock , tctx , & io ) ;
torture_assert_ntstatus_ok ( tctx , status , talloc_asprintf ( tctx , " Bad response from %s for name register \n " ,
address ) ) ;
CHECK_VALUE ( tctx , io . out . rcode , NBT_RCODE_ACT ) ;
2005-02-14 06:39:25 +03:00
}
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " query the name to make sure its there \n " ) ;
2005-02-11 09:58:07 +03:00
query . in . name = * name ;
2005-02-10 06:22:47 +03:00
query . in . dest_addr = address ;
2007-12-06 18:26:56 +03:00
query . in . dest_port = lp_nbt_port ( tctx - > lp_ctx ) ;
2007-10-07 02:28:14 +04:00
query . in . broadcast = false ;
query . in . wins_lookup = true ;
2005-02-10 06:22:47 +03:00
query . in . timeout = 3 ;
query . in . retries = 0 ;
2006-10-16 17:06:41 +04:00
status = nbt_name_query ( nbtsock , tctx , & query ) ;
2005-02-14 15:46:03 +03:00
if ( name - > type = = NBT_NAME_MASTER ) {
2006-10-16 17:06:41 +04:00
torture_assert_ntstatus_equal (
tctx , status , NT_STATUS_OBJECT_NAME_NOT_FOUND ,
talloc_asprintf ( tctx , " Bad response from %s for name query " , address ) ) ;
return true ;
2005-02-10 06:22:47 +03:00
}
2006-10-16 17:06:41 +04:00
torture_assert_ntstatus_ok ( tctx , status , talloc_asprintf ( tctx , " Bad response from %s for name query " , address ) ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
CHECK_NAME ( tctx , query . out . name , * name ) ;
CHECK_VALUE ( tctx , query . out . num_addrs , 1 ) ;
2005-02-15 14:14:04 +03:00
if ( name - > type ! = NBT_NAME_LOGON & &
( nb_flags & NBT_NM_GROUP ) ) {
2006-10-16 17:06:41 +04:00
CHECK_STRING ( tctx , query . out . reply_addrs [ 0 ] , " 255.255.255.255 " ) ;
2005-02-14 06:39:25 +03:00
} else {
2006-10-16 17:06:41 +04:00
CHECK_STRING ( tctx , query . out . reply_addrs [ 0 ] , myaddress ) ;
2005-02-14 06:39:25 +03:00
}
2005-02-10 06:22:47 +03:00
2005-02-11 10:54:20 +03:00
2006-10-16 17:06:41 +04:00
query . in . name . name = strupper_talloc ( tctx , name - > name ) ;
2005-02-11 10:54:20 +03:00
if ( query . in . name . name & &
strcmp ( query . in . name . name , name - > name ) ! = 0 ) {
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " check case sensitivity \n " ) ;
status = nbt_name_query ( nbtsock , tctx , & query ) ;
torture_assert_ntstatus_equal ( tctx , status , NT_STATUS_OBJECT_NAME_NOT_FOUND , talloc_asprintf ( tctx , " Bad response from %s for name query " , address ) ) ;
2005-02-11 10:54:20 +03:00
}
query . in . name = * name ;
if ( name - > scope ) {
2006-10-16 17:06:41 +04:00
query . in . name . scope = strupper_talloc ( tctx , name - > scope ) ;
2005-02-11 10:54:20 +03:00
}
if ( query . in . name . scope & &
strcmp ( query . in . name . scope , name - > scope ) ! = 0 ) {
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " check case sensitivity on scope \n " ) ;
status = nbt_name_query ( nbtsock , tctx , & query ) ;
torture_assert_ntstatus_equal ( tctx , status , NT_STATUS_OBJECT_NAME_NOT_FOUND , talloc_asprintf ( tctx , " Bad response from %s for name query " , address ) ) ;
2005-02-11 10:54:20 +03:00
}
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " refresh the name \n " ) ;
2005-02-11 09:58:07 +03:00
refresh . in . name = * name ;
2007-12-12 04:15:20 +03:00
refresh . in . wins_port = lp_nbt_port ( tctx - > lp_ctx ) ;
2008-10-12 02:56:56 +04:00
refresh . in . wins_servers = ( const char * * ) str_list_make ( tctx , address , NULL ) ;
refresh . in . addresses = ( const char * * ) str_list_make ( tctx , myaddress , NULL ) ;
2005-02-14 06:39:25 +03:00
refresh . in . nb_flags = nb_flags ;
2005-02-10 06:22:47 +03:00
refresh . in . ttl = 12345 ;
2006-10-16 17:06:41 +04:00
status = nbt_name_refresh_wins ( nbtsock , tctx , & refresh ) ;
2008-01-11 21:05:33 +03:00
if ( NT_STATUS_EQUAL ( status , NT_STATUS_IO_TIMEOUT ) ) {
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " No response from %s for name refresh " ,
address ) ) ;
}
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " Bad response from %s for name refresh " ,
address ) ) ;
CHECK_STRING ( tctx , refresh . out . wins_server , address ) ;
CHECK_VALUE ( tctx , refresh . out . rcode , 0 ) ;
printf ( " release the name \n " ) ;
release . in . name = * name ;
release . in . dest_port = lp_nbt_port ( tctx - > lp_ctx ) ;
release . in . dest_addr = address ;
release . in . address = myaddress ;
release . in . nb_flags = nb_flags ;
release . in . broadcast = false ;
release . in . timeout = 3 ;
release . in . retries = 0 ;
status = nbt_name_release ( nbtsock , tctx , & release ) ;
if ( NT_STATUS_EQUAL ( status , NT_STATUS_IO_TIMEOUT ) ) {
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " No response from %s for name release " ,
address ) ) ;
}
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " Bad response from %s for name release " ,
address ) ) ;
CHECK_NAME ( tctx , release . out . name , * name ) ;
CHECK_VALUE ( tctx , release . out . rcode , 0 ) ;
if ( nb_flags & NBT_NM_GROUP ) {
/* ignore this for group names */
} else if ( ! low_port ) {
torture_comment ( tctx , " no low port - skip: register the name with a wrong address \n " ) ;
} else {
torture_comment ( tctx , " register the name with a wrong address (makes the next request slow!) \n " ) ;
io . in . name = * name ;
io . in . wins_port = lp_nbt_port ( tctx - > lp_ctx ) ;
io . in . wins_servers = str_list_make ( tctx , address , NULL ) ;
io . in . addresses = str_list_make ( tctx , " 127.64.64.1 " , NULL ) ;
io . in . nb_flags = nb_flags ;
io . in . ttl = 300000 ;
2005-02-10 06:22:47 +03:00
2008-01-11 21:05:33 +03:00
status = nbt_name_register_wins ( nbtsock , tctx , & io ) ;
if ( NT_STATUS_EQUAL ( status , NT_STATUS_IO_TIMEOUT ) ) {
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " No response from %s for name register \n " ,
address ) ) ;
}
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " Bad response from %s for name register \n " ,
address ) ) ;
CHECK_STRING ( tctx , io . out . wins_server , address ) ;
CHECK_VALUE ( tctx , io . out . rcode , 0 ) ;
}
torture_comment ( tctx , " refresh the name with the correct address \n " ) ;
refresh . in . name = * name ;
refresh . in . wins_port = lp_nbt_port ( tctx - > lp_ctx ) ;
refresh . in . wins_servers = str_list_make ( tctx , address , NULL ) ;
refresh . in . addresses = str_list_make ( tctx , myaddress , NULL ) ;
refresh . in . nb_flags = nb_flags ;
refresh . in . ttl = 12345 ;
status = nbt_name_refresh_wins ( nbtsock , tctx , & refresh ) ;
if ( NT_STATUS_EQUAL ( status , NT_STATUS_IO_TIMEOUT ) ) {
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " No response from %s for name refresh " ,
address ) ) ;
}
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " Bad response from %s for name refresh " ,
address ) ) ;
2006-10-16 17:06:41 +04:00
CHECK_STRING ( tctx , refresh . out . wins_server , address ) ;
CHECK_VALUE ( tctx , refresh . out . rcode , 0 ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " release the name \n " ) ;
2005-02-11 09:58:07 +03:00
release . in . name = * name ;
2009-01-17 12:06:08 +03:00
release . in . dest_port = lp_nbt_port ( tctx - > lp_ctx ) ;
2005-02-10 06:22:47 +03:00
release . in . dest_addr = address ;
release . in . address = myaddress ;
2005-02-14 06:39:25 +03:00
release . in . nb_flags = nb_flags ;
2007-10-07 02:28:14 +04:00
release . in . broadcast = false ;
2005-02-10 06:22:47 +03:00
release . in . timeout = 3 ;
release . in . retries = 0 ;
2006-10-16 17:06:41 +04:00
status = nbt_name_release ( nbtsock , tctx , & release ) ;
torture_assert_ntstatus_ok ( tctx , status , talloc_asprintf ( tctx , " Bad response from %s for name query " , address ) ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
CHECK_NAME ( tctx , release . out . name , * name ) ;
CHECK_VALUE ( tctx , release . out . rcode , 0 ) ;
torture_comment ( tctx , " release again \n " ) ;
status = nbt_name_release ( nbtsock , tctx , & release ) ;
torture_assert_ntstatus_ok ( tctx , status ,
talloc_asprintf ( tctx , " Bad response from %s for name query " ,
address ) ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
CHECK_NAME ( tctx , release . out . name , * name ) ;
CHECK_VALUE ( tctx , release . out . rcode , 0 ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
torture_comment ( tctx , " query the name to make sure its gone \n " ) ;
2005-02-11 10:54:20 +03:00
query . in . name = * name ;
2006-10-16 17:06:41 +04:00
status = nbt_name_query ( nbtsock , tctx , & query ) ;
2005-02-15 14:14:04 +03:00
if ( name - > type ! = NBT_NAME_LOGON & &
( nb_flags & NBT_NM_GROUP ) ) {
2006-10-16 17:06:41 +04:00
torture_assert_ntstatus_ok ( tctx , status ,
" ERROR: Name query failed after group release " ) ;
2005-02-14 06:39:25 +03:00
} else {
2006-10-16 17:06:41 +04:00
torture_assert_ntstatus_equal ( tctx , status ,
NT_STATUS_OBJECT_NAME_NOT_FOUND ,
" Incorrect response to name query " ) ;
2005-02-10 06:22:47 +03:00
}
2006-10-16 17:06:41 +04:00
return true ;
2005-02-10 06:22:47 +03:00
}
2005-02-11 09:58:07 +03:00
/*
test operations against a WINS server
*/
2006-10-16 17:06:41 +04:00
static bool nbt_test_wins ( struct torture_context * tctx )
2005-02-11 09:58:07 +03:00
{
struct nbt_name name ;
2005-12-22 02:05:32 +03:00
uint32_t r = ( uint32_t ) ( random ( ) % ( 100000 ) ) ;
2006-10-16 17:06:41 +04:00
const char * address ;
bool ret = true ;
if ( ! torture_nbt_get_name ( tctx , & name , & address ) )
return false ;
2005-02-11 09:58:07 +03:00
2006-10-16 17:06:41 +04:00
name . name = talloc_asprintf ( tctx , " _TORTURE-%5u " , r ) ;
2005-12-31 11:42:01 +03:00
2005-02-11 09:58:07 +03:00
name . type = NBT_NAME_CLIENT ;
name . scope = NULL ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , true ) ;
2005-02-14 06:39:25 +03:00
2005-02-14 15:46:03 +03:00
name . type = NBT_NAME_MASTER ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , false ) ;
2005-02-14 15:46:03 +03:00
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H | NBT_NM_GROUP , false ) ;
2005-02-14 15:46:03 +03:00
2005-12-31 11:42:01 +03:00
name . type = NBT_NAME_SERVER ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , true ) ;
2005-12-31 11:42:01 +03:00
2005-02-15 14:14:04 +03:00
name . type = NBT_NAME_LOGON ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H | NBT_NM_GROUP , false ) ;
2005-02-15 14:14:04 +03:00
2005-12-22 02:05:32 +03:00
name . type = NBT_NAME_BROWSER ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H | NBT_NM_GROUP , false ) ;
2005-12-22 02:05:32 +03:00
2005-12-31 11:42:01 +03:00
name . type = NBT_NAME_PDC ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , true ) ;
2005-12-31 11:42:01 +03:00
name . type = 0xBF ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , true ) ;
2005-12-31 11:42:01 +03:00
name . type = 0xBE ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , false ) ;
2005-12-31 11:42:01 +03:00
2005-02-14 06:39:25 +03:00
name . scope = " example " ;
name . type = 0x72 ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , true ) ;
2005-02-11 09:58:07 +03:00
name . scope = " example " ;
name . type = 0x71 ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H | NBT_NM_GROUP , false ) ;
2005-02-11 09:58:07 +03:00
name . scope = " foo.example.com " ;
2005-02-14 06:39:25 +03:00
name . type = 0x72 ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , false ) ;
2005-02-11 09:58:07 +03:00
2006-10-16 17:06:41 +04:00
name . name = talloc_asprintf ( tctx , " _T \01 -%5u.foo " , r ) ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , false ) ;
2005-02-11 09:58:07 +03:00
name . name = " " ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , false ) ;
2005-02-11 09:58:07 +03:00
2006-10-16 17:06:41 +04:00
name . name = talloc_asprintf ( tctx , " . " ) ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , false ) ;
2005-02-11 09:58:07 +03:00
2006-10-16 17:06:41 +04:00
name . name = talloc_asprintf ( tctx , " %5u- \377 \200 \300 FOO " , r ) ;
2008-01-11 21:10:30 +03:00
ret & = nbt_test_wins_name ( tctx , address , & name , NBT_NODE_H , false ) ;
2005-02-11 10:54:20 +03:00
2005-02-11 09:58:07 +03:00
return ret ;
}
2005-02-10 06:22:47 +03:00
/*
test WINS operations
*/
2007-09-07 20:27:57 +04:00
struct torture_suite * torture_nbt_wins ( TALLOC_CTX * mem_ctx )
2005-02-10 06:22:47 +03:00
{
2007-09-07 20:27:57 +04:00
struct torture_suite * suite = torture_suite_create ( mem_ctx , " WINS " ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
torture_suite_add_simple_test ( suite , " wins " , nbt_test_wins ) ;
2005-02-10 06:22:47 +03:00
2006-10-16 17:06:41 +04:00
return suite ;
2005-02-10 06:22:47 +03:00
}