|
|
7035bd |
From 73368f962136398d79c22e7df6fe4f6d7ce3932f Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 16:53:02 +0100
|
|
|
7035bd |
Subject: [PATCH 1/9] testprogs: Add test that local krb5.conf has been created
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
testprogs/blackbox/test_net_ads.sh | 6 ++++++
|
|
|
7035bd |
1 file changed, 6 insertions(+)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/testprogs/blackbox/test_net_ads.sh b/testprogs/blackbox/test_net_ads.sh
|
|
|
7035bd |
index 76b394b10a9..cfafb945b62 100755
|
|
|
7035bd |
--- a/testprogs/blackbox/test_net_ads.sh
|
|
|
7035bd |
+++ b/testprogs/blackbox/test_net_ads.sh
|
|
|
7035bd |
@@ -51,6 +51,12 @@ fi
|
|
|
7035bd |
|
|
|
7035bd |
testit "join" $VALGRIND $net_tool ads join -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1`
|
|
|
7035bd |
|
|
|
7035bd |
+workgroup=$(awk '/workgroup =/ { print $NR }' "${BASEDIR}/${WORKDIR}/client.conf")
|
|
|
7035bd |
+testit "local krb5.conf created" \
|
|
|
7035bd |
+ test -r \
|
|
|
7035bd |
+ "${BASEDIR}/${WORKDIR}/lockdir/smb_krb5/krb5.conf.${workgroup}" ||
|
|
|
7035bd |
+ failed=$((failed + 1))
|
|
|
7035bd |
+
|
|
|
7035bd |
testit "testjoin" $VALGRIND $net_tool ads testjoin -P --use-kerberos=required || failed=`expr $failed + 1`
|
|
|
7035bd |
|
|
|
7035bd |
netbios=$(grep "netbios name" $BASEDIR/$WORKDIR/client.conf | cut -f2 -d= | awk '{$1=$1};1')
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From d50e4298d6d713128cc3a7687cb7d5c8f4c213e4 Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 12:03:40 +0100
|
|
|
7035bd |
Subject: [PATCH 2/9] s3:libads: Remove trailing spaces in kerberos.c
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 18 +++++++++---------
|
|
|
7035bd |
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index 75beeef4a44..60fe03fd5d7 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -1,4 +1,4 @@
|
|
|
7035bd |
-/*
|
|
|
7035bd |
+/*
|
|
|
7035bd |
Unix SMB/CIFS implementation.
|
|
|
7035bd |
kerberos utility library
|
|
|
7035bd |
Copyright (C) Andrew Tridgell 2001
|
|
|
7035bd |
@@ -37,11 +37,11 @@
|
|
|
7035bd |
#define LIBADS_CCACHE_NAME "MEMORY:libads"
|
|
|
7035bd |
|
|
|
7035bd |
/*
|
|
|
7035bd |
- we use a prompter to avoid a crash bug in the kerberos libs when
|
|
|
7035bd |
+ we use a prompter to avoid a crash bug in the kerberos libs when
|
|
|
7035bd |
dealing with empty passwords
|
|
|
7035bd |
this prompter is just a string copy ...
|
|
|
7035bd |
*/
|
|
|
7035bd |
-static krb5_error_code
|
|
|
7035bd |
+static krb5_error_code
|
|
|
7035bd |
kerb_prompter(krb5_context ctx, void *data,
|
|
|
7035bd |
const char *name,
|
|
|
7035bd |
const char *banner,
|
|
|
7035bd |
@@ -192,7 +192,7 @@ int kerberos_kinit_password_ext(const char *given_principal,
|
|
|
7035bd |
krb5_get_init_creds_opt_set_address_list(opt, addr->addrs);
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
- if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, discard_const_p(char,password),
|
|
|
7035bd |
+ if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, discard_const_p(char,password),
|
|
|
7035bd |
kerb_prompter, discard_const_p(char, password),
|
|
|
7035bd |
0, NULL, opt))) {
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
@@ -299,7 +299,7 @@ int ads_kdestroy(const char *cc_name)
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
if ((code = krb5_cc_destroy (ctx, cc))) {
|
|
|
7035bd |
- DEBUG(3, ("ads_kdestroy: krb5_cc_destroy failed: %s\n",
|
|
|
7035bd |
+ DEBUG(3, ("ads_kdestroy: krb5_cc_destroy failed: %s\n",
|
|
|
7035bd |
error_message(code)));
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
@@ -348,10 +348,10 @@ int kerberos_kinit_password(const char *principal,
|
|
|
7035bd |
int time_offset,
|
|
|
7035bd |
const char *cache_name)
|
|
|
7035bd |
{
|
|
|
7035bd |
- return kerberos_kinit_password_ext(principal,
|
|
|
7035bd |
- password,
|
|
|
7035bd |
- time_offset,
|
|
|
7035bd |
- 0,
|
|
|
7035bd |
+ return kerberos_kinit_password_ext(principal,
|
|
|
7035bd |
+ password,
|
|
|
7035bd |
+ time_offset,
|
|
|
7035bd |
+ 0,
|
|
|
7035bd |
0,
|
|
|
7035bd |
cache_name,
|
|
|
7035bd |
False,
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From 85f140daa2779dec38255a997ec77540365959ca Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 12:04:34 +0100
|
|
|
7035bd |
Subject: [PATCH 3/9] s3:libads: Leave early on error in get_kdc_ip_string()
|
|
|
7035bd |
|
|
|
7035bd |
This avoids useless allocations.
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 17 +++++++++++------
|
|
|
7035bd |
1 file changed, 11 insertions(+), 6 deletions(-)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index 60fe03fd5d7..1bf149ef09b 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -434,9 +434,14 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
struct netlogon_samlogon_response **responses = NULL;
|
|
|
7035bd |
NTSTATUS status;
|
|
|
7035bd |
bool ok;
|
|
|
7035bd |
- char *kdc_str = talloc_asprintf(mem_ctx, "%s\t\tkdc = %s\n", "",
|
|
|
7035bd |
- print_canonical_sockaddr_with_port(mem_ctx, pss));
|
|
|
7035bd |
+ char *kdc_str = NULL;
|
|
|
7035bd |
|
|
|
7035bd |
+ SMB_ASSERT(pss != NULL);
|
|
|
7035bd |
+
|
|
|
7035bd |
+ kdc_str = talloc_asprintf(mem_ctx,
|
|
|
7035bd |
+ "\t\tkdc = %s\n",
|
|
|
7035bd |
+ print_canonical_sockaddr_with_port(mem_ctx,
|
|
|
7035bd |
+ pss));
|
|
|
7035bd |
if (kdc_str == NULL) {
|
|
|
7035bd |
TALLOC_FREE(frame);
|
|
|
7035bd |
return NULL;
|
|
|
7035bd |
@@ -516,15 +521,15 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
}
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
- dc_addrs2 = talloc_zero_array(talloc_tos(),
|
|
|
7035bd |
- struct tsocket_address *,
|
|
|
7035bd |
- num_dcs);
|
|
|
7035bd |
-
|
|
|
7035bd |
DBG_DEBUG("%zu additional KDCs to test\n", num_dcs);
|
|
|
7035bd |
if (num_dcs == 0) {
|
|
|
7035bd |
TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
+
|
|
|
7035bd |
+ dc_addrs2 = talloc_zero_array(talloc_tos(),
|
|
|
7035bd |
+ struct tsocket_address *,
|
|
|
7035bd |
+ num_dcs);
|
|
|
7035bd |
if (dc_addrs2 == NULL) {
|
|
|
7035bd |
TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From 010cb49995f00b6bb5058b8b1a69e684c0bb1050 Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 12:10:47 +0100
|
|
|
7035bd |
Subject: [PATCH 4/9] s3:libads: Improve debug messages for get_kdc_ip_string()
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 6 +++++-
|
|
|
7035bd |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index 1bf149ef09b..6a46d72a156 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -590,7 +590,11 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
|
|
|
7035bd |
result = kdc_str;
|
|
|
7035bd |
out:
|
|
|
7035bd |
- DBG_DEBUG("Returning\n%s\n", kdc_str);
|
|
|
7035bd |
+ if (result != NULL) {
|
|
|
7035bd |
+ DBG_DEBUG("Returning\n%s\n", kdc_str);
|
|
|
7035bd |
+ } else {
|
|
|
7035bd |
+ DBG_NOTICE("Failed to get KDC ip address\n");
|
|
|
7035bd |
+ }
|
|
|
7035bd |
|
|
|
7035bd |
TALLOC_FREE(ip_sa_site);
|
|
|
7035bd |
TALLOC_FREE(ip_sa_nonsite);
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From c0640d8ea59ef57a1d61151f790431bcf7fddeba Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 12:48:23 +0100
|
|
|
7035bd |
Subject: [PATCH 5/9] s3:libads: Use talloc_asprintf_append() in
|
|
|
7035bd |
get_kdc_ip_string()
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 9 +++++----
|
|
|
7035bd |
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index 6a46d72a156..d1c410ffa4b 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -578,10 +578,11 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
/* Append to the string - inefficient but not done often. */
|
|
|
7035bd |
- new_kdc_str = talloc_asprintf(mem_ctx, "%s\t\tkdc = %s\n",
|
|
|
7035bd |
- kdc_str,
|
|
|
7035bd |
- print_canonical_sockaddr_with_port(mem_ctx, &dc_addrs[i]));
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
+ new_kdc_str = talloc_asprintf_append(
|
|
|
7035bd |
+ kdc_str,
|
|
|
7035bd |
+ "\t\tkdc = %s\n",
|
|
|
7035bd |
+ print_canonical_sockaddr_with_port(
|
|
|
7035bd |
+ mem_ctx, &dc_addrs[i]));
|
|
|
7035bd |
if (new_kdc_str == NULL) {
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From b8e73356ff44f0717ed413a4e8af51f043434a7f Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 12:56:58 +0100
|
|
|
7035bd |
Subject: [PATCH 6/9] s3:libads: Allocate all memory on the talloc stackframe
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 10 ++++------
|
|
|
7035bd |
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index d1c410ffa4b..aadc65a3edc 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -438,7 +438,7 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
|
|
|
7035bd |
SMB_ASSERT(pss != NULL);
|
|
|
7035bd |
|
|
|
7035bd |
- kdc_str = talloc_asprintf(mem_ctx,
|
|
|
7035bd |
+ kdc_str = talloc_asprintf(frame,
|
|
|
7035bd |
"\t\tkdc = %s\n",
|
|
|
7035bd |
print_canonical_sockaddr_with_port(mem_ctx,
|
|
|
7035bd |
pss));
|
|
|
7035bd |
@@ -459,7 +459,7 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
*/
|
|
|
7035bd |
|
|
|
7035bd |
if (sitename) {
|
|
|
7035bd |
- status = get_kdc_list(talloc_tos(),
|
|
|
7035bd |
+ status = get_kdc_list(frame,
|
|
|
7035bd |
realm,
|
|
|
7035bd |
sitename,
|
|
|
7035bd |
&ip_sa_site,
|
|
|
7035bd |
@@ -477,7 +477,7 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
|
|
|
7035bd |
/* Get all KDC's. */
|
|
|
7035bd |
|
|
|
7035bd |
- status = get_kdc_list(talloc_tos(),
|
|
|
7035bd |
+ status = get_kdc_list(frame,
|
|
|
7035bd |
realm,
|
|
|
7035bd |
NULL,
|
|
|
7035bd |
&ip_sa_nonsite,
|
|
|
7035bd |
@@ -589,7 +589,7 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
kdc_str = new_kdc_str;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
- result = kdc_str;
|
|
|
7035bd |
+ result = talloc_move(mem_ctx, &kdc_str);
|
|
|
7035bd |
out:
|
|
|
7035bd |
if (result != NULL) {
|
|
|
7035bd |
DBG_DEBUG("Returning\n%s\n", kdc_str);
|
|
|
7035bd |
@@ -597,8 +597,6 @@ out:
|
|
|
7035bd |
DBG_NOTICE("Failed to get KDC ip address\n");
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
- TALLOC_FREE(ip_sa_site);
|
|
|
7035bd |
- TALLOC_FREE(ip_sa_nonsite);
|
|
|
7035bd |
TALLOC_FREE(frame);
|
|
|
7035bd |
return result;
|
|
|
7035bd |
}
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From e2ea1de6128195af937474b41a57756013c8249e Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 12:57:18 +0100
|
|
|
7035bd |
Subject: [PATCH 7/9] s3:libads: Remove obsolete free's of kdc_str
|
|
|
7035bd |
|
|
|
7035bd |
This is allocated on the stackframe now!
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 12 +-----------
|
|
|
7035bd |
1 file changed, 1 insertion(+), 11 deletions(-)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index aadc65a3edc..2087dc1e6f9 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -443,13 +443,11 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
print_canonical_sockaddr_with_port(mem_ctx,
|
|
|
7035bd |
pss));
|
|
|
7035bd |
if (kdc_str == NULL) {
|
|
|
7035bd |
- TALLOC_FREE(frame);
|
|
|
7035bd |
- return NULL;
|
|
|
7035bd |
+ goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
ok = sockaddr_storage_to_samba_sockaddr(&sa, pss);
|
|
|
7035bd |
if (!ok) {
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
@@ -467,7 +465,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
7035bd |
DBG_ERR("get_kdc_list fail %s\n",
|
|
|
7035bd |
nt_errstr(status));
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
DBG_DEBUG("got %zu addresses from site %s search\n",
|
|
|
7035bd |
@@ -485,7 +482,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
7035bd |
DBG_ERR("get_kdc_list (site-less) fail %s\n",
|
|
|
7035bd |
nt_errstr(status));
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
DBG_DEBUG("got %zu addresses from site-less search\n", count_nonsite);
|
|
|
7035bd |
@@ -493,7 +489,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
if (count_site + count_nonsite < count_site) {
|
|
|
7035bd |
/* Wrap check. */
|
|
|
7035bd |
DBG_ERR("get_kdc_list_talloc (site-less) fail wrap error\n");
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
@@ -501,7 +496,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
dc_addrs = talloc_array(talloc_tos(), struct sockaddr_storage,
|
|
|
7035bd |
count_site + count_nonsite);
|
|
|
7035bd |
if (dc_addrs == NULL) {
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
@@ -523,7 +517,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
|
|
|
7035bd |
DBG_DEBUG("%zu additional KDCs to test\n", num_dcs);
|
|
|
7035bd |
if (num_dcs == 0) {
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
@@ -531,7 +524,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
struct tsocket_address *,
|
|
|
7035bd |
num_dcs);
|
|
|
7035bd |
if (dc_addrs2 == NULL) {
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
@@ -548,7 +540,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
status = map_nt_error_from_unix(errno);
|
|
|
7035bd |
DEBUG(2,("Failed to create tsocket_address for %s - %s\n",
|
|
|
7035bd |
addr, nt_errstr(status)));
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
}
|
|
|
7035bd |
@@ -566,7 +557,6 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
7035bd |
DEBUG(10,("get_kdc_ip_string: cldap_multi_netlogon failed: "
|
|
|
7035bd |
"%s\n", nt_errstr(status)));
|
|
|
7035bd |
- TALLOC_FREE(kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From 8242cb20ed3149acb83a140c140bdbb90de58b65 Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 13:02:05 +0100
|
|
|
7035bd |
Subject: [PATCH 8/9] s3:libads: Check print_canonical_sockaddr_with_port() for
|
|
|
7035bd |
NULL in get_kdc_ip_string()
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 9 +++++++--
|
|
|
7035bd |
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index 2087dc1e6f9..20dceeefb22 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -435,13 +435,18 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
NTSTATUS status;
|
|
|
7035bd |
bool ok;
|
|
|
7035bd |
char *kdc_str = NULL;
|
|
|
7035bd |
+ char *canon_sockaddr = NULL;
|
|
|
7035bd |
|
|
|
7035bd |
SMB_ASSERT(pss != NULL);
|
|
|
7035bd |
|
|
|
7035bd |
+ canon_sockaddr = print_canonical_sockaddr_with_port(frame, pss);
|
|
|
7035bd |
+ if (canon_sockaddr == NULL) {
|
|
|
7035bd |
+ goto out;
|
|
|
7035bd |
+ }
|
|
|
7035bd |
+
|
|
|
7035bd |
kdc_str = talloc_asprintf(frame,
|
|
|
7035bd |
"\t\tkdc = %s\n",
|
|
|
7035bd |
- print_canonical_sockaddr_with_port(mem_ctx,
|
|
|
7035bd |
- pss));
|
|
|
7035bd |
+ canon_sockaddr);
|
|
|
7035bd |
if (kdc_str == NULL) {
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|
|
|
7035bd |
|
|
|
7035bd |
From fbd0843fdd257bc0e4ebef53c7afa29f171e86e5 Mon Sep 17 00:00:00 2001
|
|
|
7035bd |
From: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
Date: Tue, 15 Mar 2022 13:10:06 +0100
|
|
|
7035bd |
Subject: [PATCH 9/9] s3:libads: Fix creating local krb5.conf
|
|
|
7035bd |
|
|
|
7035bd |
We create an KDC ip string entry directly at the beginning, use it if we
|
|
|
7035bd |
don't have any additional DCs.
|
|
|
7035bd |
|
|
|
7035bd |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
|
|
|
7035bd |
|
|
|
7035bd |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
7035bd |
---
|
|
|
7035bd |
source3/libads/kerberos.c | 5 +++++
|
|
|
7035bd |
1 file changed, 5 insertions(+)
|
|
|
7035bd |
|
|
|
7035bd |
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
|
|
|
7035bd |
index 20dceeefb22..3fd86e87064 100644
|
|
|
7035bd |
--- a/source3/libads/kerberos.c
|
|
|
7035bd |
+++ b/source3/libads/kerberos.c
|
|
|
7035bd |
@@ -522,6 +522,11 @@ static char *get_kdc_ip_string(char *mem_ctx,
|
|
|
7035bd |
|
|
|
7035bd |
DBG_DEBUG("%zu additional KDCs to test\n", num_dcs);
|
|
|
7035bd |
if (num_dcs == 0) {
|
|
|
7035bd |
+ /*
|
|
|
7035bd |
+ * We do not have additional KDCs, but we have the one passed
|
|
|
7035bd |
+ * in via `pss`. So just use that one and leave.
|
|
|
7035bd |
+ */
|
|
|
7035bd |
+ result = talloc_move(mem_ctx, &kdc_str);
|
|
|
7035bd |
goto out;
|
|
|
7035bd |
}
|
|
|
7035bd |
|
|
|
7035bd |
--
|
|
|
7035bd |
2.35.1
|
|
|
7035bd |
|