summaryrefslogtreecommitdiffstats
path: root/lib/cmdline/cmdline_private.h
blob: b1584e020dc90adbcb5a14c928cbc8339155ab69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 * Copyright (c) 2020      Andreas Schneider <asn@samba.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _CMDLINE_PRIVATE_H
#define _CMDLINE_PRIVATE_H

#include "lib/cmdline/cmdline.h"

enum {
	OPT_OPTION = 0x1000000,
	OPT_NETBIOS_SCOPE,
	OPT_LEAK_REPORT,
	OPT_LEAK_REPORT_FULL,
	OPT_DEBUG_STDOUT,
	OPT_CONFIGFILE,
	OPT_SIMPLE_BIND_DN,
	OPT_PASSWORD,
	OPT_NT_HASH,
	OPT_USE_KERBEROS,
	OPT_USE_KERBEROS_CCACHE,
	OPT_USE_WINBIND_CCACHE,
	OPT_CLIENT_PROTECTION,
	OPT_DAEMON,
	OPT_INTERACTIVE,
	OPT_FORK,
	OPT_NO_PROCESS_GROUP,
};

typedef bool (*samba_cmdline_load_config)(void);

/**
 * @internal
 *
 * @brief Initialize the commandline interface for parsing options.
 *
 * This the common function to initialize the command line interface. This
 * initializes:
 *
 *   - Crash setup
 *   - logging system sening logs to stdout
 *   - talloc leak reporting
 *
 * @param[in]  mem_ctx  The talloc memory context to use for allocating memory.
 *                      This should be a long living context till the client
 *                      exits.
 *
 * @return true on success, false if an error occured.
 */
bool samba_cmdline_init_common(TALLOC_CTX *mem_ctx);

/**
 * @brief Set the callback for loading the smb.conf file.
 *
 * This is needed as sourc3 and source4 have different code for loading the
 * smb.conf file.
 *
 * @param[in]  fn  The callback to load the smb.conf file.
 *
 * @return true on success, false if an error occured.
 */
bool samba_cmdline_set_load_config_fn(samba_cmdline_load_config fn);

/**
 * @internal
 *
 * @brief Set the talloc context for the command line interface.
 *
 * This is stored as a static pointer.
 *
 * @param[in]  mem_ctx  The talloc memory context.
 *
 * @return true on success, false if an error occured.
 */
bool samba_cmdline_set_talloc_ctx(TALLOC_CTX *mem_ctx);

/**
 * @internal
 *
 * @brief Get the talloc context for the cmdline interface.
 *
 * @return A talloc context.
 */
TALLOC_CTX *samba_cmdline_get_talloc_ctx(void);

/**
 * @internal
 *
 * @brief Set the loadparm context for the command line interface.
 *
 * @param[in]  lp_ctx  The loadparm context to use.
 *
 * @return true on success, false if an error occured.
 */
bool samba_cmdline_set_lp_ctx(struct loadparm_context *lp_ctx);

/**
 * @internal
 *
 * @brief Set the client credentials for the commandline interface.
 *
 * @param[in]  creds   The client credentials to use.
 *
 * @return true on success, false if an error occured.
 */
bool samba_cmdline_set_creds(struct cli_credentials *creds);

#endif /* _CMDLINE_PRIVATE_H */