Coverage Report

Created: 2025-08-28 06:16

/src/unbound/util/fptr_wlist.c
Line
Count
Source (jump to first uncovered line)
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
#include "daemon/remote.h"
78
#ifdef UB_ON_WINDOWS
79
#include "winrc/win_svc.h"
80
#endif
81
#include "respip/respip.h"
82
83
#ifdef WITH_PYTHONMODULE
84
#include "pythonmod/pythonmod.h"
85
#endif
86
#ifdef WITH_DYNLIBMODULE
87
#include "dynlibmod/dynlibmod.h"
88
#endif
89
#ifdef USE_CACHEDB
90
#include "cachedb/cachedb.h"
91
#endif
92
#ifdef USE_IPSECMOD
93
#include "ipsecmod/ipsecmod.h"
94
#endif
95
#ifdef CLIENT_SUBNET
96
#include "edns-subnet/subnetmod.h"
97
#endif
98
#ifdef USE_IPSET
99
#include "ipset/ipset.h"
100
#endif
101
#ifdef USE_DNSTAP
102
#include "dnstap/dtstream.h"
103
#endif
104
105
int 
106
fptr_whitelist_comm_point(comm_point_callback_type *fptr)
107
0
{
108
0
  if(fptr == &worker_handle_request) return 1;
109
0
  else if(fptr == &outnet_udp_cb) return 1;
110
0
  else if(fptr == &outnet_tcp_cb) return 1;
111
0
  else if(fptr == &tube_handle_listen) return 1;
112
0
  else if(fptr == &auth_xfer_probe_udp_callback) return 1;
113
0
  else if(fptr == &auth_xfer_transfer_tcp_callback) return 1;
114
0
  else if(fptr == &auth_xfer_transfer_http_callback) return 1;
115
0
  return 0;
116
0
}
117
118
int 
119
fptr_whitelist_comm_point_raw(comm_point_callback_type *fptr)
120
0
{
121
0
  if(fptr == &tube_handle_listen) return 1;
122
0
  else if(fptr == &tube_handle_write) return 1;
123
0
  else if(fptr == &remote_accept_callback) return 1;
124
0
  else if(fptr == &remote_control_callback) return 1;
125
0
  else if(fptr == &fast_reload_client_callback) return 1;
126
0
  return 0;
127
0
}
128
129
int 
130
fptr_whitelist_comm_timer(void (*fptr)(void*))
131
0
{
132
0
  if(fptr == &pending_udp_timer_cb) return 1;
133
0
  else if(fptr == &outnet_tcptimer) return 1;
134
0
  else if(fptr == &pending_udp_timer_delay_cb) return 1;
135
0
  else if(fptr == &worker_stat_timer_cb) return 1;
136
0
  else if(fptr == &worker_probe_timer_cb) return 1;
137
0
  else if(fptr == &validate_suspend_timer_cb) return 1;
138
#ifdef HAVE_NGTCP2
139
  else if(fptr == &doq_timer_cb) return 1;
140
#endif
141
#ifdef UB_ON_WINDOWS
142
  else if(fptr == &wsvc_cron_cb) return 1;
143
#endif
144
0
  else if(fptr == &auth_xfer_timer) return 1;
145
0
  else if(fptr == &auth_xfer_probe_timer_callback) return 1;
146
0
  else if(fptr == &auth_xfer_transfer_timer_callback) return 1;
147
0
  else if(fptr == &mesh_serve_expired_callback) return 1;
148
0
  else if(fptr == &serviced_timer_cb) return 1;
149
#ifdef USE_DNSTAP
150
  else if(fptr == &mq_wakeup_cb) return 1;
151
#endif
152
0
  return 0;
153
0
}
154
155
int 
156
fptr_whitelist_comm_signal(void (*fptr)(int, void*))
157
0
{
158
0
  if(fptr == &worker_sighandler) return 1;
159
0
  return 0;
160
0
}
161
162
int fptr_whitelist_start_accept(void (*fptr)(void*))
163
0
{
164
0
  if(fptr == &worker_start_accept) return 1;
165
0
  return 0;
166
0
}
167
168
int fptr_whitelist_stop_accept(void (*fptr)(void*))
169
0
{
170
0
  if(fptr == &worker_stop_accept) return 1;
171
0
  return 0;
172
0
}
173
174
int 
175
fptr_whitelist_event(void (*fptr)(int, short, void *))
176
0
{
177
0
  if(fptr == &comm_point_udp_callback) return 1;
178
0
#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
179
0
  else if(fptr == &comm_point_udp_ancil_callback) return 1;
180
0
#endif
181
0
  else if(fptr == &comm_point_tcp_accept_callback) return 1;
182
0
  else if(fptr == &comm_point_tcp_handle_callback) return 1;
183
0
  else if(fptr == &comm_timer_callback) return 1;
184
0
  else if(fptr == &comm_signal_callback) return 1;
185
0
  else if(fptr == &comm_point_local_handle_callback) return 1;
186
0
  else if(fptr == &comm_point_raw_handle_callback) return 1;
187
0
  else if(fptr == &tube_handle_signal) return 1;
188
0
  else if(fptr == &comm_base_handle_slow_accept) return 1;
189
0
  else if(fptr == &comm_point_http_handle_callback) return 1;
190
#ifdef HAVE_NGTCP2
191
  else if(fptr == &comm_point_doq_callback) return 1;
192
#endif
193
0
  else if(fptr == &fast_reload_service_cb) return 1;
194
#ifdef USE_DNSTAP
195
  else if(fptr == &dtio_output_cb) return 1;
196
  else if(fptr == &dtio_cmd_cb) return 1;
197
  else if(fptr == &dtio_reconnect_timeout_cb) return 1;
198
  else if(fptr == &dtio_stop_timer_cb) return 1;
199
  else if(fptr == &dtio_stop_ev_cb) return 1;
200
  else if(fptr == &dtio_tap_callback) return 1;
201
  else if(fptr == &dtio_mainfdcallback) return 1;
202
#endif
203
#ifdef HAVE_NGTCP2
204
  else if(fptr == &doq_client_event_cb) return 1;
205
  else if(fptr == &doq_client_timer_cb) return 1;
206
#endif
207
#ifdef UB_ON_WINDOWS
208
  else if(fptr == &worker_win_stop_cb) return 1;
209
#endif
210
0
  return 0;
211
0
}
212
213
int 
214
fptr_whitelist_pending_udp(comm_point_callback_type *fptr)
215
0
{
216
0
  if(fptr == &serviced_udp_callback) return 1;
217
0
  return 0;
218
0
}
219
220
int 
221
fptr_whitelist_pending_tcp(comm_point_callback_type *fptr)
222
0
{
223
0
  if(fptr == &serviced_tcp_callback) return 1;
224
0
  return 0;
225
0
}
226
227
int 
228
fptr_whitelist_serviced_query(comm_point_callback_type *fptr)
229
0
{
230
0
  if(fptr == &worker_handle_service_reply) return 1;
231
0
  else if(fptr == &libworker_handle_service_reply) return 1;
232
0
  return 0;
233
0
}
234
235
int 
236
fptr_whitelist_rbtree_cmp(int (*fptr) (const void *, const void *))
237
0
{
238
0
  if(fptr == &mesh_state_compare) return 1;
239
0
  else if(fptr == &mesh_state_ref_compare) return 1;
240
0
  else if(fptr == &addr_tree_compare) return 1;
241
0
  else if(fptr == &addr_tree_addrport_compare) return 1;
242
0
  else if(fptr == &local_zone_cmp) return 1;
243
0
  else if(fptr == &local_data_cmp) return 1;
244
0
  else if(fptr == &fwd_cmp) return 1;
245
0
  else if(fptr == &pending_cmp) return 1;
246
0
  else if(fptr == &serviced_cmp) return 1;
247
0
  else if(fptr == &reuse_cmp) return 1;
248
0
  else if(fptr == &reuse_id_cmp) return 1;
249
0
  else if(fptr == &name_tree_compare) return 1;
250
0
  else if(fptr == &order_lock_cmp) return 1;
251
0
  else if(fptr == &codeline_cmp) return 1;
252
0
  else if(fptr == &nsec3_hash_cmp) return 1;
253
0
  else if(fptr == &mini_ev_cmp) return 1;
254
0
  else if(fptr == &anchor_cmp) return 1;
255
0
  else if(fptr == &canonical_tree_compare) return 1;
256
0
  else if(fptr == &context_query_cmp) return 1;
257
0
  else if(fptr == &val_neg_data_compare) return 1;
258
0
  else if(fptr == &val_neg_zone_compare) return 1;
259
0
  else if(fptr == &probetree_cmp) return 1;
260
0
  else if(fptr == &replay_var_compare) return 1;
261
0
  else if(fptr == &view_cmp) return 1;
262
0
  else if(fptr == &auth_zone_cmp) return 1;
263
0
  else if(fptr == &auth_data_cmp) return 1;
264
0
  else if(fptr == &auth_xfer_cmp) return 1;
265
#ifdef HAVE_NGTCP2
266
  else if(fptr == &doq_conn_cmp) return 1;
267
  else if(fptr == &doq_conid_cmp) return 1;
268
  else if(fptr == &doq_timer_cmp) return 1;
269
  else if(fptr == &doq_stream_cmp) return 1;
270
#endif
271
0
  return 0;
272
0
}
273
274
int 
275
fptr_whitelist_hash_sizefunc(lruhash_sizefunc_type fptr)
276
8.55k
{
277
8.55k
  if(fptr == &msgreply_sizefunc) return 1;
278
8.55k
  else if(fptr == &ub_rrset_sizefunc) return 1;
279
0
  else if(fptr == &infra_sizefunc) return 1;
280
0
  else if(fptr == &key_entry_sizefunc) return 1;
281
0
  else if(fptr == &rate_sizefunc) return 1;
282
0
  else if(fptr == &ip_rate_sizefunc) return 1;
283
0
  else if(fptr == &test_slabhash_sizefunc) return 1;
284
#ifdef CLIENT_SUBNET
285
  else if(fptr == &msg_cache_sizefunc) return 1;
286
#endif
287
#ifdef USE_DNSCRYPT
288
  else if(fptr == &dnsc_shared_secrets_sizefunc) return 1;
289
  else if(fptr == &dnsc_nonces_sizefunc) return 1;
290
#endif
291
0
  return 0;
292
8.55k
}
293
294
int 
295
fptr_whitelist_hash_compfunc(lruhash_compfunc_type fptr)
296
17.1k
{
297
17.1k
  if(fptr == &query_info_compare) return 1;
298
17.1k
  else if(fptr == &ub_rrset_compare) return 1;
299
0
  else if(fptr == &infra_compfunc) return 1;
300
0
  else if(fptr == &key_entry_compfunc) return 1;
301
0
  else if(fptr == &rate_compfunc) return 1;
302
0
  else if(fptr == &ip_rate_compfunc) return 1;
303
0
  else if(fptr == &test_slabhash_compfunc) return 1;
304
#ifdef USE_DNSCRYPT
305
  else if(fptr == &dnsc_shared_secrets_compfunc) return 1;
306
  else if(fptr == &dnsc_nonces_compfunc) return 1;
307
#endif
308
0
  return 0;
309
17.1k
}
310
311
int 
312
fptr_whitelist_hash_delkeyfunc(lruhash_delkeyfunc_type fptr)
313
8.55k
{
314
8.55k
  if(fptr == &query_entry_delete) return 1;
315
8.55k
  else if(fptr == &ub_rrset_key_delete) return 1;
316
0
  else if(fptr == &infra_delkeyfunc) return 1;
317
0
  else if(fptr == &key_entry_delkeyfunc) return 1;
318
0
  else if(fptr == &rate_delkeyfunc) return 1;
319
0
  else if(fptr == &ip_rate_delkeyfunc) return 1;
320
0
  else if(fptr == &test_slabhash_delkey) return 1;
321
#ifdef USE_DNSCRYPT
322
  else if(fptr == &dnsc_shared_secrets_delkeyfunc) return 1;
323
  else if(fptr == &dnsc_nonces_delkeyfunc) return 1;
324
#endif
325
0
  return 0;
326
8.55k
}
327
328
int 
329
fptr_whitelist_hash_deldatafunc(lruhash_deldatafunc_type fptr)
330
8.55k
{
331
8.55k
  if(fptr == &reply_info_delete) return 1;
332
8.55k
  else if(fptr == &rrset_data_delete) return 1;
333
0
  else if(fptr == &infra_deldatafunc) return 1;
334
0
  else if(fptr == &key_entry_deldatafunc) return 1;
335
0
  else if(fptr == &rate_deldatafunc) return 1;
336
0
  else if(fptr == &test_slabhash_deldata) return 1;
337
#ifdef CLIENT_SUBNET
338
  else if(fptr == &subnet_data_delete) return 1;
339
#endif
340
#ifdef USE_DNSCRYPT
341
  else if(fptr == &dnsc_shared_secrets_deldatafunc) return 1;
342
  else if(fptr == &dnsc_nonces_deldatafunc) return 1;
343
#endif
344
0
  return 0;
345
8.55k
}
346
347
int 
348
fptr_whitelist_hash_markdelfunc(lruhash_markdelfunc_type fptr)
349
8.55k
{
350
8.55k
  if(fptr == NULL) return 1;
351
8.55k
  else if(fptr == &rrset_markdel) return 1;
352
#ifdef CLIENT_SUBNET
353
  else if(fptr == &subnet_markdel) return 1;
354
#endif
355
0
  return 0;
356
8.55k
}
357
358
/** whitelist env->send_query callbacks */
359
int 
360
fptr_whitelist_modenv_send_query(struct outbound_entry* (*fptr)(
361
  struct query_info* qinfo, uint16_t flags, int dnssec, int want_dnssec,
362
  int nocaps, int check_ratelimit, struct sockaddr_storage* addr,
363
  socklen_t addrlen, uint8_t* zone, size_t zonelen, int tcp_upstream,
364
  int ssl_upstream, char* tls_auth_name, struct module_qstate* q,
365
  int* was_ratelimited))
