Fix MSDFS with POSIX paths in vfs_dfs_samba4
authorRobin McCorkell <rmccorkell@karoshi.org.uk>
Thu, 9 Jul 2015 20:20:12 +0000 (21:20 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 10 Jul 2015 15:33:22 +0000 (17:33 +0200)
Allow for POSIX path separators when parsing a DFS query string

Signed-off-by: Robin McCorkell <rmccorkell@karoshi.org.uk>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
dfs_server/dfs_server_ad.c

index 2a1d9ec02e1d4d36fbf42877d6dc8b8aef1f8f70..cacad0bff17d523a16250a3f6e21a42e1470353d 100644 (file)
@@ -799,6 +799,7 @@ NTSTATUS dfs_server_ad_get_referrals(struct loadparm_context *lp_ctx,
        const char *netbios_name;
        const char *dns_name;
        const char **netbios_aliases;
        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;
 
        if (!lpcfg_host_msdfs(lp_ctx)) {
                return NT_STATUS_FS_DRIVER_REQUIRED;
@@ -826,16 +827,18 @@ NTSTATUS dfs_server_ad_get_referrals(struct loadparm_context *lp_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
                return NT_STATUS_NO_MEMORY;
        }
 
-       while(*server_name && *server_name == '\\') {
+       path_separator = (*server_name == '/') ? '/' : '\\';
+
+       while(*server_name && *server_name == path_separator) {
                server_name++;
        }
 
                server_name++;
        }
 
-       dfs_name = strchr(server_name, '\\');
+       dfs_name = strchr(server_name, path_separator);
        if (dfs_name != NULL) {
                dfs_name[0] = '\0';
                dfs_name++;
 
        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++;
                if (link_path != NULL) {
                        link_path[0] = '\0';
                        link_path++;