1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
--- python/samba/provision/sambadns.py.orig 2020-11-03 14:33:19 UTC
+++ python/samba/provision/sambadns.py
@@ -27,6 +27,7 @@ import time
import ldb
from base64 import b64encode
import subprocess
+import re
import samba
from samba.tdb_util import tdb_copy
from samba.mdb_util import mdb_copy
@@ -957,47 +958,38 @@ def create_named_conf(paths, realm, dnsdomain, dns_bac
stderr=subprocess.STDOUT,
cwd='.').communicate()[0]
bind_info = get_string(bind_info)
- bind9_8 = '#'
- bind9_9 = '#'
- bind9_10 = '#'
- bind9_11 = '#'
- bind9_12 = '#'
- bind9_14 = '#'
- bind9_16 = '#'
- if bind_info.upper().find('BIND 9.8') != -1:
- bind9_8 = ''
- elif bind_info.upper().find('BIND 9.9') != -1:
- bind9_9 = ''
- elif bind_info.upper().find('BIND 9.10') != -1:
- bind9_10 = ''
- elif bind_info.upper().find('BIND 9.11') != -1:
- bind9_11 = ''
- elif bind_info.upper().find('BIND 9.12') != -1:
- bind9_12 = ''
- elif bind_info.upper().find('BIND 9.14') != -1:
- bind9_14 = ''
- elif bind_info.upper().find('BIND 9.16') != -1:
- bind9_16 = ''
- elif bind_info.upper().find('BIND 9.7') != -1:
- raise ProvisioningError("DLZ option incompatible with BIND 9.7.")
- elif bind_info.upper().find('BIND_9.13') != -1:
- raise ProvisioningError("Only stable/esv releases of BIND are supported.")
- elif bind_info.upper().find('BIND_9.15') != -1:
- raise ProvisioningError("Only stable/esv releases of BIND are supported.")
- elif bind_info.upper().find('BIND_9.17') != -1:
- raise ProvisioningError("Only stable/esv releases of BIND are supported.")
+
+ bind9_release = re.search('BIND (9)\.(\d+)\.', bind_info, re.I)
+ if bind9_release:
+ bind9_disabled = ''
+ bind9_version = bind9_release.group(0) + "x"
+ bind9_version_major = int(bind9_release.group(1))
+ bind9_version_minor = int(bind9_release.group(2))
+ if bind9_version_minor == 7:
+ raise ProvisioningError("DLZ option incompatible with BIND 9.7.")
+ elif bind9_version_minor == 8:
+ bind9_dlz_version = "9"
+ elif bind9_version_minor in [13, 15, 17]:
+ raise ProvisioningError("Only stable/esv releases of BIND are supported.")
+ else:
+ bind9_dlz_version = "%d_%d" % (bind9_version_major, bind9_version_minor)
else:
+ bind9_disabled = '# '
+ bind9_version = "BIND z.y.x"
+ bind9_dlz_version = "z_y"
logger.warning("BIND version unknown, please modify %s manually." % paths.namedconf)
+
+ bind9_dlz = (
+ ' # For %s\n'
+ ' %sdatabase "dlopen %s/bind9/dlz_bind%s.so";'
+ ) % (
+ bind9_version, bind9_disabled, samba.param.modules_dir(), bind9_dlz_version
+ )
+
setup_file(setup_path("named.conf.dlz"), paths.namedconf, {
"NAMED_CONF": paths.namedconf,
"MODULESDIR": samba.param.modules_dir(),
- "BIND9_8": bind9_8,
- "BIND9_9": bind9_9,
- "BIND9_10": bind9_10,
- "BIND9_11": bind9_11,
- "BIND9_12": bind9_12,
- "BIND9_14": bind9_14,
- "BIND9_16": bind9_16
+ "BIND9_DLZ": bind9_dlz
})
--- source4/dns_server/dlz_minimal.h.orig 2019-12-06 10:10:30 UTC
+++ source4/dns_server/dlz_minimal.h
@@ -26,32 +26,31 @@
#include <stdint.h>
#include <stdbool.h>
-#if defined (BIND_VERSION_9_8)
-# define DLZ_DLOPEN_VERSION 1
-#elif defined (BIND_VERSION_9_9)
-# define DLZ_DLOPEN_VERSION 2
-# define DNS_CLIENTINFO_VERSION 1
-# define ISC_BOOLEAN_AS_BOOL 0
-#elif defined (BIND_VERSION_9_10)
-# define DLZ_DLOPEN_VERSION 3
-# define DNS_CLIENTINFO_VERSION 1
-# define ISC_BOOLEAN_AS_BOOL 0
-#elif defined (BIND_VERSION_9_11)
-# define DLZ_DLOPEN_VERSION 3
-# define DNS_CLIENTINFO_VERSION 2
-# define ISC_BOOLEAN_AS_BOOL 0
-#elif defined (BIND_VERSION_9_12)
-# define DLZ_DLOPEN_VERSION 3
-# define DNS_CLIENTINFO_VERSION 2
-# define ISC_BOOLEAN_AS_BOOL 0
-#elif defined (BIND_VERSION_9_14)
-# define DLZ_DLOPEN_VERSION 3
-# define DNS_CLIENTINFO_VERSION 2
-#elif defined (BIND_VERSION_9_16)
-# define DLZ_DLOPEN_VERSION 3
-# define DNS_CLIENTINFO_VERSION 2
+#if defined (BIND_VERSION)
+# if BIND_VERSION == 908
+# define DLZ_DLOPEN_VERSION 1
+# elif BIND_VERSION == 909
+# define DLZ_DLOPEN_VERSION 2
+# define DNS_CLIENTINFO_VERSION 1
+# define ISC_BOOLEAN_AS_BOOL 0
+# elif BIND_VERSION == 910
+# define DLZ_DLOPEN_VERSION 3
+# define DNS_CLIENTINFO_VERSION 1
+# define ISC_BOOLEAN_AS_BOOL 0
+# elif BIND_VERSION == 911 || BIND_VERSION == 912
+# define DLZ_DLOPEN_VERSION 3
+# define DNS_CLIENTINFO_VERSION 2
+# define ISC_BOOLEAN_AS_BOOL 0
+# elif BIND_VERSION >= 914
+# define DLZ_DLOPEN_VERSION 3
+# define DNS_CLIENTINFO_VERSION 2
+# define ISC_BOOLEAN_AS_BOOL 1
+# else
+# error Unsupported BIND version
+# endif
#else
# error Unsupported BIND version
+# error BIND_VERSION undefined
#endif
#ifndef ISC_BOOLEAN_AS_BOOL
--- source4/dns_server/wscript_build.orig 2019-12-06 10:11:08 UTC
+++ source4/dns_server/wscript_build
@@ -20,7 +20,7 @@ bld.SAMBA_MODULE('service_dns',
# a bind9 dlz module giving access to the Samba DNS SAM
bld.SAMBA_LIBRARY('dlz_bind9',
source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_8',
+ cflags='-DBIND_VERSION=908',
private_library=True,
link_name='modules/bind9/dlz_bind9.so',
realname='dlz_bind9.so',
@@ -28,69 +28,21 @@ bld.SAMBA_LIBRARY('dlz_bind9',
deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
enabled=bld.AD_DC_BUILD_IS_ENABLED())
-bld.SAMBA_LIBRARY('dlz_bind9_9',
+for bind_version in (909, 910, 911, 912, 914, 916):
+ string_version='%d_%d' % (bind_version//100, bind_version % 100)
+ bld.SAMBA_LIBRARY('dlz_bind%s' % (string_version),
source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_9',
+ cflags='-DBIND_VERSION=%d' % bind_version,
private_library=True,
- link_name='modules/bind9/dlz_bind9_9.so',
- realname='dlz_bind9_9.so',
+ link_name='modules/bind9/dlz_bind%s.so' % (string_version),
+ realname='dlz_bind%s.so' % (string_version),
install_path='${MODULESDIR}/bind9',
deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
enabled=bld.AD_DC_BUILD_IS_ENABLED())
-bld.SAMBA_LIBRARY('dlz_bind9_10',
- source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_10',
- private_library=True,
- link_name='modules/bind9/dlz_bind9_10.so',
- realname='dlz_bind9_10.so',
- install_path='${MODULESDIR}/bind9',
- deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
- enabled=bld.AD_DC_BUILD_IS_ENABLED())
-
-bld.SAMBA_LIBRARY('dlz_bind9_11',
- source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_11',
- private_library=True,
- link_name='modules/bind9/dlz_bind9_11.so',
- realname='dlz_bind9_11.so',
- install_path='${MODULESDIR}/bind9',
- deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
- enabled=bld.AD_DC_BUILD_IS_ENABLED())
-
-bld.SAMBA_LIBRARY('dlz_bind9_12',
- source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_12',
- private_library=True,
- link_name='modules/bind9/dlz_bind9_12.so',
- realname='dlz_bind9_12.so',
- install_path='${MODULESDIR}/bind9',
- deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
- enabled=bld.AD_DC_BUILD_IS_ENABLED())
-
-bld.SAMBA_LIBRARY('dlz_bind9_14',
- source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_14',
- private_library=True,
- link_name='modules/bind9/dlz_bind9_14.so',
- realname='dlz_bind9_14.so',
- install_path='${MODULESDIR}/bind9',
- deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
- enabled=bld.AD_DC_BUILD_IS_ENABLED())
-
-bld.SAMBA_LIBRARY('dlz_bind9_16',
- source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_16',
- private_library=True,
- link_name='modules/bind9/dlz_bind9_16.so',
- realname='dlz_bind9_16.so',
- install_path='${MODULESDIR}/bind9',
- deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
- enabled=bld.AD_DC_BUILD_IS_ENABLED())
-
bld.SAMBA_LIBRARY('dlz_bind9_for_torture',
source='dlz_bind9.c',
- cflags='-DBIND_VERSION_9_8',
+ cflags='-DBIND_VERSION=908',
private_library=True,
deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
enabled=bld.AD_DC_BUILD_IS_ENABLED())
--- source4/setup/named.conf.dlz.orig 2019-12-06 10:10:31 UTC
+++ source4/setup/named.conf.dlz
@@ -7,28 +7,10 @@
#
# This configures dynamically loadable zones (DLZ) from AD schema
-# Uncomment only single database line, depending on your BIND version
#
dlz "AD DNS Zone" {
- # For BIND 9.8.x
- ${BIND9_8} database "dlopen ${MODULESDIR}/bind9/dlz_bind9.so";
- # For BIND 9.9.x
- ${BIND9_9} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_9.so";
+${BIND9_DLZ}
- # For BIND 9.10.x
- ${BIND9_10} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_10.so";
-
- # For BIND 9.11.x
- ${BIND9_11} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_11.so";
-
- # For BIND 9.12.x
- ${BIND9_12} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_12.so";
-
- # For BIND 9.14.x
- ${BIND9_14} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_14.so";
-
- # For BIND 9.16.x
- ${BIND9_16} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_16.so";
};
--- source4/torture/dns/wscript_build.orig 2020-04-11 03:26:46 UTC
+++ source4/torture/dns/wscript_build
@@ -5,7 +5,7 @@ if bld.AD_DC_BUILD_IS_ENABLED():
source='dlz_bind9.c',
subsystem='smbtorture',
init_function='torture_bind_dns_init',
- cflags='-DBIND_VERSION_9_8',
+ cflags='-DBIND_VERSION=908',
deps='torture talloc torturemain dlz_bind9_for_torture',
internal_module=True
)
|