366
0
{
367
0
  if(fptr == &worker_send_query) return 1;
368
0
  else if(fptr == &libworker_send_query) return 1;
369
0
  return 0;
370
0
}
371
372
int 
373
fptr_whitelist_modenv_detach_subs(void (*fptr)(
374
        struct module_qstate* qstate))
375
0
{
376
0
  if(fptr == &mesh_detach_subs) return 1;
377
0
  return 0;
378
0
}
379
380
int 
381
fptr_whitelist_modenv_attach_sub(int (*fptr)(
382
        struct module_qstate* qstate, struct query_info* qinfo,
383
        uint16_t qflags, int prime, int valrec, struct module_qstate** newq))
384
0
{
385
0
  if(fptr == &mesh_attach_sub) return 1;
386
0
  return 0;
387
0
}
388
389
int 
390
fptr_whitelist_modenv_add_sub(int (*fptr)(
391
        struct module_qstate* qstate, struct query_info* qinfo,
392
        uint16_t qflags, int prime, int valrec, struct module_qstate** newq,
393
  struct mesh_state** sub))
394
0
{
395
0
  if(fptr == &mesh_add_sub) return 1;
396
0
  return 0;
397
0
}
398
399
int 
400
fptr_whitelist_modenv_kill_sub(void (*fptr)(struct module_qstate* newq))
401
0
{
402
0
  if(fptr == &mesh_state_delete) return 1;
403
0
  return 0;
404
0
}
405
406
int 
407
fptr_whitelist_modenv_detect_cycle(int (*fptr)(
408
  struct module_qstate* qstate, struct query_info* qinfo,
409
  uint16_t flags, int prime, int valrec))
