r16168: Make the example match the actual function.
[Samba/aatanasov.git] / source / libnet / libnet.c
blob0dca57926d69e8b8b5d193ed7a2339b3a87ff139
1 /*
2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2004
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "includes.h"
22 #include "libnet/libnet.h"
23 #include "lib/events/events.h"
25 struct libnet_context *libnet_context_init(struct event_context *ev)
27 struct libnet_context *ctx;
29 /* create brand new libnet context */
30 ctx = talloc(NULL, struct libnet_context);
31 if (!ctx) {
32 return NULL;
35 /* events */
36 if (ev == NULL) {
37 ev = event_context_find(ctx);
38 if (ev == NULL) {
39 talloc_free(ctx);
40 return NULL;
43 ctx->event_ctx = ev;
45 /* name resolution methods */
46 ctx->name_res_methods = str_list_copy(ctx, lp_name_resolve_order());
48 /* connected domain params */
49 ZERO_STRUCT(ctx->domain);
51 /* currently opened user */
52 ZERO_STRUCT(ctx->user_handle);
54 /* init pipe pointers */
55 ctx->samr_pipe = NULL;
56 ctx->lsa_pipe = NULL;
57 ctx->pipe = NULL;
59 return ctx;