xref: /freebsd/contrib/unbound/util/fptr_wlist.c (revision 87bf66d4a7488c496af110d4d05cc0273d49f82e)
1 /*
2  * util/fptr_wlist.c - function pointer whitelists.
3  *
4  * Copyright (c) 2007, NLnet Labs. All rights reserved.
5  *
6  * This software is open source.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * Neither the name of the NLNET LABS nor the names of its contributors may
20  * be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 /**
37  * \file
38  *
39  * This file contains functions that check function pointers.
40  * The functions contain a whitelist of known good callback values.
41  * Any other values lead to an error.
42  *
43  * Due to the listing nature, this file violates all the modularization
44  * boundaries in the program.
45  */
46 #include "config.h"
47 #include "util/fptr_wlist.h"
48 #include "util/mini_event.h"
49 #include "services/outside_network.h"
50 #include "services/listen_dnsport.h"
51 #include "services/mesh.h"
52 #include "services/localzone.h"
53 #include "services/authzone.h"
54 #include "services/cache/infra.h"
55 #include "services/cache/rrset.h"
56 #include "services/view.h"
57 #include "dns64/dns64.h"
58 #include "iterator/iterator.h"
59 #include "iterator/iter_fwd.h"
60 #include "validator/validator.h"
61 #include "validator/val_anchor.h"
62 #include "validator/val_nsec3.h"
63 #include "validator/val_sigcrypt.h"
64 #include "validator/val_kentry.h"
65 #include "validator/val_neg.h"
66 #include "validator/autotrust.h"
67 #include "util/data/msgreply.h"
68 #include "util/data/packed_rrset.h"
69 #include "util/storage/slabhash.h"
70 #include "util/storage/dnstree.h"
71 #include "util/locks.h"
72 #include "libunbound/libworker.h"
73 #include "libunbound/context.h"
74 #include "libunbound/worker.h"
75 #include "util/tube.h"
76 #include "util/config_file.h"
77 #ifdef UB_ON_WINDOWS
78 #include "winrc/win_svc.h"
79 #endif
80 #include "respip/respip.h"
81 
82 #ifdef WITH_PYTHONMODULE
83 #include "pythonmod/pythonmod.h"
84 #endif
85 #ifdef WITH_DYNLIBMODULE
86 #include "dynlibmod/dynlibmod.h"
87 #endif
88 #ifdef USE_CACHEDB
89 #include "cachedb/cachedb.h"
90 #endif
91 #ifdef USE_IPSECMOD
92 #include "ipsecmod/ipsecmod.h"
93 #endif
94 #ifdef CLIENT_SUBNET
95 #include "edns-subnet/subnetmod.h"
96 #endif
97 #ifdef USE_IPSET
98 #include "ipset/ipset.h"
99 #endif
100 #ifdef USE_DNSTAP
101 #include "dnstap/dtstream.h"
102 #endif
103 
104 int
105 fptr_whitelist_comm_point(comm_point_callback_type *fptr)
106 {
107 	if(fptr == &worker_handle_request) return 1;
108 	else if(fptr == &outnet_udp_cb) return 1;
109 	else if(fptr == &outnet_tcp_cb) return 1;
110 	else if(fptr == &tube_handle_listen) return 1;
111 	else if(fptr == &auth_xfer_probe_udp_callback) return 1;
112 	else if(fptr == &auth_xfer_transfer_tcp_callback) return 1;
113 	else if(fptr == &auth_xfer_transfer_http_callback) return 1;
114 	return 0;
115 }
116 
117 int
118 fptr_whitelist_comm_point_raw(comm_point_callback_type *fptr)
119 {
120 	if(fptr == &tube_handle_listen) return 1;
121 	else if(fptr == &tube_handle_write) return 1;
122 	else if(fptr == &remote_accept_callback) return 1;
123 	else if(fptr == &remote_control_callback) return 1;
124 	return 0;
125 }
126 
127 int
128 fptr_whitelist_comm_timer(void (*fptr)(void*))
129 {
130 	if(fptr == &pending_udp_timer_cb) return 1;
131 	else if(fptr == &outnet_tcptimer) return 1;
132 	else if(fptr == &pending_udp_timer_delay_cb) return 1;
133 	else if(fptr == &worker_stat_timer_cb) return 1;
134 	else if(fptr == &worker_probe_timer_cb) return 1;
135 	else if(fptr == &validate_suspend_timer_cb) return 1;
136 #ifdef HAVE_NGTCP2
137 	else if(fptr == &doq_timer_cb) return 1;
138 #endif
139 #ifdef UB_ON_WINDOWS
140 	else if(fptr == &wsvc_cron_cb) return 1;
141 #endif
142 	else if(fptr == &auth_xfer_timer) return 1;
143 	else if(fptr == &auth_xfer_probe_timer_callback) return 1;
144 	else if(fptr == &auth_xfer_transfer_timer_callback) return 1;
145 	else if(fptr == &mesh_serve_expired_callback) return 1;
146 	else if(fptr == &serviced_timer_cb) return 1;
147 #ifdef USE_DNSTAP
148 	else if(fptr == &mq_wakeup_cb) return 1;
149 #endif
150 	return 0;
151 }
152 
153 int
154 fptr_whitelist_comm_signal(void (*fptr)(int, void*))
155 {
156 	if(fptr == &worker_sighandler) return 1;
157 	return 0;
158 }
159 
160 int fptr_whitelist_start_accept(void (*fptr)(void*))
161 {
162 	if(fptr == &worker_start_accept) return 1;
163 	return 0;
164 }
165 
166 int fptr_whitelist_stop_accept(void (*fptr)(void*))
167 {
168 	if(fptr == &worker_stop_accept) return 1;
169 	return 0;
170 }
171 
172 int
173 fptr_whitelist_event(void (*fptr)(int, short, void *))
174 {
175 	if(fptr == &comm_point_udp_callback) return 1;
176 #if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
177 	else if(fptr == &comm_point_udp_ancil_callback) return 1;
178 #endif
179 	else if(fptr == &comm_point_tcp_accept_callback) return 1;
180 	else if(fptr == &comm_point_tcp_handle_callback) return 1;
181 	else if(fptr == &comm_timer_callback) return 1;
182 	else if(fptr == &comm_signal_callback) return 1;
183 	else if(fptr == &comm_point_local_handle_callback) return 1;
184 	else if(fptr == &comm_point_raw_handle_callback) return 1;
185 	else if(fptr == &tube_handle_signal) return 1;
186 	else if(fptr == &comm_base_handle_slow_accept) return 1;
187 	else if(fptr == &comm_point_http_handle_callback) return 1;
188 #ifdef HAVE_NGTCP2
189 	else if(fptr == &comm_point_doq_callback) return 1;
190 #endif
191 #ifdef USE_DNSTAP
192 	else if(fptr == &dtio_output_cb) return 1;
193 	else if(fptr == &dtio_cmd_cb) return 1;
194 	else if(fptr == &dtio_reconnect_timeout_cb) return 1;
195 	else if(fptr == &dtio_stop_timer_cb) return 1;
196 	else if(fptr == &dtio_stop_ev_cb) return 1;
197 	else if(fptr == &dtio_tap_callback) return 1;
198 	else if(fptr == &dtio_mainfdcallback) return 1;
199 #endif
200 #ifdef HAVE_NGTCP2
201 	else if(fptr == &doq_client_event_cb) return 1;
202 	else if(fptr == &doq_client_timer_cb) return 1;
203 #endif
204 #ifdef UB_ON_WINDOWS
205 	else if(fptr == &worker_win_stop_cb) return 1;
206 #endif
207 	return 0;
208 }
209 
210 int
211 fptr_whitelist_pending_udp(comm_point_callback_type *fptr)
212 {
213 	if(fptr == &serviced_udp_callback) return 1;
214 	return 0;
215 }
216 
217 int
218 fptr_whitelist_pending_tcp(comm_point_callback_type *fptr)
219 {
220 	if(fptr == &serviced_tcp_callback) return 1;
221 	return 0;
222 }
223 
224 int
225 fptr_whitelist_serviced_query(comm_point_callback_type *fptr)
226 {
227 	if(fptr == &worker_handle_service_reply) return 1;
228 	else if(fptr == &libworker_handle_service_reply) return 1;
229 	return 0;
230 }
231 
232 int
233 fptr_whitelist_rbtree_cmp(int (*fptr) (const void *, const void *))
234 {
235 	if(fptr == &mesh_state_compare) return 1;
236 	else if(fptr == &mesh_state_ref_compare) return 1;
237 	else if(fptr == &addr_tree_compare) return 1;
238 	else if(fptr == &addr_tree_addrport_compare) return 1;
239 	else if(fptr == &local_zone_cmp) return 1;
240 	else if(fptr == &local_data_cmp) return 1;
241 	else if(fptr == &fwd_cmp) return 1;
242 	else if(fptr == &pending_cmp) return 1;
243 	else if(fptr == &serviced_cmp) return 1;
244 	else if(fptr == &reuse_cmp) return 1;
245 	else if(fptr == &reuse_id_cmp) return 1;
246 	else if(fptr == &name_tree_compare) return 1;
247 	else if(fptr == &order_lock_cmp) return 1;
248 	else if(fptr == &codeline_cmp) return 1;
249 	else if(fptr == &nsec3_hash_cmp) return 1;
250 	else if(fptr == &mini_ev_cmp) return 1;
251 	else if(fptr == &anchor_cmp) return 1;
252 	else if(fptr == &canonical_tree_compare) return 1;
253 	else if(fptr == &context_query_cmp) return 1;
254 	else if(fptr == &val_neg_data_compare) return 1;
255 	else if(fptr == &val_neg_zone_compare) return 1;
256 	else if(fptr == &probetree_cmp) return 1;
257 	else if(fptr == &replay_var_compare) return 1;
258 	else if(fptr == &view_cmp) return 1;
259 	else if(fptr == &auth_zone_cmp) return 1;
260 	else if(fptr == &auth_data_cmp) return 1;
261 	else if(fptr == &auth_xfer_cmp) return 1;
262 #ifdef HAVE_NGTCP2
263 	else if(fptr == &doq_conn_cmp) return 1;
264 	else if(fptr == &doq_conid_cmp) return 1;
265 	else if(fptr == &doq_timer_cmp) return 1;
266 	else if(fptr == &doq_stream_cmp) return 1;
267 #endif
268 	return 0;
269 }
270 
271 int
272 fptr_whitelist_hash_sizefunc(lruhash_sizefunc_type fptr)
273 {
274 	if(fptr == &msgreply_sizefunc) return 1;
275 	else if(fptr == &ub_rrset_sizefunc) return 1;
276 	else if(fptr == &infra_sizefunc) return 1;
277 	else if(fptr == &key_entry_sizefunc) return 1;
278 	else if(fptr == &rate_sizefunc) return 1;
279 	else if(fptr == &ip_rate_sizefunc) return 1;
280 	else if(fptr == &test_slabhash_sizefunc) return 1;
281 #ifdef CLIENT_SUBNET
282 	else if(fptr == &msg_cache_sizefunc) return 1;
283 #endif
284 #ifdef USE_DNSCRYPT
285 	else if(fptr == &dnsc_shared_secrets_sizefunc) return 1;
286 	else if(fptr == &dnsc_nonces_sizefunc) return 1;
287 #endif
288 	return 0;
289 }
290 
291 int
292 fptr_whitelist_hash_compfunc(lruhash_compfunc_type fptr)
293 {
294 	if(fptr == &query_info_compare) return 1;
295 	else if(fptr == &ub_rrset_compare) return 1;
296 	else if(fptr == &infra_compfunc) return 1;
297 	else if(fptr == &key_entry_compfunc) return 1;
298 	else if(fptr == &rate_compfunc) return 1;
299 	else if(fptr == &ip_rate_compfunc) return 1;
300 	else if(fptr == &test_slabhash_compfunc) return 1;
301 #ifdef USE_DNSCRYPT
302 	else if(fptr == &dnsc_shared_secrets_compfunc) return 1;
303 	else if(fptr == &dnsc_nonces_compfunc) return 1;
304 #endif
305 	return 0;
306 }
307 
308 int
309 fptr_whitelist_hash_delkeyfunc(lruhash_delkeyfunc_type fptr)
310 {
311 	if(fptr == &query_entry_delete) return 1;
312 	else if(fptr == &ub_rrset_key_delete) return 1;
313 	else if(fptr == &infra_delkeyfunc) return 1;
314 	else if(fptr == &key_entry_delkeyfunc) return 1;
315 	else if(fptr == &rate_delkeyfunc) return 1;
316 	else if(fptr == &ip_rate_delkeyfunc) return 1;
317 	else if(fptr == &test_slabhash_delkey) return 1;
318 #ifdef USE_DNSCRYPT
319 	else if(fptr == &dnsc_shared_secrets_delkeyfunc) return 1;
320 	else if(fptr == &dnsc_nonces_delkeyfunc) return 1;
321 #endif
322 	return 0;
323 }
324 
325 int
326 fptr_whitelist_hash_deldatafunc(lruhash_deldatafunc_type fptr)
327 {
328 	if(fptr == &reply_info_delete) return 1;
329 	else if(fptr == &rrset_data_delete) return 1;
330 	else if(fptr == &infra_deldatafunc) return 1;
331 	else if(fptr == &key_entry_deldatafunc) return 1;
332 	else if(fptr == &rate_deldatafunc) return 1;
333 	else if(fptr == &test_slabhash_deldata) return 1;
334 #ifdef CLIENT_SUBNET
335 	else if(fptr == &subnet_data_delete) return 1;
336 #endif
337 #ifdef USE_DNSCRYPT
338 	else if(fptr == &dnsc_shared_secrets_deldatafunc) return 1;
339 	else if(fptr == &dnsc_nonces_deldatafunc) return 1;
340 #endif
341 	return 0;
342 }
343 
344 int
345 fptr_whitelist_hash_markdelfunc(lruhash_markdelfunc_type fptr)
346 {
347 	if(fptr == NULL) return 1;
348 	else if(fptr == &rrset_markdel) return 1;
349 #ifdef CLIENT_SUBNET
350 	else if(fptr == &subnet_markdel) return 1;
351 #endif
352 	return 0;
353 }
354 
355 /** whitelist env->send_query callbacks */
356 int
357 fptr_whitelist_modenv_send_query(struct outbound_entry* (*fptr)(
358 	struct query_info* qinfo, uint16_t flags, int dnssec, int want_dnssec,
359 	int nocaps, int check_ratelimit, struct sockaddr_storage* addr,
360 	socklen_t addrlen, uint8_t* zone, size_t zonelen, int tcp_upstream,
361 	int ssl_upstream, char* tls_auth_name, struct module_qstate* q,
362 	int* was_ratelimited))
363 {
364 	if(fptr == &worker_send_query) return 1;
365 	else if(fptr == &libworker_send_query) return 1;
366 	return 0;
367 }
368 
369 int
370 fptr_whitelist_modenv_detach_subs(void (*fptr)(
371         struct module_qstate* qstate))
372 {
373 	if(fptr == &mesh_detach_subs) return 1;
374 	return 0;
375 }
376 
377 int
378 fptr_whitelist_modenv_attach_sub(int (*fptr)(
379         struct module_qstate* qstate, struct query_info* qinfo,
380         uint16_t qflags, int prime, int valrec, struct module_qstate** newq))
381 {
382 	if(fptr == &mesh_attach_sub) return 1;
383 	return 0;
384 }
385 
386 int
387 fptr_whitelist_modenv_add_sub(int (*fptr)(
388         struct module_qstate* qstate, struct query_info* qinfo,
389         uint16_t qflags, int prime, int valrec, struct module_qstate** newq,
390 	struct mesh_state** sub))
391 {
392 	if(fptr == &mesh_add_sub) return 1;
393 	return 0;
394 }
395 
396 int
397 fptr_whitelist_modenv_kill_sub(void (*fptr)(struct module_qstate* newq))
398 {
399 	if(fptr == &mesh_state_delete) return 1;
400 	return 0;
401 }
402 
403 int
404 fptr_whitelist_modenv_detect_cycle(int (*fptr)(
405 	struct module_qstate* qstate, struct query_info* qinfo,
406 	uint16_t flags, int prime, int valrec))
407 {
408 	if(fptr == &mesh_detect_cycle) return 1;
409 	return 0;
410 }
411 
412 int
413 fptr_whitelist_mod_init(int (*fptr)(struct module_env* env, int id))
414 {
415 	if(fptr == &iter_init) return 1;
416 	else if(fptr == &val_init) return 1;
417 	else if(fptr == &dns64_init) return 1;
418 	else if(fptr == &respip_init) return 1;
419 #ifdef WITH_PYTHONMODULE
420 	else if(fptr == &pythonmod_init) return 1;
421 #endif
422 #ifdef WITH_DYNLIBMODULE
423 	else if(fptr == &dynlibmod_init) return 1;
424 #endif
425 #ifdef USE_CACHEDB
426 	else if(fptr == &cachedb_init) return 1;
427 #endif
428 #ifdef USE_IPSECMOD
429 	else if(fptr == &ipsecmod_init) return 1;
430 #endif
431 #ifdef CLIENT_SUBNET
432 	else if(fptr == &subnetmod_init) return 1;
433 #endif
434 #ifdef USE_IPSET
435 	else if(fptr == &ipset_init) return 1;
436 #endif
437 	return 0;
438 }
439 
440 int
441 fptr_whitelist_mod_deinit(void (*fptr)(struct module_env* env, int id))
442 {
443 	if(fptr == &iter_deinit) return 1;
444 	else if(fptr == &val_deinit) return 1;
445 	else if(fptr == &dns64_deinit) return 1;
446 	else if(fptr == &respip_deinit) return 1;
447 #ifdef WITH_PYTHONMODULE
448 	else if(fptr == &pythonmod_deinit) return 1;
449 #endif
450 #ifdef WITH_DYNLIBMODULE
451 	else if(fptr == &dynlibmod_deinit) return 1;
452 #endif
453 #ifdef USE_CACHEDB
454 	else if(fptr == &cachedb_deinit) return 1;
455 #endif
456 #ifdef USE_IPSECMOD
457 	else if(fptr == &ipsecmod_deinit) return 1;
458 #endif
459 #ifdef CLIENT_SUBNET
460 	else if(fptr == &subnetmod_deinit) return 1;
461 #endif
462 #ifdef USE_IPSET
463 	else if(fptr == &ipset_deinit) return 1;
464 #endif
465 	return 0;
466 }
467 
468 int
469 fptr_whitelist_mod_startup(int (*fptr)(struct module_env* env, int id))
470 {
471 #ifdef USE_IPSET
472 	if(fptr == &ipset_startup) return 1;
473 #else
474 	(void)fptr;
475 #endif
476 	return 0;
477 }
478 
479 int
480 fptr_whitelist_mod_destartup(void (*fptr)(struct module_env* env, int id))
481 {
482 #ifdef USE_IPSET
483 	if(fptr == &ipset_destartup) return 1;
484 #else
485 	(void)fptr;
486 #endif
487 	return 0;
488 }
489 
490 int
491 fptr_whitelist_mod_operate(void (*fptr)(struct module_qstate* qstate,
492         enum module_ev event, int id, struct outbound_entry* outbound))
493 {
494 	if(fptr == &iter_operate) return 1;
495 	else if(fptr == &val_operate) return 1;
496 	else if(fptr == &dns64_operate) return 1;
497 	else if(fptr == &respip_operate) return 1;
498 #ifdef WITH_PYTHONMODULE
499 	else if(fptr == &pythonmod_operate) return 1;
500 #endif
501 #ifdef WITH_DYNLIBMODULE
502 	else if(fptr == &dynlibmod_operate) return 1;
503 #endif
504 #ifdef USE_CACHEDB
505 	else if(fptr == &cachedb_operate) return 1;
506 #endif
507 #ifdef USE_IPSECMOD
508 	else if(fptr == &ipsecmod_operate) return 1;
509 #endif
510 #ifdef CLIENT_SUBNET
511 	else if(fptr == &subnetmod_operate) return 1;
512 #endif
513 #ifdef USE_IPSET
514 	else if(fptr == &ipset_operate) return 1;
515 #endif
516 	return 0;
517 }
518 
519 int
520 fptr_whitelist_mod_inform_super(void (*fptr)(
521         struct module_qstate* qstate, int id, struct module_qstate* super))
522 {
523 	if(fptr == &iter_inform_super) return 1;
524 	else if(fptr == &val_inform_super) return 1;
525 	else if(fptr == &dns64_inform_super) return 1;
526 	else if(fptr == &respip_inform_super) return 1;
527 #ifdef WITH_PYTHONMODULE
528 	else if(fptr == &pythonmod_inform_super) return 1;
529 #endif
530 #ifdef WITH_DYNLIBMODULE
531 	else if(fptr == &dynlibmod_inform_super) return 1;
532 #endif
533 #ifdef USE_CACHEDB
534 	else if(fptr == &cachedb_inform_super) return 1;
535 #endif
536 #ifdef USE_IPSECMOD
537 	else if(fptr == &ipsecmod_inform_super) return 1;
538 #endif
539 #ifdef CLIENT_SUBNET
540 	else if(fptr == &subnetmod_inform_super) return 1;
541 #endif
542 #ifdef USE_IPSET
543 	else if(fptr == &ipset_inform_super) return 1;
544 #endif
545 	return 0;
546 }
547 
548 int
549 fptr_whitelist_mod_clear(void (*fptr)(struct module_qstate* qstate,
550         int id))
551 {
552 	if(fptr == &iter_clear) return 1;
553 	else if(fptr == &val_clear) return 1;
554 	else if(fptr == &dns64_clear) return 1;
555 	else if(fptr == &respip_clear) return 1;
556 #ifdef WITH_PYTHONMODULE
557 	else if(fptr == &pythonmod_clear) return 1;
558 #endif
559 #ifdef WITH_DYNLIBMODULE
560 	else if(fptr == &dynlibmod_clear) return 1;
561 #endif
562 #ifdef USE_CACHEDB
563 	else if(fptr == &cachedb_clear) return 1;
564 #endif
565 #ifdef USE_IPSECMOD
566 	else if(fptr == &ipsecmod_clear) return 1;
567 #endif
568 #ifdef CLIENT_SUBNET
569 	else if(fptr == &subnetmod_clear) return 1;
570 #endif
571 #ifdef USE_IPSET
572 	else if(fptr == &ipset_clear) return 1;
573 #endif
574 	return 0;
575 }
576 
577 int
578 fptr_whitelist_mod_get_mem(size_t (*fptr)(struct module_env* env, int id))
579 {
580 	if(fptr == &iter_get_mem) return 1;
581 	else if(fptr == &val_get_mem) return 1;
582 	else if(fptr == &dns64_get_mem) return 1;
583 	else if(fptr == &respip_get_mem) return 1;
584 #ifdef WITH_PYTHONMODULE
585 	else if(fptr == &pythonmod_get_mem) return 1;
586 #endif
587 #ifdef WITH_DYNLIBMODULE
588 	else if(fptr == &dynlibmod_get_mem) return 1;
589 #endif
590 #ifdef USE_CACHEDB
591 	else if(fptr == &cachedb_get_mem) return 1;
592 #endif
593 #ifdef USE_IPSECMOD
594 	else if(fptr == &ipsecmod_get_mem) return 1;
595 #endif
596 #ifdef CLIENT_SUBNET
597 	else if(fptr == &subnetmod_get_mem) return 1;
598 #endif
599 #ifdef USE_IPSET
600 	else if(fptr == &ipset_get_mem) return 1;
601 #endif
602 	return 0;
603 }
604 
605 int
606 fptr_whitelist_alloc_cleanup(void (*fptr)(void*))
607 {
608 	if(fptr == &worker_alloc_cleanup) return 1;
609 	return 0;
610 }
611 
612 int fptr_whitelist_tube_listen(tube_callback_type* fptr)
613 {
614 	if(fptr == &worker_handle_control_cmd) return 1;
615 	else if(fptr == &libworker_handle_control_cmd) return 1;
616 	return 0;
617 }
618 
619 int fptr_whitelist_mesh_cb(mesh_cb_func_type fptr)
620 {
621 	if(fptr == &libworker_fg_done_cb) return 1;
622 	else if(fptr == &libworker_bg_done_cb) return 1;
623 	else if(fptr == &libworker_event_done_cb) return 1;
624 	else if(fptr == &probe_answer_cb) return 1;
625 	else if(fptr == &auth_xfer_probe_lookup_callback) return 1;
626 	else if(fptr == &auth_xfer_transfer_lookup_callback) return 1;
627 	else if(fptr == &auth_zonemd_dnskey_lookup_callback) return 1;
628 	return 0;
629 }
630 
631 int fptr_whitelist_print_func(void (*fptr)(char*,void*))
632 {
633 	if(fptr == &config_print_func) return 1;
634 	else if(fptr == &config_collate_func) return 1;
635 	else if(fptr == &remote_get_opt_ssl) return 1;
636 	return 0;
637 }
638 
639 int fptr_whitelist_inplace_cb_reply_generic(inplace_cb_reply_func_type* fptr,
640 	enum inplace_cb_list_type type)
641 {
642 #ifndef WITH_PYTHONMODULE
643 	(void)fptr;
644 #endif
645 	if(type == inplace_cb_reply) {
646 #ifdef WITH_PYTHONMODULE
647 		if(fptr == &python_inplace_cb_reply_generic) return 1;
648 #endif
649 #ifdef WITH_DYNLIBMODULE
650 		if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
651 #endif
652 	} else if(type == inplace_cb_reply_cache) {
653 #ifdef WITH_PYTHONMODULE
654 		if(fptr == &python_inplace_cb_reply_generic) return 1;
655 #endif
656 #ifdef WITH_DYNLIBMODULE
657 		if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
658 #endif
659 	} else if(type == inplace_cb_reply_local) {
660 #ifdef WITH_PYTHONMODULE
661 		if(fptr == &python_inplace_cb_reply_generic) return 1;
662 #endif
663 #ifdef WITH_DYNLIBMODULE
664 		if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
665 #endif
666 	} else if(type == inplace_cb_reply_servfail) {
667 #ifdef WITH_PYTHONMODULE
668 		if(fptr == &python_inplace_cb_reply_generic) return 1;
669 #endif
670 #ifdef WITH_DYNLIBMODULE
671 		if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
672 #endif
673 	}
674 	return 0;
675 }
676 
677 int fptr_whitelist_inplace_cb_query(inplace_cb_query_func_type* fptr)
678 {
679 #ifdef CLIENT_SUBNET
680 	if(fptr == &ecs_whitelist_check)
681 		return 1;
682 #endif
683 #ifdef WITH_PYTHONMODULE
684         if(fptr == &python_inplace_cb_query_generic)
685                 return 1;
686 #endif
687 #ifdef WITH_DYNLIBMODULE
688         if(fptr == &dynlib_inplace_cb_query_generic)
689                 return 1;
690 #endif
691 	(void)fptr;
692 	return 0;
693 }
694 
695 int fptr_whitelist_inplace_cb_edns_back_parsed(
696 	inplace_cb_edns_back_parsed_func_type* fptr)
697 {
698 #ifdef CLIENT_SUBNET
699 	if(fptr == &ecs_edns_back_parsed)
700 		return 1;
701 #else
702 	(void)fptr;
703 #endif
704 #ifdef WITH_PYTHONMODULE
705     if(fptr == &python_inplace_cb_edns_back_parsed_call)
706         return 1;
707 #endif
708 #ifdef WITH_DYNLIBMODULE
709     if(fptr == &dynlib_inplace_cb_edns_back_parsed)
710             return 1;
711 #endif
712 	return 0;
713 }
714 
715 int fptr_whitelist_inplace_cb_query_response(
716 	inplace_cb_query_response_func_type* fptr)
717 {
718 #ifdef CLIENT_SUBNET
719 	if(fptr == &ecs_query_response)
720 		return 1;
721 #else
722 	(void)fptr;
723 #endif
724 #ifdef WITH_PYTHONMODULE
725     if(fptr == &python_inplace_cb_query_response)
726         return 1;
727 #endif
728 #ifdef WITH_DYNLIBMODULE
729     if(fptr == &dynlib_inplace_cb_query_response)
730             return 1;
731 #endif
732 	return 0;
733 }
734 
735 int fptr_whitelist_serve_expired_lookup(serve_expired_lookup_func_type* fptr)
736 {
737 	if(fptr == &mesh_serve_expired_lookup)
738 		return 1;
739 	return 0;
740 }
741