summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2021-02-19 14:49:50 +0100
committerGünther Deschner <gd@samba.org>2021-07-14 16:49:30 +0000
commit799384792a8ef004a74ae3cf11fdf839eacfca2f (patch)
tree9d8f791261d6c6857ce6d4395c80991b13397e1f /source3/libnet
parent33ed555e9bd1a8d8fca0f403eeef7576e80241ba (diff)
downloadsamba-799384792a8ef004a74ae3cf11fdf839eacfca2f.tar.gz
s3-libnet_join: check for netbios name correctness as well
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_join.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 8a42a4a6076..48d2a2db046 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -2531,11 +2531,13 @@ static WERROR libnet_join_check_config(TALLOC_CTX *mem_ctx,
bool valid_security = false;
bool valid_workgroup = false;
bool valid_realm = false;
+ bool valid_hostname = false;
bool ignored_realm = false;
/* check if configuration is already set correctly */
valid_workgroup = strequal(lp_workgroup(), r->out.netbios_domain_name);
+ valid_hostname = strequal(lp_netbios_name(), r->in.machine_name);
switch (r->out.domain_is_ad) {
case false:
@@ -2561,7 +2563,8 @@ static WERROR libnet_join_check_config(TALLOC_CTX *mem_ctx,
valid_security = true;
}
- if (valid_workgroup && valid_realm && valid_security) {
+ if (valid_workgroup && valid_realm && valid_security &&
+ valid_hostname) {
if (ignored_realm && !r->in.modify_config)
{
libnet_join_set_error_string(mem_ctx, r,
@@ -2585,6 +2588,13 @@ static WERROR libnet_join_check_config(TALLOC_CTX *mem_ctx,
char *wrong_conf = talloc_strdup(mem_ctx, "");
+ if (!valid_hostname) {
+ wrong_conf = talloc_asprintf_append(wrong_conf,
+ "\"netbios name\" set to '%s', should be '%s'",
+ lp_netbios_name(), r->in.machine_name);
+ W_ERROR_HAVE_NO_MEMORY(wrong_conf);
+ }
+
if (!valid_workgroup) {
wrong_conf = talloc_asprintf_append(wrong_conf,
"\"workgroup\" set to '%s', should be '%s'",