diff options
Diffstat (limited to 'source4/libcli/util')
-rw-r--r-- | source4/libcli/util/clierror.c | 33 | ||||
-rw-r--r-- | source4/libcli/util/nterr.c | 19 |
2 files changed, 12 insertions, 40 deletions
diff --git a/source4/libcli/util/clierror.c b/source4/libcli/util/clierror.c index 1c82958ce2..52607b1a47 100644 --- a/source4/libcli/util/clierror.c +++ b/source4/libcli/util/clierror.c @@ -29,11 +29,7 @@ const char *smbcli_errstr(struct smbcli_tree *tree) { switch (tree->session->transport->error.etype) { - case ETYPE_DOS: - return dos_errstr( - tree->session->transport->error.e.dos.eclass, - tree->session->transport->error.e.dos.ecode); - case ETYPE_NT: + case ETYPE_SMB: return nt_errstr(tree->session->transport->error.e.nt_status); case ETYPE_SOCKET: @@ -53,13 +49,9 @@ const char *smbcli_errstr(struct smbcli_tree *tree) NTSTATUS smbcli_nt_error(struct smbcli_tree *tree) { switch (tree->session->transport->error.etype) { - case ETYPE_NT: + case ETYPE_SMB: return tree->session->transport->error.e.nt_status; - case ETYPE_DOS: - return dos_to_ntstatus( - tree->session->transport->error.e.dos.eclass, - tree->session->transport->error.e.dos.ecode); case ETYPE_SOCKET: return NT_STATUS_UNSUCCESSFUL; @@ -74,29 +66,8 @@ NTSTATUS smbcli_nt_error(struct smbcli_tree *tree) } -/* Return the DOS error from the last packet - an error class and an error - code. */ -void smbcli_dos_error(struct smbcli_state *cli, uint8_t *eclass, uint32_t *ecode) -{ - if (cli->transport->error.etype == ETYPE_DOS) { - ntstatus_to_dos(cli->transport->error.e.nt_status, - eclass, ecode); - return; - } - - if (eclass) *eclass = cli->transport->error.e.dos.eclass; - if (ecode) *ecode = cli->transport->error.e.dos.ecode; -} - - /* Return true if the last packet was an error */ BOOL smbcli_is_error(struct smbcli_tree *tree) { return NT_STATUS_IS_ERR(smbcli_nt_error(tree)); } - -/* Return true if the last error was a DOS error */ -BOOL smbcli_is_dos_error(struct smbcli_tree *tree) -{ - return tree->session->transport->error.etype == ETYPE_DOS; -} diff --git a/source4/libcli/util/nterr.c b/source4/libcli/util/nterr.c index eca47572e3..a5ba1305e4 100644 --- a/source4/libcli/util/nterr.c +++ b/source4/libcli/util/nterr.c @@ -648,9 +648,17 @@ static const nt_err_code_struct nt_err_desc[] = *****************************************************************************/ const char *nt_errstr(NTSTATUS nt_code) { - static fstring msg; + static char msg[40]; int idx = 0; + if (NT_STATUS_IS_DOS(nt_code)) { + return dos_errstr(NT_STATUS_DOS_CLASS(nt_code), + NT_STATUS_DOS_CODE(nt_code)); + } else if (NT_STATUS_IS_LDAP(nt_code)) { + slprintf(msg, sizeof(msg), "LDAP code %u", NT_STATUS_LDAP_CODE(nt_code)); + return msg; + } + while (nt_errs[idx].nt_errstr != NULL) { if (NT_STATUS_V(nt_errs[idx].nt_errcode) == NT_STATUS_V(nt_code)) { @@ -659,14 +667,7 @@ const char *nt_errstr(NTSTATUS nt_code) idx++; } - if (NT_STATUS_IS_DOS(nt_code)) { - slprintf(msg, sizeof(msg), "DOS code %u:%u", - NT_STATUS_DOS_CLASS(nt_code), NT_STATUS_DOS_CODE(nt_code)); - } else if (NT_STATUS_IS_LDAP(nt_code)) { - slprintf(msg, sizeof(msg), "LDAP code %u", NT_STATUS_LDAP_CODE(nt_code)); - } else { - slprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code)); - } + slprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code)); return msg; } |