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/>.
21 enum net_samsync_mode {
22 NET_SAMSYNC_MODE_FETCH_PASSDB = 0,
23 NET_SAMSYNC_MODE_FETCH_LDIF = 1,
24 NET_SAMSYNC_MODE_FETCH_KEYTAB = 2,
25 NET_SAMSYNC_MODE_DUMP = 3
28 struct samsync_context;
31 NTSTATUS (*startup)(TALLOC_CTX *mem_ctx,
32 struct samsync_context *ctx,
33 enum netr_SamDatabaseID id,
34 uint64_t *sequence_num);
35 NTSTATUS (*process_objects)(TALLOC_CTX *mem_ctx,
36 enum netr_SamDatabaseID id,
37 struct netr_DELTA_ENUM_ARRAY *array,
38 uint64_t *sequence_num,
39 struct samsync_context *ctx);
40 NTSTATUS (*finish)(TALLOC_CTX *mem_ctx,
41 struct samsync_context *ctx,
42 enum netr_SamDatabaseID id,
43 uint64_t sequence_num);
46 struct samsync_object {
56 struct samsync_context {
57 enum net_samsync_mode mode;
58 const struct dom_sid *domain_sid;
59 const char *domain_sid_str;
60 const char *domain_name;
61 const char *output_filename;
69 bool single_object_replication;
70 bool force_full_replication;
71 bool clean_old_entries;
74 struct samsync_object *objects;
76 struct rpc_pipe_client *cli;
78 const struct samsync_ops *ops;
83 extern const struct samsync_ops libnet_samsync_ldif_ops;
84 extern const struct samsync_ops libnet_samsync_keytab_ops;
85 extern const struct samsync_ops libnet_samsync_display_ops;
86 extern const struct samsync_ops libnet_samsync_passdb_ops;
88 /* The following definitions come from libnet/libnet_samsync.c */
90 NTSTATUS libnet_samsync_init_context(TALLOC_CTX *mem_ctx,
91 const struct dom_sid *domain_sid,
92 struct samsync_context **ctx_p);
93 NTSTATUS libnet_samsync(enum netr_SamDatabaseID database_id,
94 struct samsync_context *ctx);
95 NTSTATUS pull_netr_AcctLockStr(TALLOC_CTX *mem_ctx,
96 struct lsa_BinaryString *r,
97 struct netr_AcctLockStr **str_p);