From cda86869400285afe17db87a9a666fbcc5b918a8 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 8 Jul 2011 09:19:43 +1000 Subject: lib/param: Merge struct loadparm_service into common This is handled by a common header and a .c file that is included into both loadparm.c files. In the process, _lp functions were renamed to lp__ to allow the common function definition declarations to be used by source3 and source4 (which have different macro definitions). The only parameter to change type is 'strict_locking' which was a bool, and is now an int, to accommodate the 'Auto' value from source3. Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Fri Jul 8 12:35:56 CEST 2011 on sn-devel-104 --- lib/param/loadparm.h | 16 +++++ lib/param/param_functions.c | 141 ++++++++++++++++++++++++++++++++++++- lib/param/param_structs.h | 13 ---- lib/param/wscript_build | 6 ++ source3/Makefile.in | 2 +- source3/include/proto.h | 2 +- source3/param/loadparm.c | 167 ++++---------------------------------------- source3/smbd/smb2_read.c | 2 +- source3/wscript_build | 8 +-- source4/param/loadparm.c | 24 +++++-- source4/param/wscript_build | 7 +- source4/script/mkproto.pl | 54 ++++++++------ wscript_build | 1 + 13 files changed, 233 insertions(+), 210 deletions(-) delete mode 100644 lib/param/param_structs.h create mode 100644 lib/param/wscript_build diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h index d36f5a0f6e..1fa06b6587 100644 --- a/lib/param/loadparm.h +++ b/lib/param/loadparm.h @@ -116,3 +116,19 @@ struct parm_struct { #ifndef PRINT_MAX_JOBID #define PRINT_MAX_JOBID 10000 #endif + +#define LOADPARM_EXTRA_LOCALS \ + bool valid; \ + int usershare; \ + struct timespec usershare_last_mod; \ + int iMaxPrintJobs; \ + char *szCopy; \ + char *szService; \ + char *szInclude; \ + bool bWidelinks; \ + int bAvailable; \ + struct parmlist_entry *param_opt; \ + struct bitmap *copymap; \ + char dummy[3]; /* for alignment */ + +#include "lib/param/param_local.h" diff --git a/lib/param/param_functions.c b/lib/param/param_functions.c index e68e34ae55..ee865fd97c 100644 --- a/lib/param/param_functions.c +++ b/lib/param/param_functions.c @@ -1,7 +1,35 @@ +/* + Unix SMB/CIFS implementation. + Parameter loading functions + Copyright (C) Karl Auer 1993-1998 + + Largely re-written by Andrew Tridgell, September 1994 + + Copyright (C) Simo Sorce 2001 + Copyright (C) Alexander Bokovoy 2002 + Copyright (C) Stefan (metze) Metzmacher 2002 + Copyright (C) Jim McDonough 2003 + Copyright (C) Michael Adam 2008 + Copyright (C) Jelmer Vernooij 2007 + Copyright (C) Andrew Bartlett 2011 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + FN_LOCAL_STRING(pathname, szPath) FN_LOCAL_LIST(hostsallow, szHostsallow) FN_LOCAL_LIST(hostsdeny, szHostsdeny) -FN_LOCAL_STRING(comment, comment) FN_LOCAL_STRING(fstype, fstype) FN_LOCAL_LIST(ntvfs_handler, ntvfs_handler) FN_LOCAL_BOOL(msdfs_root, bMSDfsRoot) @@ -10,8 +38,7 @@ FN_LOCAL_BOOL(readonly, bRead_only) FN_LOCAL_BOOL(print_ok, bPrint_ok) FN_LOCAL_BOOL(map_hidden, bMap_hidden) FN_LOCAL_BOOL(map_archive, bMap_archive) -FN_LOCAL_BOOL(strict_locking, bStrictLocking) -FN_LOCAL_BOOL(oplocks, bOplocks) +FN_LOCAL_BOOL(oplocks, bOpLocks) FN_LOCAL_BOOL(strict_sync, bStrictSync) FN_LOCAL_BOOL(ci_filesystem, bCIFileSystem) FN_LOCAL_BOOL(map_system, bMap_system) @@ -21,3 +48,111 @@ FN_LOCAL_INTEGER(create_mask, iCreate_mask) FN_LOCAL_INTEGER(force_create_mode, iCreate_force_mode) FN_LOCAL_INTEGER(dir_mask, iDir_mask) FN_LOCAL_INTEGER(force_dir_mode, iDir_force_mode) +FN_LOCAL_STRING(preexec, szPreExec) +FN_LOCAL_STRING(postexec, szPostExec) +FN_LOCAL_STRING(rootpreexec, szRootPreExec) +FN_LOCAL_STRING(rootpostexec, szRootPostExec) +FN_LOCAL_STRING(dontdescend, szDontdescend) +FN_LOCAL_STRING(username, szUsername) +FN_LOCAL_LIST(invalid_users, szInvalidUsers) +FN_LOCAL_LIST(valid_users, szValidUsers) +FN_LOCAL_LIST(admin_users, szAdminUsers) +FN_LOCAL_STRING(printcommand, szPrintcommand) +FN_LOCAL_STRING(lpqcommand, szLpqcommand) +FN_LOCAL_STRING(lprmcommand, szLprmcommand) +FN_LOCAL_STRING(lppausecommand, szLppausecommand) +FN_LOCAL_STRING(lpresumecommand, szLpresumecommand) +FN_LOCAL_STRING(queuepausecommand, szQueuepausecommand) +FN_LOCAL_STRING(queueresumecommand, szQueueresumecommand) +static FN_LOCAL_STRING(_printername, szPrintername) +FN_LOCAL_CONST_STRING(printjob_username, szPrintjobUsername) +FN_LOCAL_STRING(magicscript, szMagicScript) +FN_LOCAL_STRING(magicoutput, szMagicOutput) +FN_LOCAL_STRING(comment, comment) +FN_LOCAL_STRING(force_user, force_user) +FN_LOCAL_STRING(force_group, force_group) +FN_LOCAL_LIST(readlist, readlist) +FN_LOCAL_LIST(writelist, writelist) +FN_LOCAL_LIST(printer_admin, printer_admin) +FN_LOCAL_LIST(vfs_objects, szVfsObjects) +FN_LOCAL_STRING(msdfs_proxy, szMSDfsProxy) +static FN_LOCAL_STRING(volume, volume) +FN_LOCAL_STRING(veto_files, szVetoFiles) +FN_LOCAL_STRING(hide_files, szHideFiles) +FN_LOCAL_STRING(veto_oplocks, szVetoOplockFiles) +FN_LOCAL_STRING(aio_write_behind, szAioWriteBehind) +FN_LOCAL_STRING(dfree_command, szDfree) +FN_LOCAL_BOOL(autoloaded, autoloaded) +FN_LOCAL_BOOL(preexec_close, bPreexecClose) +FN_LOCAL_BOOL(rootpreexec_close, bRootpreexecClose) +FN_LOCAL_INTEGER(casesensitive, iCaseSensitive) +FN_LOCAL_BOOL(preservecase, bCasePreserve) +FN_LOCAL_BOOL(shortpreservecase, bShortCasePreserve) +FN_LOCAL_BOOL(hide_dot_files, bHideDotFiles) +FN_LOCAL_BOOL(hide_special_files, bHideSpecialFiles) +FN_LOCAL_BOOL(hideunreadable, bHideUnReadable) +FN_LOCAL_BOOL(hideunwriteable_files, bHideUnWriteableFiles) +FN_LOCAL_BOOL(access_based_share_enum, bAccessBasedShareEnum) +FN_LOCAL_BOOL(no_set_dir, bNo_set_dir) +FN_LOCAL_BOOL(guest_ok, bGuest_ok) +FN_LOCAL_BOOL(guest_only, bGuest_only) +FN_LOCAL_BOOL(administrative_share, bAdministrative_share) +FN_LOCAL_BOOL(print_notify_backchannel, bPrintNotifyBackchannel) +FN_LOCAL_BOOL(store_dos_attributes, bStoreDosAttributes) +FN_LOCAL_BOOL(dmapi_support, bDmapiSupport) +FN_LOCAL_PARM_BOOL(locking, bLocking) +FN_LOCAL_PARM_INTEGER(strict_locking, iStrictLocking) +FN_LOCAL_PARM_BOOL(posix_locking, bPosixLocking) +FN_LOCAL_BOOL(share_modes, bShareModes) +FN_LOCAL_BOOL(level2_oplocks, bLevel2OpLocks) +FN_LOCAL_BOOL(onlyuser, bOnlyUser) +FN_LOCAL_PARM_BOOL(manglednames, bMangledNames) +FN_LOCAL_BOOL(symlinks, bSymlinks) +FN_LOCAL_BOOL(syncalways, bSyncAlways) +FN_LOCAL_BOOL(strict_allocate, bStrictAllocate) +FN_LOCAL_BOOL(delete_readonly, bDeleteReadonly) +FN_LOCAL_BOOL(fake_oplocks, bFakeOplocks) +FN_LOCAL_BOOL(recursive_veto_delete, bDeleteVetoFiles) +FN_LOCAL_BOOL(dos_filemode, bDosFilemode) +FN_LOCAL_BOOL(dos_filetimes, bDosFiletimes) +FN_LOCAL_BOOL(dos_filetime_resolution, bDosFiletimeResolution) +FN_LOCAL_BOOL(fake_dir_create_times, bFakeDirCreateTimes) +FN_LOCAL_BOOL(blocking_locks, bBlockingLocks) +FN_LOCAL_BOOL(inherit_perms, bInheritPerms) +FN_LOCAL_BOOL(inherit_acls, bInheritACLS) +FN_LOCAL_BOOL(inherit_owner, bInheritOwner) +FN_LOCAL_BOOL(use_client_driver, bUseClientDriver) +FN_LOCAL_BOOL(default_devmode, bDefaultDevmode) +FN_LOCAL_BOOL(force_printername, bForcePrintername) +FN_LOCAL_BOOL(nt_acl_support, bNTAclSupport) +FN_LOCAL_BOOL(force_unknown_acl_user, bForceUnknownAclUser) +FN_LOCAL_BOOL(ea_support, bEASupport) +FN_LOCAL_BOOL(_use_sendfile, bUseSendfile) +FN_LOCAL_BOOL(profile_acls, bProfileAcls) +FN_LOCAL_BOOL(map_acl_inherit, bMap_acl_inherit) +FN_LOCAL_BOOL(afs_share, bAfs_Share) +FN_LOCAL_BOOL(acl_check_permissions, bAclCheckPermissions) +FN_LOCAL_BOOL(acl_group_control, bAclGroupControl) +FN_LOCAL_BOOL(acl_map_full_control, bAclMapFullControl) +FN_LOCAL_INTEGER(security_mask, iSecurity_mask) +FN_LOCAL_INTEGER(force_security_mode, iSecurity_force_mode) +FN_LOCAL_INTEGER(dir_security_mask, iDir_Security_mask) +FN_LOCAL_INTEGER(force_dir_security_mode, iDir_Security_force_mode) +FN_LOCAL_INTEGER(defaultcase, iDefaultCase) +FN_LOCAL_INTEGER(minprintspace, iMinPrintSpace) +FN_LOCAL_INTEGER(printing, iPrinting) +FN_LOCAL_INTEGER(max_reported_jobs, iMaxReportedPrintJobs) +FN_LOCAL_INTEGER(oplock_contention_limit, iOplockContentionLimit) +FN_LOCAL_INTEGER(write_cache_size, iWriteCacheSize) +FN_LOCAL_INTEGER(block_size, iBlock_size) +FN_LOCAL_INTEGER(dfree_cache_time, iDfreeCacheTime) +FN_LOCAL_INTEGER(allocation_roundup_size, iallocation_roundup_size) +FN_LOCAL_INTEGER(aio_read_size, iAioReadSize) +FN_LOCAL_INTEGER(aio_write_size, iAioWriteSize) +FN_LOCAL_INTEGER(map_readonly, iMap_readonly) +FN_LOCAL_INTEGER(directory_name_cache_size, iDirectoryNameCacheSize) +FN_LOCAL_INTEGER(smb_encrypt, ismb_encrypt) +FN_LOCAL_CHAR(magicchar, magic_char) +FN_LOCAL_STRING(cups_options, szCupsOptions) +FN_LOCAL_PARM_BOOL(change_notify, bChangeNotify) +FN_LOCAL_PARM_BOOL(kernel_change_notify, bKernelChangeNotify) diff --git a/lib/param/param_structs.h b/lib/param/param_structs.h deleted file mode 100644 index f076ce15fa..0000000000 --- a/lib/param/param_structs.h +++ /dev/null @@ -1,13 +0,0 @@ -#define LOADPARM_EXTRA_LOCALS \ - struct parmlist_entry *param_opt; \ - char *szService; \ - char *szCopy; \ - char *szInclude; \ - char *szPrintername; \ - int bAvailable; \ - int iMaxPrintJobs; \ - char *volume; \ - struct bitmap *copymap; \ - char dummy[3]; /* for alignment */ - -#include "param_local.h" diff --git a/lib/param/wscript_build b/lib/param/wscript_build new file mode 100644 index 0000000000..c84a99d7ea --- /dev/null +++ b/lib/param/wscript_build @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +bld.SAMBA_GENERATOR('param_local_h', + source= 'param_functions.c ../../script/mkparamdefs.pl', + target='param_local.h', + rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT} --generate-scope=LOCAL') diff --git a/source3/Makefile.in b/source3/Makefile.in index e348509655..146c9cb2f2 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1643,7 +1643,7 @@ idl_full:: 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)/../lib/param/param_functions.c --file ../lib/param/param_local.h --generate-scope=LOCAL $(PERL) ../script/mkparamdefs.pl $(srcdir)/param/loadparm.c --file param/param_global.h --generate-scope=GLOBAL ##################################################################### diff --git a/source3/include/proto.h b/source3/include/proto.h index daa7490d55..715641fc72 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1497,7 +1497,7 @@ bool lp_force_printername(int ); bool lp_nt_acl_support(int ); bool lp_force_unknown_acl_user(int ); bool lp_ea_support(int ); -bool _lp_use_sendfile(int ); +bool lp__use_sendfile(int ); bool lp_profile_acls(int ); bool lp_map_acl_inherit(int ); bool lp_afs_share(int ); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a41e9f7e32..e339a911c3 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -127,21 +127,8 @@ static bool defaults_saved = false; char *szIdmapGID; \ int winbindMaxDomainConnections; \ int ismb2_max_credits; -#define LOADPARM_EXTRA_LOCALS \ - bool valid; \ - int usershare; \ - struct timespec usershare_last_mod; \ - int iMaxPrintJobs; \ - char *szCopy; \ - char *szInclude; \ - bool bAvailable; \ - bool bWidelinks; \ - struct parmlist_entry *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; @@ -5079,22 +5066,22 @@ static char *lp_string(const char *s) int fn_name(void) {return(*(int *)(&Globals.ptr));} #define FN_LOCAL_STRING(fn_name,val) \ - char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.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_CONST_STRING(fn_name,val) \ - const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);} + const char *lp_ ## fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);} #define FN_LOCAL_LIST(fn_name,val) \ - const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} + const char **lp_ ## fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} #define FN_LOCAL_BOOL(fn_name,val) \ - bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} + bool lp_ ## fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} #define FN_LOCAL_INTEGER(fn_name,val) \ - int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} + int lp_ ## fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} #define FN_LOCAL_PARM_BOOL(fn_name,val) \ - bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);} + bool lp_ ## fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);} #define FN_LOCAL_PARM_INTEGER(fn_name,val) \ - int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);} + int lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);} #define FN_LOCAL_CHAR(fn_name,val) \ - char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.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) @@ -5312,8 +5299,6 @@ 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_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify) -FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify) FN_GLOBAL_CONST_STRING(lp_dedicated_keytab_file, szDedicatedKeytabFile) FN_GLOBAL_INTEGER(lp_kerberos_method, iKerberosMethod) FN_GLOBAL_BOOL(lp_defer_sharing_violations, bDeferSharingViolations) @@ -5372,20 +5357,7 @@ int lp_smb2_max_credits(void) } return Globals.ismb2_max_credits; } -FN_LOCAL_STRING(lp_preexec, szPreExec) -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_STRING(lp_pathname, szPath) -FN_LOCAL_STRING(lp_dontdescend, szDontdescend) -FN_LOCAL_STRING(lp_username, szUsername) -FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers) -FN_LOCAL_LIST(lp_valid_users, szValidUsers) -FN_LOCAL_LIST(lp_admin_users, szAdminUsers) FN_GLOBAL_LIST(lp_svcctl_list, szServicesList) -FN_LOCAL_STRING(lp_cups_options, szCupsOptions) FN_GLOBAL_STRING(lp_cups_server, szCupsServer) int lp_cups_encrypt(void) { @@ -5412,122 +5384,8 @@ 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_LOCAL_STRING(lp_printcommand, szPrintcommand) -FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand) -FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand) -FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand) -FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand) -FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand) -FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand) -static FN_LOCAL_STRING(_lp_printername, szPrintername) -FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername) -FN_LOCAL_LIST(lp_hostsallow, szHostsallow) -FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny) -FN_LOCAL_STRING(lp_magicscript, szMagicScript) -FN_LOCAL_STRING(lp_magicoutput, szMagicOutput) -FN_LOCAL_STRING(lp_comment, comment) -FN_LOCAL_STRING(lp_force_user, force_user) -FN_LOCAL_STRING(lp_force_group, force_group) -FN_LOCAL_LIST(lp_readlist, readlist) -FN_LOCAL_LIST(lp_writelist, writelist) -FN_LOCAL_LIST(lp_printer_admin, printer_admin) -FN_LOCAL_STRING(lp_fstype, fstype) -FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects) -FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy) -static FN_LOCAL_STRING(lp_volume, volume) -FN_LOCAL_STRING(lp_veto_files, szVetoFiles) -FN_LOCAL_STRING(lp_hide_files, szHideFiles) -FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles) -FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot) -FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind) -FN_LOCAL_STRING(lp_dfree_command, szDfree) -FN_LOCAL_BOOL(lp_autoloaded, autoloaded) -FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose) -FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose) -FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive) -FN_LOCAL_BOOL(lp_preservecase, bCasePreserve) -FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve) -FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles) -FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles) -FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable) -FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles) -FN_LOCAL_BOOL(lp_browseable, bBrowseable) -FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum) -FN_LOCAL_BOOL(lp_readonly, bRead_only) -FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir) -FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok) -FN_LOCAL_BOOL(lp_guest_only, bGuest_only) -FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share) -FN_LOCAL_BOOL(lp_print_ok, bPrint_ok) -FN_LOCAL_BOOL(lp_print_notify_backchannel, bPrintNotifyBackchannel) -FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden) -FN_LOCAL_BOOL(lp_map_archive, bMap_archive) -FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes) -FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport) -FN_LOCAL_PARM_BOOL(lp_locking, bLocking) -FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking) -FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking) -FN_LOCAL_BOOL(lp_share_modes, bShareModes) -FN_LOCAL_BOOL(lp_oplocks, bOpLocks) -FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks) -FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser) -FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames) -FN_LOCAL_BOOL(lp_symlinks, bSymlinks) -FN_LOCAL_BOOL(lp_syncalways, bSyncAlways) -FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate) -FN_LOCAL_BOOL(lp_strict_sync, bStrictSync) -FN_LOCAL_BOOL(lp_map_system, bMap_system) -FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly) -FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks) -FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles) -FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode) -FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes) -FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution) -FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes) FN_GLOBAL_BOOL(lp_async_smb_echo_handler, bAsyncSMBEchoHandler) FN_GLOBAL_BOOL(lp_multicast_dns_register, bMulticastDnsRegister) -FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks) -FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms) -FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS) -FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner) -FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver) -FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode) -FN_LOCAL_BOOL(lp_force_printername, bForcePrintername) -FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport) -FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser) -FN_LOCAL_BOOL(lp_ea_support, bEASupport) -FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile) -FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls) -FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit) -FN_LOCAL_BOOL(lp_afs_share, bAfs_Share) -FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions) -FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl) -FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl) -FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask) -FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode) -FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask) -FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode) -FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask) -FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode) -FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask) -FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode) -FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections) -FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase) -FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace) -FN_LOCAL_INTEGER(lp_printing, iPrinting) -FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs) -FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit) -FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy) -FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize) -FN_LOCAL_INTEGER(lp_block_size, iBlock_size) -FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime) -FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size) -FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize) -FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize) -FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly) -FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize) -FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt) -FN_LOCAL_CHAR(lp_magicchar, magic_char) 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) @@ -5540,6 +5398,11 @@ FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, client_ldap_sasl_wrapping) FN_GLOBAL_CONST_STRING(lp_ncalrpc_dir, ncalrpc_dir) +#include "lib/param/param_functions.c" + +FN_LOCAL_STRING(servicename, szService) +FN_LOCAL_CONST_STRING(const_servicename, szService) + /* local prototypes */ static int map_parameter_canonical(const char *pszParmName, bool *inverse); @@ -9435,7 +9298,7 @@ void lp_set_name_resolve_order(const char *new_order) const char *lp_printername(int snum) { - const char *ret = _lp_printername(snum); + const char *ret = lp__printername(snum); if (ret == NULL || (ret != NULL && *ret == '\0')) ret = lp_const_servicename(snum); @@ -9523,7 +9386,7 @@ bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state) if (signing_state) { sign_active = smb_signing_is_active(signing_state); } - return (_lp_use_sendfile(snum) && + return (lp__use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && !sign_active); } diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index 996f8d46ae..8c3a8fd877 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -288,7 +288,7 @@ static NTSTATUS schedule_smb2_sendfile_read(struct smbd_smb2_request *smb2req, * reads on most normal files. JRA. */ - if (!_lp_use_sendfile(SNUM(fsp->conn)) || + if (!lp__use_sendfile(SNUM(fsp->conn)) || smb2req->do_signing || smb2req->in.vector_count != 4 || (fsp->base_fsp != NULL) || diff --git a/source3/wscript_build b/source3/wscript_build index b471445c94..35b0b1d521 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -744,11 +744,6 @@ 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', @@ -756,7 +751,7 @@ bld.SAMBA_GENERATOR('param/param_global_h', bld.SAMBA3_SUBSYSTEM('param', source=PARAM_WITHOUT_REG_SRC, - deps='samba-util PARAM_UTIL smbd_conn ldap lber LOADPARM_CTX samba3core smbconf param/param_local_h param/param_global_h''') + deps='samba-util PARAM_UTIL smbd_conn ldap lber LOADPARM_CTX samba3core smbconf param_local_h param/param_global_h''') bld.SAMBA3_SUBSYSTEM('param_service', source='param/service.c', @@ -1429,6 +1424,7 @@ bld.RECURSE('../lib/addns') bld.RECURSE('../lib/async_req') bld.RECURSE('../lib/ccan') bld.RECURSE('../lib/socket') +bld.RECURSE('../lib/param') bld.RECURSE('../libcli/auth') bld.RECURSE('../libcli/drsuapi') bld.RECURSE('../libcli/ldap') diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 36788290d1..b890ad81a9 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -61,7 +61,6 @@ #include "smb_server/smb_server.h" #include "libcli/raw/signing.h" #include "../lib/util/dlinklist.h" -#include "../lib/util/parmlist.h" #include "param/param.h" #include "param/loadparm.h" #include "libcli/raw/libcliraw.h" @@ -70,7 +69,6 @@ #include "auth/gensec/gensec.h" #include "s3_param.h" #include "../lib/util/bitmap.h" -#include "../lib/param/param_structs.h" #define standard_sub_basic talloc_strdup @@ -1031,7 +1029,7 @@ static struct parm_struct parm_table[] = { .label = "strict locking", .type = P_BOOL, .p_class = P_LOCAL, - .offset = LOCAL_VAR(bStrictLocking), + .offset = LOCAL_VAR(iStrictLocking), .special = NULL, .enum_list = NULL }, @@ -1039,7 +1037,7 @@ static struct parm_struct parm_table[] = { .label = "oplocks", .type = P_BOOL, .p_class = P_LOCAL, - .offset = LOCAL_VAR(bOplocks), + .offset = LOCAL_VAR(bOpLocks), .special = NULL, .enum_list = NULL }, @@ -1420,12 +1418,16 @@ static struct loadparm_context *global_loadparm_context; return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val))); \ } +#define FN_LOCAL_CONST_STRING(fn_name,val) FN_LOCAL_STRING(fn_name, val) + #define FN_LOCAL_LIST(fn_name,val) \ _PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_service *service, \ struct loadparm_service *sDefault) {\ return(const char **)(service != NULL && service->val != NULL? service->val : sDefault->val); \ } +#define FN_LOCAL_PARM_BOOL(fn_name, val) FN_LOCAL_BOOL(fn_name, val) + #define FN_LOCAL_BOOL(fn_name,val) \ _PUBLIC_ bool lpcfg_ ## fn_name(struct loadparm_service *service, \ struct loadparm_service *sDefault) { \ @@ -1438,6 +1440,16 @@ static struct loadparm_context *global_loadparm_context; return((service != NULL)? service->val : sDefault->val); \ } +#define FN_LOCAL_PARM_INTEGER(fn_name, val) FN_LOCAL_INTEGER(fn_name, val) + +#define FN_LOCAL_PARM_CHAR(fn_name, val) FN_LOCAL_CHAR(fn_name, val) + +#define FN_LOCAL_CHAR(fn_name,val) \ + _PUBLIC_ char lpcfg_ ## fn_name(struct loadparm_service *service, \ + struct loadparm_service *sDefault) { \ + return((service != NULL)? service->val : sDefault->val); \ + } + #include "lib/param/param_functions.c" FN_GLOBAL_INTEGER(server_role, server_role) @@ -3171,8 +3183,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lp_ctx->sDefault->bBrowseable = true; lp_ctx->sDefault->bRead_only = true; lp_ctx->sDefault->bMap_archive = true; - lp_ctx->sDefault->bStrictLocking = true; - lp_ctx->sDefault->bOplocks = true; + lp_ctx->sDefault->iStrictLocking = true; + lp_ctx->sDefault->bOpLocks = true; lp_ctx->sDefault->iCreate_mask = 0744; lp_ctx->sDefault->iCreate_force_mode = 0000; lp_ctx->sDefault->iDir_mask = 0755; diff --git a/source4/param/wscript_build b/source4/param/wscript_build index a56191d089..d5ca60d207 100644 --- a/source4/param/wscript_build +++ b/source4/param/wscript_build @@ -5,11 +5,6 @@ bld.SAMBA_GENERATOR('s3_param_h', target='s3_param.h', rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT}') -bld.SAMBA_GENERATOR('param_local_h', - source= '../../lib/param/param_functions.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', target='param_global.h', @@ -20,7 +15,7 @@ bld.SAMBA_LIBRARY('samba-hostconfig', pc_files='samba-hostconfig.pc', vnum='0.0.1', deps='DYNCONFIG', - public_deps='samba-util bitmap', + public_deps='samba-util bitmap param_local_h', public_headers='param.h', autoproto='param_proto.h', autoproto_extra_source='../../lib/param/param_functions.c' diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl index 4760e63bda..348f150e6d 100755 --- a/source4/script/mkproto.pl +++ b/source4/script/mkproto.pl @@ -127,28 +127,40 @@ sub print_footer($$) sub handle_loadparm($$) { my ($file,$line) = @_; - - 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 %tmap = ( - "BOOL" => "bool ", - "CONST_STRING" => "const char *", - "STRING" => "const char *", - "INTEGER" => "int ", - "CHAR" => "char ", - "LIST" => "const char **", - ); - - my %smap = ( - "GLOBAL" => "struct loadparm_context *", - "LOCAL" => "struct loadparm_service *, struct loadparm_service *" - ); - - $file->("$tmap{$type}lpcfg_$name($smap{$scope});\n"); + my $scope; + my $type; + my $name; + my $var; + + if ($line =~ /^FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),(.*)\)/o) { + $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" => "bool ", + "CONST_STRING" => "const char *", + "STRING" => "const char *", + "INTEGER" => "int ", + "CHAR" => "char ", + "LIST" => "const char **", + ); + + my %smap = ( + "GLOBAL" => "struct loadparm_context *", + "LOCAL" => "struct loadparm_service *, struct loadparm_service *" + ); + + $file->("$tmap{$type}lpcfg_$name($smap{$scope});\n"); } sub process_file($$$) diff --git a/wscript_build b/wscript_build index 2e758536d3..bfbbafb529 100644 --- a/wscript_build +++ b/wscript_build @@ -36,6 +36,7 @@ bld.RECURSE('lib/tevent') bld.RECURSE('lib/ccan') bld.RECURSE('lib/tdb_compat') bld.RECURSE('lib/ldb') +bld.RECURSE('lib/param') bld.RECURSE('dynconfig') bld.RECURSE('lib/util/charset') bld.RECURSE('source4/scripting/python') -- cgit