diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 107e500a51b..585a1792e15 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -288,6 +288,7 @@ typedef struct BOOL bDisableNetbios; BOOL bKernelChangeNotify; BOOL bUseKerberosKeytab; + BOOL bDeferSharingViolations; int restrict_anonymous; int name_cache_timeout; int client_signing; @@ -417,7 +418,6 @@ typedef struct BOOL bMap_acl_inherit; BOOL bAfs_Share; BOOL bEASupport; - BOOL bDeferSharingViolations; param_opt_struct *param_opt; char dummy[3]; /* for alignment */ @@ -541,7 +541,6 @@ static service sDefault = { False, /* bMap_acl_inherit */ False, /* bAfs_Share */ False, /* bEASupport */ - True, /* bDeferSharingViolations */ NULL, /* Parametric options */ @@ -894,7 +893,7 @@ static struct parm_struct parm_table[] = { {"disable netbios", P_BOOL, P_GLOBAL, &Globals.bDisableNetbios, NULL, NULL, FLAG_ADVANCED}, {"acl compatibility", P_STRING, P_GLOBAL, &Globals.szAclCompat, handle_acl_compatibility, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, - { "defer sharing violations", P_BOOL, P_LOCAL, &sDefault.bDeferSharingViolations, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, + { "defer sharing violations", P_BOOL, P_GLOBAL, &Globals.bDeferSharingViolations, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL}, {"ea support", P_BOOL, P_LOCAL, &sDefault.bEASupport, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, {"nt acl support", P_BOOL, P_LOCAL, &sDefault.bNTAclSupport, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, {"nt pipe support", P_BOOL, P_GLOBAL, &Globals.bNTPipeSupport, NULL, NULL, FLAG_ADVANCED}, @@ -1540,6 +1539,7 @@ static void init_globals(void) Globals.client_signing = Auto; Globals.server_signing = False; + Globals.bDeferSharingViolations = True; string_set(&Globals.smb_ports, SMB_PORTS); } @@ -1774,6 +1774,7 @@ FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego) FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups) FN_GLOBAL_BOOL(lp_kernel_change_notify, &Globals.bKernelChangeNotify) FN_GLOBAL_BOOL(lp_use_kerberos_keytab, &Globals.bUseKerberosKeytab) +FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations) FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level) FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl) FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl) @@ -1893,7 +1894,6 @@ FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver) FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode) FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport) FN_LOCAL_BOOL(lp_ea_support, bEASupport) -FN_LOCAL_BOOL(lp_defer_sharing_violations, bDeferSharingViolations) FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile) FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls) FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 305377dfc63..6de27746442 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -115,6 +115,10 @@ static void notify_deferred_opens(files_struct *fsp) int num_de_entries, i; pid_t mypid = sys_getpid(); + if (!lp_defer_sharing_violations()) { + return; + } + num_de_entries = get_deferred_opens(fsp->conn, fsp->dev, fsp->inode, &de_array); for (i = 0; i < num_de_entries; i++) { deferred_open_entry *entry = &de_array[i]; diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 119eb04e099..d38d94e5aa3 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -786,7 +786,7 @@ static void delete_defered_open_entry_record(connection_struct *conn, SMB_DEV_T deferred_open_entry *de_array = NULL; int num_de_entries, i; - if (!lp_defer_sharing_violations(SNUM(conn))) { + if (!lp_defer_sharing_violations()) { return; } @@ -818,7 +818,7 @@ void defer_open_sharing_error(connection_struct *conn, struct timeval *ptv, int num_de_entries, i; struct dev_inode_bundle dib; - if (!lp_defer_sharing_violations(SNUM(conn))) { + if (!lp_defer_sharing_violations()) { return; } diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 72a604811b1..60ce1499e8d 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -151,6 +151,10 @@ void remove_sharing_violation_open_smb_message(uint16 mid) { struct pending_message_list *pml; + if (!lp_defer_sharing_violations()) { + return; + } + for (pml = smb_sharing_violation_queue; pml; pml = pml->next) { if (mid == SVAL(pml->buf.data,smb_mid)) { DEBUG(10,("remove_sharing_violation_open_smb_message: deleting mid %u len %u\n", @@ -172,6 +176,10 @@ void schedule_sharing_violation_open_smb_message(uint16 mid) struct pending_message_list *pml; int i = 0; + if (!lp_defer_sharing_violations()) { + return; + } + for (pml = smb_sharing_violation_queue; pml; pml = pml->next) { uint16 msg_mid = SVAL(pml->buf.data,smb_mid); DEBUG(10,("schedule_sharing_violation_open_smb_message: [%d] msg_mid = %u\n", i++, @@ -197,6 +205,11 @@ void schedule_sharing_violation_open_smb_message(uint16 mid) BOOL open_was_deferred(uint16 mid) { struct pending_message_list *pml; + + if (!lp_defer_sharing_violations()) { + return False; + } + for (pml = smb_sharing_violation_queue; pml; pml = pml->next) { if (SVAL(pml->buf.data,smb_mid) == mid) { return True; @@ -212,6 +225,11 @@ BOOL open_was_deferred(uint16 mid) struct pending_message_list *get_open_deferred_message(uint16 mid) { struct pending_message_list *pml; + + if (!lp_defer_sharing_violations()) { + return NULL; + } + for (pml = smb_sharing_violation_queue; pml; pml = pml->next) { if (SVAL(pml->buf.data,smb_mid) == mid) { return pml; @@ -231,6 +249,10 @@ BOOL push_sharing_violation_open_smb_message(struct timeval *ptv, char *private, struct timeval tv; SMB_BIG_INT tdif; + if (!lp_defer_sharing_violations()) { + return True; + } + tv = *ptv; tdif = tv.tv_sec; tdif *= 1000000;