summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-11-21 00:10:28 +0000
committerGerald Carter <jerry@samba.org>2002-11-21 00:10:28 +0000
commite955763315700af82b23bbfd2777cbecad47f7e7 (patch)
tree263af1d77504e7db330fd51d644eb7aa24d612dc /source3
parent211b99b2cbd2344c098ac907676d4a4ce609944a (diff)
downloadsamba-e955763315700af82b23bbfd2777cbecad47f7e7.tar.gz
samba-e955763315700af82b23bbfd2777cbecad47f7e7.tar.bz2
samba-e955763315700af82b23bbfd2777cbecad47f7e7.zip
merge get_friendly_nt_err_msg() from app_head
(This used to be commit 3ea73f158ebfca0561d7928e5d6c0939c0734585)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/nterr.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source3/libsmb/nterr.c b/source3/libsmb/nterr.c
index 02fd53fc05..73d77b728a 100644
--- a/source3/libsmb/nterr.c
+++ b/source3/libsmb/nterr.c
@@ -539,6 +539,35 @@ static nt_err_code_struct nt_errs[] =
{ NULL, NT_STATUS(0) }
};
+nt_err_code_struct nt_err_desc[] =
+{
+ { "Success", NT_STATUS_OK },
+ { "Undetermined error", NT_STATUS_UNSUCCESSFUL },
+ { "Access denied", NT_STATUS_ACCESS_DENIED },
+ { "Account locked out", NT_STATUS_ACCOUNT_LOCKED_OUT },
+ { "Password is too short", NT_STATUS_PWD_TOO_SHORT },
+ { "Password is too recent", NT_STATUS_PWD_TOO_RECENT },
+ { "Password history conflict", NT_STATUS_PWD_HISTORY_CONFLICT },
+ { "No logon servers", NT_STATUS_NO_LOGON_SERVERS },
+ { "Invalid account name", NT_STATUS_INVALID_ACCOUNT_NAME },
+ { "User exists", NT_STATUS_USER_EXISTS },
+ { "No such user", NT_STATUS_NO_SUCH_USER },
+ { "Group exists", NT_STATUS_GROUP_EXISTS },
+ { "No such group", NT_STATUS_NO_SUCH_GROUP },
+ { "Member not in group", NT_STATUS_MEMBER_NOT_IN_GROUP },
+ { "Wrong Password", NT_STATUS_WRONG_PASSWORD },
+ { "Ill formed password", NT_STATUS_ILL_FORMED_PASSWORD },
+ { "Password restriction", NT_STATUS_PASSWORD_RESTRICTION },
+ { "Logon failure", NT_STATUS_LOGON_FAILURE },
+ { "Account restruction", NT_STATUS_ACCOUNT_RESTRICTION },
+ { "Invalid logon hours", NT_STATUS_INVALID_LOGON_HOURS },
+ { "Invalid workstation", NT_STATUS_INVALID_WORKSTATION },
+ { "Password expired", NT_STATUS_PASSWORD_EXPIRED },
+ { "Account Disabled", NT_STATUS_ACCOUNT_DISABLED },
+ { NULL, NT_STATUS(0) }
+};
+
+
/*****************************************************************************
returns an NT error message. not amazingly helpful, but better than a number.
*****************************************************************************/
@@ -560,6 +589,27 @@ char *nt_errstr(NTSTATUS nt_code)
return msg;
}
+/************************************************************************
+ Print friendler version fo NT error code
+ ***********************************************************************/
+
+char *get_friendly_nt_error_msg(NTSTATUS nt_code)
+{
+ int idx = 0;
+
+ while (nt_err_desc[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++;
+ }
+
+ /* fall back to NT_STATUS_XXX string */
+
+ return get_nt_error_msg(nt_code);
+}
+
/*****************************************************************************
returns an NT_STATUS constant as a string for inclusion in autogen C code
*****************************************************************************/