1603 smbsrv raw mode is ill-advised
authorGordon Ross <gwr@nexenta.com>
Thu, 06 Oct 2011 10:22:06 -0400
changeset 13479 68b69d972a7f
parent 13478 b5ecd19f36a6
child 13480 868da6012e6f
1603 smbsrv raw mode is ill-advised Reviewed by: [email protected] Reviewed by: Dan Kruchinin <[email protected]> Reviewed by: Richard Lowe <[email protected]> Approved by: Garrett D'Amore <[email protected]>
usr/src/uts/common/fs/smbsrv/smb_init.c
usr/src/uts/common/fs/smbsrv/smb_server.c
--- a/usr/src/uts/common/fs/smbsrv/smb_init.c	Wed Oct 05 05:23:02 2011 -0700
+++ b/usr/src/uts/common/fs/smbsrv/smb_init.c	Thu Oct 06 10:22:06 2011 -0400
@@ -19,6 +19,7 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -64,7 +65,7 @@
 int	smb_flush_required = 1;
 int	smb_dirsymlink_enable = 1;
 int	smb_sign_debug = 0;
-int	smb_raw_mode = 1;
+int	smb_raw_mode = 0;
 int	smb_shortnames = 1;
 uint_t	smb_audit_flags =
 #ifdef	DEBUG
--- a/usr/src/uts/common/fs/smbsrv/smb_server.c	Wed Oct 05 05:23:02 2011 -0700
+++ b/usr/src/uts/common/fs/smbsrv/smb_server.c	Thu Oct 06 10:22:06 2011 -0400
@@ -1858,6 +1858,20 @@
 	    sizeof (sv->sv_cfg.skc_hostname));
 	(void) strlcpy(sv->sv_cfg.skc_system_comment, ioc->system_comment,
 	    sizeof (sv->sv_cfg.skc_system_comment));
+
+	if (sv->sv_cfg.skc_oplock_enable && smb_raw_mode) {
+		/*
+		 * Note that these two optional protocol features
+		 * (oplocks, raw_mode) have unfortunate interactions.
+		 * Since raw_mode is only wanted by ancient clients,
+		 * we just turn it off (that's what MS recommends).
+		 * Leave some evidence in the log if someone has
+		 * patched smb_raw_mode to enable it.
+		 */
+		cmn_err(CE_NOTE,
+		    "Raw mode enabled: Disabling opportunistic locks");
+		sv->sv_cfg.skc_oplock_enable = 0;
+	}
 }
 
 static int