410
0
{
411
0
  if(fptr == &mesh_detect_cycle) return 1;
412
0
  return 0;
413
0
}
414
415
int
416
fptr_whitelist_mod_init(int (*fptr)(struct module_env* env, int id))
417
0
{
418
0
  if(fptr == &iter_init) return 1;
419
0
  else if(fptr == &val_init) return 1;
420
0
  else if(fptr == &dns64_init) return 1;
421
0
  else if(fptr == &respip_init) return 1;
422
#ifdef WITH_PYTHONMODULE
423
  else if(fptr == &pythonmod_init) return 1;
424
#endif
425
#ifdef WITH_DYNLIBMODULE
426
  else if(fptr == &dynlibmod_init) return 1;
427
#endif
428
#ifdef USE_CACHEDB
429
  else if(fptr == &cachedb_init) return 1;
430
#endif
431
#ifdef USE_IPSECMOD
432
  else if(fptr == &ipsecmod_init) return 1;
433
#endif
434
#ifdef CLIENT_SUBNET
435
  else if(fptr == &subnetmod_init) return 1;
436
#endif
437
#ifdef USE_IPSET
438
  else if(fptr == &ipset_init) return 1;
439
#endif
440
0
  return 0;
441
0
}
442
443
int
444
fptr_whitelist_mod_deinit(void (*fptr)(struct module_env* env, int id))
445
0
{
446
0
  if(fptr == &iter_deinit) return 1;
447
0
  else if(fptr == &val_deinit) return 1;
448
0
  else if(fptr == &dns64_deinit) return 1;
449
0
  else if(fptr == &respip_deinit) return 1;
450
#ifdef WITH_PYTHONMODULE
451
  else if(fptr == &pythonmod_deinit) return 1;
452
#endif
453
#ifdef WITH_DYNLIBMODULE
454
  else if(fptr == &dynlibmod_deinit) return 1;
455
#endif
456
#ifdef USE_CACHEDB
457
  else if(fptr == &cachedb_deinit) return 1;
458
#endif
459
#ifdef USE_IPSECMOD
460
  else if(fptr == &ipsecmod_deinit) return 1;
461
#endif
462
#ifdef CLIENT_SUBNET
463
  else if(fptr == &subnetmod_deinit) return 1;
464
#endif
465
#ifdef USE_IPSET
466
  else if(fptr == &ipset_deinit) return 1;
467
#endif
468
0
  return 0;
469
0
}
470
471
int
472
fptr_whitelist_mod_startup(int (*fptr)(struct module_env* env, int id))
473
0
{
474
#ifdef USE_IPSET
475
  if(fptr == &ipset_startup) return 1;
476
#else
477
0
  (void)fptr;
478
0
#endif
479
0
  return 0;
480
0
}
481
482
int
483
fptr_whitelist_mod_destartup(void (*fptr)(struct module_env* env, int id))
484
0
{
485
#ifdef USE_IPSET
486
  if(fptr == &ipset_destartup) return 1;
487
#else
488
0
  (void)fptr;
489
0
#endif
490
0
  return 0;
491
0
}
492
493
int 
494
fptr_whitelist_mod_operate(void (*fptr)(struct module_qstate* qstate,
495
        enum module_ev event, int id, struct outbound_entry* outbound))
