Fix bug 7104 - "wide links" and "unix extensions" are incompatible.
[samba.git] / source3 / smbd / service.c
index 48593446e2f8e0b131faa95345291885656fd993..8039d16586eb164f576f4c4def3a919aac6feff1 100644 (file)
@@ -60,7 +60,8 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath)
                return false;
        }
 
-       destname = SMB_STRDUP(connectpath);
+       /* Allocate for strlen + '\0' + possible leading '/' */
+       destname = SMB_MALLOC(strlen(connectpath) + 2);
        if (!destname) {
                return false;
        }
@@ -1038,6 +1039,14 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
        }
 #endif
 
+       if (lp_unix_extensions() && lp_widelinks(snum)) {
+               DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
+                       "These parameters are incompatible. "
+                       "Disabling wide links for this share.\n",
+                       lp_servicename(snum) ));
+               lp_do_parameter(snum, "wide links", "False");
+       }
+
        /* Figure out the characteristics of the underlying filesystem. This
         * assumes that all the filesystem mounted withing a share path have
         * the same characteristics, which is likely but not guaranteed.