1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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>
This commit is contained in:
Günther Deschner 2021-02-19 14:49:50 +01:00
parent 33ed555e9b
commit 799384792a

View File

@ -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'",