net_idmap: use wbcSet[U|G]idMapping() and wbcSet[U|G]idHwm() functions
[Samba.git] / source / nsswitch / wb_client.c
blob5e1a5d8ad465eb8f9ebde0d2902db21cb1e601b6
1 /*
2 Unix SMB/CIFS implementation.
4 winbind client code
6 Copyright (C) Tim Potter 2000
7 Copyright (C) Andrew Tridgell 2000
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 #include "includes.h"
24 #include "nsswitch/winbind_nss.h"
25 #include "libwbclient/wbclient.h"
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_WINBIND
30 NSS_STATUS winbindd_request_response(int req_type,
31 struct winbindd_request *request,
32 struct winbindd_response *response);
34 bool winbind_set_mapping(const struct id_map *map)
36 struct winbindd_request request;
37 struct winbindd_response response;
38 int result;
40 /* Initialise request */
42 ZERO_STRUCT(request);
43 ZERO_STRUCT(response);
45 /* Make request */
47 request.data.dual_idmapset.id = map->xid.id;
48 request.data.dual_idmapset.type = map->xid.type;
49 sid_to_fstring(request.data.dual_idmapset.sid, map->sid);
51 result = winbindd_request_response(WINBINDD_SET_MAPPING, &request, &response);
53 return (result == NSS_STATUS_SUCCESS);
56 bool winbind_set_uid_hwm(unsigned long id)
58 struct winbindd_request request;
59 struct winbindd_response response;
60 int result;
62 /* Initialise request */
64 ZERO_STRUCT(request);
65 ZERO_STRUCT(response);
67 /* Make request */
69 request.data.dual_idmapset.id = id;
70 request.data.dual_idmapset.type = ID_TYPE_UID;
72 result = winbindd_request_response(WINBINDD_SET_HWM, &request, &response);
74 return (result == NSS_STATUS_SUCCESS);
77 bool winbind_set_gid_hwm(unsigned long id)
79 struct winbindd_request request;
80 struct winbindd_response response;
81 int result;
83 /* Initialise request */
85 ZERO_STRUCT(request);
86 ZERO_STRUCT(response);
88 /* Make request */
90 request.data.dual_idmapset.id = id;
91 request.data.dual_idmapset.type = ID_TYPE_GID;
93 result = winbindd_request_response(WINBINDD_SET_HWM, &request, &response);
95 return (result == NSS_STATUS_SUCCESS);