|
Packit |
723427 |
/*
|
|
Packit |
723427 |
* util/fptr_wlist.c - function pointer whitelists.
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* Copyright (c) 2007, NLnet Labs. All rights reserved.
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* This software is open source.
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
723427 |
* modification, are permitted provided that the following conditions
|
|
Packit |
723427 |
* are met:
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* Redistributions of source code must retain the above copyright notice,
|
|
Packit |
723427 |
* this list of conditions and the following disclaimer.
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
723427 |
* this list of conditions and the following disclaimer in the documentation
|
|
Packit |
723427 |
* and/or other materials provided with the distribution.
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* Neither the name of the NLNET LABS nor the names of its contributors may
|
|
Packit |
723427 |
* be used to endorse or promote products derived from this software without
|
|
Packit |
723427 |
* specific prior written permission.
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit |
723427 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit |
723427 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit |
723427 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit |
723427 |
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit |
723427 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
Packit |
723427 |
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
Packit |
723427 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
Packit |
723427 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
Packit |
723427 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
Packit |
723427 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
723427 |
*/
|
|
Packit |
723427 |
|
|
Packit |
723427 |
/**
|
|
Packit |
723427 |
* \file
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* This file contains functions that check function pointers.
|
|
Packit |
723427 |
* The functions contain a whitelist of known good callback values.
|
|
Packit |
723427 |
* Any other values lead to an error.
|
|
Packit |
723427 |
*
|
|
Packit |
723427 |
* Due to the listing nature, this file violates all the modularization
|
|
Packit |
723427 |
* boundaries in the program.
|
|
Packit |
723427 |
*/
|
|
Packit |
723427 |
#include "config.h"
|
|
Packit |
723427 |
#include "fptr_wlist.h"
|
|
Packit |
723427 |
#include "svr.h"
|
|
Packit |
723427 |
#include "probe.h"
|
|
Packit |
723427 |
#include "mini_event.h"
|
|
Packit |
723427 |
#include "http.h"
|
|
Packit |
723427 |
#include "update.h"
|
|
Packit |
723427 |
#ifdef USE_WINSOCK
|
|
Packit |
723427 |
#include "winrc/netlist.h"
|
|
Packit |
723427 |
#include "winrc/win_svc.h"
|
|
Packit |
723427 |
#endif
|
|
Packit |
723427 |
|
|
Packit |
723427 |
int
|
|
Packit |
723427 |
fptr_whitelist_comm_point(comm_point_callback_t *fptr)
|
|
Packit |
723427 |
{
|
|
Packit |
723427 |
if(fptr == &outq_handle_udp) return 1;
|
|
Packit |
723427 |
else if(fptr == &outq_handle_tcp) return 1;
|
|
Packit |
723427 |
return 0;
|
|
Packit |
723427 |
}
|
|
Packit |
723427 |
|
|
Packit |
723427 |
int
|
|
Packit |
723427 |
fptr_whitelist_comm_point_raw(comm_point_callback_t *fptr)
|
|
Packit |
723427 |
{
|
|
Packit |
723427 |
if(fptr == &handle_ssl_accept) return 1;
|
|
Packit |
723427 |
else if(fptr == &http_get_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &control_callback) return 1;
|
|
Packit |
723427 |
return 0;
|
|
Packit |
723427 |
}
|
|
Packit |
723427 |
|
|
Packit |
723427 |
int
|
|
Packit |
723427 |
fptr_whitelist_comm_timer(void (*fptr)(void*))
|
|
Packit |
723427 |
{
|
|
Packit |
723427 |
if(fptr == &outq_timeout) return 1;
|
|
Packit |
723427 |
else if(fptr == &svr_retry_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &http_get_timeout_handler) return 1;
|
|
Packit |
723427 |
else if(fptr == &selfupdate_timeout) return 1;
|
|
Packit |
723427 |
else if(fptr == &svr_tcp_callback) return 1;
|
|
Packit |
723427 |
#ifdef USE_WINSOCK
|
|
Packit |
723427 |
else if(fptr == &wsvc_cron_cb) return 1;
|
|
Packit |
723427 |
#endif
|
|
Packit |
723427 |
return 0;
|
|
Packit |
723427 |
}
|
|
Packit |
723427 |
|
|
Packit |
723427 |
int
|
|
Packit |
723427 |
fptr_whitelist_comm_signal(void (*fptr)(int, void*))
|
|
Packit |
723427 |
{
|
|
Packit |
723427 |
(void)fptr;
|
|
Packit |
723427 |
return 0;
|
|
Packit |
723427 |
}
|
|
Packit |
723427 |
|
|
Packit |
723427 |
int
|
|
Packit |
723427 |
fptr_whitelist_event(void (*fptr)(int, short, void *))
|
|
Packit |
723427 |
{
|
|
Packit |
723427 |
if(fptr == &comm_point_udp_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &comm_point_udp_ancil_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &comm_point_tcp_accept_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &comm_point_tcp_handle_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &comm_timer_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &comm_signal_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &comm_point_local_handle_callback) return 1;
|
|
Packit |
723427 |
else if(fptr == &comm_point_raw_handle_callback) return 1;
|
|
Packit |
723427 |
#ifdef USE_WINSOCK
|
|
Packit |
723427 |
else if(fptr == &netlist_change_cb) return 1;
|
|
Packit |
723427 |
else if(fptr == &worker_win_stop_cb) return 1;
|
|
Packit |
723427 |
#endif
|
|
Packit |
723427 |
return 0;
|
|
Packit |
723427 |
}
|
|
Packit |
723427 |
|
|
Packit |
723427 |
int
|
|
Packit |
723427 |
fptr_whitelist_rbtree_cmp(int (*fptr) (const void *, const void *))
|
|
Packit |
723427 |
{
|
|
Packit |
723427 |
if(fptr == &mini_ev_cmp) return 1;
|
|
Packit |
723427 |
return 0;
|
|
Packit |
723427 |
}
|
|
Packit |
723427 |
|
|
Packit |
723427 |
#ifdef USE_WINSOCK
|
|
Packit |
723427 |
int fptr_whitelist_enum_reg(void (*fptr) (HKEY, void *))
|
|
Packit |
723427 |
{
|
|
Packit |
723427 |
if(fptr == &enum_reg_set_nameserver) return 1;
|
|
Packit |
723427 |
return 0;
|
|
Packit |
723427 |
}
|
|
Packit |
723427 |
#endif /* USE_WINSOCK */
|
|
Packit |
723427 |
|