smb2_tcon: only announce SMB2_SHARE_CAP_CLUSTER if rpcd_witness can run
[Samba.git] / source3 / libsmb / errormap_wbc.c
blobad523d6f26d1af6f9658cadf31b61a14c52e2903
1 /*
2 * Unix SMB/CIFS implementation.
3 * error mapping functions
4 * Copyright (C) Andrew Tridgell 2001
5 * Copyright (C) Andrew Bartlett 2001
6 * Copyright (C) Tim Potter 2000
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/>.
22 #include "includes.h"
23 #include "nsswitch/libwbclient/wbclient.h"
25 /*******************************************************************************
26 Map between wbcErr and NT status.
27 *******************************************************************************/
29 static const struct {
30 wbcErr wbc_err;
31 NTSTATUS nt_status;
32 } wbcErr_ntstatus_map[] = {
33 { WBC_ERR_SUCCESS, NT_STATUS_OK },
34 { WBC_ERR_NOT_IMPLEMENTED, NT_STATUS_NOT_IMPLEMENTED },
35 { WBC_ERR_UNKNOWN_FAILURE, NT_STATUS_UNSUCCESSFUL },
36 { WBC_ERR_NO_MEMORY, NT_STATUS_NO_MEMORY },
37 { WBC_ERR_INVALID_SID, NT_STATUS_INVALID_SID },
38 { WBC_ERR_INVALID_PARAM, NT_STATUS_INVALID_PARAMETER },
39 { WBC_ERR_WINBIND_NOT_AVAILABLE, NT_STATUS_SERVER_DISABLED },
40 { WBC_ERR_DOMAIN_NOT_FOUND, NT_STATUS_NO_SUCH_DOMAIN },
41 { WBC_ERR_INVALID_RESPONSE, NT_STATUS_INVALID_NETWORK_RESPONSE },
42 { WBC_ERR_NSS_ERROR, NT_STATUS_INTERNAL_ERROR },
43 { WBC_ERR_AUTH_ERROR, NT_STATUS_LOGON_FAILURE },
44 { WBC_ERR_UNKNOWN_USER, NT_STATUS_NO_SUCH_USER },
45 { WBC_ERR_UNKNOWN_GROUP, NT_STATUS_NO_SUCH_GROUP },
46 { WBC_ERR_PWD_CHANGE_FAILED, NT_STATUS_PASSWORD_RESTRICTION }
49 NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err)
51 int i;
53 /* Look through list */
54 for (i=0;i<ARRAY_SIZE(wbcErr_ntstatus_map);i++) {
55 if (wbcErr_ntstatus_map[i].wbc_err == wbc_err) {
56 return wbcErr_ntstatus_map[i].nt_status;
60 /* Default return */
61 return NT_STATUS_UNSUCCESSFUL;