*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/* NT error codes. please read nterr.h */
#include "includes.h"
-typedef const struct
+typedef struct
{
const char *nt_errstr;
NTSTATUS nt_errcode;
{ "NT_STATUS_TOO_MANY_LINKS", NT_STATUS_TOO_MANY_LINKS },
{ "NT_STATUS_QUOTA_LIST_INCONSISTENT", NT_STATUS_QUOTA_LIST_INCONSISTENT },
{ "NT_STATUS_FILE_IS_OFFLINE", NT_STATUS_FILE_IS_OFFLINE },
+ { "NT_STATUS_DS_NO_MORE_RIDS", NT_STATUS_DS_NO_MORE_RIDS },
{ "NT_STATUS_NOT_A_REPARSE_POINT", NT_STATUS_NOT_A_REPARSE_POINT },
+ { "NT_STATUS_DOWNGRADE_DETECTED", NT_STATUS_DOWNGRADE_DETECTED },
{ "NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES },
{ "STATUS_MORE_ENTRIES", STATUS_MORE_ENTRIES },
{ "STATUS_SOME_UNMAPPED", STATUS_SOME_UNMAPPED },
{ "STATUS_NO_MORE_FILES", STATUS_NO_MORE_FILES },
+ { "NT_STATUS_RPC_CANNOT_SUPPORT", NT_STATUS_RPC_CANNOT_SUPPORT },
+ { "NT_STATUS_RPC_NT_CALL_FAILED", NT_STATUS_RPC_NT_CALL_FAILED },
{ NULL, NT_STATUS(0) }
};
const char *nt_errstr(NTSTATUS nt_code)
{
- static pstring msg;
int idx = 0;
+ char *result;
#ifdef HAVE_LDAP
- if (NT_STATUS_TYPE(nt_code) == NT_STATUS_TYPE_LDAP) {
+ if (NT_STATUS_IS_LDAP(nt_code)) {
return ldap_err2string(NT_STATUS_LDAP_CODE(nt_code));
}
#endif
- slprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code));
+ if (NT_STATUS_IS_DOS(nt_code)) {
+ return smb_dos_err_name(NT_STATUS_DOS_CLASS(nt_code),
+ NT_STATUS_DOS_CODE(nt_code));
+ }
while (nt_errs[idx].nt_errstr != NULL) {
if (NT_STATUS_EQUAL(nt_errs[idx].nt_errcode, nt_code)) {
idx++;
}
- return msg;
+ result = talloc_asprintf(talloc_tos(), "NT code 0x%08x",
+ NT_STATUS_V(nt_code));
+ SMB_ASSERT(result != NULL);
+ return result;
}
/************************************************************************
const char *get_nt_error_c_code(NTSTATUS nt_code)
{
- static pstring out;
+ char *result;
int idx = 0;
while (nt_errs[idx].nt_errstr != NULL) {
idx++;
}
- slprintf(out, sizeof(out), "NT_STATUS(0x%08x)", NT_STATUS_V(nt_code));
-
- return out;
+ result = talloc_asprintf(talloc_tos(), "NT_STATUS(0x%08x)",
+ NT_STATUS_V(nt_code));
+ SMB_ASSERT(result);
+ return result;
}
/*****************************************************************************
Returns the NT_STATUS constant matching the string supplied (as an NTSTATUS)
*****************************************************************************/
-NTSTATUS nt_status_string_to_code(char *nt_status_str)
+NTSTATUS nt_status_string_to_code(const char *nt_status_str)
{
int idx = 0;