mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
added oclog_hex()
This commit is contained in:
25
src/log.c
25
src/log.c
@@ -199,3 +199,28 @@ void mslog_hex(const main_server_st * s, const struct proc_st* proc,
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void oclog_hex(const worker_st* ws, int priority,
|
||||
const char *prefix, uint8_t* bin, unsigned bin_size, unsigned b64)
|
||||
{
|
||||
char buf[512];
|
||||
int ret;
|
||||
size_t buf_size;
|
||||
gnutls_datum_t data = {bin, bin_size};
|
||||
|
||||
if (priority == LOG_DEBUG && ws->config->debug == 0)
|
||||
return;
|
||||
|
||||
if (b64) {
|
||||
base64_encode((char*)bin, bin_size, (char*)buf, sizeof(buf));
|
||||
} else {
|
||||
buf_size = sizeof(buf);
|
||||
ret = gnutls_hex_encode(&data, buf, &buf_size);
|
||||
if (ret < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
_oclog(ws, priority, "%s %s", prefix, buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -262,6 +262,9 @@ void __attribute__ ((format(printf, 3, 4)))
|
||||
# define oclog _oclog
|
||||
#endif
|
||||
|
||||
void oclog_hex(const worker_st* ws, int priority,
|
||||
const char *prefix, uint8_t* bin, unsigned bin_size, unsigned b64);
|
||||
|
||||
int complete_vpn_info(worker_st * ws,
|
||||
struct vpn_st* vinfo);
|
||||
unsigned check_if_default_route(char **routes, unsigned routes_size);
|
||||
|
||||
Reference in New Issue
Block a user