diff options
Diffstat (limited to 'src/gss_err.c')
-rw-r--r-- | src/gss_err.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gss_err.c b/src/gss_err.c index b350a19..ad2fcec 100644 --- a/src/gss_err.c +++ b/src/gss_err.c @@ -9,7 +9,18 @@ #include "gss_ntlmssp.h" -#define UNKNOWN_ERROR "Unknown Error" +/* Untl we get gettext support */ +#define _(x) x + +/* the order is determined by ntlm_err_code order */ +static const char *err_strs[] = { + _("Unknown Error"), + _("Failed to decode data"), /* ERR_DECODE */ + _("Failed to encode data"), /* ERR_ENCODE */ + _("Crypto routine failure"), /* ERR_CRYPTO */ +}; + +#define UNKNOWN_ERROR err_strs[0] uint32_t gssntlm_display_status(uint32_t *minor_status, uint32_t status_value, @@ -42,6 +53,14 @@ uint32_t gssntlm_display_status(uint32_t *minor_status, goto done; } + if (status_value > ERR_BASE && status_value < ERR_LAST) { + status_string->value = strdup(err_strs[status_value - ERR_BASE]); + if (!status_string->value) { + return GSSERRS(ENOMEM, GSS_S_FAILURE); + } + goto done; + } + /* handle both XSI and GNU specific varints of strerror_r */ errno = 0; #if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) |