File 0006-Handle-kvno-increment-for-RODCs.patch of Package adcli (Revision ce46d0e7322eb68daa00b5c190e5847d)
Currently displaying revision ce46d0e7322eb68daa00b5c190e5847d , Show latest
xxxxxxxxxx
1
From 320f776279b99a63a12c7136ef251f7e8805c13c Mon Sep 17 00:00:00 2001
2
From: Sumit Bose <sbose@redhat.com>
3
Date: Wed, 1 Nov 2017 17:14:05 +0100
4
Subject: [PATCH 06/25] Handle kvno increment for RODCs
5
6
Since the actual password change does not happen on the read-only domain
7
controller (RODC) the kvno change has to be replicated back which might
8
take some time. So we check the kvno before and after the change if we
9
are connected to a RODC and increment the kvno if needed.
10
---
11
library/adenroll.c | 31 +++++++++++++++++++++++++++++++
12
1 file changed, 31 insertions(+)
13
14
diff --git a/library/adenroll.c b/library/adenroll.c
15
index 05885d0..bb970d1 100644
16
--- a/library/adenroll.c
17
+++ b/library/adenroll.c
18
19
adcli_enroll_flags flags)
20
{
21
adcli_result res;
22
+ krb5_kvno old_kvno = -1;
23
24
if (!(flags & ADCLI_ENROLL_PASSWORD_VALID)) {
25
+
26
+ /* Handle kvno changes for read-only domain controllers
27
+ * (RODC). Since the actual password change does not happen on
28
+ * the RODC the kvno change has to be replicated back which
29
+ * might take some time. So we check the kvno before and after
30
+ * the change if we are connected to a RODC and increment the
31
+ * kvno if needed. */
32
+ if (!adcli_conn_is_writeable (enroll->conn)) {
33
+ if (enroll->computer_attributes == NULL) {
34
+ res = retrieve_computer_account (enroll);
35
+ if (res != ADCLI_SUCCESS)
36
+ return res;
37
+ }
38
+ old_kvno = adcli_enroll_get_kvno (enroll);
39
+ _adcli_info ("Found old kvno '%d'", old_kvno);
40
+
41
+ ldap_msgfree (enroll->computer_attributes);
42
+ enroll->computer_attributes = NULL;
43
+ adcli_enroll_set_kvno (enroll, 0);
44
+ }
45
+
46
res = set_computer_password (enroll);
47
if (res != ADCLI_SUCCESS)
48
return res;
49
50
return res;
51
}
52
53
+ /* Handle kvno changes for read-only domain controllers (RODC) */
54
+ if (!adcli_conn_is_writeable (enroll->conn) && old_kvno != -1 &&
55
+ adcli_enroll_get_kvno (enroll) != 0 &&
56
+ adcli_enroll_get_kvno (enroll) == old_kvno) {
57
+ enroll->kvno++;
58
+ _adcli_info ("No kvno change detected on read-only DC, kvno "
59
+ "will be incremented by 1 to '%d'", enroll->kvno);
60
+ }
61
+
62
/* We ignore failures of setting these fields */
63
update_and_calculate_enctypes (enroll);
64
update_computer_account (enroll);
65
--
66
2.16.4
67
68