[PATCH v3] Fix MSDFS with POSIX paths in vfs_dfs_samba4

Robin McCorkell rmccorkell at karoshi.org.uk
Tue Jul 7 14:37:17 UTC 2015


Any chance to get this reviewed and merged? The problem is a real issue
in mount.cifs, which always tries to use POSIX paths.

On 15/06/2015 12:36 PM, Robin McCorkell wrote:
> Allow for POSIX path separators when parsing a DFS query string, and
> pre-empt a bug with multibyte DFS pathname handling by switching to
> strchr_m()
>
> Signed-off-by: Robin McCorkell <rmccorkell at karoshi.org.uk>
> ---
>  dfs_server/dfs_server_ad.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/dfs_server/dfs_server_ad.c b/dfs_server/dfs_server_ad.c
> index 3d93e19..c226880 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,18 @@ NTSTATUS dfs_server_ad_get_referrals(struct loadparm_context *lp_ctx,
>  		return NT_STATUS_NO_MEMORY;
>  	}
>  
> -	while(*server_name && *server_name == '\\') {
> +	path_separator = (*server_name == '/') ? '/' : '\\';
> +
> +	while(*server_name && *server_name == path_separator) {
>  		server_name++;
>  	}
>  
> -	dfs_name = strchr(server_name, '\\');
> +	dfs_name = strchr_m(server_name, path_separator);
>  	if (dfs_name != NULL) {
>  		dfs_name[0] = '\0';
>  		dfs_name++;
>  
> -		link_path = strchr(dfs_name, '\\');
> +		link_path = strchr_m(dfs_name, path_separator);
>  		if (link_path != NULL) {
>  			link_path[0] = '\0';
>  			link_path++;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150707/e4d3589c/signature.pgp>


More information about the samba-technical mailing list