2004-06-17 04:31:24 +04:00
/*
Unix SMB / CIFS implementation .
dcerpc torture tests
Copyright ( C ) Andrew Tridgell 2003
Copyright ( C ) Andrew Bartlett < abartlet @ samba . org 2004
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
2004-06-17 04:31:24 +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/>.
2004-06-17 04:31:24 +04:00
*/
# include "includes.h"
2006-05-28 01:39:56 +04:00
# include "librpc/gen_ndr/ndr_lsa_c.h"
2005-03-22 00:22:07 +03:00
# include "lib/cmdline/popt_common.h"
2010-04-14 00:06:51 +04:00
# include "torture/rpc/torture_rpc.h"
2004-06-17 04:31:24 +04:00
2004-06-18 15:58:43 +04:00
/*
This test is ' bogus ' in that it doesn ' t actually perform to the
spec . We need to deal with other things inside the DCERPC layer ,
before we could have multiple binds .
2004-06-17 04:31:24 +04:00
2004-06-18 15:58:43 +04:00
We should never pass this test , until such details are fixed in our
client , and it looks like multible binds are never used anyway .
*/
2004-06-17 04:31:24 +04:00
2007-10-07 02:28:14 +04:00
bool torture_multi_bind ( struct torture_context * torture )
2004-06-17 04:31:24 +04:00
{
struct dcerpc_pipe * p ;
struct dcerpc_binding * binding ;
TALLOC_CTX * mem_ctx ;
NTSTATUS status ;
2007-10-07 02:28:14 +04:00
bool ret ;
2004-06-17 04:31:24 +04:00
2004-06-19 08:31:12 +04:00
mem_ctx = talloc_init ( " torture_multi_bind " ) ;
2007-08-28 23:03:08 +04:00
status = torture_rpc_binding ( torture , & binding ) ;
2004-06-17 04:31:24 +04:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
2005-01-27 10:08:20 +03:00
talloc_free ( mem_ctx ) ;
2007-10-07 02:28:14 +04:00
return false ;
2004-06-17 04:31:24 +04:00
}
2007-08-28 16:54:27 +04:00
status = torture_rpc_connection ( torture , & p , & ndr_table_lsarpc ) ;
2004-06-17 04:31:24 +04:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
2005-03-22 11:00:45 +03:00
talloc_free ( mem_ctx ) ;
2007-10-07 02:28:14 +04:00
return false ;
2004-06-17 04:31:24 +04:00
}
2007-12-07 04:37:04 +03:00
status = dcerpc_pipe_auth ( mem_ctx , & p , binding , & ndr_table_lsarpc , cmdline_credentials ,
torture - > lp_ctx ) ;
2004-06-17 04:31:24 +04:00
if ( NT_STATUS_IS_OK ( status ) ) {
2005-03-01 19:08:36 +03:00
printf ( " (incorrectly) allowed re-bind to uuid %s - %s \n " ,
2007-08-20 01:23:03 +04:00
GUID_string ( mem_ctx , & ndr_table_lsarpc . syntax_id . uuid ) , nt_errstr ( status ) ) ;
2007-10-07 02:28:14 +04:00
ret = false ;
2004-06-17 04:31:24 +04:00
} else {
2005-03-01 19:08:36 +03:00
printf ( " \n " ) ;
2007-10-07 02:28:14 +04:00
ret = true ;
2004-06-17 04:31:24 +04:00
}
2005-01-27 10:08:20 +03:00
talloc_free ( mem_ctx ) ;
2004-06-17 04:31:24 +04:00
return ret ;
}