r20011: define libnet_BecomeDC_state struct and add some dummy functions
[jra/samba/.git] / source4 / libnet / libnet_become_dc.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    Copyright (C) Stefan Metzmacher      2006
5
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.
10
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.
15
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.
19 */
20
21 #include "includes.h"
22 #include "libnet/libnet.h"
23 #include "libcli/composite/composite.h"
24
25 struct libnet_BecomeDC_state {
26         struct libnet_context *libnet;
27
28         struct becomeDC_ldap {
29                 struct ldb_context *ldb;
30                 struct ldb_message *rootdse;
31         } ldap1;
32
33         struct {
34                 const char *dns_name;
35                 const char *netbios_name;
36                 const char *domain_dn_str;
37                 const char *config_dn_str;
38                 const char *schema_dn_str;
39         } domain_info;
40
41         struct {
42                 const char *dns_name;
43                 const char *netbios_name;
44                 const char *address;
45                 const char *server_dn_str;
46                 const char *ntds_dn_str;
47         } source_dsa;
48
49         struct {
50                 const char *hostname;
51         } dest_dsa;
52 };
53
54
55 static NTSTATUS becomeDC_ldap_connect(struct libnet_BecomeDC_state *s, struct becomeDC_ldap *ldap)
56 {
57         return NT_STATUS_NOT_IMPLEMENTED;
58 }
59
60 static NTSTATUS becomeDC_ldap1_requests(struct libnet_BecomeDC_state *s)
61 {
62         return NT_STATUS_NOT_IMPLEMENTED;
63 }
64
65 struct composite_context *libnet_BecomeDC_send(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_BecomeDC *r)
66 {
67         struct composite_context *c;
68         struct libnet_BecomeDC_state *s;
69
70         c = composite_create(mem_ctx, ctx->event_ctx);
71         if (c == NULL) return NULL;
72
73         s = talloc_zero(c, struct libnet_BecomeDC_state);
74         if (composite_nomem(s, c)) return c;
75         c->private_data = s;
76
77         s->libnet = ctx;
78
79         s->source_dsa.address = talloc_strdup(s, r->in.dest_address);
80         if (composite_nomem(s->source_dsa.address, c)) return c;
81
82         c->status = becomeDC_ldap_connect(s, &s->ldap1);
83         if (!composite_is_ok(c)) return c;
84
85         c->status = becomeDC_ldap1_requests(s);
86         if (!composite_is_ok(c)) return c;
87
88         return c;
89 }
90
91 NTSTATUS libnet_BecomeDC_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, struct libnet_BecomeDC *r)
92 {
93         NTSTATUS status;
94
95         status = composite_wait(c);
96
97         ZERO_STRUCT(r->out);
98
99         talloc_free(c);
100         return status;
101 }
102
103 NTSTATUS libnet_BecomeDC(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_BecomeDC *r)
104 {
105         NTSTATUS status;
106         struct composite_context *c;
107         c = libnet_BecomeDC_send(ctx, mem_ctx, r);
108         status = libnet_BecomeDC_recv(c, mem_ctx, r);
109         return status;
110 }