496
0
{
497
0
  if(fptr == &iter_operate) return 1;
498
0
  else if(fptr == &val_operate) return 1;
499
0
  else if(fptr == &dns64_operate) return 1;
500
0
  else if(fptr == &respip_operate) return 1;
501
#ifdef WITH_PYTHONMODULE
502
  else if(fptr == &pythonmod_operate) return 1;
503
#endif
504
#ifdef WITH_DYNLIBMODULE
505
  else if(fptr == &dynlibmod_operate) return 1;
506
#endif
507
#ifdef USE_CACHEDB
508
  else if(fptr == &cachedb_operate) return 1;
509
#endif
510
#ifdef USE_IPSECMOD
511
  else if(fptr == &ipsecmod_operate) return 1;
512
#endif
513
#ifdef CLIENT_SUBNET
514
  else if(fptr == &subnetmod_operate) return 1;
515
#endif
516
#ifdef USE_IPSET
517
  else if(fptr == &ipset_operate) return 1;
518
#endif
519
0
  return 0;
520
0
}
521
522
int 
523
fptr_whitelist_mod_inform_super(void (*fptr)(
524
        struct module_qstate* qstate, int id, struct module_qstate* super))
525
0
{
526
0
  if(fptr == &iter_inform_super) return 1;
527
0
  else if(fptr == &val_inform_super) return 1;
528
0
  else if(fptr == &dns64_inform_super) return 1;
529
0
  else if(fptr == &respip_inform_super) return 1;
530
#ifdef WITH_PYTHONMODULE
531
  else if(fptr == &pythonmod_inform_super) return 1;
532
#endif
533
#ifdef WITH_DYNLIBMODULE
534
  else if(fptr == &dynlibmod_inform_super) return 1;
535
#endif
536
#ifdef USE_CACHEDB
537
  else if(fptr == &cachedb_inform_super) return 1;
538
#endif
539
#ifdef USE_IPSECMOD
540
  else if(fptr == &ipsecmod_inform_super) return 1;
541
#endif
542
#ifdef CLIENT_SUBNET
543
  else if(fptr == &subnetmod_inform_super) return 1;
544
#endif
545
#ifdef USE_IPSET
546
  else if(fptr == &ipset_inform_super) return 1;
547
#endif
548
0
  return 0;
549
0
}
550
551
int 
552
fptr_whitelist_mod_clear(void (*fptr)(struct module_qstate* qstate,
553
        int id))
