2004-08-18 15:01:06 +04:00
/*
Unix SMB / CIFS implementation .
Copyright ( C ) Stefan Metzmacher 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-08-18 15:01:06 +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-08-18 15:01:06 +04:00
*/
# include "includes.h"
2004-11-02 14:42:35 +03:00
# include "libnet/libnet.h"
2005-06-16 15:36:09 +04:00
# include "lib/events/events.h"
2007-09-08 16:42:09 +04:00
# include "param/param.h"
2007-12-10 20:41:19 +03:00
# include "libcli/resolve/resolve.h"
2004-08-18 15:01:06 +04:00
2008-12-29 22:24:57 +03:00
struct libnet_context * libnet_context_init ( struct tevent_context * ev ,
2007-12-07 04:37:04 +03:00
struct loadparm_context * lp_ctx )
2004-08-18 15:01:06 +04:00
{
struct libnet_context * ctx ;
2008-04-14 20:43:37 +04:00
/* We require an event context here */
if ( ! ev ) {
return NULL ;
}
2005-07-02 18:32:49 +04:00
/* create brand new libnet context */
2006-09-16 21:59:33 +04:00
ctx = talloc ( ev , struct libnet_context ) ;
2004-08-18 15:01:06 +04:00
if ( ! ctx ) {
return NULL ;
}
2005-06-16 15:36:09 +04:00
ctx - > event_ctx = ev ;
2007-12-07 04:37:04 +03:00
ctx - > lp_ctx = lp_ctx ;
2004-08-18 15:01:06 +04:00
2009-12-25 16:48:45 +03:00
/* make sure dcerpc is initialized */
2011-06-06 08:58:28 +04:00
dcerpc_init ( ) ;
2009-12-25 16:48:45 +03:00
2005-11-21 01:00:47 +03:00
/* name resolution methods */
2010-07-16 08:32:42 +04:00
ctx - > resolve_ctx = lpcfg_resolve_context ( lp_ctx ) ;
2006-05-16 01:49:27 +04:00
2006-08-22 00:52:14 +04:00
/* connected services' params */
ZERO_STRUCT ( ctx - > samr ) ;
2007-05-12 01:44:18 +04:00
ZERO_STRUCT ( ctx - > lsa ) ;
/* default buffer size for various operations requiring specifying a buffer */
ctx - > samr . buf_size = 128 ;
2006-05-18 02:21:24 +04:00
2010-09-24 06:50:00 +04:00
ctx - > server_address = NULL ;
2004-08-18 15:01:06 +04:00
return ctx ;
}