diff options
author | Gerald Carter <jerry@samba.org> | 2002-11-21 00:12:14 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-11-21 00:12:14 +0000 |
commit | 8713f45a06cf242749e2ccb460d0d15c682350bb (patch) | |
tree | d65557002bebfa2acf09716fbc1e0c4496cf05b5 /source3 | |
parent | 91b7ac9fb955124263d0e86801db972590dabfb9 (diff) | |
download | samba-8713f45a06cf242749e2ccb460d0d15c682350bb.tar.gz samba-8713f45a06cf242749e2ccb460d0d15c682350bb.tar.bz2 samba-8713f45a06cf242749e2ccb460d0d15c682350bb.zip |
merge get_friendly_nt_err_msg() from app_head
(This used to be commit af21e7738404f073fe2e22b282322e3facdfeb82)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/nterr.c | 50 |
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 *****************************************************************************/ |