Fixed proxy to string functions (#7333)

This commit is contained in:
akallabeth 2021-10-07 10:25:59 +02:00 committed by GitHub
parent 51268bbcba
commit a4be45dd5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 56 additions and 18 deletions

View File

@ -46,30 +46,68 @@ struct proxy_module
wArrayList* handles;
};
static const char* FILTER_TYPE_STRINGS[] = {
"KEYBOARD_EVENT", "MOUSE_EVENT", "CLIENT_CHANNEL_DATA", "SERVER_CHANNEL_DATA",
"CLIENT_PASSTHROUGH_DYN_CHANNEL_CREATE", "SERVER_FETCH_TARGET_ADDR", "SERVER_PEER_LOGON",
"CLIENT_PASSTHROUGH_CHANNEL_CREATE" };
static const char* HOOK_TYPE_STRINGS[] = {
"CLIENT_PRE_CONNECT", "CLIENT_POST_CONNECT", "CLIENT_LOGIN_FAILURE", "CLIENT_END_PAINT",
"SERVER_POST_CONNECT", "SERVER_CHANNELS_INIT", "SERVER_CHANNELS_FREE", "SERVER_SESSION_END",
};
static const char* pf_modules_get_filter_type_string(PF_FILTER_TYPE result)
{
if (result >= FILTER_TYPE_KEYBOARD && result < FILTER_LAST)
return FILTER_TYPE_STRINGS[result];
else
return "FILTER_UNKNOWN";
switch (result)
{
case FILTER_TYPE_KEYBOARD:
return "FILTER_TYPE_KEYBOARD";
case FILTER_TYPE_MOUSE:
return "FILTER_TYPE_MOUSE";
case FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_DATA:
return "FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_DATA";
case FILTER_TYPE_SERVER_PASSTHROUGH_CHANNEL_DATA:
return "FILTER_TYPE_SERVER_PASSTHROUGH_CHANNEL_DATA";
case FILTER_TYPE_CLIENT_PASSTHROUGH_DYN_CHANNEL_CREATE:
return "FILTER_TYPE_CLIENT_PASSTHROUGH_DYN_CHANNEL_CREATE";
case FILTER_TYPE_SERVER_FETCH_TARGET_ADDR:
return "FILTER_TYPE_SERVER_FETCH_TARGET_ADDR";
case FILTER_TYPE_SERVER_PEER_LOGON:
return "FILTER_TYPE_SERVER_PEER_LOGON";
case FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_CREATE:
return "FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_CREATE";
case FILTER_LAST:
return "FILTER_LAST";
default:
return "FILTER_UNKNOWN";
}
}
static const char* pf_modules_get_hook_type_string(PF_HOOK_TYPE result)
{
if (result >= HOOK_TYPE_CLIENT_PRE_CONNECT && result < HOOK_LAST)
return HOOK_TYPE_STRINGS[result];
else
return "HOOK_UNKNOWN";
switch (result)
{
case HOOK_TYPE_CLIENT_INIT_CONNECT:
return "HOOK_TYPE_CLIENT_INIT_CONNECT";
case HOOK_TYPE_CLIENT_UNINIT_CONNECT:
return "HOOK_TYPE_CLIENT_UNINIT_CONNECT";
case HOOK_TYPE_CLIENT_PRE_CONNECT:
return "HOOK_TYPE_CLIENT_PRE_CONNECT";
case HOOK_TYPE_CLIENT_POST_CONNECT:
return "HOOK_TYPE_CLIENT_POST_CONNECT";
case HOOK_TYPE_CLIENT_POST_DISCONNECT:
return "HOOK_TYPE_CLIENT_POST_DISCONNECT";
case HOOK_TYPE_CLIENT_VERIFY_X509:
return "HOOK_TYPE_CLIENT_VERIFY_X509";
case HOOK_TYPE_CLIENT_LOGIN_FAILURE:
return "HOOK_TYPE_CLIENT_LOGIN_FAILURE";
case HOOK_TYPE_CLIENT_END_PAINT:
return "HOOK_TYPE_CLIENT_END_PAINT";
case HOOK_TYPE_SERVER_POST_CONNECT:
return "HOOK_TYPE_SERVER_POST_CONNECT";
case HOOK_TYPE_SERVER_ACTIVATE:
return "HOOK_TYPE_SERVER_ACTIVATE";
case HOOK_TYPE_SERVER_CHANNELS_INIT:
return "HOOK_TYPE_SERVER_CHANNELS_INIT";
case HOOK_TYPE_SERVER_CHANNELS_FREE:
return "HOOK_TYPE_SERVER_CHANNELS_FREE";
case HOOK_TYPE_SERVER_SESSION_END:
return "HOOK_TYPE_SERVER_SESSION_END";
case HOOK_LAST:
return "HOOK_LAST";
default:
return "HOOK_TYPE_UNKNOWN";
}
}
static BOOL pf_modules_proxy_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)