Skip to content

Commit

Permalink
Add mdns name configuration option
Browse files Browse the repository at this point in the history
Add the mdns name configuration variable to control the mdns hostname.
The default is to use the NETBIOS name of the system to match previous
versions which is typically the hostname in all capitals. A value of mdns
can be provided to defer the hostname to the mdns library.

With the recent patch to support time machine being merged this patch
allows for a user to configure the server name that is advertised to
be lower cased through Avahi advertisements.

Signed-off-by: Kevin Anderson <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
kevinanderson1 authored and jrasamba committed Dec 8, 2017
1 parent b8d0602 commit 18307f8
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
26 changes: 25 additions & 1 deletion WHATSNEW.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ policy. Can be applied automatically by setting

'server services = +gpoupdate'.

Time Machine Support with vfs_fruit
===================================
Samba can be configured as a Time Machine target for Apple Mac devices
through the vfs_fruit module. When enabling a share for Time Machine
support the relevant Avahi records to support discovery will be published
for installations that have been built against the Avahi client library.

Shares can be designated as a Time Machine share with the following setting:

'fruit:time machine = yes'

Support for lower casing the MDNS Name
======================================
Allows the server name that is advertised through MDNS to be set to the
hostname rather than the Samba NETBIOS name. This allows an administrator
to make Samba registered MDNS records match the case of the hostname
rather than being in all capitals.

This can be set with the following settings:

'mdns name = mdns'


smb.conf changes
================

Expand All @@ -38,7 +61,8 @@ smb.conf changes
gpo update command New
oplock contention limit Removed
prefork children New 1

mdns name Added netbios
fruit:time machine Added false

NT4-style replication based net commands removed
================================================
Expand Down
19 changes: 19 additions & 0 deletions docs-xml/smbdotconf/base/mdnsname.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<samba:parameter name="mdns name"
type="enum"
context="G"
enumlist="enum_mdns_name_values"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">

<description>
<para>This parameter controls the name that multicast DNS
support advertises as its' hostname.</para>

<para>The default is to use the NETBIOS name which is typically
the hostname in all capital letters. </para>

<para>A setting of mdns will defer the hostname configuration
to the MDNS library that is used.</para>

</description>
<value type="default">netbios</value>
</samba:parameter>
2 changes: 2 additions & 0 deletions lib/param/loadparm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2906,6 +2906,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)

lpcfg_do_global_parameter(lp_ctx, "client ldap sasl wrapping", "sign");

lpcfg_do_global_parameter(lp_ctx, "mdns name", "netbios");

lpcfg_do_global_parameter(lp_ctx, "ldap server require strong auth", "yes");

lpcfg_do_global_parameter(lp_ctx, "follow symlinks", "yes");
Expand Down
3 changes: 3 additions & 0 deletions lib/param/loadparm.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ enum ldap_server_require_strong_auth {
/* DNS update settings */
enum dns_update_settings {DNS_UPDATE_OFF, DNS_UPDATE_ON, DNS_UPDATE_SIGNED};

/* MDNS name sources */
enum mdns_name_values {MDNS_NAME_NETBIOS, MDNS_NAME_MDNS};

/* LDAP SSL options */
enum ldap_ssl_types {LDAP_SSL_OFF, LDAP_SSL_START_TLS};

Expand Down
6 changes: 6 additions & 0 deletions lib/param/param_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ static const struct enum_list enum_smb_signing_vals[] = {
{-1, NULL}
};

static const struct enum_list enum_mdns_name_values[] = {
{MDNS_NAME_NETBIOS, "netbios"},
{MDNS_NAME_MDNS, "mdns"},
{-1, NULL}
};

static const struct enum_list enum_tls_verify_peer_vals[] = {
{TLS_VERIFY_PEER_NO_CHECK,
TLS_VERIFY_PEER_NO_CHECK_STRING},
Expand Down
18 changes: 16 additions & 2 deletions source3/smbd/avahi_register.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,23 @@ static void avahi_client_callback(AvahiClient *c, AvahiClientState status,
int dk = 0;
AvahiStringList *adisk = NULL;
AvahiStringList *adisk2 = NULL;
const char *hostname = NULL;
enum mdns_name_values mdns_name = lp_mdns_name();

DBG_DEBUG("AVAHI_CLIENT_S_RUNNING\n");

switch (mdns_name) {
case MDNS_NAME_MDNS:
hostname = avahi_client_get_host_name(c);
break;
case MDNS_NAME_NETBIOS:
hostname = lp_netbios_name();
break;
default:
DBG_ERR("Unhandled mdns_name %d\n", mdns_name);
return;
}

state->entry_group = avahi_entry_group_new(
c, avahi_entry_group_callback, state);
if (state->entry_group == NULL) {
Expand All @@ -125,7 +139,7 @@ static void avahi_client_callback(AvahiClient *c, AvahiClientState status,

error = avahi_entry_group_add_service(
state->entry_group, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, 0, lp_netbios_name(),
AVAHI_PROTO_UNSPEC, 0, hostname,
"_smb._tcp", NULL, NULL, state->port, NULL);
if (error != AVAHI_OK) {
DBG_DEBUG("avahi_entry_group_add_service failed: %s\n",
Expand Down Expand Up @@ -169,7 +183,7 @@ static void avahi_client_callback(AvahiClient *c, AvahiClientState status,

error = avahi_entry_group_add_service_strlst(
state->entry_group, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, 0, lp_netbios_name(),
AVAHI_PROTO_UNSPEC, 0, hostname,
"_adisk._tcp", NULL, NULL, 0, adisk);
avahi_string_list_free(adisk);
adisk = NULL;
Expand Down

0 comments on commit 18307f8

Please sign in to comment.