unsigned int seed;
struct worker* worker = (struct worker*)calloc(1,
sizeof(struct worker));
-#ifdef EXPORT_ALL_SYMBOLS
- static void* symlist[] = {
- &worker_handle_reply, &worker_alloc_cleanup,
- &worker_probe_timer_cb, &worker_stat_timer_cb,
- &remote_get_opt_ssl, &remote_control_callback,
- &worker_handle_control_cmd, &remote_accept_callback,
- &worker_handle_service_reply, &worker_send_query,
- &worker_sighandler, &worker_handle_request, NULL
- };
- fptr_add_symbols(symlist);
-#endif
if(!worker)
return NULL;
worker->numports = n;
#include "pythonmod/pythonmod.h"
#endif
-#ifdef EXPORT_ALL_SYMBOLS
-static void** extra_symlist = NULL;
-void fptr_add_symbols(void** list)
-{
- extra_symlist = list;
-}
-int fptr_in_extralist(void* sym)
-{
- void** p = extra_symlist;
- if(!p) return 0;
- while(*p) {
- if(*p++ == sym)
- return 1;
- }
- return 0;
-}
-#endif /* EXPORT_ALL_SYMBOLS */
-
int
fptr_whitelist_comm_point(comm_point_callback_t *fptr)
{
else if(fptr == &outnet_udp_cb) return 1;
else if(fptr == &outnet_tcp_cb) return 1;
else if(fptr == &tube_handle_listen) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
else if(fptr == &tube_handle_write) return 1;
else if(fptr == &remote_accept_callback) return 1;
else if(fptr == &remote_control_callback) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
else if(fptr == &worker_probe_timer_cb) return 1;
#ifdef UB_ON_WINDOWS
else if(fptr == &wsvc_cron_cb) return 1;
-#endif
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
#endif
return 0;
}
fptr_whitelist_comm_signal(void (*fptr)(int, void*))
{
if(fptr == &worker_sighandler) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
else if(fptr == &tube_handle_signal) return 1;
#ifdef UB_ON_WINDOWS
else if(fptr == &worker_win_stop_cb) return 1;
-#endif
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
#endif
return 0;
}
if(fptr == &serviced_udp_callback) return 1;
else if(fptr == &worker_handle_reply) return 1;
else if(fptr == &libworker_handle_reply) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
if(fptr == &serviced_tcp_callback) return 1;
else if(fptr == &worker_handle_reply) return 1;
else if(fptr == &libworker_handle_reply) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
{
if(fptr == &worker_handle_service_reply) return 1;
else if(fptr == &libworker_handle_service_reply) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
else if(fptr == &val_neg_zone_compare) return 1;
else if(fptr == &probetree_cmp) return 1;
else if(fptr == &replay_var_compare) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
{
if(fptr == &worker_send_query) return 1;
else if(fptr == &libworker_send_query) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
fptr_whitelist_alloc_cleanup(void (*fptr)(void*))
{
if(fptr == &worker_alloc_cleanup) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
{
if(fptr == &worker_handle_control_cmd) return 1;
else if(fptr == &libworker_handle_control_cmd) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
if(fptr == &libworker_fg_done_cb) return 1;
else if(fptr == &libworker_bg_done_cb) return 1;
else if(fptr == &probe_answer_cb) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
if(fptr == &config_print_func) return 1;
else if(fptr == &config_collate_func) return 1;
else if(fptr == &remote_get_opt_ssl) return 1;
-#ifdef EXPORT_ALL_SYMBOLS
- else if(fptr_in_extralist(fptr)) return 1;
-#endif
return 0;
}
* Macro to perform an assertion check for fptr wlist checks.
* Does not get disabled in optimize mode. Check adds security by layers.
*/
+#if defined(UB_ON_WINDOWS) && defined(EXPORT_ALL_SYMBOLS)
+#define fptr_ok(x) /* nothing, dll-exe memory layout on win disables it */
+#else
#define fptr_ok(x) \
do { if(!(x)) \
fatal_exit("%s:%d: %s: pointer whitelist %s failed", \
__FILE__, __LINE__, __func__, #x); \
} while(0);
+#endif
/**
* Check function pointer whitelist for comm_point callback values.
/** compare two replay_vars */
int replay_var_compare(const void* a, const void* b);
-/** if export_all_symbols then you can register more symbols in an array,
- * these are symbols from another module that is not loaded during compile */
-void fptr_add_symbols(void** list);
-
#endif /* UTIL_FPTR_WLIST_H */