diff options
Diffstat (limited to 'source3/libsmb/nterr.c')
-rw-r--r-- | source3/libsmb/nterr.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/libsmb/nterr.c b/source3/libsmb/nterr.c index 238908d6cd..25286156ee 100644 --- a/source3/libsmb/nterr.c +++ b/source3/libsmb/nterr.c @@ -558,3 +558,24 @@ char *get_nt_error_msg(NTSTATUS nt_code) return msg; } + +/***************************************************************************** + returns an NT_STATUS constant as a string for inclusion in autogen C code + *****************************************************************************/ +char *get_nt_error_c_code(NTSTATUS nt_code) +{ + static pstring out; + int idx = 0; + + while (nt_errs[idx].nt_errstr != NULL) { + if (NT_STATUS_V(nt_errs[idx].nt_errcode) == + NT_STATUS_V(nt_code)) { + return nt_errs[idx].nt_errstr; + } + idx++; + } + + slprintf(out, sizeof(out), "NT_STATUS(0x%08x)", NT_STATUS_V(nt_code)); + + return out; +} |