Fix bug #8229 - git patch attached against 3.6.0-rc2 to fix 'widelinks' regression...
authorJeremy Allison <jra@samba.org>
Tue, 13 Sep 2011 23:42:09 +0000 (16:42 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 14 Sep 2011 01:55:45 +0000 (03:55 +0200)
Add "allow insecure widelinks" to re-enable the ability (requested
by some sites) to have "widelinks = yes" and "unix extensions = yes".

Based on an original patch by Linda Walsh <samba@tlinx.org>

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Sep 14 03:55:45 CEST 2011 on sn-devel-104

docs-xml/smbdotconf/misc/allowinsecurewidelinks.xml [new file with mode: 0644]
docs-xml/smbdotconf/misc/widelinks.xml
docs-xml/smbdotconf/protocol/unixextensions.xml
source3/include/proto.h
source3/param/loadparm.c

diff --git a/docs-xml/smbdotconf/misc/allowinsecurewidelinks.xml b/docs-xml/smbdotconf/misc/allowinsecurewidelinks.xml
new file mode 100644 (file)
index 0000000..a8a0991
--- /dev/null
@@ -0,0 +1,37 @@
+<samba:parameter name="allow insecure wide links"
+               context="G"
+               type="boolean"
+               xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+       <para>
+       In normal operation the option <smbconfoption name="wide links"/>
+       which allows the server to follow symlinks outside of a share path
+       is automatically disabled when <smbconfoption name="unix extensions"/>
+       are enabled on a Samba server. This is done for security purposes
+       to prevent UNIX clients creating symlinks to areas of the server
+       file system that the administrator does not wish to export.
+       </para>
+       <para>
+       Setting <smbconfoption name="allow insecure wide links"/> to
+       true disables the link between these two parameters, removing
+       this protection and allowing a site to configure
+       the server to follow symlinks (by setting <smbconfoption name="wide links"/>
+       to "true") even when <smbconfoption name="unix extensions"/>
+       is turned on.
+       </para>
+       <para>
+       If is not recommended to enable this option unless you
+       fully understand the implications of allowing the server to
+       follow symbolic links created by UNIX clients. For most
+       normal Samba configurations this would be considered a security
+       hole and setting this parameter is not recommended.
+       </para>
+       <para>
+       This option was added at the request of sites who had
+       deliberately set Samba up in this way and needed to continue
+       supporting this functionality without having to patch the
+       Samba code.
+       </para>
+</description>
+<value type="default">no</value>
+</samba:parameter>
index 1c30bb768a3b44ec34850abcb2406ad0139b1137..da1374afab7a5b5b887cfa10898670078fdab967 100644 (file)
        disabled (with a message in the log file) if the
        <smbconfoption name="unix extensions"/> option is on.
        </para>
+       <para>
+       See the parameter <smbconfoption name="allow insecure wide links"/>
+       if you wish to change this coupling between the two parameters.
+       </para>
 </description>
 
 <value type="default">no</value>
index d816648836bc596e988c5db8fd8f7c52da839e59..61a39cb76399d704609c9613fc341592bfb96285 100644 (file)
     Note if this parameter is turned on, the <smbconfoption name="wide links"/>
     parameter will automatically be disabled.
     </para>
+    <para>
+    See the parameter <smbconfoption name="allow insecure wide links"/>
+    if you wish to change this coupling between the two parameters.
+    </para>
 </description>
 
 <value type="default">yes</value>
index 47321f3aa43bd414634fb208ac9d4da0af06403b..d3ea6fc88348f12c6e5795eb063e2efd7ea0f65b 100644 (file)
@@ -1473,6 +1473,7 @@ bool lp_oplocks(int );
 bool lp_level2_oplocks(int );
 bool lp_onlyuser(int );
 bool lp_manglednames(const struct share_params *p );
+bool lp_allow_insecure_widelinks(void);
 bool lp_widelinks(int );
 bool lp_symlinks(int );
 bool lp_syncalways(int );
index 3b5c4df35df7d2dc73ff6229f4751e2c8ce68aeb..01f6fa2942d354f36a3499360dab357edf59c504 100644 (file)
@@ -3899,6 +3899,15 @@ static struct parm_struct parm_table[] = {
                .enum_list      = NULL,
                .flags          = FLAG_ADVANCED | FLAG_SHARE,
        },
+       {
+               .label          = "allow insecure wide links",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bAllowInsecureWidelinks),
+               .special        = NULL,
+               .enum_list      = NULL,
+               .flags          = FLAG_ADVANCED,
+       },
        {
                .label          = "wide links",
                .type           = P_BOOL,
@@ -5390,6 +5399,7 @@ FN_GLOBAL_INTEGER(lp_ctdb_timeout, ctdb_timeout)
 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, ctdb_locktime_warn_threshold)
 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, bAsyncSMBEchoHandler)
 FN_GLOBAL_BOOL(lp_multicast_dns_register, bMulticastDnsRegister)
+FN_GLOBAL_BOOL(lp_allow_insecure_widelinks, bAllowInsecureWidelinks)
 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)
@@ -9637,6 +9647,10 @@ static bool lp_widelinks_internal(int snum)
 
 void widelinks_warning(int snum)
 {
+       if (lp_allow_insecure_widelinks()) {
+               return;
+       }
+
        if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
                DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
                        "These parameters are incompatible. "
@@ -9649,7 +9663,13 @@ bool lp_widelinks(int snum)
 {
        /* wide links is always incompatible with unix extensions */
        if (lp_unix_extensions()) {
-               return false;
+               /*
+                * Unless we have "allow insecure widelinks"
+                * turned on.
+                */
+               if (!lp_allow_insecure_widelinks()) {
+                       return false;
+               }
        }
 
        return lp_widelinks_internal(snum);