summaryrefslogtreecommitdiff
path: root/source3/libsmb/nterr.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-10-05 22:06:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:31:12 -0500
commitb92212575d370275bf1609cac6bc13c71de472d4 (patch)
tree412282ba0a0869a2415db214688d6e38e3a1290b /source3/libsmb/nterr.c
parent0ebab65706e7e2ef82d8af81225db05a5f78b5c4 (diff)
downloadsamba-b92212575d370275bf1609cac6bc13c71de472d4.tar.gz
samba-b92212575d370275bf1609cac6bc13c71de472d4.tar.bz2
samba-b92212575d370275bf1609cac6bc13c71de472d4.zip
r25538: Revert r25533
(This used to be commit 1e02208c43cb27ca4b43d268a7f0324f2a9b2cfd)
Diffstat (limited to 'source3/libsmb/nterr.c')
-rw-r--r--source3/libsmb/nterr.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source3/libsmb/nterr.c b/source3/libsmb/nterr.c
index 774e50e700..d88e650c9c 100644
--- a/source3/libsmb/nterr.c
+++ b/source3/libsmb/nterr.c
@@ -647,6 +647,7 @@ nt_err_code_struct nt_err_desc[] =
const char *nt_errstr(NTSTATUS nt_code)
{
+ static pstring msg;
int idx = 0;
#ifdef HAVE_LDAP
@@ -655,6 +656,8 @@ const char *nt_errstr(NTSTATUS nt_code)
}
#endif
+ slprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code));
+
while (nt_errs[idx].nt_errstr != NULL) {
if (NT_STATUS_EQUAL(nt_errs[idx].nt_errcode, nt_code)) {
return nt_errs[idx].nt_errstr;
@@ -662,8 +665,7 @@ const char *nt_errstr(NTSTATUS nt_code)
idx++;
}
- return talloc_asprintf(talloc_tos(), "NT code 0x%08x",
- NT_STATUS_V(nt_code));
+ return msg;
}
/************************************************************************
@@ -687,6 +689,28 @@ const char *get_friendly_nt_error_msg(NTSTATUS nt_code)
}
/*****************************************************************************
+ Returns an NT_STATUS constant as a string for inclusion in autogen C code.
+ *****************************************************************************/
+
+const 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;
+}
+
+/*****************************************************************************
Returns the NT_STATUS constant matching the string supplied (as an NTSTATUS)
*****************************************************************************/