blob: d443cf7255bdb6a1b4d32c19710bc6306ec8932f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
Unix SMB/CIFS implementation.
client error handling routines
Copyright (C) Andrew Tridgell 1994-1998
Copyright (C) Jelmer Vernooij 2003
Copyright (C) Jeremy Allison 2006
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "source3/include/client.h"
#include "source3/libsmb/proto.h"
#include "../libcli/smb/smbXcli_base.h"
int cli_status_to_errno(NTSTATUS status)
{
int err;
if (NT_STATUS_IS_DOS(status)) {
uint8_t eclass = NT_STATUS_DOS_CLASS(status);
uint32_t ecode = NT_STATUS_DOS_CODE(status);
status = dos_to_ntstatus(eclass, ecode);
}
if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
/*
* Legacy code from cli_errno, see Samba up to 4.13: A
* special case for this Vista error. Since its
* high-order byte isn't 0xc0, it won't match
* correctly in map_errno_from_nt_status().
*/
err = EACCES;
} else {
err = map_errno_from_nt_status(status);
}
DBG_NOTICE("0x%"PRIx32" -> %d\n", NT_STATUS_V(status), err);
return err;
}
bool cli_state_is_connected(struct cli_state *cli)
{
if (cli == NULL) {
return false;
}
if (!cli->initialised) {
return false;
}
return smbXcli_conn_is_connected(cli->conn);
}
|