2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Guenther Deschner 2008
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 3 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, see <http://www.gnu.org/licenses/>.
20 #include "../librpc/gen_ndr/netlogon.h"
22 enum net_samsync_mode
{
23 NET_SAMSYNC_MODE_FETCH_PASSDB
= 0,
24 NET_SAMSYNC_MODE_FETCH_LDIF
= 1,
25 NET_SAMSYNC_MODE_FETCH_KEYTAB
= 2,
26 NET_SAMSYNC_MODE_DUMP
= 3
29 struct samsync_context
;
32 NTSTATUS (*startup
)(TALLOC_CTX
*mem_ctx
,
33 struct samsync_context
*ctx
,
34 enum netr_SamDatabaseID id
,
35 uint64_t *sequence_num
);
36 NTSTATUS (*process_objects
)(TALLOC_CTX
*mem_ctx
,
37 enum netr_SamDatabaseID id
,
38 struct netr_DELTA_ENUM_ARRAY
*array
,
39 uint64_t *sequence_num
,
40 struct samsync_context
*ctx
);
41 NTSTATUS (*finish
)(TALLOC_CTX
*mem_ctx
,
42 struct samsync_context
*ctx
,
43 enum netr_SamDatabaseID id
,
44 uint64_t sequence_num
);
47 struct samsync_object
{
57 struct samsync_context
{
58 enum net_samsync_mode mode
;
59 const struct dom_sid
*domain_sid
;
60 const char *domain_sid_str
;
61 const char *domain_name
;
62 const char *output_filename
;
70 bool single_object_replication
;
71 bool force_full_replication
;
72 bool clean_old_entries
;
75 struct samsync_object
*objects
;
77 struct rpc_pipe_client
*cli
;
78 struct netlogon_creds_cli_context
*netlogon_creds
;
79 struct messaging_context
*msg_ctx
;
81 const struct samsync_ops
*ops
;
86 extern const struct samsync_ops libnet_samsync_ldif_ops
;
87 extern const struct samsync_ops libnet_samsync_keytab_ops
;
88 extern const struct samsync_ops libnet_samsync_display_ops
;
89 extern const struct samsync_ops libnet_samsync_passdb_ops
;
91 /* The following definitions come from libnet/libnet_samsync.c */
93 NTSTATUS
libnet_samsync_init_context(TALLOC_CTX
*mem_ctx
,
94 const struct dom_sid
*domain_sid
,
95 struct samsync_context
**ctx_p
);
96 NTSTATUS
libnet_samsync(enum netr_SamDatabaseID database_id
,
97 struct samsync_context
*ctx
);
98 NTSTATUS
pull_netr_AcctLockStr(TALLOC_CTX
*mem_ctx
,
99 struct lsa_BinaryString
*r
,
100 struct netr_AcctLockStr
**str_p
);