Fix bug 7104 - "wide links" and "unix extensions" are incompatible.
[samba.git] / source3 / smbd / service.c
index b5946f0335cf384f95bfd5120153c8821a2c09e7..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.
@@ -1193,7 +1202,7 @@ connection_struct *make_connection(struct smbd_server_connection *sconn,
                        return NULL;
                }
 
-               DEBUG(0,("%s (%s) couldn't find service %s\n",
+               DEBUG(3,("%s (%s) couldn't find service %s\n",
                        get_remote_machine_name(),
                        client_addr(get_client_fd(),addr,sizeof(addr)),
                        service));