mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 01:26:48 +08:00
dbus: include DTLS/CSTP compression and MTU in the user info
This commit is contained in:
+20
-1
@@ -97,7 +97,7 @@ typedef struct {
|
||||
{name, sizeof(name)-1, iface, sizeof(iface)-1, desc, sizeof(desc)-1, func}
|
||||
|
||||
#define LIST_USERS_SIG "(issssssssusssss)"
|
||||
#define LIST_SINGLE_USER_SIG "(issssssssusssssuuasasasas)"
|
||||
#define LIST_SINGLE_USER_SIG "(issssssssusssssssuuuasasasas)"
|
||||
#define LIST_BANNED_SIG "(usu)"
|
||||
|
||||
#define DESC_LIST \
|
||||
@@ -559,7 +559,26 @@ static int append_user_info(main_server_st * s, DBusMessageIter * subs,
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (single > 0) {
|
||||
strtmp = ctmp->cstp_compr;
|
||||
if (dbus_message_iter_append_basic
|
||||
(subs, DBUS_TYPE_STRING, &strtmp) == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
strtmp = ctmp->dtls_compr;
|
||||
if (dbus_message_iter_append_basic
|
||||
(subs, DBUS_TYPE_STRING, &strtmp) == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = ctmp->mtu;
|
||||
if (dbus_message_iter_append_basic
|
||||
(subs, DBUS_TYPE_UINT32, &tmp) == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ctmp->config.rx_per_sec > 0)
|
||||
tmp = ctmp->config.rx_per_sec;
|
||||
else
|
||||
|
||||
+34
-4
@@ -782,7 +782,7 @@ int common_info_cmd(DBusMessageIter * args)
|
||||
{
|
||||
DBusMessageIter suba, subs;
|
||||
dbus_int32_t id = 0;
|
||||
dbus_uint32_t rx = 0, tx = 0;
|
||||
dbus_uint32_t rx = 0, tx = 0, mtu = 0;
|
||||
char *username = "";
|
||||
dbus_uint32_t since = 0;
|
||||
char *groupname = "", *ip = "";
|
||||
@@ -796,6 +796,7 @@ int common_info_cmd(DBusMessageIter * args)
|
||||
FILE *out;
|
||||
unsigned at_least_one = 0;
|
||||
const char *dtls_ciphersuite, *tls_ciphersuite;
|
||||
char *cstp_compr = "", *dtls_compr = "";
|
||||
int ret = 1, r;
|
||||
|
||||
out = pager_start();
|
||||
@@ -922,6 +923,27 @@ int common_info_cmd(DBusMessageIter * args)
|
||||
goto error_parse;
|
||||
dbus_message_iter_get_basic(&subs, &dtls_ciphersuite);
|
||||
|
||||
if (!dbus_message_iter_next(&subs))
|
||||
goto error_recv;
|
||||
|
||||
if (dbus_message_iter_get_arg_type(&subs) != DBUS_TYPE_STRING)
|
||||
goto error_parse;
|
||||
dbus_message_iter_get_basic(&subs, &cstp_compr);
|
||||
|
||||
if (!dbus_message_iter_next(&subs))
|
||||
goto error_recv;
|
||||
|
||||
if (dbus_message_iter_get_arg_type(&subs) != DBUS_TYPE_STRING)
|
||||
goto error_parse;
|
||||
dbus_message_iter_get_basic(&subs, &dtls_compr);
|
||||
|
||||
if (!dbus_message_iter_next(&subs))
|
||||
goto error_recv;
|
||||
|
||||
if (dbus_message_iter_get_arg_type(&subs) != DBUS_TYPE_UINT32)
|
||||
goto error_parse;
|
||||
dbus_message_iter_get_basic(&subs, &mtu);
|
||||
|
||||
if (!dbus_message_iter_next(&subs))
|
||||
goto error_recv;
|
||||
|
||||
@@ -962,11 +984,14 @@ int common_info_cmd(DBusMessageIter * args)
|
||||
fprintf(out, "P-t-P IPv6: %s\n", vpn_ptp_ipv6);
|
||||
}
|
||||
fprintf(out, "\tDevice: %s ", device);
|
||||
if (mtu > 0) {
|
||||
fprintf(out, "MTU: %u\n", (unsigned)mtu);
|
||||
} else {
|
||||
fprintf(out, "MTU: (unknown)\n");
|
||||
}
|
||||
|
||||
if (user_agent != NULL && user_agent[0] != 0)
|
||||
fprintf(out, "User-Agent: %s\n", user_agent);
|
||||
else
|
||||
fprintf(out, "\n");
|
||||
fprintf(out, "\tUser-Agent: %s\n", user_agent);
|
||||
|
||||
if (rx > 0 || tx > 0) {
|
||||
/* print limits */
|
||||
@@ -1000,6 +1025,11 @@ int common_info_cmd(DBusMessageIter * args)
|
||||
if (dtls_ciphersuite != NULL && dtls_ciphersuite[0] != 0)
|
||||
fprintf(out, "\tDTLS cipher: %s\n", dtls_ciphersuite);
|
||||
|
||||
if (cstp_compr != NULL && cstp_compr[0] != 0)
|
||||
fprintf(out, "\tCSTP compression: %s\n", cstp_compr);
|
||||
if (dtls_compr != NULL && dtls_compr[0] != 0)
|
||||
fprintf(out, "\tDTLS compression: %s\n", dtls_compr);
|
||||
|
||||
/* user network info */
|
||||
fputs("\n", out);
|
||||
if (print_list_entries(out, "\tDNS:", &subs) < 0)
|
||||
|
||||
Reference in New Issue
Block a user