summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--script/mkparamdefs.pl (renamed from source4/script/mkparamdefs.pl)66
-rw-r--r--source3/Makefile.in8
-rw-r--r--source3/param/loadparm.c446
-rwxr-xr-xsource3/wscript_build12
-rw-r--r--source4/param/wscript_build4
6 files changed, 98 insertions, 440 deletions
diff --git a/.gitignore b/.gitignore
index 383bb1e098..4bf1bae4ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -90,6 +90,8 @@ source3/script/installbin.sh
source3/script/uninstallbin.sh
source3/smbadduser
source3/smbd/build_options.c
+source3/param/param_global.h
+source3/param/param_local.h
source3/setup
pidl/blib
pidl/cover_db
diff --git a/source4/script/mkparamdefs.pl b/script/mkparamdefs.pl
index 9b255a86fc..d9784201a3 100644
--- a/source4/script/mkparamdefs.pl
+++ b/script/mkparamdefs.pl
@@ -99,7 +99,7 @@ $file->("/* This file was automatically generated by mkparmdefs.pl. DO NOT EDIT
$file->("{\n");
}
-sub print_footer($$$)
+sub print_footer($$$)
{
my ($file, $header_name, $generate_scope) = @_;
$file->("LOADPARM_EXTRA_" . $generate_scope . "S\n");
@@ -107,32 +107,43 @@ sub print_footer($$$)
$file->("\n#endif /* $header_name */\n\n");
}
-sub handle_loadparm($$$)
+sub handle_loadparm($$$)
{
my ($file,$line,$generate_scope) = @_;
+ my $scope;
+ my $type;
+ my $name;
+ my $var;
+
if ($line =~ /^FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),(.*)\)/o) {
- my $scope = $1;
- my $type = $2;
- my $name = $3;
- my $var = $4;
-
- my %tmap = (
- "BOOL" => "int ",
- "CONST_STRING" => "char *",
- "STRING" => "char *",
- "INTEGER" => "int ",
- "CHAR" => "char ",
- "LIST" => "const char **",
- );
-
- if ($scope eq $generate_scope) {
- $file->("\t$tmap{$type} $var;\n");
- }
+ $scope = $1;
+ $type = $2;
+ $name = $3;
+ $var = $4;
+ } elsif ($line =~ /^FN_(GLOBAL|LOCAL)_PARM_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),(.*)\)/o) {
+ $scope = $1;
+ $type = $2;
+ $name = $3;
+ $var = $4;
+ } else {
+ return;
+ }
+ my %tmap = (
+ "BOOL" => "int ",
+ "CONST_STRING" => "char *",
+ "STRING" => "char *",
+ "INTEGER" => "int ",
+ "CHAR" => "char ",
+ "LIST" => "const char **",
+ );
+
+ if ($scope eq $generate_scope) {
+ $file->("\t$tmap{$type} $var;\n");
}
}
-sub process_file($$)
+sub process_file($$)
{
my ($file, $filename) = @_;
@@ -146,8 +157,8 @@ sub process_file($$)
my $comment = undef;
my $incomment = 0;
- while (my $line = <FH>) {
- if ($line =~ /^\/\*\*/) {
+ while (my $line = <FH>) {
+ if ($line =~ /^\/\*\*/) {
$comment = "";
$incomment = 1;
}
@@ -157,16 +168,18 @@ sub process_file($$)
if ($line =~ /\*\//) {
$incomment = 0;
}
- }
+ }
# these are ordered for maximum speed
next if ($line =~ /^\s/);
-
+
next unless ($line =~ /\(/);
next if ($line =~ /^\/|[;]/);
- if ($line =~ /^FN_/) {
+ if ($line =~ /^static (FN_.*)/) {
+ handle_loadparm($file, $1, $generate_scope);
+ } elsif ($line =~ /^FN_/) {
handle_loadparm($file, $line, $generate_scope);
}
next;
@@ -186,7 +199,6 @@ if (not defined($file)) {
}
mkpath(dirname($file), 0, 0755);
-open(PUBLIC, ">$file") or die("Can't open `$file': $!");
+open(PUBLIC, ">$file") or die("Can't open `$file': $!");
print PUBLIC "$$public_data";
close(PUBLIC);
-
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 4839ab6c0f..aaea79d0f3 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1552,7 +1552,7 @@ all:: SHOWFLAGS basics libs $(SBIN_PROGS) $(BIN_PROGS) \
$(MODULES) $(NSS_MODULES) $(PAM_MODULES) \
$(EXTRA_ALL_TARGETS)
-basics:: samba3-idl
+basics:: samba3-idl mkparam
nss_modules:: $(NSS_MODULES)
@@ -1629,6 +1629,10 @@ idl_full::
@PIDL_OUTPUTDIR="librpc/gen_ndr" PIDL_ARGS="$(PIDL_ARGS)" CPP="$(CPP)" PIDL="../pidl/pidl" \
srcdir="$(srcdir)" $(srcdir)/script/build_idl.sh --full $(IDL_FILES)
+mkparam:
+ $(PERL) ../script/mkparamdefs.pl $(srcdir)/param/loadparm.c --file param/param_local.h --generate-scope=LOCAL
+ $(PERL) ../script/mkparamdefs.pl $(srcdir)/param/loadparm.c --file param/param_global.h --generate-scope=GLOBAL
+
#####################################################################
@@ -3377,6 +3381,8 @@ cleanlibs::
clean:: cleanlibs
-rm -f include/build_env.h
-rm -f smbd/build_options.c
+ -rm -f param/param_local.h
+ -rm -f param/param_global.h
-rm -f $(PRECOMPILED_HEADER)
-rm -f core */*~ *~ \
*/*.o */*/*.o */*/*/*.o */*/*/*/*.o \
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index c7ed46fd8b..1b6d3a14b9 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -125,415 +125,44 @@ struct param_opt_struct {
unsigned flags;
};
-/*
- * This structure describes global (ie., server-wide) parameters.
- */
-struct loadparm_global {
- int ConfigBackend;
- char *smb_ports;
- char *dos_charset;
- char *unix_charset;
- char *szPrintcapname;
- char *szAddPortCommand;
- char *szEnumPortsCommand;
- char *szAddPrinterCommand;
- char *szDeletePrinterCommand;
- char *szOs2DriverMap;
- char *szLockDir;
- char *szStateDir;
- char *szCacheDir;
- char *szPidDir;
- char *szRootdir;
- char *szDefaultService;
- char *szGetQuota;
- char *szSetQuota;
- char *szMsgCommand;
- char *szServerString;
- char *szAutoServices;
- char *szPasswdProgram;
- char *szPasswdChat;
- char *szLogFile;
- char *szConfigFile;
- char *szSMBPasswdFile;
- char *szPrivateDir;
- char *szPassdbBackend;
- char **szPreloadModules;
- char *szPasswordServer;
- char *szSocketOptions;
- char *szRealm;
- char *szRealmUpper;
- char *szDnsDomain;
- char *szAfsUsernameMap;
- int iAfsTokenLifetime;
- char *szLogNtTokenCommand;
- char *szUsernameMap;
- char *szLogonScript;
- char *szLogonPath;
- char *szLogonDrive;
- char *szLogonHome;
- char **szWINSservers;
- char **szInterfaces;
- char *szRemoteAnnounce;
- char *szRemoteBrowseSync;
- char *szSocketAddress;
- bool bNmbdBindExplicitBroadcast;
- char *szNISHomeMapName;
- char *szWorkgroup;
- char *szNetbiosName;
- char **szNetbiosAliases;
- char *szNetbiosScope;
- char *szNameResolveOrder;
- char *szPanicAction;
- char *szAddUserScript;
- char *szRenameUserScript;
- char *szDelUserScript;
- char *szAddGroupScript;
- char *szDelGroupScript;
- char *szAddUserToGroupScript;
- char *szDelUserFromGroupScript;
- char *szSetPrimaryGroupScript;
- char *szAddMachineScript;
- char *szShutdownScript;
- char *szAbortShutdownScript;
- char *szUsernameMapScript;
- int iUsernameMapCacheTime;
- char *szCheckPasswordScript;
- char *szWINSHook;
- char *szUtmpDir;
- char *szWtmpDir;
- bool bUtmp;
- char *szIdmapUID;
- char *szIdmapGID;
- bool bPassdbExpandExplicit;
- int AlgorithmicRidBase;
- char *szTemplateHomedir;
- char *szTemplateShell;
- char *szWinbindSeparator;
- bool bWinbindEnumUsers;
- bool bWinbindEnumGroups;
- bool bWinbindUseDefaultDomain;
- bool bWinbindTrustedDomainsOnly;
- bool bWinbindNestedGroups;
- int winbind_expand_groups;
- bool bWinbindRefreshTickets;
- bool bWinbindOfflineLogon;
- bool bWinbindNormalizeNames;
- bool bWinbindRpcOnly;
- bool bCreateKrb5Conf;
- int winbindMaxDomainConnections;
- char *szIdmapBackend;
- char *szAddShareCommand;
- char *szChangeShareCommand;
- char *szDeleteShareCommand;
- char **szEventLogs;
- char *szGuestaccount;
- char *szManglingMethod;
- char **szServicesList;
- char *szUsersharePath;
- char *szUsershareTemplateShare;
- char **szUsersharePrefixAllowList;
- char **szUsersharePrefixDenyList;
- int mangle_prefix;
- int max_log_size;
- char *szLogLevel;
- int max_xmit;
- int max_mux;
- int max_open_files;
- int open_files_db_hash_size;
- int pwordlevel;
- int unamelevel;
- int deadtime;
- bool getwd_cache;
- int maxprotocol;
- int minprotocol;
- int security;
- char **AuthMethods;
- bool paranoid_server_security;
- int maxdisksize;
- int lpqcachetime;
- int iMaxSmbdProcesses;
- bool bDisableSpoolss;
- int syslog;
- int os_level;
- bool enhanced_browsing;
- int max_ttl;
- int max_wins_ttl;
- int min_wins_ttl;
- int lm_announce;
- int lm_interval;
- int machine_password_timeout;
- int map_to_guest;
- int oplock_break_wait_time;
- int winbind_cache_time;
- int winbind_reconnect_delay;
- int winbind_max_clients;
- char **szWinbindNssInfo;
- int iLockSpinTime;
- char *szLdapMachineSuffix;
- char *szLdapUserSuffix;
- char *szLdapIdmapSuffix;
- char *szLdapGroupSuffix;
- int ldap_ssl;
- bool ldap_ssl_ads;
- int ldap_deref;
- int ldap_follow_referral;
- char *szLdapSuffix;
- char *szLdapAdminDn;
- int ldap_debug_level;
- int ldap_debug_threshold;
- int iAclCompat;
- char *szCupsServer;
- int CupsEncrypt;
- char *szIPrintServer;
- char *ctdbdSocket;
- char **szClusterAddresses;
- bool clustering;
- int ctdb_timeout;
- int ctdb_locktime_warn_threshold;
- int ldap_passwd_sync;
- int ldap_replication_sleep;
- int ldap_timeout; /* This is initialised in init_globals */
- int ldap_connection_timeout;
- int ldap_page_size;
- bool ldap_delete_dn;
- bool bMsAddPrinterWizard;
- bool bDNSproxy;
- bool bWINSsupport;
- bool bWINSproxy;
- bool bLocalMaster;
- int iPreferredMaster;
- int iDomainMaster;
- bool bDomainLogons;
- char **szInitLogonDelayedHosts;
- int InitLogonDelay;
- bool bEncryptPasswords;
- int clientSchannel;
- int serverSchannel;
- bool bNullPasswords;
- bool bObeyPamRestrictions;
- bool bLoadPrinters;
- int PrintcapCacheTime;
- bool bLargeReadwrite;
- bool bReadRaw;
- bool bWriteRaw;
- bool bSyslogOnly;
- bool bBrowseList;
- bool bNISHomeMap;
- bool bTimeServer;
- bool bBindInterfacesOnly;
- bool bPamPasswordChange;
- bool bUnixPasswdSync;
- bool bPasswdChatDebug;
- int iPasswdChatTimeout;
- bool bTimestampLogs;
- bool bNTSmbSupport;
- bool bNTPipeSupport;
- bool bNTStatusSupport;
- bool bStatCache;
- int iMaxStatCacheSize;
- bool bKernelOplocks;
- bool bAllowTrustedDomains;
- bool bLanmanAuth;
- bool bNTLMAuth;
- bool bUseSpnego;
- bool bClientLanManAuth;
- bool bClientNTLMv2Auth;
- bool bClientPlaintextAuth;
- bool bClientUseSpnego;
- bool client_use_spnego_principal;
- bool send_spnego_principal;
- bool bDebugPrefixTimestamp;
- bool bDebugHiresTimestamp;
- bool bDebugPid;
- bool bDebugUid;
- bool bDebugClass;
- bool bEnableCoreFiles;
- bool bHostMSDfs;
- bool bUseMmap;
- bool bHostnameLookups;
- bool bUnixExtensions;
- bool bDisableNetbios;
- char * szDedicatedKeytabFile;
- int iKerberosMethod;
- bool bDeferSharingViolations;
- bool bEnablePrivileges;
- bool bASUSupport;
- bool bUsershareOwnerOnly;
- bool bUsershareAllowGuests;
- bool bRegistryShares;
- int restrict_anonymous;
- int name_cache_timeout;
- int client_signing;
- int server_signing;
- int client_ldap_sasl_wrapping;
- int iUsershareMaxShares;
- int iIdmapCacheTime;
- int iIdmapNegativeCacheTime;
- bool bResetOnZeroVC;
- bool bLogWriteableFilesOnExit;
- int iKeepalive;
- int iminreceivefile;
- struct param_opt_struct *param_opt;
- int cups_connection_timeout;
- char *szSMBPerfcountModule;
- bool bMapUntrustedToDomain;
- bool bAsyncSMBEchoHandler;
- bool bMulticastDnsRegister;
- int ismb2_max_read;
- int ismb2_max_write;
- int ismb2_max_trans;
+#define LOADPARM_EXTRA_GLOBALS \
+ struct param_opt_struct *param_opt; \
+ char *szRealm; \
+ char *szLogLevel; \
+ int iminreceivefile; \
+ char *szPrintcapname; \
+ int CupsEncrypt; \
+ int iPreferredMaster; \
+ int iDomainMaster; \
+ char *szLdapMachineSuffix; \
+ char *szLdapUserSuffix; \
+ char *szLdapIdmapSuffix; \
+ char *szLdapGroupSuffix; \
+ char *szStateDir; \
+ char *szCacheDir; \
+ char *szSocketAddress; \
+ char *szUsershareTemplateShare; \
+ char *szIdmapUID; \
+ char *szIdmapGID; \
+ int winbindMaxDomainConnections; \
int ismb2_max_credits;
- char *ncalrpc_dir;
-};
-
-static struct loadparm_global Globals;
-
-/*
- * This structure describes a single service.
- */
-struct loadparm_service {
- bool valid;
- bool autoloaded;
- int usershare;
- struct timespec usershare_last_mod;
- char *szService;
- char *szPath;
- char *szUsername;
- char **szInvalidUsers;
- char **szValidUsers;
- char **szAdminUsers;
- char *szCopy;
- char *szInclude;
- char *szPreExec;
- char *szPostExec;
- char *szRootPreExec;
- char *szRootPostExec;
- char *szCupsOptions;
- char *szPrintcommand;
- char *szLpqcommand;
- char *szLprmcommand;
- char *szLppausecommand;
- char *szLpresumecommand;
- char *szQueuepausecommand;
- char *szQueueresumecommand;
- char *szPrintername;
- char *szPrintjobUsername;
- char *szDontdescend;
- char **szHostsallow;
- char **szHostsdeny;
- char *szMagicScript;
- char *szMagicOutput;
- char *szVetoFiles;
- char *szHideFiles;
- char *szVetoOplockFiles;
- char *comment;
- char *force_user;
- char *force_group;
- char **readlist;
- char **writelist;
- char **printer_admin;
- char *volume;
- char *fstype;
- char **szVfsObjects;
- char *szMSDfsProxy;
- char *szAioWriteBehind;
- char *szDfree;
- int iMinPrintSpace;
- int iMaxPrintJobs;
- int iMaxReportedPrintJobs;
- int iWriteCacheSize;
- int iCreate_mask;
- int iCreate_force_mode;
- int iSecurity_mask;
- int iSecurity_force_mode;
- int iDir_mask;
- int iDir_force_mode;
- int iDir_Security_mask;
- int iDir_Security_force_mode;
- int iMaxConnections;
- int iDefaultCase;
- int iPrinting;
- int iOplockContentionLimit;
- int iCSCPolicy;
- int iBlock_size;
- int iDfreeCacheTime;
- bool bPreexecClose;
- bool bRootpreexecClose;
- int iCaseSensitive;
- bool bCasePreserve;
- bool bShortCasePreserve;
- bool bHideDotFiles;
- bool bHideSpecialFiles;
- bool bHideUnReadable;
- bool bHideUnWriteableFiles;
- bool bBrowseable;
- bool bAccessBasedShareEnum;
- bool bAvailable;
- bool bRead_only;
- bool bNo_set_dir;
- bool bGuest_only;
- bool bAdministrative_share;
- bool bGuest_ok;
- bool bPrint_ok;
- bool bPrintNotifyBackchannel;
- bool bMap_system;
- bool bMap_hidden;
- bool bMap_archive;
- bool bStoreDosAttributes;
- bool bDmapiSupport;
- bool bLocking;
- int iStrictLocking;
- bool bPosixLocking;
- bool bShareModes;
- bool bOpLocks;
- bool bLevel2OpLocks;
- bool bOnlyUser;
- bool bMangledNames;
- bool bWidelinks;
- bool bSymlinks;
- bool bSyncAlways;
- bool bStrictAllocate;
- bool bStrictSync;
- char magic_char;
- struct bitmap *copymap;
- bool bDeleteReadonly;
- bool bFakeOplocks;
- bool bDeleteVetoFiles;
- bool bDosFilemode;
- bool bDosFiletimes;
- bool bDosFiletimeResolution;
- bool bFakeDirCreateTimes;
- bool bBlockingLocks;
- bool bInheritPerms;
- bool bInheritACLS;
- bool bInheritOwner;
- bool bMSDfsRoot;
- bool bUseClientDriver;
- bool bDefaultDevmode;
- bool bForcePrintername;
- bool bNTAclSupport;
- bool bForceUnknownAclUser;
- bool bUseSendfile;
- bool bProfileAcls;
- bool bMap_acl_inherit;
- bool bAfs_Share;
- bool bEASupport;
- bool bAclCheckPermissions;
- bool bAclMapFullControl;
- bool bAclGroupControl;
- bool bChangeNotify;
- bool bKernelChangeNotify;
- int iallocation_roundup_size;
- int iAioReadSize;
- int iAioWriteSize;
- int iMap_readonly;
- int iDirectoryNameCacheSize;
- int ismb_encrypt;
- struct param_opt_struct *param_opt;
-
+#define LOADPARM_EXTRA_LOCALS \
+ bool valid; \
+ int usershare; \
+ struct timespec usershare_last_mod; \
+ int iMaxPrintJobs; \
+ char *szCopy; \
+ char *szInclude; \
+ bool bAvailable; \
+ bool bWidelinks; \
+ struct param_opt_struct *param_opt; \
+ struct bitmap *copymap; \
char dummy[3]; /* for alignment */
-};
+#include "param/param_global.h"
+#include "param/param_local.h"
+
+static struct loadparm_global Globals;
/* This is a default service used to prime a services structure */
static struct loadparm_service sDefault =
@@ -5648,8 +5277,7 @@ 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_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)
@@ -5770,7 +5398,7 @@ FN_LOCAL_STRING(lp_postexec, szPostExec)
FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
FN_LOCAL_STRING(lp_servicename, szService)
-FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
+ FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
FN_LOCAL_STRING(lp_pathname, szPath)
FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
FN_LOCAL_STRING(lp_username, szUsername)
diff --git a/source3/wscript_build b/source3/wscript_build
index 1489266ec6..301d851dd3 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -735,9 +735,19 @@ if bld.env.toplevel_build:
deps='''s3_param_h param''',
vars=locals())
+bld.SAMBA_GENERATOR('param/param_local_h',
+ source= 'param/loadparm.c ../script/mkparamdefs.pl',
+ target='param/param_local.h',
+ rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT} --generate-scope=LOCAL')
+
+bld.SAMBA_GENERATOR('param/param_global_h',
+ source= 'param/loadparm.c ../script/mkparamdefs.pl',
+ target='param/param_global.h',
+ rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT} --generate-scope=GLOBAL')
+
bld.SAMBA3_SUBSYSTEM('param',
source=PARAM_WITHOUT_REG_SRC,
- deps='samba-util PARAM_UTIL smbd_conn ldap lber LOADPARM_CTX samba3core smbconf''')
+ deps='samba-util PARAM_UTIL smbd_conn ldap lber LOADPARM_CTX samba3core smbconf param/param_local_h param/param_global_h''')
bld.SAMBA3_SUBSYSTEM('param_service',
source='param/service.c',
diff --git a/source4/param/wscript_build b/source4/param/wscript_build
index da10565c6c..7f45402017 100644
--- a/source4/param/wscript_build
+++ b/source4/param/wscript_build
@@ -6,12 +6,12 @@ bld.SAMBA_GENERATOR('s3_param_h',
rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT}')
bld.SAMBA_GENERATOR('param_local_h',
- source= 'loadparm.c ../script/mkparamdefs.pl',
+ source= 'loadparm.c ../../script/mkparamdefs.pl',
target='param_local.h',
rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT} --generate-scope=LOCAL')
bld.SAMBA_GENERATOR('param_global_h',
- source= 'loadparm.c ../script/mkparamdefs.pl',
+ source= 'loadparm.c ../../script/mkparamdefs.pl',
target='param_global.h',
rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT} --generate-scope=GLOBAL')