Author: vlendec Date: 2007-10-05 22:06:24 +0000 (Fri, 05 Oct 2007) New Revision: 25538
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25538 Log: Revert r25533 Modified: branches/SAMBA_3_2/source/libsmb/nterr.c branches/SAMBA_3_2/source/torture/torture.c branches/SAMBA_3_2_0/source/libsmb/nterr.c branches/SAMBA_3_2_0/source/torture/torture.c Changeset: Modified: branches/SAMBA_3_2/source/libsmb/nterr.c =================================================================== --- branches/SAMBA_3_2/source/libsmb/nterr.c 2007-10-05 21:58:26 UTC (rev 25537) +++ branches/SAMBA_3_2/source/libsmb/nterr.c 2007-10-05 22:06:24 UTC (rev 25538) @@ -647,6 +647,7 @@ const char *nt_errstr(NTSTATUS nt_code) { + static pstring msg; int idx = 0; #ifdef HAVE_LDAP @@ -655,6 +656,8 @@ } #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 @@ idx++; } - return talloc_asprintf(talloc_tos(), "NT code 0x%08x", - NT_STATUS_V(nt_code)); + return msg; } /************************************************************************ @@ -687,6 +689,28 @@ } /***************************************************************************** + 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) *****************************************************************************/ Modified: branches/SAMBA_3_2/source/torture/torture.c =================================================================== --- branches/SAMBA_3_2/source/torture/torture.c 2007-10-05 21:58:26 UTC (rev 25537) +++ branches/SAMBA_3_2/source/torture/torture.c 2007-10-05 22:06:24 UTC (rev 25538) @@ -4768,14 +4768,14 @@ 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", - nt_errstr(NT_STATUS(error)), - nt_errstr(nt_status)); + get_nt_error_c_code(NT_STATUS(error)), + get_nt_error_c_code(nt_status)); } printf("\t{%s,\t%s,\t%s},\n", smb_dos_err_class(errclass), smb_dos_err_name(errclass, errnum), - nt_errstr(NT_STATUS(error))); + get_nt_error_c_code(NT_STATUS(error))); } return True; } Modified: branches/SAMBA_3_2_0/source/libsmb/nterr.c =================================================================== --- branches/SAMBA_3_2_0/source/libsmb/nterr.c 2007-10-05 21:58:26 UTC (rev 25537) +++ branches/SAMBA_3_2_0/source/libsmb/nterr.c 2007-10-05 22:06:24 UTC (rev 25538) @@ -647,6 +647,7 @@ const char *nt_errstr(NTSTATUS nt_code) { + static pstring msg; int idx = 0; #ifdef HAVE_LDAP @@ -655,6 +656,8 @@ } #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 @@ idx++; } - return talloc_asprintf(talloc_tos(), "NT code 0x%08x", - NT_STATUS_V(nt_code)); + return msg; } /************************************************************************ @@ -687,6 +689,28 @@ } /***************************************************************************** + 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) *****************************************************************************/ Modified: branches/SAMBA_3_2_0/source/torture/torture.c =================================================================== --- branches/SAMBA_3_2_0/source/torture/torture.c 2007-10-05 21:58:26 UTC (rev 25537) +++ branches/SAMBA_3_2_0/source/torture/torture.c 2007-10-05 22:06:24 UTC (rev 25538) @@ -4768,14 +4768,14 @@ 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", - nt_errstr(NT_STATUS(error)), - nt_errstr(nt_status)); + get_nt_error_c_code(NT_STATUS(error)), + get_nt_error_c_code(nt_status)); } printf("\t{%s,\t%s,\t%s},\n", smb_dos_err_class(errclass), smb_dos_err_name(errclass, errnum), - nt_errstr(NT_STATUS(error))); + get_nt_error_c_code(NT_STATUS(error))); } return True; }