554
0
{
555
0
  if(fptr == &iter_clear) return 1;
556
0
  else if(fptr == &val_clear) return 1;
557
0
  else if(fptr == &dns64_clear) return 1;
558
0
  else if(fptr == &respip_clear) return 1;
559
#ifdef WITH_PYTHONMODULE
560
  else if(fptr == &pythonmod_clear) return 1;
561
#endif
562
#ifdef WITH_DYNLIBMODULE
563
  else if(fptr == &dynlibmod_clear) return 1;
564
#endif
565
#ifdef USE_CACHEDB
566
  else if(fptr == &cachedb_clear) return 1;
567
#endif
568
#ifdef USE_IPSECMOD
569
  else if(fptr == &ipsecmod_clear) return 1;
570
#endif
571
#ifdef CLIENT_SUBNET
572
  else if(fptr == &subnetmod_clear) return 1;
573
#endif
574
#ifdef USE_IPSET
575
  else if(fptr == &ipset_clear) return 1;
576
#endif
577
0
  return 0;
578
0
}
579
580
int 
581
fptr_whitelist_mod_get_mem(size_t (*fptr)(struct module_env* env, int id))
582
0
{
583
0
  if(fptr == &iter_get_mem) return 1;
584
0
  else if(fptr == &val_get_mem) return 1;
585
0
  else if(fptr == &dns64_get_mem) return 1;
586
0
  else if(fptr == &respip_get_mem) return 1;
587
#ifdef WITH_PYTHONMODULE
588
  else if(fptr == &pythonmod_get_mem) return 1;
589
#endif
590
#ifdef WITH_DYNLIBMODULE
591
  else if(fptr == &dynlibmod_get_mem) return 1;
592
#endif
593
#ifdef USE_CACHEDB
594
  else if(fptr == &cachedb_get_mem) return 1;
595
#endif
596
#ifdef USE_IPSECMOD
597
  else if(fptr == &ipsecmod_get_mem) return 1;
598
#endif
599
#ifdef CLIENT_SUBNET
600
  else if(fptr == &subnetmod_get_mem) return 1;
601
#endif
602
#ifdef USE_IPSET
603
  else if(fptr == &ipset_get_mem) return 1;
604
#endif
605
0
  return 0;
606
0
}
607
608
int 
609
fptr_whitelist_alloc_cleanup(void (*fptr)(void*))
610
0
{
611
0
  if(fptr == &worker_alloc_cleanup) return 1;
612
0
  return 0;
613
0
}
614
615
int fptr_whitelist_tube_listen(tube_callback_type* fptr)
616
0
{
617
0
  if(fptr == &worker_handle_control_cmd) return 1;
618
0
  else if(fptr == &libworker_handle_control_cmd) return 1;
619
0
  return 0;
620
0
}
621
622
int fptr_whitelist_mesh_cb(mesh_cb_func_type fptr)
623
0
{
624
0
  if(fptr == &libworker_fg_done_cb) return 1;
625
0
  else if(fptr == &libworker_bg_done_cb) return 1;
626
0
  else if(fptr == &libworker_event_done_cb) return 1;
627
0
  else if(fptr == &probe_answer_cb) return 1;
628
0
  else if(fptr == &auth_xfer_probe_lookup_callback) return 1;
629
0
  else if(fptr == &auth_xfer_transfer_lookup_callback) return 1;
630
0
  else if(fptr == &auth_zonemd_dnskey_lookup_callback) return 1;
631
0
  return 0;
632
0
}
633
634
int fptr_whitelist_print_func(void (*fptr)(char*,void*))
635
0
{
636
0
  if(fptr == &config_print_func) return 1;
637
0
  else if(fptr == &config_collate_func) return 1;
638
0
  else if(fptr == &remote_get_opt_ssl) return 1;
639
0
  return 0;
640
0
}
641
642
int fptr_whitelist_inplace_cb_reply_generic(inplace_cb_reply_func_type* fptr,
643
  enum inplace_cb_list_type type)
