net_vampire: add username/password to samsync_context.
[samba.git] / source3 / libnet / libnet_samsync.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  libnet Support
4  *  Copyright (C) Guenther Deschner 2008
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 3 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, see <http://www.gnu.org/licenses/>.
18  */
19
20
21 enum net_samsync_mode {
22         NET_SAMSYNC_MODE_FETCH_PASSDB = 0,
23         NET_SAMSYNC_MODE_FETCH_LDIF = 1,
24         NET_SAMSYNC_MODE_DUMP = 2
25 };
26
27 struct samsync_context;
28
29 typedef NTSTATUS (*samsync_delta_fn_t)(TALLOC_CTX *,
30                                        enum netr_SamDatabaseID,
31                                        struct netr_DELTA_ENUM_ARRAY *,
32                                        NTSTATUS,
33                                        struct samsync_context *);
34
35 struct samsync_context {
36         enum net_samsync_mode mode;
37         const struct dom_sid *domain_sid;
38         const char *domain_sid_str;
39         const char *domain_name;
40         const char *output_filename;
41
42         const char *username;
43         const char *password;
44
45         char *result_message;
46         char *error_message;
47
48         struct rpc_pipe_client *cli;
49         samsync_delta_fn_t delta_fn;
50         void *private_data;
51 };
52
53 NTSTATUS fetch_sam_entries_ldif(TALLOC_CTX *mem_ctx,
54                                 enum netr_SamDatabaseID database_id,
55                                 struct netr_DELTA_ENUM_ARRAY *r,
56                                 NTSTATUS result,
57                                 struct samsync_context *ctx);
58 NTSTATUS fetch_sam_entries(TALLOC_CTX *mem_ctx,
59                            enum netr_SamDatabaseID database_id,
60                            struct netr_DELTA_ENUM_ARRAY *r,
61                            NTSTATUS status,
62                            struct samsync_context *ctx);
63 NTSTATUS display_sam_entries(TALLOC_CTX *mem_ctx,
64                              enum netr_SamDatabaseID database_id,
65                              struct netr_DELTA_ENUM_ARRAY *r,
66                              NTSTATUS status,
67                              struct samsync_context *ctx);