diff options
author | Simo Sorce <simo@redhat.com> | 2014-08-10 09:31:59 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2014-08-10 14:29:38 -0400 |
commit | 4149cbd77bba720db460f42fcd88e547ba2bbdfc (patch) | |
tree | 4196556735581a73558132bbdaa1751875aa6695 /src/gss_err.c | |
parent | fb6ffe0c50e166bf095736a051e4840bd5a5ad4f (diff) | |
download | gss-ntlmssp-4149cbd77bba720db460f42fcd88e547ba2bbdfc.tar.gz gss-ntlmssp-4149cbd77bba720db460f42fcd88e547ba2bbdfc.tar.xz gss-ntlmssp-4149cbd77bba720db460f42fcd88e547ba2bbdfc.zip |
Add support for printing internal NTLM error codes
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) |