#include "ads.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "intl.h"
-#include "smb_signing.h"
-#include "dbwrap.h"
-#include "smbldap.h"
+#include "../libcli/smb/smb_signing.h"
+#include "dbwrap/dbwrap.h"
+#include "dbwrap/dbwrap_rbt.h"
#include "../lib/util/bitmap.h"
+#include "../source4/dns_server/dns_update.h"
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#include <cups/http.h>
#endif
+#ifdef CLUSTER_SUPPORT
+#include "ctdb_private.h"
+#endif
+
bool bLoaded = false;
extern userdom_struct current_user_info;
.bPosixLocking = true,
.bShareModes = true,
.bOpLocks = true,
+ .bKernelOplocks = false,
.bLevel2OpLocks = true,
.bOnlyUser = false,
.bMangledNames = true,
static void add_to_file_list(const char *fname, const char *subfname);
static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
+static void free_param_opts(struct parmlist_entry **popts);
-static const struct enum_list enum_protocol[] = {
- {PROTOCOL_SMB2_02, "SMB2"},
- {PROTOCOL_SMB2_02, "SMB2_02"},
- {PROTOCOL_NT1, "NT1"},
- {PROTOCOL_LANMAN2, "LANMAN2"},
- {PROTOCOL_LANMAN1, "LANMAN1"},
- {PROTOCOL_CORE, "CORE"},
- {PROTOCOL_COREPLUS, "COREPLUS"},
- {PROTOCOL_COREPLUS, "CORE+"},
- {-1, NULL}
-};
-
-static const struct enum_list enum_security[] = {
- {SEC_SHARE, "SHARE"},
- {SEC_USER, "USER"},
- {SEC_SERVER, "SERVER"},
- {SEC_DOMAIN, "DOMAIN"},
-#ifdef HAVE_ADS
- {SEC_ADS, "ADS"},
-#endif
- {-1, NULL}
-};
+#include "lib/param/param_enums.c"
static const struct enum_list enum_printing[] = {
{PRINT_SYSV, "sysv"},
};
-
-static const struct enum_list enum_bool_auto[] = {
- {false, "No"},
- {false, "False"},
- {false, "0"},
- {true, "Yes"},
- {true, "True"},
- {true, "1"},
- {Auto, "Auto"},
- {-1, NULL}
-};
-
-static const struct enum_list enum_csc_policy[] = {
- {CSC_POLICY_MANUAL, "manual"},
- {CSC_POLICY_DOCUMENTS, "documents"},
- {CSC_POLICY_PROGRAMS, "programs"},
- {CSC_POLICY_DISABLE, "disable"},
- {-1, NULL}
-};
-
-/* SMB signing types. */
-static const struct enum_list enum_smb_signing_vals[] = {
- {false, "No"},
- {false, "False"},
- {false, "0"},
- {false, "Off"},
- {false, "disabled"},
- {true, "Yes"},
- {true, "True"},
- {true, "1"},
- {true, "On"},
- {true, "enabled"},
- {Auto, "auto"},
- {Required, "required"},
- {Required, "mandatory"},
- {Required, "force"},
- {Required, "forced"},
- {Required, "enforced"},
- {-1, NULL}
-};
-
/* ACL compatibility options. */
static const struct enum_list enum_acl_compat_vals[] = {
{ ACL_COMPAT_AUTO, "auto" },
},
{
.label = "realm",
- .type = P_USTRING,
+ .type = P_STRING,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(szRealm),
.special = handle_realm,
.enum_list = enum_config_backend,
.flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
},
+ {
+ .label = "server role",
+ .type = P_ENUM,
+ .p_class = P_GLOBAL,
+ .offset = GLOBAL_VAR(ServerRole),
+ .special = NULL,
+ .enum_list = enum_server_role,
+ .flags = FLAG_BASIC | FLAG_ADVANCED,
+ },
{N_("Security Options"), P_SEP, P_SEPARATOR},
.enum_list = NULL,
.flags = FLAG_ADVANCED,
},
+ {
+ .label = "private directory",
+ .type = P_STRING,
+ .p_class = P_GLOBAL,
+ .offset = GLOBAL_VAR(szPrivateDir),
+ .special = NULL,
+ .enum_list = NULL,
+ .flags = FLAG_HIDE,
+ },
{
.label = "passdb backend",
.type = P_STRING,
.p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(szPassdbBackend),
+ .offset = GLOBAL_VAR(passdb_backend),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_WIZARD,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
},
- {
- .label = "send spnego principal",
- .type = P_BOOL,
- .p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(send_spnego_principal),
- .special = NULL,
- .enum_list = NULL,
- .flags = FLAG_ADVANCED,
- },
{
.label = "username",
.type = P_STRING,
.offset = LOCAL_VAR(bAclCheckPermissions),
.special = NULL,
.enum_list = NULL,
- .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
+ .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
},
{
.label = "acl group control",
.label = "log file",
.type = P_STRING,
.p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(szLogFile),
+ .offset = GLOBAL_VAR(logfile),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
},
{
.label = "max log size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(max_log_size),
.special = NULL,
{
.label = "allocation roundup size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_LOCAL,
.offset = LOCAL_VAR(iallocation_roundup_size),
.special = NULL,
},
{
.label = "aio read size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_LOCAL,
.offset = LOCAL_VAR(iAioReadSize),
.special = NULL,
},
{
.label = "aio write size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_LOCAL,
.offset = LOCAL_VAR(iAioWriteSize),
.special = NULL,
.label = "max protocol",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(maxprotocol),
+ .offset = GLOBAL_VAR(srv_maxprotocol),
+ .special = NULL,
+ .enum_list = enum_protocol,
+ .flags = FLAG_ADVANCED,
+ },
+ {
+ .label = "server max protocol",
+ .type = P_ENUM,
+ .p_class = P_GLOBAL,
+ .offset = GLOBAL_VAR(srv_maxprotocol),
.special = NULL,
.enum_list = enum_protocol,
.flags = FLAG_ADVANCED,
.label = "protocol",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(maxprotocol),
+ .offset = GLOBAL_VAR(srv_maxprotocol),
.special = NULL,
.enum_list = enum_protocol,
.flags = FLAG_ADVANCED,
.label = "min protocol",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(minprotocol),
+ .offset = GLOBAL_VAR(srv_minprotocol),
+ .special = NULL,
+ .enum_list = enum_protocol,
+ .flags = FLAG_ADVANCED,
+ },
+ {
+ .label = "server min protocol",
+ .type = P_ENUM,
+ .p_class = P_GLOBAL,
+ .offset = GLOBAL_VAR(srv_minprotocol),
.special = NULL,
.enum_list = enum_protocol,
.flags = FLAG_ADVANCED,
},
{
.label = "min receivefile size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(iminreceivefile),
.special = NULL,
},
{
.label = "max xmit",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(max_xmit),
.special = NULL,
{
.label = "block size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_LOCAL,
.offset = LOCAL_VAR(iBlock_size),
.special = NULL,
},
{
.label = "max disk size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(maxdisksize),
.special = NULL,
.label = "socket options",
.type = P_STRING,
.p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(szSocketOptions),
+ .offset = GLOBAL_VAR(socket_options),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
},
{
.label = "write cache size",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_LOCAL,
.offset = LOCAL_VAR(iWriteCacheSize),
.special = NULL,
},
{
.label = "smb2 max read",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(ismb2_max_read),
.special = NULL,
},
{
.label = "smb2 max write",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(ismb2_max_write),
.special = NULL,
},
{
.label = "smb2 max trans",
- .type = P_INTEGER,
+ .type = P_BYTES,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(ismb2_max_trans),
.special = NULL,
.label = "dns proxy",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(bDNSproxy),
+ .offset = GLOBAL_VAR(bWINSdnsProxy),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
{
.label = "kernel oplocks",
.type = P_BOOL,
- .p_class = P_GLOBAL,
- .offset = GLOBAL_VAR(bKernelOplocks),
+ .p_class = P_LOCAL,
+ .offset = LOCAL_VAR(bKernelOplocks),
.special = NULL,
.enum_list = NULL,
- .flags = FLAG_ADVANCED | FLAG_GLOBAL,
+ .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
},
{
.label = "locking",
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_SHARE,
},
+ {
+ .label = "allow insecure wide links",
+ .type = P_BOOL,
+ .p_class = P_GLOBAL,
+ .offset = GLOBAL_VAR(bAllowInsecureWidelinks),
+ .special = NULL,
+ .enum_list = NULL,
+ .flags = FLAG_ADVANCED,
+ },
{
.label = "wide links",
.type = P_BOOL,
*/
static void free_global_parameters(void)
{
+ free_param_opts(&Globals.param_opt);
free_parameters_by_snum(GLOBAL_SECTION_SNUM);
}
if (!done_init) {
/* The logfile can be set before this is invoked. Free it if so. */
- if (Globals.szLogFile != NULL) {
- string_free(&Globals.szLogFile);
- Globals.szLogFile = NULL;
+ if (Globals.logfile != NULL) {
+ string_free(&Globals.logfile);
+ Globals.logfile = NULL;
}
done_init = true;
} else {
* wipe out smb.conf options set with lp_set_cmdline(). The
* apply_lp_set_cmdline() call puts these values back in the
* table once the defaults are set */
- memset((void *)&Globals, '\0', sizeof(Globals));
+ ZERO_STRUCT(Globals);
for (i = 0; parm_table[i].label; i++) {
if ((parm_table[i].type == P_STRING ||
parm_table[i].type == P_USTRING))
{
- string_set(lp_parm_ptr(NULL, &parm_table[i]), "");
+ string_set((char **)lp_parm_ptr(NULL, &parm_table[i]), "");
}
}
string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
#endif
- string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
+ string_set(&Globals.socket_options, DEFAULT_SOCKET_OPTIONS);
string_set(&Globals.szLogonDrive, "");
/* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
Globals.ConfigBackend = config_backend;
+ Globals.ServerRole = ROLE_AUTO;
/* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
/* Discovered by 2 days of pain by Don McCall @ HP :-). */
Globals.max_log_size = 5000;
Globals.max_open_files = max_open_files();
Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
- Globals.maxprotocol = PROTOCOL_NT1;
- Globals.minprotocol = PROTOCOL_CORE;
+ Globals.srv_maxprotocol = PROTOCOL_SMB2_02;
+ Globals.srv_minprotocol = PROTOCOL_CORE;
Globals.security = SEC_USER;
Globals.paranoid_server_security = true;
Globals.bEncryptPasswords = true;
Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
- Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
+ Globals.lm_announce = Auto; /* = Auto: send only if LM clients found */
Globals.lm_interval = 60;
#if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
Globals.bNISHomeMap = false;
a large number of sites (tridge) */
Globals.bHostnameLookups = false;
- string_set(&Globals.szPassdbBackend, "tdbsam");
+ string_set(&Globals.passdb_backend, "tdbsam");
string_set(&Globals.szLdapSuffix, "");
string_set(&Globals.szLdapMachineSuffix, "");
string_set(&Globals.szLdapUserSuffix, "");
TALLOC_FREE(Globals.szInitLogonDelayedHosts);
Globals.InitLogonDelay = 100; /* 100 ms default delay */
- Globals.bDNSproxy = true;
-
- /* this just means to use them if they exist */
- Globals.bKernelOplocks = true;
+ Globals.bWINSdnsProxy = true;
Globals.bAllowTrustedDomains = true;
string_set(&Globals.szIdmapBackend, "tdb");
Globals.bUseSpnego = true;
Globals.bClientUseSpnego = true;
- Globals.client_signing = Auto;
- Globals.server_signing = false;
+ Globals.client_signing = SMB_SIGNING_DEFAULT;
+ Globals.server_signing = SMB_SIGNING_DEFAULT;
Globals.bDeferSharingViolations = true;
string_set(&Globals.smb_ports, SMB_PORTS);
*/
#define FN_GLOBAL_STRING(fn_name,ptr) \
- char *fn_name(void) {return(lp_string(*(char **)(&Globals.ptr) ? *(char **)(&Globals.ptr) : ""));}
+ char *lp_ ## fn_name(void) {return(lp_string(*(char **)(&Globals.ptr) ? *(char **)(&Globals.ptr) : ""));}
#define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
- const char *fn_name(void) {return(*(const char **)(&Globals.ptr) ? *(const char **)(&Globals.ptr) : "");}
+ const char *lp_ ## fn_name(void) {return(*(const char **)(&Globals.ptr) ? *(const char **)(&Globals.ptr) : "");}
#define FN_GLOBAL_LIST(fn_name,ptr) \
- const char **fn_name(void) {return(*(const char ***)(&Globals.ptr));}
+ const char **lp_ ## fn_name(void) {return(*(const char ***)(&Globals.ptr));}
#define FN_GLOBAL_BOOL(fn_name,ptr) \
- bool fn_name(void) {return(*(bool *)(&Globals.ptr));}
+ bool lp_ ## fn_name(void) {return(*(bool *)(&Globals.ptr));}
#define FN_GLOBAL_CHAR(fn_name,ptr) \
- char fn_name(void) {return(*(char *)(&Globals.ptr));}
+ char lp_ ## fn_name(void) {return(*(char *)(&Globals.ptr));}
#define FN_GLOBAL_INTEGER(fn_name,ptr) \
- int fn_name(void) {return(*(int *)(&Globals.ptr));}
+ int lp_ ## fn_name(void) {return(*(int *)(&Globals.ptr));}
#define FN_LOCAL_STRING(fn_name,val) \
char *lp_ ## fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
#define FN_LOCAL_CHAR(fn_name,val) \
char lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
-FN_GLOBAL_CONST_STRING(lp_smb_ports, smb_ports)
-FN_GLOBAL_CONST_STRING(lp_dos_charset, dos_charset)
-FN_GLOBAL_CONST_STRING(lp_unix_charset, unix_charset)
-FN_GLOBAL_STRING(lp_logfile, szLogFile)
-FN_GLOBAL_STRING(lp_configfile, szConfigFile)
-FN_GLOBAL_CONST_STRING(lp_smb_passwd_file, szSMBPasswdFile)
-FN_GLOBAL_CONST_STRING(lp_private_dir, szPrivateDir)
-FN_GLOBAL_STRING(lp_serverstring, szServerString)
-FN_GLOBAL_INTEGER(lp_printcap_cache_time, PrintcapCacheTime)
-FN_GLOBAL_STRING(lp_addport_cmd, szAddPortCommand)
-FN_GLOBAL_STRING(lp_enumports_cmd, szEnumPortsCommand)
-FN_GLOBAL_STRING(lp_addprinter_cmd, szAddPrinterCommand)
-FN_GLOBAL_STRING(lp_deleteprinter_cmd, szDeletePrinterCommand)
-FN_GLOBAL_STRING(lp_os2_driver_map, szOs2DriverMap)
-FN_GLOBAL_CONST_STRING(lp_lockdir, szLockDir)
+
+static FN_GLOBAL_BOOL(domain_logons, bDomainLogons)
+static FN_GLOBAL_BOOL(_readraw, bReadRaw)
+static FN_GLOBAL_BOOL(time_server, bTimeServer)
+static FN_GLOBAL_BOOL(_writeraw, bWriteRaw)
+static FN_GLOBAL_CONST_STRING(_ctdbd_socket, ctdbdSocket)
+static FN_GLOBAL_INTEGER(_server_role, ServerRole)
+
/* If lp_statedir() and lp_cachedir() are explicitely set during the
* build process or in smb.conf, we use that value. Otherwise they
* default to the value of lp_lockdir(). */
return(*(char **)(&Globals.szLockDir) ?
*(char **)(&Globals.szLockDir) : "");
}
-FN_GLOBAL_CONST_STRING(lp_piddir, szPidDir)
-FN_GLOBAL_STRING(lp_mangling_method, szManglingMethod)
-FN_GLOBAL_INTEGER(lp_mangle_prefix, mangle_prefix)
-FN_GLOBAL_CONST_STRING(lp_utmpdir, szUtmpDir)
-FN_GLOBAL_CONST_STRING(lp_wtmpdir, szWtmpDir)
-FN_GLOBAL_BOOL(lp_utmp, bUtmp)
-FN_GLOBAL_STRING(lp_rootdir, szRootdir)
-FN_GLOBAL_STRING(lp_perfcount_module, szSMBPerfcountModule)
-FN_GLOBAL_STRING(lp_defaultservice, szDefaultService)
-FN_GLOBAL_STRING(lp_msg_command, szMsgCommand)
-FN_GLOBAL_STRING(lp_get_quota_command, szGetQuota)
-FN_GLOBAL_STRING(lp_set_quota_command, szSetQuota)
-FN_GLOBAL_STRING(lp_auto_services, szAutoServices)
-FN_GLOBAL_STRING(lp_passwd_program, szPasswdProgram)
-FN_GLOBAL_STRING(lp_passwd_chat, szPasswdChat)
-FN_GLOBAL_CONST_STRING(lp_passwordserver, szPasswordServer)
-FN_GLOBAL_CONST_STRING(lp_name_resolve_order, szNameResolveOrder)
-FN_GLOBAL_CONST_STRING(lp_workgroup, szWorkgroup)
-FN_GLOBAL_CONST_STRING(lp_netbios_name, szNetbiosName)
-FN_GLOBAL_CONST_STRING(lp_netbios_scope, szNetbiosScope)
-FN_GLOBAL_CONST_STRING(lp_realm, szRealmUpper)
-FN_GLOBAL_CONST_STRING(lp_dnsdomain, szDnsDomain)
-FN_GLOBAL_CONST_STRING(lp_afs_username_map, szAfsUsernameMap)
-FN_GLOBAL_INTEGER(lp_afs_token_lifetime, iAfsTokenLifetime)
-FN_GLOBAL_STRING(lp_log_nt_token_command, szLogNtTokenCommand)
-FN_GLOBAL_STRING(lp_username_map, szUsernameMap)
-FN_GLOBAL_CONST_STRING(lp_logon_script, szLogonScript)
-FN_GLOBAL_CONST_STRING(lp_logon_path, szLogonPath)
-FN_GLOBAL_CONST_STRING(lp_logon_drive, szLogonDrive)
-FN_GLOBAL_CONST_STRING(lp_logon_home, szLogonHome)
-FN_GLOBAL_STRING(lp_remote_announce, szRemoteAnnounce)
-FN_GLOBAL_STRING(lp_remote_browse_sync, szRemoteBrowseSync)
-FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, bNmbdBindExplicitBroadcast)
-FN_GLOBAL_LIST(lp_wins_server_list, szWINSservers)
-FN_GLOBAL_LIST(lp_interfaces, szInterfaces)
-FN_GLOBAL_STRING(lp_nis_home_map_name, szNISHomeMapName)
-FN_GLOBAL_LIST(lp_netbios_aliases, szNetbiosAliases)
-FN_GLOBAL_CONST_STRING(lp_passdb_backend, szPassdbBackend)
-FN_GLOBAL_LIST(lp_preload_modules, szPreloadModules)
-FN_GLOBAL_STRING(lp_panic_action, szPanicAction)
-FN_GLOBAL_STRING(lp_adduser_script, szAddUserScript)
-FN_GLOBAL_STRING(lp_renameuser_script, szRenameUserScript)
-FN_GLOBAL_STRING(lp_deluser_script, szDelUserScript)
-
-FN_GLOBAL_CONST_STRING(lp_guestaccount, szGuestaccount)
-FN_GLOBAL_STRING(lp_addgroup_script, szAddGroupScript)
-FN_GLOBAL_STRING(lp_delgroup_script, szDelGroupScript)
-FN_GLOBAL_STRING(lp_addusertogroup_script, szAddUserToGroupScript)
-FN_GLOBAL_STRING(lp_deluserfromgroup_script, szDelUserFromGroupScript)
-FN_GLOBAL_STRING(lp_setprimarygroup_script, szSetPrimaryGroupScript)
-
-FN_GLOBAL_STRING(lp_addmachine_script, szAddMachineScript)
-
-FN_GLOBAL_STRING(lp_shutdown_script, szShutdownScript)
-FN_GLOBAL_STRING(lp_abort_shutdown_script, szAbortShutdownScript)
-FN_GLOBAL_STRING(lp_username_map_script, szUsernameMapScript)
-FN_GLOBAL_INTEGER(lp_username_map_cache_time, iUsernameMapCacheTime)
-
-FN_GLOBAL_STRING(lp_check_password_script, szCheckPasswordScript)
-
-FN_GLOBAL_STRING(lp_wins_hook, szWINSHook)
-FN_GLOBAL_CONST_STRING(lp_template_homedir, szTemplateHomedir)
-FN_GLOBAL_CONST_STRING(lp_template_shell, szTemplateShell)
-FN_GLOBAL_CONST_STRING(lp_winbind_separator, szWinbindSeparator)
-FN_GLOBAL_INTEGER(lp_acl_compatibility, iAclCompat)
-FN_GLOBAL_BOOL(lp_winbind_enum_users, bWinbindEnumUsers)
-FN_GLOBAL_BOOL(lp_winbind_enum_groups, bWinbindEnumGroups)
-FN_GLOBAL_BOOL(lp_winbind_use_default_domain, bWinbindUseDefaultDomain)
-FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, bWinbindTrustedDomainsOnly)
-FN_GLOBAL_BOOL(lp_winbind_nested_groups, bWinbindNestedGroups)
-FN_GLOBAL_INTEGER(lp_winbind_expand_groups, winbind_expand_groups)
-FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, bWinbindRefreshTickets)
-FN_GLOBAL_BOOL(lp_winbind_offline_logon, bWinbindOfflineLogon)
-FN_GLOBAL_BOOL(lp_winbind_normalize_names, bWinbindNormalizeNames)
-FN_GLOBAL_BOOL(lp_winbind_rpc_only, bWinbindRpcOnly)
-FN_GLOBAL_BOOL(lp_create_krb5_conf, bCreateKrb5Conf)
-static FN_GLOBAL_INTEGER(lp_winbind_max_domain_connections_int,
+static FN_GLOBAL_INTEGER(winbind_max_domain_connections_int,
winbindMaxDomainConnections)
int lp_winbind_max_domain_connections(void)
return MAX(1, lp_winbind_max_domain_connections_int());
}
-FN_GLOBAL_CONST_STRING(lp_idmap_backend, szIdmapBackend)
-FN_GLOBAL_INTEGER(lp_idmap_cache_time, iIdmapCacheTime)
-FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, iIdmapNegativeCacheTime)
-FN_GLOBAL_INTEGER(lp_keepalive, iKeepalive)
-FN_GLOBAL_BOOL(lp_passdb_expand_explicit, bPassdbExpandExplicit)
-
-FN_GLOBAL_STRING(lp_ldap_suffix, szLdapSuffix)
-FN_GLOBAL_STRING(lp_ldap_admin_dn, szLdapAdminDn)
-FN_GLOBAL_INTEGER(lp_ldap_ssl, ldap_ssl)
-FN_GLOBAL_BOOL(lp_ldap_ssl_ads, ldap_ssl_ads)
-FN_GLOBAL_INTEGER(lp_ldap_deref, ldap_deref)
-FN_GLOBAL_INTEGER(lp_ldap_follow_referral, ldap_follow_referral)
-FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, ldap_passwd_sync)
-FN_GLOBAL_BOOL(lp_ldap_delete_dn, ldap_delete_dn)
-FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, ldap_replication_sleep)
-FN_GLOBAL_INTEGER(lp_ldap_timeout, ldap_timeout)
-FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, ldap_connection_timeout)
-FN_GLOBAL_INTEGER(lp_ldap_page_size, ldap_page_size)
-FN_GLOBAL_INTEGER(lp_ldap_debug_level, ldap_debug_level)
-FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, ldap_debug_threshold)
-FN_GLOBAL_STRING(lp_add_share_cmd, szAddShareCommand)
-FN_GLOBAL_STRING(lp_change_share_cmd, szChangeShareCommand)
-FN_GLOBAL_STRING(lp_delete_share_cmd, szDeleteShareCommand)
-FN_GLOBAL_STRING(lp_usershare_path, szUsersharePath)
-FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, szUsersharePrefixAllowList)
-FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, szUsersharePrefixDenyList)
-
-FN_GLOBAL_LIST(lp_eventlog_list, szEventLogs)
-
-FN_GLOBAL_BOOL(lp_registry_shares, bRegistryShares)
-FN_GLOBAL_BOOL(lp_usershare_allow_guests, bUsershareAllowGuests)
-FN_GLOBAL_BOOL(lp_usershare_owner_only, bUsershareOwnerOnly)
-FN_GLOBAL_BOOL(lp_disable_netbios, bDisableNetbios)
-FN_GLOBAL_BOOL(lp_reset_on_zero_vc, bResetOnZeroVC)
-FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit, bLogWriteableFilesOnExit)
-FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, bMsAddPrinterWizard)
-FN_GLOBAL_BOOL(lp_dns_proxy, bDNSproxy)
-FN_GLOBAL_BOOL(lp_we_are_a_wins_server, bWINSsupport)
-FN_GLOBAL_BOOL(lp_wins_proxy, bWINSproxy)
-FN_GLOBAL_BOOL(lp_local_master, bLocalMaster)
-FN_GLOBAL_BOOL(lp_domain_logons, bDomainLogons)
-FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, szInitLogonDelayedHosts)
-FN_GLOBAL_INTEGER(lp_init_logon_delay, InitLogonDelay)
-FN_GLOBAL_BOOL(lp_load_printers, bLoadPrinters)
-FN_GLOBAL_BOOL(_lp_readraw, bReadRaw)
-FN_GLOBAL_BOOL(lp_large_readwrite, bLargeReadwrite)
-FN_GLOBAL_BOOL(_lp_writeraw, bWriteRaw)
-FN_GLOBAL_BOOL(lp_null_passwords, bNullPasswords)
-FN_GLOBAL_BOOL(lp_obey_pam_restrictions, bObeyPamRestrictions)
-FN_GLOBAL_BOOL(lp_encrypted_passwords, bEncryptPasswords)
-FN_GLOBAL_INTEGER(lp_client_schannel, clientSchannel)
-FN_GLOBAL_INTEGER(lp_server_schannel, serverSchannel)
-FN_GLOBAL_BOOL(lp_syslog_only, bSyslogOnly)
-FN_GLOBAL_BOOL(lp_timestamp_logs, bTimestampLogs)
-FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, bDebugPrefixTimestamp)
-FN_GLOBAL_BOOL(lp_debug_hires_timestamp, bDebugHiresTimestamp)
-FN_GLOBAL_BOOL(lp_debug_pid, bDebugPid)
-FN_GLOBAL_BOOL(lp_debug_uid, bDebugUid)
-FN_GLOBAL_BOOL(lp_debug_class, bDebugClass)
-FN_GLOBAL_BOOL(lp_enable_core_files, bEnableCoreFiles)
-FN_GLOBAL_BOOL(lp_browse_list, bBrowseList)
-FN_GLOBAL_BOOL(lp_nis_home_map, bNISHomeMap)
-static FN_GLOBAL_BOOL(lp_time_server, bTimeServer)
-FN_GLOBAL_BOOL(lp_bind_interfaces_only, bBindInterfacesOnly)
-FN_GLOBAL_BOOL(lp_pam_password_change, bPamPasswordChange)
-FN_GLOBAL_BOOL(lp_unix_password_sync, bUnixPasswdSync)
-FN_GLOBAL_BOOL(lp_passwd_chat_debug, bPasswdChatDebug)
-FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, iPasswdChatTimeout)
-FN_GLOBAL_BOOL(lp_nt_pipe_support, bNTPipeSupport)
-FN_GLOBAL_BOOL(lp_nt_status_support, bNTStatusSupport)
-FN_GLOBAL_BOOL(lp_stat_cache, bStatCache)
-FN_GLOBAL_INTEGER(lp_max_stat_cache_size, iMaxStatCacheSize)
-FN_GLOBAL_BOOL(lp_allow_trusted_domains, bAllowTrustedDomains)
-FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, bMapUntrustedToDomain)
-FN_GLOBAL_INTEGER(lp_restrict_anonymous, restrict_anonymous)
-FN_GLOBAL_BOOL(lp_lanman_auth, bLanmanAuth)
-FN_GLOBAL_BOOL(lp_ntlm_auth, bNTLMAuth)
-FN_GLOBAL_BOOL(lp_client_plaintext_auth, bClientPlaintextAuth)
-FN_GLOBAL_BOOL(lp_client_lanman_auth, bClientLanManAuth)
-FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, bClientNTLMv2Auth)
-FN_GLOBAL_BOOL(lp_host_msdfs, bHostMSDfs)
-FN_GLOBAL_BOOL(lp_kernel_oplocks, bKernelOplocks)
-FN_GLOBAL_BOOL(lp_enhanced_browsing, enhanced_browsing)
-FN_GLOBAL_BOOL(lp_use_mmap, bUseMmap)
-FN_GLOBAL_BOOL(lp_unix_extensions, bUnixExtensions)
-FN_GLOBAL_BOOL(lp_use_spnego, bUseSpnego)
-FN_GLOBAL_BOOL(lp_client_use_spnego, bClientUseSpnego)
-FN_GLOBAL_BOOL(lp_client_use_spnego_principal, client_use_spnego_principal)
-FN_GLOBAL_BOOL(lp_send_spnego_principal, send_spnego_principal)
-FN_GLOBAL_BOOL(lp_hostname_lookups, bHostnameLookups)
-FN_GLOBAL_CONST_STRING(lp_dedicated_keytab_file, szDedicatedKeytabFile)
-FN_GLOBAL_INTEGER(lp_kerberos_method, iKerberosMethod)
-FN_GLOBAL_BOOL(lp_defer_sharing_violations, bDeferSharingViolations)
-FN_GLOBAL_BOOL(lp_enable_privileges, bEnablePrivileges)
-FN_GLOBAL_BOOL(lp_enable_asu_support, bASUSupport)
-FN_GLOBAL_INTEGER(lp_os_level, os_level)
-FN_GLOBAL_INTEGER(lp_max_ttl, max_ttl)
-FN_GLOBAL_INTEGER(lp_max_wins_ttl, max_wins_ttl)
-FN_GLOBAL_INTEGER(lp_min_wins_ttl, min_wins_ttl)
-FN_GLOBAL_INTEGER(lp_max_log_size, max_log_size)
-FN_GLOBAL_INTEGER(lp_max_open_files, max_open_files)
-FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, open_files_db_hash_size)
-FN_GLOBAL_INTEGER(lp_maxxmit, max_xmit)
-FN_GLOBAL_INTEGER(lp_maxmux, max_mux)
-FN_GLOBAL_INTEGER(lp_passwordlevel, pwordlevel)
-FN_GLOBAL_INTEGER(lp_usernamelevel, unamelevel)
-FN_GLOBAL_INTEGER(lp_deadtime, deadtime)
-FN_GLOBAL_BOOL(lp_getwd_cache, getwd_cache)
-static FN_GLOBAL_INTEGER(_lp_maxprotocol, maxprotocol)
-int lp_maxprotocol(void)
-{
- int ret = _lp_maxprotocol();
- if ((ret >= PROTOCOL_SMB2_02) && (lp_security() == SEC_SHARE)) {
- DEBUG(2,("WARNING!!: \"security = share\" is incompatible "
- "with the SMB2 protocol. Resetting to SMB1.\n" ));
- lp_do_parameter(-1, "max protocol", "NT1");
- return PROTOCOL_NT1;
- }
- return ret;
-}
-FN_GLOBAL_INTEGER(lp_minprotocol, minprotocol)
-FN_GLOBAL_INTEGER(lp_security, security)
-FN_GLOBAL_LIST(lp_auth_methods, AuthMethods)
-FN_GLOBAL_BOOL(lp_paranoid_server_security, paranoid_server_security)
-FN_GLOBAL_INTEGER(lp_maxdisksize, maxdisksize)
-FN_GLOBAL_INTEGER(lp_lpqcachetime, lpqcachetime)
-FN_GLOBAL_INTEGER(lp_max_smbd_processes, iMaxSmbdProcesses)
-FN_GLOBAL_BOOL(_lp_disable_spoolss, bDisableSpoolss)
-FN_GLOBAL_INTEGER(lp_syslog, syslog)
-FN_GLOBAL_INTEGER(lp_lm_announce, lm_announce)
-FN_GLOBAL_INTEGER(lp_lm_interval, lm_interval)
-FN_GLOBAL_INTEGER(lp_machine_password_timeout, machine_password_timeout)
-FN_GLOBAL_INTEGER(lp_map_to_guest, map_to_guest)
-FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, oplock_break_wait_time)
-FN_GLOBAL_INTEGER(lp_lock_spin_time, iLockSpinTime)
-FN_GLOBAL_INTEGER(lp_usershare_max_shares, iUsershareMaxShares)
-FN_GLOBAL_CONST_STRING(lp_socket_options, szSocketOptions)
-FN_GLOBAL_INTEGER(lp_config_backend, ConfigBackend)
-FN_GLOBAL_INTEGER(lp_smb2_max_read, ismb2_max_read)
-FN_GLOBAL_INTEGER(lp_smb2_max_write, ismb2_max_write)
-FN_GLOBAL_INTEGER(lp_smb2_max_trans, ismb2_max_trans)
int lp_smb2_max_credits(void)
{
if (Globals.ismb2_max_credits == 0) {
}
return Globals.ismb2_max_credits;
}
-FN_GLOBAL_LIST(lp_svcctl_list, szServicesList)
-FN_GLOBAL_STRING(lp_cups_server, szCupsServer)
int lp_cups_encrypt(void)
{
int result = 0;
#endif
return result;
}
-FN_GLOBAL_STRING(lp_iprint_server, szIPrintServer)
-FN_GLOBAL_INTEGER(lp_cups_connection_timeout, cups_connection_timeout)
-FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, ctdbdSocket)
-FN_GLOBAL_LIST(lp_cluster_addresses, szClusterAddresses)
-FN_GLOBAL_BOOL(lp_clustering, clustering)
-FN_GLOBAL_INTEGER(lp_ctdb_timeout, ctdb_timeout)
-FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, ctdb_locktime_warn_threshold)
-FN_GLOBAL_BOOL(lp_async_smb_echo_handler, bAsyncSMBEchoHandler)
-FN_GLOBAL_BOOL(lp_multicast_dns_register, bMulticastDnsRegister)
-FN_GLOBAL_INTEGER(lp_winbind_cache_time, winbind_cache_time)
-FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, winbind_reconnect_delay)
-FN_GLOBAL_INTEGER(lp_winbind_max_clients, winbind_max_clients)
-FN_GLOBAL_LIST(lp_winbind_nss_info, szWinbindNssInfo)
-FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, AlgorithmicRidBase)
-FN_GLOBAL_INTEGER(lp_name_cache_timeout, name_cache_timeout)
-FN_GLOBAL_INTEGER(lp_client_signing, client_signing)
-FN_GLOBAL_INTEGER(lp_server_signing, server_signing)
-FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, client_ldap_sasl_wrapping)
-
-FN_GLOBAL_CONST_STRING(lp_ncalrpc_dir, ncalrpc_dir)
+
+/* These functions remain in source3/param for now */
+
+FN_GLOBAL_CONST_STRING(name_resolve_order, szNameResolveOrder)
+FN_GLOBAL_CONST_STRING(smb_ports, smb_ports)
+FN_GLOBAL_INTEGER(security, security)
+FN_GLOBAL_INTEGER(usershare_max_shares, iUsershareMaxShares)
+FN_GLOBAL_STRING(configfile, szConfigFile)
#include "lib/param/param_functions.c"
static void init_copymap(struct loadparm_service *pservice);
static bool hash_a_service(const char *name, int number);
static void free_service_byindex(int iService);
-static void free_param_opts(struct parmlist_entry **popts);
static void show_parameter(int parmIndex);
static bool is_synonym_of(int parm1, int parm2, bool *inverse);
i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
if (i < 0)
- return (false);
+ return false;
if (!(*(ServicePtrs[iDefaultService]->szPath))
|| strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
user, ServicePtrs[i]->szPath ));
- return (true);
+ return true;
}
/***************************************************************************
int i = add_a_service(&sDefault, ipc_name);
if (i < 0)
- return (false);
+ return false;
if (asprintf(&comment, "IPC Service (%s)",
Globals.szServerString) < 0) {
- return (false);
+ return false;
}
string_set(&ServicePtrs[i]->szPath, tmpdir());
DEBUG(3, ("adding IPC service\n"));
SAFE_FREE(comment);
- return (true);
+ return true;
}
/***************************************************************************
int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
if (i < 0)
- return (false);
+ return false;
/* note that we do NOT default the availability flag to true - */
/* we take it from the default service passed. This allows all */
DEBUG(3, ("adding printer service %s\n", pszPrintername));
- return (true);
+ return true;
}
int iService = -1;
char *canon_name;
TDB_DATA data;
+ NTSTATUS status;
if (ServiceHash == NULL) {
return -1;
canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
- data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
+ status = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name,
+ &data);
- if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
+ if (NT_STATUS_IS_OK(status) &&
+ (data.dptr != NULL) &&
+ (data.dsize == sizeof(iService)))
+ {
iService = *(int *)data.dptr;
}
case P_INTEGER:
case P_ENUM:
case P_OCTAL:
+ case P_BYTES:
*(int *)dest_ptr = *(int *)src_ptr;
break;
return ret;
}
+/**
+ * reload those shares from registry that are already
+ * activated in the services array.
+ */
+static bool reload_registry_shares(void)
+{
+ int i;
+ bool ret = true;
+
+ for (i = 0; i < iNumServices; i++) {
+ if (!VALID(i)) {
+ continue;
+ }
+
+ if (ServicePtrs[i]->usershare == USERSHARE_VALID) {
+ continue;
+ }
+
+ ret = process_registry_service(ServicePtrs[i]->szService);
+ if (!ret) {
+ goto done;
+ }
+ }
+
+done:
+ return ret;
+}
+
+
#define MAX_INCLUDE_DEPTH 100
static uint8_t include_depth;
}
f = f->next;
}
- return (false);
+ return false;
}
char *dnsdomain = strlower_talloc(talloc_tos(), pszParmValue);
ret &= string_set(&Globals.szRealm, pszParmValue);
- ret &= string_set(&Globals.szRealmUpper, realm);
- ret &= string_set(&Globals.szDnsDomain, dnsdomain);
+ ret &= string_set(&Globals.szRealm_upper, realm);
+ ret &= string_set(&Globals.szRealm_lower, dnsdomain);
TALLOC_FREE(realm);
TALLOC_FREE(dnsdomain);
if (strchr(pszParmName, ':') == NULL) {
DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
pszParmName));
- return (true);
+ return true;
}
/*
? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
set_param_opt(opt_list, pszParmName, pszParmValue, 0);
- return (true);
+ return true;
}
/* if it's already been set by the command line, then we don't
DEBUG(0,
("Global parameter %s found in service section!\n",
pszParmName));
- return (true);
+ return true;
}
parm_ptr = lp_local_ptr_by_snum(snum, &parm_table[parmnum]);
}
}
break;
+ case P_BYTES:
+ {
+ uint64_t val;
+ if (conv_str_size_error(pszParmValue, &val)) {
+ if (val <= INT_MAX) {
+ *(int *)parm_ptr = (int)val;
+ break;
+ }
+ }
+
+ DEBUG(0,("lp_do_parameter(%s): value is not "
+ "a valid size specifier!\n", pszParmValue));
+ return false;
+ }
+
case P_LIST:
+ case P_CMDLIST:
TALLOC_FREE(*((char ***)parm_ptr));
*(char ***)parm_ptr = str_list_make_v3(
NULL, pszParmValue, NULL);
break;
}
- return (true);
+ return true;
}
/***************************************************************************
void *userdata)
{
if (!bInGlobalSection && bGlobalOnly)
- return (true);
+ return true;
DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
{
+ /* For the seperation of lists values that we print below */
+ const char *list_sep = ", ";
int i;
switch (p->type)
{
break;
case P_OCTAL: {
- char *o = octal_string(*(int *)ptr);
- fprintf(f, "%s", o);
- TALLOC_FREE(o);
+ int val = *(int *)ptr;
+ if (val == -1) {
+ fprintf(f, "-1");
+ } else {
+ fprintf(f, "0%o", val);
+ }
break;
}
+ case P_CMDLIST:
+ list_sep = " ";
+ /* fall through */
case P_LIST:
if ((char ***)ptr && *(char ***)ptr) {
char **list = *(char ***)ptr;
for (; *list; list++) {
/* surround strings with whitespace in double quotes */
- if ( strchr_m( *list, ' ' ) )
- fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
- else
- fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
+ if (*(list+1) == NULL) {
+ /* last item, no extra separator */
+ list_sep = "";
+ }
+ if ( strchr_m( *list, ' ' ) ) {
+ fprintf(f, "\"%s\"%s", *list, list_sep);
+ } else {
+ fprintf(f, "%s%s", *list, list_sep);
+ }
}
}
break;
case P_SEP:
break;
}
- return (false);
+ return false;
}
/***************************************************************************
/* check for multiple global sections */
if (bInGlobalSection) {
DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
- return (true);
+ return true;
}
if (!bInGlobalSection && bGlobalOnly)
- return (true);
+ return true;
/* if we have a current service, tidy it up before moving on */
bRetval = true;
iServiceIndex = add_a_service(&sDefault, pszSectionName);
if (iServiceIndex < 0) {
DEBUG(0, ("Failed to add a new service\n"));
- return (false);
+ return false;
}
/* Clean all parametric options for service */
/* They will be added during parsing again */
free_param_opts(&ServicePtrs[iServiceIndex]->param_opt);
}
- return (bRetval);
+ return bRetval;
}
return false;
switch (parm_table[i].type) {
case P_LIST:
+ case P_CMDLIST:
return str_list_equal((const char **)parm_table[i].def.lvalue,
*(const char ***)lp_parm_ptr(NULL,
&parm_table[i]));
case P_INTEGER:
case P_OCTAL:
case P_ENUM:
+ case P_BYTES:
return parm_table[i].def.ivalue ==
*(int *)lp_parm_ptr(NULL,
&parm_table[i]);
continue;
switch (parm_table[i].type) {
case P_LIST:
+ case P_CMDLIST:
parm_table[i].def.lvalue = str_list_copy(
NULL, *(const char ***)lp_parm_ptr(NULL, &parm_table[i]));
break;
case P_INTEGER:
case P_OCTAL:
case P_ENUM:
+ case P_BYTES:
parm_table[i].def.ivalue =
*(int *)lp_parm_ptr(NULL, &parm_table[i]);
break;
const char **prefixallowlist = lp_usershare_prefix_allow_list();
const char **prefixdenylist = lp_usershare_prefix_deny_list();
int us_vers;
- SMB_STRUCT_DIR *dp;
+ DIR *dp;
SMB_STRUCT_STAT sbuf;
char *sharepath = NULL;
char *comment = NULL;
}
/* Ensure this is pointing to a directory. */
- dp = sys_opendir(sharepath);
+ dp = opendir(sharepath);
if (!dp) {
DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
if (sys_stat(sharepath, &sbuf, false) == -1) {
DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
servicename, sharepath, strerror(errno) ));
- sys_closedir(dp);
+ closedir(dp);
return USERSHARE_POSIX_ERR;
}
- sys_closedir(dp);
+ closedir(dp);
if (!S_ISDIR(sbuf.st_ex_mode)) {
DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
}
{
- TDB_DATA data = dbwrap_fetch_bystring(
- ServiceHash, canon_name, canon_name);
+ TDB_DATA data;
+ NTSTATUS status;
+
+ status = dbwrap_fetch_bystring(ServiceHash, canon_name,
+ canon_name, &data);
iService = -1;
- if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
- iService = *(int *)data.dptr;
+ if (NT_STATUS_IS_OK(status) &&
+ (data.dptr != NULL) &&
+ (data.dsize == sizeof(iService))) {
+ memcpy(&iService, data.dptr, sizeof(iService));
}
}
/* Try and open the file read only - no symlinks allowed. */
#ifdef O_NOFOLLOW
- fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
+ fd = open(fname, O_RDONLY|O_NOFOLLOW, 0);
#else
- fd = sys_open(fname, O_RDONLY, 0);
+ fd = open(fname, O_RDONLY, 0);
#endif
if (fd == -1) {
been removed.
***************************************************************************/
-int load_usershare_shares(struct smbd_server_connection *sconn)
+int load_usershare_shares(struct smbd_server_connection *sconn,
+ bool (*snumused) (struct smbd_server_connection *, int))
{
- SMB_STRUCT_DIR *dp;
+ DIR *dp;
SMB_STRUCT_STAT sbuf;
- SMB_STRUCT_DIRENT *de;
+ struct dirent *de;
int num_usershares = 0;
int max_user_shares = Globals.iUsershareMaxShares;
unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
}
}
- dp = sys_opendir(usersharepath);
+ dp = opendir(usersharepath);
if (!dp) {
DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
usersharepath, strerror(errno) ));
}
for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
- (de = sys_readdir(dp));
+ (de = readdir(dp));
num_dir_entries++ ) {
int r;
const char *n = de->d_name;
}
}
- sys_closedir(dp);
+ closedir(dp);
/* Sweep through and delete any non-refreshed usershares that are
not currently in use. */
for (iService = iNumServices - 1; iService >= 0; iService--) {
if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
- if (conn_snum_used(sconn, iService)) {
+ if (snumused && snumused(sconn, iService)) {
continue;
}
/* Remove from the share ACL db. */
/***************************************************************************
Allow client apps to specify that they are a client
***************************************************************************/
-void lp_set_in_client(bool b)
+static void lp_set_in_client(bool b)
{
in_client = b;
}
/***************************************************************************
Determine if we're running in a client app
***************************************************************************/
-bool lp_is_in_client(void)
+static bool lp_is_in_client(void)
{
return in_client;
}
bool add_ipc,
bool initialize_globals,
bool allow_include_registry,
- bool allow_registry_shares)
+ bool load_all_shares)
{
char *n2 = NULL;
bool bRetval;
lp_save_defaults();
}
- free_param_opts(&Globals.param_opt);
+ if (!initialize_globals) {
+ free_param_opts(&Globals.param_opt);
+ apply_lp_set_cmdline();
+ }
lp_do_parameter(-1, "idmap config * : backend", Globals.szIdmapBackend);
return lp_load_ex(pszFname, global_only, save_defaults,
add_ipc, initialize_globals,
allow_include_registry,
- allow_registry_shares);
+ load_all_shares);
}
} else if (lp_config_backend_is_registry()) {
bRetval = process_registry_globals();
bRetval = false;
}
- if (bRetval && lp_registry_shares() && allow_registry_shares) {
- bRetval = process_registry_shares();
+ if (bRetval && lp_registry_shares()) {
+ if (load_all_shares) {
+ bRetval = process_registry_shares();
+ } else {
+ bRetval = reload_registry_shares();
+ }
}
lp_add_auto_services(lp_auto_services());
}
}
- set_server_role();
set_allowed_client_auth();
- if (lp_security() == SEC_SHARE) {
- DEBUG(1, ("WARNING: The security=share option is deprecated\n"));
- } else if (lp_security() == SEC_SERVER) {
- DEBUG(1, ("WARNING: The security=server option is deprecated\n"));
- }
-
if (lp_security() == SEC_ADS && strchr(lp_passwordserver(), ':')) {
DEBUG(1, ("WARNING: The optional ':port' in password server = %s is deprecated\n",
lp_passwordserver()));
add_ipc,
initialize_globals,
true, /* allow_include_registry */
- false); /* allow_registry_shares*/
+ false); /* load_all_shares*/
}
bool lp_load_initial_only(const char *pszFname)
false, /* add_ipc */
true, /* initialize_globals */
false, /* allow_include_registry */
- false); /* allow_registry_shares*/
+ false); /* load_all_shares*/
+}
+
+/**
+ * most common lp_load wrapper, loading only the globals
+ */
+bool lp_load_global(const char *file_name)
+{
+ return lp_load_ex(file_name,
+ true, /* global_only */
+ false, /* save_defaults */
+ false, /* add_ipc */
+ true, /* initialize_globals */
+ true, /* allow_include_registry */
+ false); /* load_all_shares*/
+}
+
+/**
+ * lp_load wrapper, especially for clients
+ */
+bool lp_load_client(const char *file_name)
+{
+ lp_set_in_client(true);
+
+ return lp_load_global(file_name);
+}
+
+/**
+ * lp_load wrapper, loading only globals, but intended
+ * for subsequent calls, not reinitializing the globals
+ * to default values
+ */
+bool lp_load_global_no_reinit(const char *file_name)
+{
+ return lp_load_ex(file_name,
+ true, /* global_only */
+ false, /* save_defaults */
+ false, /* add_ipc */
+ false, /* initialize_globals */
+ true, /* allow_include_registry */
+ false); /* load_all_shares*/
+}
+
+/**
+ * lp_load wrapper, especially for clients, no reinitialization
+ */
+bool lp_load_client_no_reinit(const char *file_name)
+{
+ lp_set_in_client(true);
+
+ return lp_load_global_no_reinit(file_name);
}
bool lp_load_with_registry_shares(const char *pszFname,
add_ipc,
initialize_globals,
true, /* allow_include_registry */
- true); /* allow_registry_shares*/
+ true); /* load_all_shares*/
}
/***************************************************************************
return (iService);
}
-bool share_defined(const char *service_name)
-{
- return (lp_servicenumber(service_name) != -1);
-}
-
/*******************************************************************
A useful volume label function.
********************************************************************/
If we are PDC then prefer us as DMB
************************************************************/
-bool lp_domain_master_true_or_auto(void)
+static bool lp_domain_master_true_or_auto(void)
{
if (Globals.iDomainMaster) /* auto or yes */
return true;
void lp_set_logfile(const char *name)
{
- string_set(&Globals.szLogFile, name);
+ string_set(&Globals.logfile, name);
debug_set_logfile(name);
}
bool lp_disable_spoolss( void )
{
if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
- spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
+ spoolss_state = lp__disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
return spoolss_state == SVCCTL_STOPPED ? true : false;
}
void widelinks_warning(int snum)
{
+ if (lp_allow_insecure_widelinks()) {
+ return;
+ }
+
if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
"These parameters are incompatible. "
{
/* wide links is always incompatible with unix extensions */
if (lp_unix_extensions()) {
- return false;
+ /*
+ * Unless we have "allow insecure widelinks"
+ * turned on.
+ */
+ if (!lp_allow_insecure_widelinks()) {
+ return false;
+ }
}
return lp_widelinks_internal(snum);
if (lp_async_smb_echo_handler()) {
return false;
}
- return _lp_writeraw();
+ return lp__writeraw();
}
bool lp_readraw(void)
if (lp_async_smb_echo_handler()) {
return false;
}
- return _lp_readraw();
+ return lp__readraw();
+}
+
+int lp_server_role(void)
+{
+ return lp_find_server_role(lp__server_role(),
+ lp_security(),
+ lp_domain_logons(),
+ lp_domain_master_true_or_auto());
+}
+
+const char *lp_ctdbd_socket(void)
+{
+ const char *result = lp__ctdbd_socket();
+
+#ifdef CLUSTER_SUPPORT
+ if ((result == NULL) || (*result == '\0')) {
+ return CTDB_PATH;
+ }
+#endif
+ return result;
}