2 Unix SMB/CIFS implementation.
6 Copyright (C) Gerald (Jerry) Carter 2007
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 3 of the License, or (at your option) any later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 /* Required Headers */
25 #include "libwbclient.h"
27 /* From wb_common.c */
29 NSS_STATUS winbindd_request_response(int req_type,
30 struct winbindd_request *request,
31 struct winbindd_response *response);
33 /** @brief Wrapper around Winbind's send/receive API call
35 * @param cmd Winbind command operation to perform
36 * @param request Send structure
37 * @param response Receive structure
42 /**********************************************************************
43 result == NSS_STATUS_UNAVAIL: winbind not around
44 result == NSS_STATUS_NOTFOUND: winbind around, but domain missing
46 Due to a bad API NSS_STATUS_NOTFOUND is returned both when winbind_off
47 and when winbind return WINBINDD_ERROR. So the semantics of this
48 routine depends on winbind_on. Grepping for winbind_off I just
49 found 3 places where winbind is turned off, and this does not conflict
50 (as far as I have seen) with the callers of is_trusted_domains.
53 **********************************************************************/
55 wbcErr wbcRequestResponse(int cmd,
56 struct winbindd_request *request,
57 struct winbindd_response *response)
59 wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
60 NSS_STATUS nss_status;
62 if (!request || !response) {
63 wbc_status = WBC_ERR_INVALID_PARAM;
64 BAIL_ON_WBC_ERROR(wbc_status);
68 nss_status = winbindd_request_response(cmd, request, response);
71 case NSS_STATUS_SUCCESS:
72 wbc_status = WBC_ERR_SUCCESS;
74 case NSS_STATUS_UNAVAIL:
75 return WBC_ERR_WINBIND_NOT_AVAILABLE;
77 case NSS_STATUS_NOTFOUND:
78 return WBC_ERR_DOMAIN_NOT_FOUND;
81 wbc_status = WBC_ERR_NSS_ERROR;
89 /** @brief Free library allocated memory
91 * @param *p Pointer to free
96 void wbcFreeMemory(void *p)