[PATCH] Fix MSDFS with POSIX paths in vfs_dfs_samba4

Robin McCorkell rmccorkell at karoshi.org.uk
Fri Feb 27 05:05:06 MST 2015


The source3 code supports using forward slashes in the share path, but the
source4 VFS code was broken with DFS roots. This commit allows either forward
slashes or backslashes to be used, by detecting the first character of the
share path.

Signed-off-by: Robin McCorkell <rmccorkell at karoshi.org.uk>
---
 dfs_server/dfs_server_ad.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dfs_server/dfs_server_ad.c b/dfs_server/dfs_server_ad.c
index 3d93e19..8785eda 100644
--- a/dfs_server/dfs_server_ad.c
+++ b/dfs_server/dfs_server_ad.c
@@ -801,6 +801,7 @@ NTSTATUS dfs_server_ad_get_referrals(struct loadparm_context *lp_ctx,
 	const char *netbios_name;
 	const char *dns_name;
 	const char **netbios_aliases;
+	char path_separator;
 
 	if (!lpcfg_host_msdfs(lp_ctx)) {
 		return NT_STATUS_FS_DRIVER_REQUIRED;
@@ -827,17 +828,18 @@ NTSTATUS dfs_server_ad_get_referrals(struct loadparm_context *lp_ctx,
 	if (server_name == NULL) {
 		return NT_STATUS_NO_MEMORY;
 	}
+	path_separator = (*server_name == '/') ? '/' : '\\';
 
-	while(*server_name && *server_name == '\\') {
+	while(*server_name && *server_name == path_separator) {
 		server_name++;
 	}
 
-	dfs_name = strchr(server_name, '\\');
+	dfs_name = strchr(server_name, path_separator);
 	if (dfs_name != NULL) {
 		dfs_name[0] = '\0';
 		dfs_name++;
 
-		link_path = strchr(dfs_name, '\\');
+		link_path = strchr(dfs_name, path_separator);
 		if (link_path != NULL) {
 			link_path[0] = '\0';
 			link_path++;
-- 
1.9.1



More information about the samba-technical mailing list