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
;
34 /* The following definitions come from param/loadparm.c */
36 const struct loadparm_substitution
*loadparm_s3_global_substitution(void);
38 char *lp_parm_substituted_string(TALLOC_CTX
*mem_ctx
,
39 const struct loadparm_substitution
*lp_sub
,
45 char *lp_servicename(TALLOC_CTX
*ctx
, const struct loadparm_substitution
*, int);
46 const char *lp_const_servicename(int);
47 bool lp_autoloaded(int);
48 const char *lp_dnsdomain(void);
49 int lp_winbind_max_domain_connections(void);
50 bool lp_idmap_range(const char *domain_name
, uint32_t *low
, uint32_t *high
);
51 bool lp_idmap_default_range(uint32_t *low
, uint32_t *high
);
52 const char *lp_idmap_backend(const char *domain_name
);
53 const char *lp_idmap_default_backend (void);
54 int lp_security(void);
55 int lp_client_max_protocol(void);
56 int lp_client_ipc_min_protocol(void);
57 int lp_client_ipc_max_protocol(void);
58 int lp_client_ipc_signing(void);
59 enum credentials_use_kerberos
lp_client_use_kerberos(void);
60 int lp_smb2_max_credits(void);
61 int lp_cups_encrypt(void);
62 bool lp_widelinks(int );
63 int lp_rpc_low_port(void);
64 int lp_rpc_high_port(void);
65 bool lp_lanman_auth(void);
66 enum samba_weak_crypto
lp_weak_crypto(void);
68 int lp_wi_scan_global_parametrics(
69 const char *regex
, size_t max_matches
,
70 bool (*cb
)(const char *string
, regmatch_t matches
[],
74 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
);
75 struct loadparm_service
;
76 const char *lp_parm_const_string_service(struct loadparm_service
*service
, const char *type
,
77 const char *option
, const char *def
);
78 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
);
79 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
);
80 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
);
81 unsigned long long lp_parm_ulonglong(int snum
, const char *type
,
83 unsigned long long def
);
84 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
);
86 int lp_parm_enum(int snum
, const char *type
, const char *option
,
87 const struct enum_list
*_enum
, int def
);
88 char *canonicalize_servicename(TALLOC_CTX
*ctx
, const char *src
);
89 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
90 const char *user
, const char *pszHomedir
);
91 int lp_add_service(const char *pszService
, int iDefaultService
);
92 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
);
93 bool lp_parameter_is_valid(const char *pszParmName
);
94 bool lp_parameter_is_global(const char *pszParmName
);
95 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
97 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
99 const char **canon_parm
,
100 const char **canon_val
);
101 void show_parameter_list(void);
102 bool lp_invert_boolean(const char *str
, const char **inverse_str
);
103 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
);
104 bool process_registry_service(const char *service_name
);
105 bool process_registry_shares(void);
106 bool lp_config_backend_is_registry(void);
107 bool lp_config_backend_is_file(void);
108 bool lp_file_list_changed(void);
109 const char *lp_ldap_machine_suffix(TALLOC_CTX
*ctx
);
110 const char *lp_ldap_user_suffix(TALLOC_CTX
*ctx
);
111 const char *lp_ldap_group_suffix(TALLOC_CTX
*ctx
);
112 const char *lp_ldap_idmap_suffix(TALLOC_CTX
*ctx
);
114 /* Return a pointer to a service by name. */
115 struct loadparm_service
*lp_service(const char *pszServiceName
);
116 struct loadparm_service
*lp_servicebynum(int snum
);
117 struct loadparm_service
*lp_default_loadparm_service(void);
118 void *lp_parm_ptr(struct loadparm_service
*service
, struct parm_struct
*parm
);
119 void *lp_local_ptr_by_snum(int snum
, struct parm_struct
*parm
);
120 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
);
121 bool lp_set_cmdline(const char *pszParmName
, const char *pszParmValue
);
122 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
);
123 bool lp_snum_ok(int iService
);
124 void lp_add_one_printer(const char *name
, const char *comment
,
125 const char *location
, void *pdata
);
126 bool lp_loaded(void);
127 void lp_killunused(struct smbd_server_connection
*sconn
,
128 bool (*snumused
) (struct smbd_server_connection
*, int));
129 void lp_kill_all_services(void);
130 void lp_killservice(int iServiceIn
);
131 const char* server_role_str(uint32_t role
);
132 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
133 SMB_STRUCT_STAT
*psbuf
,
134 const char *servicename
,
140 char **pp_cp_share_name
,
141 struct security_descriptor
**ppsd
,
143 int load_usershare_service(const char *servicename
);
144 int load_usershare_shares(struct smbd_server_connection
*sconn
,
145 bool (*snumused
) (struct smbd_server_connection
*, int));
146 void gfree_loadparm(void);
147 bool lp_load_initial_only(const char *pszFname
);
148 bool lp_load_global(const char *file_name
);
149 bool lp_load_with_shares(const char *file_name
);
150 bool lp_load_client(const char *file_name
);
151 bool lp_load_global_no_reinit(const char *file_name
);
152 bool lp_load_no_reinit(const char *file_name
);
153 bool lp_load_client_no_reinit(const char *file_name
);
154 bool lp_load_with_registry_shares(const char *pszFname
);
155 int lp_numservices(void);
156 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
);
157 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
);
158 int lp_servicenumber(const char *pszServiceName
);
159 const char *volume_label(TALLOC_CTX
*ctx
, int snum
);
160 bool lp_domain_master(void);
161 bool lp_preferred_master(void);
162 void lp_remove_service(int snum
);
163 void lp_copy_service(int snum
, const char *new_name
);
164 int lp_default_server_announce(void);
165 const char *lp_printername(TALLOC_CTX
*ctx
,
166 const struct loadparm_substitution
*lp_sub
,
168 void lp_set_logfile(const char *name
);
169 int lp_maxprintjobs(int snum
);
170 const char *lp_printcapname(void);
171 bool lp_disable_spoolss( void );
172 void lp_set_spoolss_state( uint32_t state
);
173 uint32_t lp_get_spoolss_state( void );
174 struct smb1_signing_state
;
175 void set_use_sendfile(int snum
, bool val
);
176 void lp_set_mangling_method(const char *new_method
);
177 bool lp_posix_pathnames(void);
178 void lp_set_posix_pathnames(void);
179 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
);
180 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
);
181 int lp_min_receive_file_size(void);
182 void widelinks_warning(int snum
);
183 const char *lp_ncalrpc_dir(void);
184 void _lp_set_server_role(int server_role
);
185 uint32_t lp_get_async_dns_timeout(void);
186 bool lp_smb2_unix_extensions(void);
188 /* The following definitions come from param/loadparm_ctx.c */
190 const struct loadparm_s3_helpers
*loadparm_s3_helpers(void);
192 /* The following definitions come from param/loadparm_server_role.c */
194 int lp_server_role(void);
195 void set_server_role(void);
197 /* The following definitions come from param/util.c */
199 uint32_t get_int_param( const char* param
);
200 char *get_string_param( const char* param
);
202 #endif /* _S3_LOADPARM_H */