644
0
{
645
0
#ifndef WITH_PYTHONMODULE
646
0
  (void)fptr;
647
0
#endif
648
0
  if(type == inplace_cb_reply) {
649
#ifdef WITH_PYTHONMODULE
650
    if(fptr == &python_inplace_cb_reply_generic) return 1;
651
#endif
652
#ifdef WITH_DYNLIBMODULE
653
    if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
654
#endif
655
0
  } else if(type == inplace_cb_reply_cache) {
656
#ifdef WITH_PYTHONMODULE
657
    if(fptr == &python_inplace_cb_reply_generic) return 1;
658
#endif
659
#ifdef WITH_DYNLIBMODULE
660
    if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
661
#endif
662
0
  } else if(type == inplace_cb_reply_local) {
663
#ifdef WITH_PYTHONMODULE
664
    if(fptr == &python_inplace_cb_reply_generic) return 1;
665
#endif
666
#ifdef WITH_DYNLIBMODULE
667
    if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
668
#endif
669
0
  } else if(type == inplace_cb_reply_servfail) {
670
#ifdef WITH_PYTHONMODULE
671
    if(fptr == &python_inplace_cb_reply_generic) return 1;
672
#endif
673
#ifdef WITH_DYNLIBMODULE
674
    if(fptr == &dynlib_inplace_cb_reply_generic) return 1;
675
#endif
676
0
  }
677
0
  return 0;
678
0
}
679
680
int fptr_whitelist_inplace_cb_query(inplace_cb_query_func_type* fptr)
681
0
{
682
#ifdef CLIENT_SUBNET
683
  if(fptr == &ecs_whitelist_check)
684
    return 1;
685
#endif
686
#ifdef WITH_PYTHONMODULE
687
        if(fptr == &python_inplace_cb_query_generic)
688
                return 1;
689
#endif
690
#ifdef WITH_DYNLIBMODULE
691
        if(fptr == &dynlib_inplace_cb_query_generic)
692
                return 1;
693
#endif
694
0
  (void)fptr;
695
0
  return 0;
696
0
}
697
698
int fptr_whitelist_inplace_cb_edns_back_parsed(
699
  inplace_cb_edns_back_parsed_func_type* fptr)
