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