[PATCH] Fix MSDFS with POSIX paths in vfs_dfs_samba4

Robin McCorkell rmccorkell at karoshi.org.uk
Fri Jun 5 07:52:33 MDT 2015


Damn, this isn't working as posix_pathnames isn't an smb.conf parameter,
it's a floating function with a static bool behind it. I tried to use
lp_posix_pathnames() instead, but got linker errors. Anyone got any ideas
what I should do? Should we always try to parse POSIX-style paths,
regardless of the value of lp_posix_pathnames() ? Or is checking the result
of that function absolutely crucial?

Robin McCorkell
Karoshi Client maintainer, The Linux Schools Project

http://www.linuxschools.com
https://github.com/the-linux-schools-project

On 5 June 2015 at 13:48, Robin McCorkell <rmccorkell at karoshi.org.uk> wrote:

> Allow for POSIX path separators when parsing a DFS query string
>
> The source3 code supports forward slashes, but a missing check in the
> source4
> code prevents POSIX paths being used when the server is in AD mode.
>
> This is a tweaked resubmission of my patch on 27 February, with an
> lpcfg_*()
> check added.
> ---
>  dfs_server/dfs_server_ad.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/dfs_server/dfs_server_ad.c b/dfs_server/dfs_server_ad.c
> index 3d93e19..cb1ef51 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;
> @@ -828,16 +829,20 @@ NTSTATUS dfs_server_ad_get_referrals(struct
> loadparm_context *lp_ctx,
>                 return NT_STATUS_NO_MEMORY;
>         }
>
> -       while(*server_name && *server_name == '\\') {
> +       if (lpcfg_posix_pathnames(lp_ctx) && *server_name == '/') {
> +               path_separator = '/';
> +       }
> +
> +       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