loadparm.c

来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· C语言 代码 · 共 1,423 行 · 第 1/5 页

C
1,423
字号
	False,			/* bAfs_Share */	False,			/* bEASupport */	True,			/* bAclCheckPermissions */	True,			/* bAclMapFullControl */	False,			/* bAclGroupControl */	SMB_ROUNDUP_ALLOCATION_SIZE,		/* iallocation_roundup_size */	0,			/* iAioReadSize */	0,			/* iAioWriteSize */	MAP_READONLY_YES,	/* iMap_readonly */		NULL,			/* Parametric options */	""			/* dummy */};/* local variables */static service **ServicePtrs = NULL;static int iNumServices = 0;static int iServiceIndex = 0;static TDB_CONTEXT *ServiceHash;static int *invalid_services = NULL;static int num_invalid_services = 0;static BOOL bInGlobalSection = True;static BOOL bGlobalOnly = False;static int server_role;static int default_server_announce;#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))/* prototypes for the special type handlers */static BOOL handle_include( int snum, const char *pszParmValue, char **ptr);static BOOL handle_copy( int snum, const char *pszParmValue, char **ptr);static BOOL handle_netbios_name( int snum, const char *pszParmValue, char **ptr);static BOOL handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);static BOOL handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);static BOOL handle_debug_list( int snum, const char *pszParmValue, char **ptr );static BOOL handle_workgroup( int snum, const char *pszParmValue, char **ptr );static BOOL handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );static BOOL handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );static BOOL handle_charset( int snum, const char *pszParmValue, char **ptr );static BOOL handle_acl_compatibility( int snum, const char *pszParmValue, char **ptr);static BOOL handle_printing( int snum, const char *pszParmValue, char **ptr);static void set_server_role(void);static void set_default_server_announce_type(void);static void set_allowed_client_auth(void);static const struct enum_list enum_protocol[] = {	{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}};static const struct enum_list enum_printing[] = {	{PRINT_SYSV, "sysv"},	{PRINT_AIX, "aix"},	{PRINT_HPUX, "hpux"},	{PRINT_BSD, "bsd"},	{PRINT_QNX, "qnx"},	{PRINT_PLP, "plp"},	{PRINT_LPRNG, "lprng"},	{PRINT_CUPS, "cups"},	{PRINT_IPRINT, "iprint"},	{PRINT_LPRNT, "nt"},	{PRINT_LPROS2, "os2"},#ifdef DEVELOPER	{PRINT_TEST, "test"},	{PRINT_VLP, "vlp"},#endif /* DEVELOPER */	{-1, NULL}};static const struct enum_list enum_ldap_ssl[] = {#ifdef WITH_LDAP_SAMCONFIG	{LDAP_SSL_ON, "Yes"},	{LDAP_SSL_ON, "yes"},	{LDAP_SSL_ON, "on"},	{LDAP_SSL_ON, "On"},#endif	{LDAP_SSL_OFF, "no"},	{LDAP_SSL_OFF, "No"},	{LDAP_SSL_OFF, "off"},	{LDAP_SSL_OFF, "Off"},	{LDAP_SSL_START_TLS, "start tls"},	{LDAP_SSL_START_TLS, "Start_tls"},	{-1, NULL}};static const struct enum_list enum_ldap_passwd_sync[] = {	{LDAP_PASSWD_SYNC_OFF, "no"},	{LDAP_PASSWD_SYNC_OFF, "No"},	{LDAP_PASSWD_SYNC_OFF, "off"},	{LDAP_PASSWD_SYNC_OFF, "Off"},	{LDAP_PASSWD_SYNC_ON, "Yes"},	{LDAP_PASSWD_SYNC_ON, "yes"},	{LDAP_PASSWD_SYNC_ON, "on"},	{LDAP_PASSWD_SYNC_ON, "On"},	{LDAP_PASSWD_SYNC_ONLY, "Only"},	{LDAP_PASSWD_SYNC_ONLY, "only"},	{-1, NULL}};/* Types of machine we can announce as. */#define ANNOUNCE_AS_NT_SERVER 1#define ANNOUNCE_AS_WIN95 2#define ANNOUNCE_AS_WFW 3#define ANNOUNCE_AS_NT_WORKSTATION 4static const struct enum_list enum_announce_as[] = {	{ANNOUNCE_AS_NT_SERVER, "NT"},	{ANNOUNCE_AS_NT_SERVER, "NT Server"},	{ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},	{ANNOUNCE_AS_WIN95, "win95"},	{ANNOUNCE_AS_WFW, "WfW"},	{-1, NULL}};static const struct enum_list enum_map_readonly[] = {	{MAP_READONLY_NO, "no"},	{MAP_READONLY_NO, "false"},	{MAP_READONLY_NO, "0"},	{MAP_READONLY_YES, "yes"},	{MAP_READONLY_YES, "true"},	{MAP_READONLY_YES, "1"},	{MAP_READONLY_PERMISSIONS, "permissions"},	{MAP_READONLY_PERMISSIONS, "perms"},	{-1, NULL}};static const struct enum_list enum_case[] = {	{CASE_LOWER, "lower"},	{CASE_UPPER, "upper"},	{-1, NULL}};static const struct enum_list enum_bool_auto[] = {	{False, "No"},	{False, "False"},	{False, "0"},	{True, "Yes"},	{True, "True"},	{True, "1"},	{Auto, "Auto"},	{-1, NULL}};/* Client-side offline caching policy types */#define CSC_POLICY_MANUAL 0#define CSC_POLICY_DOCUMENTS 1#define CSC_POLICY_PROGRAMS 2#define CSC_POLICY_DISABLE 3static 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}};/*    Do you want session setups at user level security with a invalid   password to be rejected or allowed in as guest? WinNT rejects them   but it can be a pain as it means "net view" needs to use a password   You have 3 choices in the setting of map_to_guest:   "Never" means session setups with an invalid password   are rejected. This is the default.   "Bad User" means session setups with an invalid password   are rejected, unless the username does not exist, in which case it   is treated as a guest login   "Bad Password" means session setups with an invalid password   are treated as a guest login   Note that map_to_guest only has an effect in user or server   level security.*/static const struct enum_list enum_map_to_guest[] = {	{NEVER_MAP_TO_GUEST, "Never"},	{MAP_TO_GUEST_ON_BAD_USER, "Bad User"},	{MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},        {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},	{-1, NULL}};/* Note: We do not initialise the defaults union - it is not allowed in ANSI C * * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit * screen in SWAT. This is used to exclude parameters as well as to squash all * parameters that have been duplicated by pseudonyms. * * NOTE: To display a parameter in BASIC view set FLAG_BASIC *       Any parameter that does NOT have FLAG_ADVANCED will not disply at all *	 Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in *        respective views. * * NOTE2: Handling of duplicated (synonym) paramters: *	Only the first occurance of a parameter should be enabled by FLAG_BASIC *	and/or FLAG_ADVANCED. All duplicates following the first mention should be *	set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred *	name first, and all synonyms must follow it with the FLAG_HIDE attribute. */static struct parm_struct parm_table[] = {	{N_("Base Options"), P_SEP, P_SEPARATOR}, 	{"dos charset", P_STRING, P_GLOBAL, &Globals.dos_charset, handle_charset, NULL, FLAG_ADVANCED}, 	{"unix charset", P_STRING, P_GLOBAL, &Globals.unix_charset, handle_charset, NULL, FLAG_ADVANCED}, 	{"display charset", P_STRING, P_GLOBAL, &Globals.display_charset, handle_charset, NULL, FLAG_ADVANCED}, 	{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT}, 	{"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT}, 	{"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE}, 	{"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkgroup, handle_workgroup, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, #ifdef WITH_ADS	{"realm", P_USTRING, P_GLOBAL, &Globals.szRealm, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, #endif	{"netbios name", P_USTRING, P_GLOBAL, &Globals.szNetbiosName, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, 	{"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, handle_netbios_aliases,  NULL, FLAG_ADVANCED}, 	{"netbios scope", P_USTRING, P_GLOBAL, &Globals.szNetbiosScope, handle_netbios_scope,  NULL, FLAG_ADVANCED}, 	{"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED }, 	{"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, 	{"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD}, 	{N_("Security Options"), P_SEP, P_SEPARATOR}, 	{"security", P_ENUM, P_GLOBAL, &Globals.security, NULL, enum_security, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, 	{"auth methods", P_LIST, P_GLOBAL, &Globals.AuthMethods, NULL, NULL, FLAG_ADVANCED}, 	{"encrypt passwords", P_BOOL, P_GLOBAL, &Globals.bEncryptPasswords, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, 	{"update encrypted", P_BOOL, P_GLOBAL, &Globals.bUpdateEncrypt, NULL, NULL, FLAG_ADVANCED}, 	{"client schannel", P_ENUM, P_GLOBAL, &Globals.clientSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED}, 	{"server schannel", P_ENUM, P_GLOBAL, &Globals.serverSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED}, 	{"allow trusted domains", P_BOOL, P_GLOBAL, &Globals.bAllowTrustedDomains, NULL, NULL, FLAG_ADVANCED}, 	{"hosts equiv", P_STRING, P_GLOBAL, &Globals.szHostsEquiv, NULL, NULL, FLAG_ADVANCED}, 	{"map to guest", P_ENUM, P_GLOBAL, &Globals.map_to_guest, NULL, enum_map_to_guest, FLAG_ADVANCED}, 	{"null passwords", P_BOOL, P_GLOBAL, &Globals.bNullPasswords, NULL, NULL, FLAG_ADVANCED}, 	{"obey pam restrictions", P_BOOL, P_GLOBAL, &Globals.bObeyPamRestrictions, NULL, NULL, FLAG_ADVANCED}, 	{"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD}, 	{"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, FLAG_ADVANCED}, 	{"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED}, 	{"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD}, 	{"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.AlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED}, 	{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED}, 	{"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE}, 	{"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE}, 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?