[PATCH] s4-dfs_server: check for netbios aliases in ad_get_referrals
Michael Adam
obnox at samba.org
Mon Jun 10 15:22:21 MDT 2013
Pushed to autobuild with Metze's signoff added
as per Metze's request.
Thanks - Michael
On 2013-06-05 at 15:48 +0200, Bjoern Baumbach wrote:
> Hi!
>
> Currenlty file shares, provided by an ad dc, are not accessible by names
> that are not related to our dns names. Furthermore the netbios aliases
> do not work.
>
> This patch provides the check for the netbios aliases and enables the
> option to use the smb.conf netbios aliases to fix the access to
> fileshares (while using a alternate dns name for our server).
>
> Best regards,
> Björn
>
> --
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de, mailto:kontakt at sernet.de
> From f7972e229f75176f2b09c84f023fa88d817a85c4 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
> Date: Wed, 5 Jun 2013 15:01:14 +0200
> Subject: [PATCH] s4-dfs_server: check for netbios aliases in ad_get_referrals
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Without this patch ad_get_referrals checks for netbios, dns names
> and ip, but not for netbios aliases set by netbios aliases option,
> whether the requested name is our dns name.
>
> Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
>
> Signed-off-by: Bj??rn Baumbach <bb at sernet.de>
> ---
> dfs_server/dfs_server_ad.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/dfs_server/dfs_server_ad.c b/dfs_server/dfs_server_ad.c
> index ceabe05..8fa143d 100644
> --- a/dfs_server/dfs_server_ad.c
> +++ b/dfs_server/dfs_server_ad.c
> @@ -751,6 +751,7 @@ NTSTATUS dfs_server_ad_get_referrals(struct loadparm_context *lp_ctx,
> const char *dns_domain;
> const char *netbios_name;
> const char *dns_name;
> + const char **netbios_aliases;
>
> if (!lpcfg_host_msdfs(lp_ctx)) {
> return NT_STATUS_FS_DRIVER_REQUIRED;
> @@ -827,6 +828,40 @@ NTSTATUS dfs_server_ad_get_referrals(struct loadparm_context *lp_ctx,
> return NT_STATUS_NOT_FOUND;
> }
>
> + netbios_aliases = lpcfg_netbios_aliases(lp_ctx);
> + while (netbios_aliases && *netbios_aliases) {
> + const char *netbios_alias = *netbios_aliases;
> + char *dns_alias;
> + int cmp;
> +
> + cmp = strcasecmp_m(server_name, netbios_alias);
> + if (cmp == 0) {
> + /*
> + * If it is not domain related do not
> + * handle it here.
> + */
> + return NT_STATUS_NOT_FOUND;
> + }
> +
> + dns_alias = talloc_asprintf(r, "%s.%s",
> + netbios_alias,
> + dns_domain);
> + if (dns_alias == NULL) {
> + return NT_STATUS_NO_MEMORY;
> + }
> +
> + cmp = strcasecmp_m(server_name, dns_alias);
> + talloc_free(dns_alias);
> + if (cmp == 0) {
> + /*
> + * If it is not domain related do not
> + * handle it here.
> + */
> + return NT_STATUS_NOT_FOUND;
> + }
> + netbios_aliases++;
> + }
> +
> if ((strcasecmp_m(server_name, netbios_domain) != 0) &&
> (strcasecmp_m(server_name, dns_domain) != 0)) {
> /*
> --
> 1.8.1.5
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 215 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130610/61841d5f/attachment.pgp>
More information about the samba-technical
mailing list