[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Tue Jun 28 21:51:01 MDT 2011
The branch, master has been updated
via 21756b7 s3-param Use .offset rather than .ptr when defining parameters
via 573109d s3-param Remove .offset == 0 checks as 'valid' will have offset 0
via 0e38199 s3-param use .offset rather than .ptr (renames)
from 1fffddb Fix bug #8219 - SMB Panic from Windows 7 Client
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 21756b7c7d3048ce3396ab63aebc80babf4819e9
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed Jun 29 10:49:35 2011 +1000
s3-param Use .offset rather than .ptr when defining parameters
This change has a number of purposes:
* It removes the fancy logic around pointers into sDefault for all
per-share parameters. Instead, this is always expressed as an
offset, rather than implicitly via PTR_DIFF macros.
* It makes struct parm_struct almost identical to that as used in
source4/param. This will very shortly allow the loadparm tables
and most of the 'special' helper functions to be placed in common.
Andrew Bartlett
Autobuild-User: Andrew Bartlett <abartlet at samba.org>
Autobuild-Date: Wed Jun 29 05:50:46 CEST 2011 on sn-devel-104
commit 573109d346b67a9f711187636a2cae3ae7f1cbcf
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed Jun 29 12:36:06 2011 +1000
s3-param Remove .offset == 0 checks as 'valid' will have offset 0
The validity of an entry in the parm_table is by having a .p_class of
P_LOCAL or P_GLOBAL rather than P_SEPARATOR. Termination of the table
is by having a .label of non-NULL. This is possible because there are
no longer any specially handled smb.conf options without a value in
the struct loadparm_globals or struct loadparm_service.
This is required because the first element in the structure will have
.offset = 0, and skipping that would be unfortunate (particularly as it
is the vital 'valid' variable).
Andrew Bartlett
commit 0e38199a84368273739e440eb0163b95651dad7f
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed Jun 29 10:48:35 2011 +1000
s3-param use .offset rather than .ptr (renames)
This commit uses GLOBAL_VAR and LOCAL_VAR macros to hide the use of .ptr
in the source3 loadparm code.
This will then be changed to use offsetof() in a future commit, removing
the #define offset ptr hack.
Andrew Bartlett
-----------------------------------------------------------------------
Summary of changes:
source3/include/smb.h | 2 +-
source3/param/loadparm.c | 887 +++++++++++++++++++++++-----------------------
2 files changed, 439 insertions(+), 450 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/smb.h b/source3/include/smb.h
index f46a58e..25e3bac 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -731,7 +731,7 @@ struct parm_struct {
const char *label;
parm_type type;
parm_class p_class;
- void *ptr;
+ offset_t offset;
bool (*special)(int snum, const char *, char **);
const struct enum_list *enum_list;
unsigned flags;
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index a0a5e74..430c2de 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -930,6 +930,9 @@ static const struct enum_list enum_kerberos_method[] = {
* name first, and all synonyms must follow it with the FLAG_HIDE attribute.
*/
+#define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
+#define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
+
static struct parm_struct parm_table[] = {
{N_("Base Options"), P_SEP, P_SEPARATOR},
@@ -937,7 +940,7 @@ static struct parm_struct parm_table[] = {
.label = "dos charset",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.dos_charset,
+ .offset = GLOBAL_VAR(dos_charset),
.special = handle_dos_charset,
.enum_list = NULL,
.flags = FLAG_ADVANCED
@@ -946,7 +949,7 @@ static struct parm_struct parm_table[] = {
.label = "unix charset",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.unix_charset,
+ .offset = GLOBAL_VAR(unix_charset),
.special = handle_charset,
.enum_list = NULL,
.flags = FLAG_ADVANCED
@@ -955,7 +958,7 @@ static struct parm_struct parm_table[] = {
.label = "comment",
.type = P_STRING,
.p_class = P_LOCAL,
- .ptr = &sDefault.comment,
+ .offset = LOCAL_VAR(comment),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
@@ -964,7 +967,7 @@ static struct parm_struct parm_table[] = {
.label = "path",
.type = P_STRING,
.p_class = P_LOCAL,
- .ptr = &sDefault.szPath,
+ .offset = LOCAL_VAR(szPath),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
@@ -973,7 +976,7 @@ static struct parm_struct parm_table[] = {
.label = "directory",
.type = P_STRING,
.p_class = P_LOCAL,
- .ptr = &sDefault.szPath,
+ .offset = LOCAL_VAR(szPath),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_HIDE,
@@ -982,7 +985,7 @@ static struct parm_struct parm_table[] = {
.label = "workgroup",
.type = P_USTRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szWorkgroup,
+ .offset = GLOBAL_VAR(szWorkgroup),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
@@ -991,7 +994,7 @@ static struct parm_struct parm_table[] = {
.label = "realm",
.type = P_USTRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szRealm,
+ .offset = GLOBAL_VAR(szRealm),
.special = handle_realm,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
@@ -1000,7 +1003,7 @@ static struct parm_struct parm_table[] = {
.label = "netbios name",
.type = P_USTRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szNetbiosName,
+ .offset = GLOBAL_VAR(szNetbiosName),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
@@ -1009,7 +1012,7 @@ static struct parm_struct parm_table[] = {
.label = "netbios aliases",
.type = P_LIST,
.p_class = P_GLOBAL,
- .ptr = &Globals.szNetbiosAliases,
+ .offset = GLOBAL_VAR(szNetbiosAliases),
.special = handle_netbios_aliases,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1018,7 +1021,7 @@ static struct parm_struct parm_table[] = {
.label = "netbios scope",
.type = P_USTRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szNetbiosScope,
+ .offset = GLOBAL_VAR(szNetbiosScope),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1027,7 +1030,7 @@ static struct parm_struct parm_table[] = {
.label = "server string",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szServerString,
+ .offset = GLOBAL_VAR(szServerString),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED,
@@ -1036,7 +1039,7 @@ static struct parm_struct parm_table[] = {
.label = "interfaces",
.type = P_LIST,
.p_class = P_GLOBAL,
- .ptr = &Globals.szInterfaces,
+ .offset = GLOBAL_VAR(szInterfaces),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
@@ -1045,7 +1048,7 @@ static struct parm_struct parm_table[] = {
.label = "bind interfaces only",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bBindInterfacesOnly,
+ .offset = GLOBAL_VAR(bBindInterfacesOnly),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_WIZARD,
@@ -1054,7 +1057,7 @@ static struct parm_struct parm_table[] = {
.label = "config backend",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .ptr = &Globals.ConfigBackend,
+ .offset = GLOBAL_VAR(ConfigBackend),
.special = NULL,
.enum_list = enum_config_backend,
.flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
@@ -1066,7 +1069,7 @@ static struct parm_struct parm_table[] = {
.label = "security",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .ptr = &Globals.security,
+ .offset = GLOBAL_VAR(security),
.special = NULL,
.enum_list = enum_security,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
@@ -1075,7 +1078,7 @@ static struct parm_struct parm_table[] = {
.label = "auth methods",
.type = P_LIST,
.p_class = P_GLOBAL,
- .ptr = &Globals.AuthMethods,
+ .offset = GLOBAL_VAR(AuthMethods),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1084,7 +1087,7 @@ static struct parm_struct parm_table[] = {
.label = "encrypt passwords",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bEncryptPasswords,
+ .offset = GLOBAL_VAR(bEncryptPasswords),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
@@ -1093,7 +1096,7 @@ static struct parm_struct parm_table[] = {
.label = "client schannel",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .ptr = &Globals.clientSchannel,
+ .offset = GLOBAL_VAR(clientSchannel),
.special = NULL,
.enum_list = enum_bool_auto,
.flags = FLAG_BASIC | FLAG_ADVANCED,
@@ -1102,7 +1105,7 @@ static struct parm_struct parm_table[] = {
.label = "server schannel",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .ptr = &Globals.serverSchannel,
+ .offset = GLOBAL_VAR(serverSchannel),
.special = NULL,
.enum_list = enum_bool_auto,
.flags = FLAG_BASIC | FLAG_ADVANCED,
@@ -1111,7 +1114,7 @@ static struct parm_struct parm_table[] = {
.label = "allow trusted domains",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bAllowTrustedDomains,
+ .offset = GLOBAL_VAR(bAllowTrustedDomains),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1120,7 +1123,7 @@ static struct parm_struct parm_table[] = {
.label = "map to guest",
.type = P_ENUM,
.p_class = P_GLOBAL,
- .ptr = &Globals.map_to_guest,
+ .offset = GLOBAL_VAR(map_to_guest),
.special = NULL,
.enum_list = enum_map_to_guest,
.flags = FLAG_ADVANCED,
@@ -1129,7 +1132,7 @@ static struct parm_struct parm_table[] = {
.label = "null passwords",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bNullPasswords,
+ .offset = GLOBAL_VAR(bNullPasswords),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_DEPRECATED,
@@ -1138,7 +1141,7 @@ static struct parm_struct parm_table[] = {
.label = "obey pam restrictions",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bObeyPamRestrictions,
+ .offset = GLOBAL_VAR(bObeyPamRestrictions),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1147,7 +1150,7 @@ static struct parm_struct parm_table[] = {
.label = "password server",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szPasswordServer,
+ .offset = GLOBAL_VAR(szPasswordServer),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_WIZARD,
@@ -1156,7 +1159,7 @@ static struct parm_struct parm_table[] = {
.label = "smb passwd file",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szSMBPasswdFile,
+ .offset = GLOBAL_VAR(szSMBPasswdFile),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1165,7 +1168,7 @@ static struct parm_struct parm_table[] = {
.label = "private dir",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szPrivateDir,
+ .offset = GLOBAL_VAR(szPrivateDir),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1174,7 +1177,7 @@ static struct parm_struct parm_table[] = {
.label = "passdb backend",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szPassdbBackend,
+ .offset = GLOBAL_VAR(szPassdbBackend),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_WIZARD,
@@ -1183,7 +1186,7 @@ static struct parm_struct parm_table[] = {
.label = "algorithmic rid base",
.type = P_INTEGER,
.p_class = P_GLOBAL,
- .ptr = &Globals.AlgorithmicRidBase,
+ .offset = GLOBAL_VAR(AlgorithmicRidBase),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1192,7 +1195,7 @@ static struct parm_struct parm_table[] = {
.label = "root directory",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szRootdir,
+ .offset = GLOBAL_VAR(szRootdir),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1201,7 +1204,7 @@ static struct parm_struct parm_table[] = {
.label = "root dir",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szRootdir,
+ .offset = GLOBAL_VAR(szRootdir),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_HIDE,
@@ -1210,7 +1213,7 @@ static struct parm_struct parm_table[] = {
.label = "root",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szRootdir,
+ .offset = GLOBAL_VAR(szRootdir),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_HIDE,
@@ -1219,7 +1222,7 @@ static struct parm_struct parm_table[] = {
.label = "guest account",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szGuestaccount,
+ .offset = GLOBAL_VAR(szGuestaccount),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_BASIC | FLAG_ADVANCED,
@@ -1228,7 +1231,7 @@ static struct parm_struct parm_table[] = {
.label = "enable privileges",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bEnablePrivileges,
+ .offset = GLOBAL_VAR(bEnablePrivileges),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_DEPRECATED,
@@ -1238,7 +1241,7 @@ static struct parm_struct parm_table[] = {
.label = "pam password change",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bPamPasswordChange,
+ .offset = GLOBAL_VAR(bPamPasswordChange),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1247,7 +1250,7 @@ static struct parm_struct parm_table[] = {
.label = "passwd program",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szPasswdProgram,
+ .offset = GLOBAL_VAR(szPasswdProgram),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1256,7 +1259,7 @@ static struct parm_struct parm_table[] = {
.label = "passwd chat",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szPasswdChat,
+ .offset = GLOBAL_VAR(szPasswdChat),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1265,7 +1268,7 @@ static struct parm_struct parm_table[] = {
.label = "passwd chat debug",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bPasswdChatDebug,
+ .offset = GLOBAL_VAR(bPasswdChatDebug),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1274,7 +1277,7 @@ static struct parm_struct parm_table[] = {
.label = "passwd chat timeout",
.type = P_INTEGER,
.p_class = P_GLOBAL,
- .ptr = &Globals.iPasswdChatTimeout,
+ .offset = GLOBAL_VAR(iPasswdChatTimeout),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1283,7 +1286,7 @@ static struct parm_struct parm_table[] = {
.label = "check password script",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szCheckPasswordScript,
+ .offset = GLOBAL_VAR(szCheckPasswordScript),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1292,7 +1295,7 @@ static struct parm_struct parm_table[] = {
.label = "username map",
.type = P_STRING,
.p_class = P_GLOBAL,
- .ptr = &Globals.szUsernameMap,
+ .offset = GLOBAL_VAR(szUsernameMap),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1301,7 +1304,7 @@ static struct parm_struct parm_table[] = {
.label = "password level",
.type = P_INTEGER,
.p_class = P_GLOBAL,
- .ptr = &Globals.pwordlevel,
+ .offset = GLOBAL_VAR(pwordlevel),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_DEPRECATED,
@@ -1310,7 +1313,7 @@ static struct parm_struct parm_table[] = {
.label = "username level",
.type = P_INTEGER,
.p_class = P_GLOBAL,
- .ptr = &Globals.unamelevel,
+ .offset = GLOBAL_VAR(unamelevel),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1319,7 +1322,7 @@ static struct parm_struct parm_table[] = {
.label = "unix password sync",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bUnixPasswdSync,
+ .offset = GLOBAL_VAR(bUnixPasswdSync),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1328,7 +1331,7 @@ static struct parm_struct parm_table[] = {
.label = "restrict anonymous",
.type = P_INTEGER,
.p_class = P_GLOBAL,
- .ptr = &Globals.restrict_anonymous,
+ .offset = GLOBAL_VAR(restrict_anonymous),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1337,7 +1340,7 @@ static struct parm_struct parm_table[] = {
.label = "lanman auth",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bLanmanAuth,
+ .offset = GLOBAL_VAR(bLanmanAuth),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1346,7 +1349,7 @@ static struct parm_struct parm_table[] = {
.label = "ntlm auth",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bNTLMAuth,
+ .offset = GLOBAL_VAR(bNTLMAuth),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1355,7 +1358,7 @@ static struct parm_struct parm_table[] = {
.label = "client NTLMv2 auth",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bClientNTLMv2Auth,
+ .offset = GLOBAL_VAR(bClientNTLMv2Auth),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1364,7 +1367,7 @@ static struct parm_struct parm_table[] = {
.label = "client lanman auth",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bClientLanManAuth,
+ .offset = GLOBAL_VAR(bClientLanManAuth),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1373,7 +1376,7 @@ static struct parm_struct parm_table[] = {
.label = "client plaintext auth",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.bClientPlaintextAuth,
+ .offset = GLOBAL_VAR(bClientPlaintextAuth),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1382,7 +1385,7 @@ static struct parm_struct parm_table[] = {
.label = "client use spnego principal",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.client_use_spnego_principal,
+ .offset = GLOBAL_VAR(client_use_spnego_principal),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1391,7 +1394,7 @@ static struct parm_struct parm_table[] = {
.label = "send spnego principal",
.type = P_BOOL,
.p_class = P_GLOBAL,
- .ptr = &Globals.send_spnego_principal,
+ .offset = GLOBAL_VAR(send_spnego_principal),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@@ -1400,7 +1403,7 @@ static struct parm_struct parm_table[] = {
.label = "username",
.type = P_STRING,
.p_class = P_LOCAL,
- .ptr = &sDefault.szUsername,
+ .offset = LOCAL_VAR(szUsername),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
@@ -1409,7 +1412,7 @@ static struct parm_struct parm_table[] = {
.label = "user",
.type = P_STRING,
.p_class = P_LOCAL,
- .ptr = &sDefault.szUsername,
--
Samba Shared Repository
More information about the samba-cvs
mailing list