Add exit codes for more errors

This commit is contained in:
Ian Weir 2021-10-07 10:57:40 -06:00 committed by akallabeth
parent 96cf17a45b
commit aa4c3dfb8a
2 changed files with 97 additions and 1 deletions

View File

@ -1518,6 +1518,78 @@ static DWORD WINAPI xf_client_thread(LPVOID param)
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_ACCOUNT_LOCKED_OUT)
exit_code = XF_EXIT_ACCOUNT_LOCKED_OUT;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_PRE_CONNECT_FAILED)
exit_code = XF_EXIT_PRE_CONNECT_FAILED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_UNDEFINED)
exit_code = XF_EXIT_CONNECT_UNDEFINED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_POST_CONNECT_FAILED)
exit_code = XF_EXIT_POST_CONNECT_FAILED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_DNS_ERROR)
exit_code = XF_EXIT_DNS_ERROR;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_DNS_NAME_NOT_FOUND)
exit_code = XF_EXIT_DNS_NAME_NOT_FOUND;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_FAILED)
exit_code = XF_EXIT_CONNECT_FAILED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_MCS_CONNECT_INITIAL_ERROR)
exit_code = XF_EXIT_MCS_CONNECT_INITIAL_ERROR;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_TLS_CONNECT_FAILED)
exit_code = XF_EXIT_TLS_CONNECT_FAILED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_INSUFFICIENT_PRIVILEGES)
exit_code = XF_EXIT_INSUFFICIENT_PRIVILEGES;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_CANCELLED)
exit_code = XF_EXIT_CONNECT_CANCELLED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_SECURITY_NEGO_CONNECT_FAILED)
exit_code = XF_EXIT_SECURITY_NEGO_CONNECT_FAILED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_TRANSPORT_FAILED)
exit_code = XF_EXIT_CONNECT_TRANSPORT_FAILED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_PASSWORD_EXPIRED)
exit_code = XF_EXIT_CONNECT_PASSWORD_EXPIRED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_PASSWORD_MUST_CHANGE)
exit_code = XF_EXIT_CONNECT_PASSWORD_MUST_CHANGE;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_KDC_UNREACHABLE)
exit_code = XF_EXIT_CONNECT_KDC_UNREACHABLE;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_ACCOUNT_DISABLED)
exit_code = XF_EXIT_CONNECT_ACCOUNT_DISABLED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_PASSWORD_CERTAINLY_EXPIRED)
exit_code = XF_EXIT_CONNECT_PASSWORD_CERTAINLY_EXPIRED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_CLIENT_REVOKED)
exit_code = XF_EXIT_CONNECT_CLIENT_REVOKED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_WRONG_PASSWORD)
exit_code = XF_EXIT_CONNECT_WRONG_PASSWORD;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_ACCESS_DENIED)
exit_code = XF_EXIT_CONNECT_ACCESS_DENIED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_ACCOUNT_RESTRICTION)
exit_code = XF_EXIT_CONNECT_ACCOUNT_RESTRICTION;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_ACCOUNT_EXPIRED)
exit_code = XF_EXIT_CONNECT_ACCOUNT_EXPIRED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_LOGON_TYPE_NOT_GRANTED)
exit_code = XF_EXIT_CONNECT_LOGON_TYPE_NOT_GRANTED;
else if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_CONNECT_NO_OR_MISSING_CREDENTIALS)
exit_code = XF_EXIT_CONNECT_NO_OR_MISSING_CREDENTIALS;
else
exit_code = XF_EXIT_CONN_FAILED;
}
@ -1682,7 +1754,7 @@ end:
DWORD xf_exit_code_from_disconnect_reason(DWORD reason)
{
if (reason == 0 || (reason >= XF_EXIT_PARSE_ARGUMENTS && reason <= XF_EXIT_ACCOUNT_LOCKED_OUT))
if (reason == 0 || (reason >= XF_EXIT_PARSE_ARGUMENTS && reason <= XF_EXIT_CONNECT_NO_OR_MISSING_CREDENTIALS))
return reason;
/* License error set */
else if (reason >= 0x100 && reason <= 0x10A)

View File

@ -351,6 +351,30 @@ enum XF_EXIT_CODE
XF_EXIT_NEGO_FAILURE = 133,
XF_EXIT_LOGON_FAILURE = 134,
XF_EXIT_ACCOUNT_LOCKED_OUT = 135,
XF_EXIT_PRE_CONNECT_FAILED = 136,
XF_EXIT_CONNECT_UNDEFINED = 137,
XF_EXIT_POST_CONNECT_FAILED = 138,
XF_EXIT_DNS_ERROR = 139,
XF_EXIT_DNS_NAME_NOT_FOUND = 140,
XF_EXIT_CONNECT_FAILED = 141,
XF_EXIT_MCS_CONNECT_INITIAL_ERROR = 142,
XF_EXIT_TLS_CONNECT_FAILED = 143,
XF_EXIT_INSUFFICIENT_PRIVILEGES = 144,
XF_EXIT_CONNECT_CANCELLED = 145,
XF_EXIT_SECURITY_NEGO_CONNECT_FAILED = 146,
XF_EXIT_CONNECT_TRANSPORT_FAILED = 147,
XF_EXIT_CONNECT_PASSWORD_EXPIRED = 148,
XF_EXIT_CONNECT_PASSWORD_MUST_CHANGE = 149,
XF_EXIT_CONNECT_KDC_UNREACHABLE = 150,
XF_EXIT_CONNECT_ACCOUNT_DISABLED = 151,
XF_EXIT_CONNECT_PASSWORD_CERTAINLY_EXPIRED = 152,
XF_EXIT_CONNECT_CLIENT_REVOKED = 153,
XF_EXIT_CONNECT_WRONG_PASSWORD = 154,
XF_EXIT_CONNECT_ACCESS_DENIED = 155,
XF_EXIT_CONNECT_ACCOUNT_RESTRICTION = 156,
XF_EXIT_CONNECT_ACCOUNT_EXPIRED = 157,
XF_EXIT_CONNECT_LOGON_TYPE_NOT_GRANTED = 158,
XF_EXIT_CONNECT_NO_OR_MISSING_CREDENTIALS = 159,
XF_EXIT_UNKNOWN = 255,
};