3 * Unix SMB/CIFS implementation.
5 * Type definitions for loadparm
7 * Copyright (c) 2020 Andreas Schneider <asn@samba.org>
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef _S3_LOADPARM_H
23 #define _S3_LOADPARM_H
28 /* Forward declarations */
29 typedef struct stat_ex SMB_STRUCT_STAT
;
30 typedef struct files_struct files_struct
;
31 struct smbd_server_connection
;
32 struct security_descriptor
;
33 struct loadparm_context
;
35 /* The following definitions come from param/loadparm.c */
37 void loadparm_s3_init_globals(struct loadparm_context
*lp_ctx
,
40 const struct loadparm_substitution
*loadparm_s3_global_substitution(void);
42 char *lp_parm_substituted_string(TALLOC_CTX
*mem_ctx
,
43 const struct loadparm_substitution
*lp_sub
,
49 char *lp_servicename(TALLOC_CTX
*ctx
, const struct loadparm_substitution
*, int);
50 const char *lp_const_servicename(int);
51 bool lp_autoloaded(int);
52 const char *lp_dnsdomain(void);
53 int lp_winbind_max_domain_connections(void);
54 bool lp_idmap_range(const char *domain_name
, uint32_t *low
, uint32_t *high
);
55 bool lp_idmap_default_range(uint32_t *low
, uint32_t *high
);
56 const char *lp_idmap_backend(const char *domain_name
);
57 const char *lp_idmap_default_backend (void);
58 int lp_security(void);
59 int lp_client_max_protocol(void);
60 int lp_client_ipc_min_protocol(void);
61 int lp_client_ipc_max_protocol(void);
62 int lp_client_ipc_signing(void);
63 enum credentials_use_kerberos
lp_client_use_kerberos(void);
64 int lp_smb2_max_credits(void);
65 int lp_cups_encrypt(void);
66 bool lp_widelinks(int );
67 int lp_rpc_low_port(void);
68 int lp_rpc_high_port(void);
69 bool lp_lanman_auth(void);
70 enum samba_weak_crypto
lp_weak_crypto(void);
72 int lp_wi_scan_global_parametrics(
73 const char *regex
, size_t max_matches
,
74 bool (*cb
)(const char *string
, regmatch_t matches
[],
78 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
);
79 struct loadparm_service
;
80 const char *lp_parm_const_string_service(struct loadparm_service
*service
, const char *type
,
81 const char *option
, const char *def
);
82 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
);
83 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
);
84 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
);
85 unsigned long long lp_parm_ulonglong(int snum
, const char *type
,
87 unsigned long long def
);
88 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
);
90 int lp_parm_enum(int snum
, const char *type
, const char *option
,
91 const struct enum_list
*_enum
, int def
);
92 char *canonicalize_servicename(TALLOC_CTX
*ctx
, const char *src
);
93 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
94 const char *user
, const char *pszHomedir
);
95 int lp_add_service(const char *pszService
, int iDefaultService
);
96 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
);
97 bool lp_parameter_is_valid(const char *pszParmName
);
98 bool lp_parameter_is_global(const char *pszParmName
);
99 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
101 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
103 const char **canon_parm
,
104 const char **canon_val
);
105 void show_parameter_list(void);
106 bool lp_invert_boolean(const char *str
, const char **inverse_str
);
107 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
);
108 bool process_registry_service(const char *service_name
);
109 bool process_registry_shares(void);
110 bool lp_config_backend_is_registry(void);
111 bool lp_config_backend_is_file(void);
112 bool lp_file_list_changed(void);
113 const char *lp_ldap_machine_suffix(TALLOC_CTX
*ctx
);
114 const char *lp_ldap_user_suffix(TALLOC_CTX
*ctx
);
115 const char *lp_ldap_group_suffix(TALLOC_CTX
*ctx
);
116 const char *lp_ldap_idmap_suffix(TALLOC_CTX
*ctx
);
118 /* Return a pointer to a service by name. */
119 struct loadparm_service
*lp_service(const char *pszServiceName
);
120 struct loadparm_service
*lp_servicebynum(int snum
);
121 struct loadparm_service
*lp_default_loadparm_service(void);
122 void *lp_parm_ptr(struct loadparm_service
*service
, struct parm_struct
*parm
);
123 void *lp_local_ptr_by_snum(int snum
, struct parm_struct
*parm
);
124 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
);
125 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
);
126 bool lp_snum_ok(int iService
);
127 void lp_add_one_printer(const char *name
, const char *comment
,
128 const char *location
, void *pdata
);
129 bool lp_loaded(void);
130 void lp_killunused(struct smbd_server_connection
*sconn
,
131 bool (*snumused
) (struct smbd_server_connection
*, int));
132 void lp_kill_all_services(void);
133 void lp_killservice(int iServiceIn
);
134 const char* server_role_str(uint32_t role
);
135 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
136 SMB_STRUCT_STAT
*psbuf
,
137 const char *servicename
,
143 char **pp_cp_share_name
,
144 struct security_descriptor
**ppsd
,
146 int load_usershare_service(const char *servicename
);
147 int load_usershare_shares(struct smbd_server_connection
*sconn
,
148 bool (*snumused
) (struct smbd_server_connection
*, int));
149 void gfree_loadparm(void);
150 bool lp_load_initial_only(const char *pszFname
);
151 bool lp_load_global(const char *file_name
);
152 bool lp_load_with_shares(const char *file_name
);
153 bool lp_load_client(const char *file_name
);
154 bool lp_load_global_no_reinit(const char *file_name
);
155 bool lp_load_no_reinit(const char *file_name
);
156 bool lp_load_client_no_reinit(const char *file_name
);
157 bool lp_load_with_registry_shares(const char *pszFname
);
158 int lp_numservices(void);
159 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
);
160 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
);
161 int lp_servicenumber(const char *pszServiceName
);
162 const char *volume_label(TALLOC_CTX
*ctx
, int snum
);
163 bool lp_domain_master(void);
164 bool lp_preferred_master(void);
165 void lp_remove_service(int snum
);
166 void lp_copy_service(int snum
, const char *new_name
);
167 int lp_default_server_announce(void);
168 const char *lp_printername(TALLOC_CTX
*ctx
,
169 const struct loadparm_substitution
*lp_sub
,
171 void lp_set_logfile(const char *name
);
172 int lp_maxprintjobs(int snum
);
173 const char *lp_printcapname(void);
174 bool lp_disable_spoolss( void );
175 void lp_set_spoolss_state( uint32_t state
);
176 uint32_t lp_get_spoolss_state( void );
177 struct smb1_signing_state
;
178 void set_use_sendfile(int snum
, bool val
);
179 void lp_set_mangling_method(const char *new_method
);
180 bool lp_posix_pathnames(void);
181 void lp_set_posix_pathnames(void);
182 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
);
183 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
);
184 int lp_min_receive_file_size(void);
185 void widelinks_warning(int snum
);
186 const char *lp_ncalrpc_dir(void);
187 void _lp_set_server_role(int server_role
);
188 uint32_t lp_get_async_dns_timeout(void);
190 /* The following definitions come from param/loadparm_ctx.c */
192 const struct loadparm_s3_helpers
*loadparm_s3_helpers(void);
194 /* The following definitions come from param/loadparm_server_role.c */
196 int lp_server_role(void);
197 void set_server_role(void);
199 /* The following definitions come from param/util.c */
201 uint32_t get_int_param( const char* param
);
202 char *get_string_param( const char* param
);
204 #endif /* _S3_LOADPARM_H */