2 Unix SMB/CIFS implementation.
3 client error handling routines
4 Copyright (C) Andrew Tridgell 1994-1998
5 Copyright (C) Jelmer Vernooij 2003
6 Copyright (C) Jeremy Allison 2006
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "libsmb/libsmb.h"
24 #include "../libcli/smb/smbXcli_base.h"
26 int cli_status_to_errno(NTSTATUS status
)
30 if (NT_STATUS_IS_DOS(status
)) {
31 uint8_t eclass
= NT_STATUS_DOS_CLASS(status
);
32 uint32_t ecode
= NT_STATUS_DOS_CODE(status
);
33 status
= dos_to_ntstatus(eclass
, ecode
);
36 if (NT_STATUS_EQUAL(status
, NT_STATUS_STOPPED_ON_SYMLINK
)) {
38 * Legacy code from cli_errno, see Samba up to 4.13: A
39 * special case for this Vista error. Since its
40 * high-order byte isn't 0xc0, it won't match
41 * correctly in map_errno_from_nt_status().
45 err
= map_errno_from_nt_status(status
);
48 DBG_NOTICE("0x%"PRIx32
" -> %d\n", NT_STATUS_V(status
), err
);
53 bool cli_state_is_connected(struct cli_state
*cli
)
59 if (!cli
->initialised
) {
63 return smbXcli_conn_is_connected(cli
->conn
);