[PATCH] Fix MSDFS with POSIX paths in vfs_dfs_samba4

Robin McCorkell rmccorkell at karoshi.org.uk
Fri Feb 27 14:38:04 MST 2015


Could I get a review of this patch? I don't know if this is the right
way to go about it (there's a lp_posix_pathnames() that controls this
functionality in the source3 code, but it's not available in source4).
Any tips?

Thanks,
Robin McCorkell


On 27/02/2015 12:05 PM, Robin McCorkell wrote:
> 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++;


-------------- 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/20150227/e0c56101/attachment.pgp>


More information about the samba-technical mailing list