700
0
{
701
#ifdef CLIENT_SUBNET
702
  if(fptr == &ecs_edns_back_parsed)
703
    return 1;
704
#else
705
0
  (void)fptr;
706
0
#endif
707
#ifdef WITH_PYTHONMODULE
708
    if(fptr == &python_inplace_cb_edns_back_parsed_call)
709
        return 1;
710
#endif
711
#ifdef WITH_DYNLIBMODULE
712
    if(fptr == &dynlib_inplace_cb_edns_back_parsed)
713
            return 1;
714
#endif
715
0
  return 0;
716
0
}
717
718
int fptr_whitelist_inplace_cb_query_response(
719
  inplace_cb_query_response_func_type* fptr)
720
0
{
721
#ifdef CLIENT_SUBNET
722
  if(fptr == &ecs_query_response)
723
    return 1;
724
#else
725
0
  (void)fptr;
726
0
#endif
727
#ifdef WITH_PYTHONMODULE
728
    if(fptr == &python_inplace_cb_query_response)
729
        return 1;
730
#endif
731
#ifdef WITH_DYNLIBMODULE
732
    if(fptr == &dynlib_inplace_cb_query_response)
733
            return 1;
734
#endif
735
0
  return 0;
736
0
}
737
738
int fptr_whitelist_serve_expired_lookup(serve_expired_lookup_func_type* fptr)
739
0
{
740
0
  if(fptr == &mesh_serve_expired_lookup)
741
0
    return 1;
742
0
  return 0;
743
0
}