|
|
f14ccb |
From af7dfb4e2b288742d0f3a0b7c9f4c280f8c9738d Mon Sep 17 00:00:00 2001
|
|
|
f14ccb |
From: Volker Lendecke <vl@samba.org>
|
|
|
f14ccb |
Date: Wed, 4 Mar 2015 10:09:18 +0100
|
|
|
f14ccb |
Subject: [PATCH 1/4] libads: Fix CID 1273306 Uninitialized scalar variable
|
|
|
f14ccb |
|
|
|
f14ccb |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11418
|
|
|
f14ccb |
|
|
|
f14ccb |
Signed-off-by: Volker Lendecke <vl@samba.org>
|
|
|
f14ccb |
Reviewed-by: David Disseldorp <ddiss@samba.org>
|
|
|
f14ccb |
(cherry picked from commit 4a686c5b0bbcf0bdb089348403a3c35b8aff67e4)
|
|
|
f14ccb |
---
|
|
|
f14ccb |
source3/libads/kerberos_keytab.c | 2 +-
|
|
|
f14ccb |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
f14ccb |
|
|
|
f14ccb |
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
index ae3d80e39..2d5c7ff 100644
|
|
|
f14ccb |
--- a/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
+++ b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
@@ -508,7 +508,7 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
|
|
|
f14ccb |
krb5_context context = NULL;
|
|
|
f14ccb |
krb5_keytab keytab = NULL;
|
|
|
f14ccb |
krb5_kt_cursor cursor;
|
|
|
f14ccb |
- krb5_keytab_entry kt_entry;
|
|
|
f14ccb |
+ krb5_keytab_entry kt_entry = {0};
|
|
|
f14ccb |
krb5_kvno kvno;
|
|
|
f14ccb |
size_t found = 0;
|
|
|
f14ccb |
char *sam_account_name, *upn;
|
|
|
f14ccb |
--
|
|
|
f14ccb |
2.4.6
|
|
|
f14ccb |
|
|
|
f14ccb |
|
|
|
f14ccb |
From c2fc9c04e670fa4f2a4ad7bb037e40bed08a554f Mon Sep 17 00:00:00 2001
|
|
|
f14ccb |
From: Volker Lendecke <vl@samba.org>
|
|
|
f14ccb |
Date: Wed, 4 Mar 2015 10:09:51 +0100
|
|
|
f14ccb |
Subject: [PATCH 2/4] libads: Fix CID 1273305 Uninitialized scalar variable
|
|
|
f14ccb |
|
|
|
f14ccb |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11418
|
|
|
f14ccb |
|
|
|
f14ccb |
Signed-off-by: Volker Lendecke <vl@samba.org>
|
|
|
f14ccb |
Reviewed-by: David Disseldorp <ddiss@samba.org>
|
|
|
f14ccb |
(cherry picked from commit 706770d7a8c4625ecb555db40c146126d2c160f0)
|
|
|
f14ccb |
---
|
|
|
f14ccb |
source3/libads/kerberos_keytab.c | 2 +-
|
|
|
f14ccb |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
f14ccb |
|
|
|
f14ccb |
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
index 2d5c7ff..bbd981c 100644
|
|
|
f14ccb |
--- a/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
+++ b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
@@ -507,7 +507,7 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
|
|
|
f14ccb |
krb5_error_code ret = 0;
|
|
|
f14ccb |
krb5_context context = NULL;
|
|
|
f14ccb |
krb5_keytab keytab = NULL;
|
|
|
f14ccb |
- krb5_kt_cursor cursor;
|
|
|
f14ccb |
+ krb5_kt_cursor cursor = {0};
|
|
|
f14ccb |
krb5_keytab_entry kt_entry = {0};
|
|
|
f14ccb |
krb5_kvno kvno;
|
|
|
f14ccb |
size_t found = 0;
|
|
|
f14ccb |
--
|
|
|
f14ccb |
2.4.6
|
|
|
f14ccb |
|
|
|
f14ccb |
|
|
|
f14ccb |
From dec69489dfb6ed3f60a1ed9360ceb03800fe01d1 Mon Sep 17 00:00:00 2001
|
|
|
f14ccb |
From: Uri Simchoni <urisimchoni@gmail.com>
|
|
|
f14ccb |
Date: Sat, 2 May 2015 13:44:52 +0300
|
|
|
f14ccb |
Subject: [PATCH 3/4] libads: Fix free of uninitialized pointer
|
|
|
f14ccb |
|
|
|
f14ccb |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11418
|
|
|
f14ccb |
|
|
|
f14ccb |
In ads_keytab_creat_default(), if the keytab to be created cannot
|
|
|
f14ccb |
be opened, the bail-out code calls smb_krb5_kt_free_entry() on
|
|
|
f14ccb |
an uninitialized entry.
|
|
|
f14ccb |
|
|
|
f14ccb |
To reproduce:
|
|
|
f14ccb |
1. Join a domain
|
|
|
f14ccb |
2. KRB5_KTNAME=FILE:/non-existant-path/krb5.keytab net ads keytab create -P
|
|
|
f14ccb |
|
|
|
f14ccb |
Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
|
|
|
f14ccb |
Reviewed-by: Jeremy Allison <jra@samba.org>
|
|
|
f14ccb |
Reviewed-by: Andreas Schneider <asn@samba.org>
|
|
|
f14ccb |
(cherry picked from commit df91bc5159b24f6f10fd9742b49192921d51f821)
|
|
|
f14ccb |
---
|
|
|
f14ccb |
source3/libads/kerberos_keytab.c | 5 +++--
|
|
|
f14ccb |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
f14ccb |
|
|
|
f14ccb |
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
index bbd981c..ef6374a 100644
|
|
|
f14ccb |
--- a/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
+++ b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
@@ -520,6 +520,9 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
|
|
|
f14ccb |
size_t i;
|
|
|
f14ccb |
ADS_STATUS status;
|
|
|
f14ccb |
|
|
|
f14ccb |
+ ZERO_STRUCT(kt_entry);
|
|
|
f14ccb |
+ ZERO_STRUCT(cursor);
|
|
|
f14ccb |
+
|
|
|
f14ccb |
frame = talloc_stackframe();
|
|
|
f14ccb |
if (frame == NULL) {
|
|
|
f14ccb |
ret = -1;
|
|
|
f14ccb |
@@ -575,8 +578,6 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
|
|
|
f14ccb |
#endif
|
|
|
f14ccb |
|
|
|
f14ccb |
memset(princ_s, '\0', sizeof(princ_s));
|
|
|
f14ccb |
- ZERO_STRUCT(kt_entry);
|
|
|
f14ccb |
- ZERO_STRUCT(cursor);
|
|
|
f14ccb |
|
|
|
f14ccb |
initialize_krb5_error_table();
|
|
|
f14ccb |
ret = krb5_init_context(&context);
|
|
|
f14ccb |
--
|
|
|
f14ccb |
2.4.6
|
|
|
f14ccb |
|
|
|
f14ccb |
|
|
|
f14ccb |
From be29f73d746d2d356856eeeec7e958597e429bc0 Mon Sep 17 00:00:00 2001
|
|
|
f14ccb |
From: Uri Simchoni <urisimchoni@gmail.com>
|
|
|
f14ccb |
Date: Sat, 2 May 2015 13:44:53 +0300
|
|
|
f14ccb |
Subject: [PATCH 4/4] libads: Fix deadlock when re-joining a domain and
|
|
|
f14ccb |
updating keytab
|
|
|
f14ccb |
|
|
|
f14ccb |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11418
|
|
|
f14ccb |
|
|
|
f14ccb |
When updating the system keytab as a result of joining a domain,
|
|
|
f14ccb |
if the keytb had prior entries, ads_keytab_create_default tries to
|
|
|
f14ccb |
update those entries. However, it starts updating before freeing the
|
|
|
f14ccb |
cursor which was used for finding those entries, and hence causes
|
|
|
f14ccb |
an an attempt to write-lock the keytab while a read-lock exists.
|
|
|
f14ccb |
|
|
|
f14ccb |
To reproduce configure smb.conf for ads domain member and run this twice:
|
|
|
f14ccb |
net ads join -U <credentials> '--option=kerberos method=secrets and keytab'
|
|
|
f14ccb |
|
|
|
f14ccb |
Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
|
|
|
f14ccb |
Reviewed-by: Jeremy Allison <jra@samba.org>
|
|
|
f14ccb |
Reviewed-by: Andreas Schneider <asn@samba.org>
|
|
|
f14ccb |
|
|
|
f14ccb |
Autobuild-User(master): Jeremy Allison <jra@samba.org>
|
|
|
f14ccb |
Autobuild-Date(master): Mon May 4 21:01:41 CEST 2015 on sn-devel-104
|
|
|
f14ccb |
|
|
|
f14ccb |
(cherry picked from commit 38beef2ff63664d7d5805f1032bb9f69d0b965d7)
|
|
|
f14ccb |
---
|
|
|
f14ccb |
source3/libads/kerberos_keytab.c | 5 +++--
|
|
|
f14ccb |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
f14ccb |
|
|
|
f14ccb |
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
index ef6374a..309e614 100644
|
|
|
f14ccb |
--- a/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
+++ b/source3/libads/kerberos_keytab.c
|
|
|
f14ccb |
@@ -731,13 +731,14 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
|
|
|
f14ccb |
smb_krb5_kt_free_entry(context, &kt_entry);
|
|
|
f14ccb |
ZERO_STRUCT(kt_entry);
|
|
|
f14ccb |
}
|
|
|
f14ccb |
+ krb5_kt_end_seq_get(context, keytab, &cursor);
|
|
|
f14ccb |
+ ZERO_STRUCT(cursor);
|
|
|
f14ccb |
+
|
|
|
f14ccb |
ret = 0;
|
|
|
f14ccb |
for (i = 0; oldEntries[i]; i++) {
|
|
|
f14ccb |
ret |= ads_keytab_add_entry(ads, oldEntries[i]);
|
|
|
f14ccb |
TALLOC_FREE(oldEntries[i]);
|
|
|
f14ccb |
}
|
|
|
f14ccb |
- krb5_kt_end_seq_get(context, keytab, &cursor);
|
|
|
f14ccb |
- ZERO_STRUCT(cursor);
|
|
|
f14ccb |
|
|
|
f14ccb |
done:
|
|
|
f14ccb |
TALLOC_FREE(oldEntries);
|
|
|
f14ccb |
--
|
|
|
f14ccb |
2.4.6
|
|
|
f14ccb |
|