summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/libsmb/nterr.c8
-rw-r--r--source3/torture/torture.c6
3 files changed, 7 insertions, 8 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2305a7ac68..a6e9cf9b5d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1976,7 +1976,6 @@ bool get_dc_name(const char *domain,
const char *nt_errstr(NTSTATUS nt_code);
const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
-const char *get_nt_error_c_code(NTSTATUS nt_code);
NTSTATUS nt_status_string_to_code(const char *nt_status_str);
NTSTATUS nt_status_squash(NTSTATUS nt_status);
diff --git a/source3/libsmb/nterr.c b/source3/libsmb/nterr.c
index e48f221be0..0201aa2ddc 100644
--- a/source3/libsmb/nterr.c
+++ b/source3/libsmb/nterr.c
@@ -740,7 +740,7 @@ 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)
+const char *get_nt_error_c_code(TALLOC_CTX *mem_ctx, NTSTATUS nt_code)
{
char *result;
int idx = 0;
@@ -748,14 +748,14 @@ const char *get_nt_error_c_code(NTSTATUS nt_code)
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;
+ result = talloc_strdup(mem_ctx, nt_errs[idx].nt_errstr);
+ return result;
}
idx++;
}
- result = talloc_asprintf(talloc_tos(), "NT_STATUS(0x%08x)",
+ result = talloc_asprintf(mem_ctx, "NT_STATUS(0x%08x)",
NT_STATUS_V(nt_code));
- SMB_ASSERT(result);
return result;
}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index b0e5cf8a02..fe9a5cb093 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -5910,14 +5910,14 @@ static bool run_error_map_extract(int dummy) {
if (NT_STATUS_V(nt_status) != error) {
printf("/*\t{ This NT error code was 'sqashed'\n\t from %s to %s \n\t during the session setup }\n*/\n",
- get_nt_error_c_code(NT_STATUS(error)),
- get_nt_error_c_code(nt_status));
+ get_nt_error_c_code(talloc_tos(), NT_STATUS(error)),
+ get_nt_error_c_code(talloc_tos(), nt_status));
}
printf("\t{%s,\t%s,\t%s},\n",
smb_dos_err_class(errclass),
smb_dos_err_name(errclass, errnum),
- get_nt_error_c_code(NT_STATUS(error)));
+ get_nt_error_c_code(talloc_tos(), NT_STATUS(error)));
}
return True;
}