2 Unix SMB/CIFS implementation.
6 Copyright (C) Gerald (Jerry) Carter 2007
7 Copyright (C) Kai Blin 2009
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 3 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 /* Required Headers */
27 #include "libwbclient.h"
29 struct wbc_sid_to_uid_state
{
30 struct winbindd_request req
;
34 static void wbcSidToUid_done(struct tevent_req
*subreq
);
37 * @brief Convert a Windows SID to a Unix uid, allocating an uid if needed
39 * @param mem_ctx talloc context to allocate the request from
40 * @param ev tevent context to use for async operation
41 * @param wb_ctx winbind context to use
42 * @param *sid pointer to the domain SID to be resolved
44 * @return tevent_req on success, NULL on error
47 struct tevent_req
*wbcSidToUid_send(TALLOC_CTX
*mem_ctx
,
48 struct tevent_context
*ev
,
49 struct wb_context
*wb_ctx
,
50 const struct wbcDomainSid
*sid
)
52 struct tevent_req
*req
, *subreq
;
53 struct wbc_sid_to_uid_state
*state
;
55 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
57 req
= tevent_req_create(mem_ctx
, &state
, struct wbc_sid_to_uid_state
);
62 ZERO_STRUCT(state
->req
);
64 state
->req
.cmd
= WINBINDD_SID_TO_UID
;
65 wbc_status
= wbcSidToString(sid
, &sid_string
);
66 if (!WBC_ERROR_IS_OK(wbc_status
)) {
67 return tevent_req_post(req
, ev
);
69 strncpy(state
->req
.data
.sid
, sid_string
, sizeof(state
->req
.data
.sid
)-1);
70 wbcFreeMemory(sid_string
);
72 subreq
= wb_trans_send(state
, ev
, wb_ctx
, false, &state
->req
);
73 if (tevent_req_nomem(subreq
, req
)) {
74 return tevent_req_post(req
, ev
);
77 tevent_req_set_callback(subreq
, wbcSidToUid_done
, req
);
81 static void wbcSidToUid_done(struct tevent_req
*subreq
)
83 struct tevent_req
*req
= tevent_req_callback_data(
84 subreq
, struct tevent_req
);
85 struct wbc_sid_to_uid_state
*state
= tevent_req_data(
86 req
, struct wbc_sid_to_uid_state
);
87 struct winbindd_response
*resp
;
90 wbc_status
= wb_trans_recv(subreq
, state
, &resp
);
92 if (!WBC_ERROR_IS_OK(wbc_status
)) {
93 tevent_req_error(req
, wbc_status
);
96 state
->uid
= resp
->data
.uid
;
103 * @brief Receive a Unix uid mapped to a Windows SID
105 * @param req tevent_req containing the request
106 * @param *puid pointer to hold the resolved uid_t value
111 wbcErr
wbcSidToUid_recv(struct tevent_req
*req
, uid_t
*puid
)
113 struct wbc_sid_to_uid_state
*state
= tevent_req_data(
114 req
, struct wbc_sid_to_uid_state
);
117 if (tevent_req_is_wbcerr(req
, &wbc_status
)) {
118 tevent_req_received(req
);
124 tevent_req_received(req
);
125 return WBC_ERR_SUCCESS
;
128 /* Convert a Windows SID to a Unix uid, allocating an uid if needed */
129 wbcErr
wbcSidToUid(const struct wbcDomainSid
*sid
, uid_t
*puid
)
131 struct winbindd_request request
;
132 struct winbindd_response response
;
133 char *sid_string
= NULL
;
134 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
137 wbc_status
= WBC_ERR_INVALID_PARAM
;
138 BAIL_ON_WBC_ERROR(wbc_status
);
141 /* Initialize request */
143 ZERO_STRUCT(request
);
144 ZERO_STRUCT(response
);
146 wbc_status
= wbcSidToString(sid
, &sid_string
);
147 BAIL_ON_WBC_ERROR(wbc_status
);
149 strncpy(request
.data
.sid
, sid_string
, sizeof(request
.data
.sid
)-1);
150 wbcFreeMemory(sid_string
);
154 wbc_status
= wbcRequestResponse(WINBINDD_SID_TO_UID
,
157 BAIL_ON_WBC_ERROR(wbc_status
);
159 *puid
= response
.data
.uid
;
161 wbc_status
= WBC_ERR_SUCCESS
;
167 /* Convert a Windows SID to a Unix uid if there already is a mapping */
168 wbcErr
wbcQuerySidToUid(const struct wbcDomainSid
*sid
,
171 return WBC_ERR_NOT_IMPLEMENTED
;
174 struct wbc_uid_to_sid_state
{
175 struct winbindd_request req
;
176 struct wbcDomainSid
*sid
;
179 static void wbcUidToSid_done(struct tevent_req
*subreq
);
182 * @brief Request a Windows SID for an Unix uid, allocating an SID if needed
184 * @param mem_ctx talloc context to allocate the request from
185 * @param ev tevent context to use for async operation
186 * @param wb_ctx winbind context to use
187 * @param uid uid to be resolved to a SID
189 * @return tevent_req on success, NULL on error
192 struct tevent_req
*wbcUidToSid_send(TALLOC_CTX
*mem_ctx
,
193 struct tevent_context
*ev
,
194 struct wb_context
*wb_ctx
,
197 struct tevent_req
*req
, *subreq
;
198 struct wbc_uid_to_sid_state
*state
;
200 req
= tevent_req_create(mem_ctx
, &state
, struct wbc_uid_to_sid_state
);
205 ZERO_STRUCT(state
->req
);
207 state
->req
.cmd
= WINBINDD_UID_TO_SID
;
208 state
->req
.data
.uid
= uid
;
210 subreq
= wb_trans_send(state
, ev
, wb_ctx
, false, &state
->req
);
211 if (tevent_req_nomem(subreq
, req
)) {
212 return tevent_req_post(req
, ev
);
215 tevent_req_set_callback(subreq
, wbcUidToSid_done
, req
);
219 static void wbcUidToSid_done(struct tevent_req
*subreq
)
221 struct tevent_req
*req
= tevent_req_callback_data(
222 subreq
, struct tevent_req
);
223 struct wbc_uid_to_sid_state
*state
= tevent_req_data(
224 req
, struct wbc_uid_to_sid_state
);
225 struct winbindd_response
*resp
;
228 wbc_status
= wb_trans_recv(subreq
, state
, &resp
);
230 if (!WBC_ERROR_IS_OK(wbc_status
)) {
231 tevent_req_error(req
, wbc_status
);
235 state
->sid
= talloc(state
, struct wbcDomainSid
);
236 if (state
->sid
== NULL
) {
238 tevent_req_error(req
, WBC_ERR_NO_MEMORY
);
242 wbc_status
= wbcStringToSid(resp
->data
.sid
.sid
, state
->sid
);
245 if (!WBC_ERROR_IS_OK(wbc_status
)) {
246 tevent_req_error(req
, wbc_status
);
250 tevent_req_done(req
);
254 * @brief Receive a Unix uid mapped to a Windows SID
256 * @param req tevent_req containing the request
257 * @param *psid pointer to hold the resolved SID
262 wbcErr
wbcUidToSid_recv(struct tevent_req
*req
, struct wbcDomainSid
*psid
)
264 struct wbc_uid_to_sid_state
*state
= tevent_req_data(
265 req
, struct wbc_uid_to_sid_state
);
269 tevent_req_received(req
);
270 return WBC_ERR_INVALID_PARAM
;
273 if (tevent_req_is_wbcerr(req
, &wbc_status
)) {
274 tevent_req_received(req
);
278 memcpy(psid
, state
->sid
, sizeof(struct wbcDomainSid
));
280 tevent_req_received(req
);
281 return WBC_ERR_SUCCESS
;
284 /* Convert a Unix uid to a Windows SID, allocating a SID if needed */
285 wbcErr
wbcUidToSid(uid_t uid
, struct wbcDomainSid
*sid
)
287 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
288 struct winbindd_request request
;
289 struct winbindd_response response
;
292 wbc_status
= WBC_ERR_INVALID_PARAM
;
293 BAIL_ON_WBC_ERROR(wbc_status
);
296 /* Initialize request */
298 ZERO_STRUCT(request
);
299 ZERO_STRUCT(response
);
301 request
.data
.uid
= uid
;
305 wbc_status
= wbcRequestResponse(WINBINDD_UID_TO_SID
,
308 BAIL_ON_WBC_ERROR(wbc_status
);
310 wbc_status
= wbcStringToSid(response
.data
.sid
.sid
, sid
);
311 BAIL_ON_WBC_ERROR(wbc_status
);
317 /* Convert a Unix uid to a Windows SID if there already is a mapping */
318 wbcErr
wbcQueryUidToSid(uid_t uid
,
319 struct wbcDomainSid
*sid
)
321 return WBC_ERR_NOT_IMPLEMENTED
;
324 struct wbc_sid_to_gid_state
{
325 struct winbindd_request req
;
329 static void wbcSidToGid_done(struct tevent_req
*subreq
);
332 * @brief Request to convert a Windows SID to a Unix gid,
333 * allocating a gid if needed
335 * @param mem_ctx talloc context to allocate the request from
336 * @param ev tevent context to use for async operation
337 * @param wb_ctx winbind context to use
338 * @param *sid pointer to the domain SID to be resolved
340 * @return tevent_req on success, NULL on error
343 struct tevent_req
*wbcSidToGid_send(TALLOC_CTX
*mem_ctx
,
344 struct tevent_context
*ev
,
345 struct wb_context
*wb_ctx
,
346 const struct wbcDomainSid
*sid
)
348 struct tevent_req
*req
, *subreq
;
349 struct wbc_sid_to_gid_state
*state
;
351 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
353 req
= tevent_req_create(mem_ctx
, &state
, struct wbc_sid_to_gid_state
);
358 ZERO_STRUCT(state
->req
);
360 state
->req
.cmd
= WINBINDD_SID_TO_GID
;
361 wbc_status
= wbcSidToString(sid
, &sid_string
);
362 if (!WBC_ERROR_IS_OK(wbc_status
)) {
363 return tevent_req_post(req
, ev
);
365 strncpy(state
->req
.data
.sid
, sid_string
, sizeof(state
->req
.data
.sid
)-1);
366 wbcFreeMemory(sid_string
);
368 subreq
= wb_trans_send(state
, ev
, wb_ctx
, false, &state
->req
);
369 if (tevent_req_nomem(subreq
, req
)) {
370 return tevent_req_post(req
, ev
);
373 tevent_req_set_callback(subreq
, wbcSidToGid_done
, req
);
377 static void wbcSidToGid_done(struct tevent_req
*subreq
)
379 struct tevent_req
*req
= tevent_req_callback_data(
380 subreq
, struct tevent_req
);
381 struct wbc_sid_to_gid_state
*state
= tevent_req_data(
382 req
, struct wbc_sid_to_gid_state
);
383 struct winbindd_response
*resp
;
386 wbc_status
= wb_trans_recv(subreq
, state
, &resp
);
388 if (!WBC_ERROR_IS_OK(wbc_status
)) {
389 tevent_req_error(req
, wbc_status
);
392 state
->gid
= resp
->data
.gid
;
395 tevent_req_done(req
);
399 * @brief Receive a Unix gid mapped to a Windows SID
401 * @param req tevent_req containing the request
402 * @param *pgid pointer to hold the resolved gid_t value
407 wbcErr
wbcSidToGid_recv(struct tevent_req
*req
, gid_t
*pgid
)
409 struct wbc_sid_to_gid_state
*state
= tevent_req_data(
410 req
, struct wbc_sid_to_gid_state
);
413 if (tevent_req_is_wbcerr(req
, &wbc_status
)) {
414 tevent_req_received(req
);
420 tevent_req_received(req
);
421 return WBC_ERR_SUCCESS
;
424 /** @brief Convert a Windows SID to a Unix gid, allocating a gid if needed
426 * @param *sid Pointer to the domain SID to be resolved
427 * @param *pgid Pointer to the resolved gid_t value
433 wbcErr
wbcSidToGid(const struct wbcDomainSid
*sid
, gid_t
*pgid
)
435 struct winbindd_request request
;
436 struct winbindd_response response
;
437 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
438 char *sid_string
= NULL
;
441 wbc_status
= WBC_ERR_INVALID_PARAM
;
442 BAIL_ON_WBC_ERROR(wbc_status
);
445 /* Initialize request */
447 ZERO_STRUCT(request
);
448 ZERO_STRUCT(response
);
450 wbc_status
= wbcSidToString(sid
, &sid_string
);
451 BAIL_ON_WBC_ERROR(wbc_status
);
453 strncpy(request
.data
.sid
, sid_string
, sizeof(request
.data
.sid
)-1);
454 wbcFreeMemory(sid_string
);
458 wbc_status
= wbcRequestResponse(WINBINDD_SID_TO_GID
,
461 BAIL_ON_WBC_ERROR(wbc_status
);
463 *pgid
= response
.data
.gid
;
465 wbc_status
= WBC_ERR_SUCCESS
;
472 /* Convert a Windows SID to a Unix gid if there already is a mapping */
474 wbcErr
wbcQuerySidToGid(const struct wbcDomainSid
*sid
,
477 return WBC_ERR_NOT_IMPLEMENTED
;
480 struct wbc_gid_to_sid_state
{
481 struct winbindd_request req
;
482 struct wbcDomainSid
*sid
;
485 static void wbcGidToSid_done(struct tevent_req
*subreq
);
488 * @brief Request a Windows SID for an Unix Gid, allocating an SID if needed
490 * @param mem_ctx talloc context to allocate the request from
491 * @param ev tevent context to use for async operation
492 * @param wb_ctx winbind context to use
493 * @param gid gid to be resolved to a SID
495 * @return tevent_req on success, NULL on error
498 struct tevent_req
*wbcGidToSid_send(TALLOC_CTX
*mem_ctx
,
499 struct tevent_context
*ev
,
500 struct wb_context
*wb_ctx
,
503 struct tevent_req
*req
, *subreq
;
504 struct wbc_gid_to_sid_state
*state
;
506 req
= tevent_req_create(mem_ctx
, &state
, struct wbc_gid_to_sid_state
);
511 ZERO_STRUCT(state
->req
);
513 state
->req
.cmd
= WINBINDD_GID_TO_SID
;
514 state
->req
.data
.gid
= gid
;
516 subreq
= wb_trans_send(state
, ev
, wb_ctx
, false, &state
->req
);
517 if (tevent_req_nomem(subreq
, req
)) {
518 return tevent_req_post(req
, ev
);
521 tevent_req_set_callback(subreq
, wbcGidToSid_done
, req
);
525 static void wbcGidToSid_done(struct tevent_req
*subreq
)
527 struct tevent_req
*req
= tevent_req_callback_data(
528 subreq
, struct tevent_req
);
529 struct wbc_gid_to_sid_state
*state
= tevent_req_data(
530 req
, struct wbc_gid_to_sid_state
);
531 struct winbindd_response
*resp
;
534 wbc_status
= wb_trans_recv(subreq
, state
, &resp
);
536 if (!WBC_ERROR_IS_OK(wbc_status
)) {
537 tevent_req_error(req
, wbc_status
);
541 state
->sid
= talloc(state
, struct wbcDomainSid
);
542 if (state
->sid
== NULL
) {
544 tevent_req_error(req
, WBC_ERR_NO_MEMORY
);
548 wbc_status
= wbcStringToSid(resp
->data
.sid
.sid
, state
->sid
);
551 if (!WBC_ERROR_IS_OK(wbc_status
)) {
552 tevent_req_error(req
, wbc_status
);
556 tevent_req_done(req
);
560 * @brief Receive a Unix gid mapped to a Windows SID
562 * @param req tevent_req containing the request
563 * @param *psid pointer to hold the resolved SID
568 wbcErr
wbcGidToSid_recv(struct tevent_req
*req
, struct wbcDomainSid
*psid
)
570 struct wbc_gid_to_sid_state
*state
= tevent_req_data(
571 req
, struct wbc_gid_to_sid_state
);
575 tevent_req_received(req
);
576 return WBC_ERR_INVALID_PARAM
;
579 if (tevent_req_is_wbcerr(req
, &wbc_status
)) {
580 tevent_req_received(req
);
584 memcpy(psid
, state
->sid
, sizeof(struct wbcDomainSid
));
586 tevent_req_received(req
);
587 return WBC_ERR_SUCCESS
;
591 /* Convert a Unix gid to a Windows SID, allocating a SID if needed */
592 wbcErr
wbcGidToSid(gid_t gid
, struct wbcDomainSid
*sid
)
594 struct winbindd_request request
;
595 struct winbindd_response response
;
596 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
599 wbc_status
= WBC_ERR_INVALID_PARAM
;
600 BAIL_ON_WBC_ERROR(wbc_status
);
603 /* Initialize request */
605 ZERO_STRUCT(request
);
606 ZERO_STRUCT(response
);
608 request
.data
.gid
= gid
;
612 wbc_status
= wbcRequestResponse(WINBINDD_GID_TO_SID
,
615 BAIL_ON_WBC_ERROR(wbc_status
);
617 wbc_status
= wbcStringToSid(response
.data
.sid
.sid
, sid
);
618 BAIL_ON_WBC_ERROR(wbc_status
);
624 /* Convert a Unix gid to a Windows SID if there already is a mapping */
625 wbcErr
wbcQueryGidToSid(gid_t gid
,
626 struct wbcDomainSid
*sid
)
628 return WBC_ERR_NOT_IMPLEMENTED
;
631 /* Obtain a new uid from Winbind */
632 wbcErr
wbcAllocateUid(uid_t
*puid
)
634 struct winbindd_request request
;
635 struct winbindd_response response
;
636 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
639 return WBC_ERR_INVALID_PARAM
;
641 /* Initialise request */
643 ZERO_STRUCT(request
);
644 ZERO_STRUCT(response
);
648 wbc_status
= wbcRequestResponse(WINBINDD_ALLOCATE_UID
,
649 &request
, &response
);
650 BAIL_ON_WBC_ERROR(wbc_status
);
652 /* Copy out result */
653 *puid
= response
.data
.uid
;
655 wbc_status
= WBC_ERR_SUCCESS
;
661 /* Obtain a new gid from Winbind */
662 wbcErr
wbcAllocateGid(gid_t
*pgid
)
664 struct winbindd_request request
;
665 struct winbindd_response response
;
666 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
669 return WBC_ERR_INVALID_PARAM
;
671 /* Initialise request */
673 ZERO_STRUCT(request
);
674 ZERO_STRUCT(response
);
678 wbc_status
= wbcRequestResponse(WINBINDD_ALLOCATE_GID
,
679 &request
, &response
);
680 BAIL_ON_WBC_ERROR(wbc_status
);
682 /* Copy out result */
683 *pgid
= response
.data
.gid
;
685 wbc_status
= WBC_ERR_SUCCESS
;
691 /* we can't include smb.h here... */
692 #define _ID_TYPE_UID 1
693 #define _ID_TYPE_GID 2
695 /* Set an user id mapping */
696 wbcErr
wbcSetUidMapping(uid_t uid
, const struct wbcDomainSid
*sid
)
698 struct winbindd_request request
;
699 struct winbindd_response response
;
700 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
701 char *sid_string
= NULL
;
704 return WBC_ERR_INVALID_PARAM
;
707 /* Initialise request */
709 ZERO_STRUCT(request
);
710 ZERO_STRUCT(response
);
714 request
.data
.dual_idmapset
.id
= uid
;
715 request
.data
.dual_idmapset
.type
= _ID_TYPE_UID
;
717 wbc_status
= wbcSidToString(sid
, &sid_string
);
718 BAIL_ON_WBC_ERROR(wbc_status
);
720 strncpy(request
.data
.dual_idmapset
.sid
, sid_string
,
721 sizeof(request
.data
.dual_idmapset
.sid
)-1);
722 wbcFreeMemory(sid_string
);
724 wbc_status
= wbcRequestResponse(WINBINDD_SET_MAPPING
,
725 &request
, &response
);
726 BAIL_ON_WBC_ERROR(wbc_status
);
732 /* Set a group id mapping */
733 wbcErr
wbcSetGidMapping(gid_t gid
, const struct wbcDomainSid
*sid
)
735 struct winbindd_request request
;
736 struct winbindd_response response
;
737 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
738 char *sid_string
= NULL
;
741 return WBC_ERR_INVALID_PARAM
;
744 /* Initialise request */
746 ZERO_STRUCT(request
);
747 ZERO_STRUCT(response
);
751 request
.data
.dual_idmapset
.id
= gid
;
752 request
.data
.dual_idmapset
.type
= _ID_TYPE_GID
;
754 wbc_status
= wbcSidToString(sid
, &sid_string
);
755 BAIL_ON_WBC_ERROR(wbc_status
);
757 strncpy(request
.data
.dual_idmapset
.sid
, sid_string
,
758 sizeof(request
.data
.dual_idmapset
.sid
)-1);
759 wbcFreeMemory(sid_string
);
761 wbc_status
= wbcRequestResponse(WINBINDD_SET_MAPPING
,
762 &request
, &response
);
763 BAIL_ON_WBC_ERROR(wbc_status
);
769 /* Remove a user id mapping */
770 wbcErr
wbcRemoveUidMapping(uid_t uid
, const struct wbcDomainSid
*sid
)
772 struct winbindd_request request
;
773 struct winbindd_response response
;
774 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
775 char *sid_string
= NULL
;
778 return WBC_ERR_INVALID_PARAM
;
781 /* Initialise request */
783 ZERO_STRUCT(request
);
784 ZERO_STRUCT(response
);
788 request
.data
.dual_idmapset
.id
= uid
;
789 request
.data
.dual_idmapset
.type
= _ID_TYPE_UID
;
791 wbc_status
= wbcSidToString(sid
, &sid_string
);
792 BAIL_ON_WBC_ERROR(wbc_status
);
794 strncpy(request
.data
.dual_idmapset
.sid
, sid_string
,
795 sizeof(request
.data
.dual_idmapset
.sid
)-1);
796 wbcFreeMemory(sid_string
);
798 wbc_status
= wbcRequestResponse(WINBINDD_REMOVE_MAPPING
,
799 &request
, &response
);
800 BAIL_ON_WBC_ERROR(wbc_status
);
806 /* Remove a group id mapping */
807 wbcErr
wbcRemoveGidMapping(gid_t gid
, const struct wbcDomainSid
*sid
)
809 struct winbindd_request request
;
810 struct winbindd_response response
;
811 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
812 char *sid_string
= NULL
;
815 return WBC_ERR_INVALID_PARAM
;
818 /* Initialise request */
820 ZERO_STRUCT(request
);
821 ZERO_STRUCT(response
);
825 request
.data
.dual_idmapset
.id
= gid
;
826 request
.data
.dual_idmapset
.type
= _ID_TYPE_GID
;
828 wbc_status
= wbcSidToString(sid
, &sid_string
);
829 BAIL_ON_WBC_ERROR(wbc_status
);
831 strncpy(request
.data
.dual_idmapset
.sid
, sid_string
,
832 sizeof(request
.data
.dual_idmapset
.sid
)-1);
833 wbcFreeMemory(sid_string
);
835 wbc_status
= wbcRequestResponse(WINBINDD_REMOVE_MAPPING
,
836 &request
, &response
);
837 BAIL_ON_WBC_ERROR(wbc_status
);
843 /* Set the highwater mark for allocated uids. */
844 wbcErr
wbcSetUidHwm(uid_t uid_hwm
)
846 struct winbindd_request request
;
847 struct winbindd_response response
;
848 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
850 /* Initialise request */
852 ZERO_STRUCT(request
);
853 ZERO_STRUCT(response
);
857 request
.data
.dual_idmapset
.id
= uid_hwm
;
858 request
.data
.dual_idmapset
.type
= _ID_TYPE_UID
;
860 wbc_status
= wbcRequestResponse(WINBINDD_SET_HWM
,
861 &request
, &response
);
862 BAIL_ON_WBC_ERROR(wbc_status
);
868 /* Set the highwater mark for allocated gids. */
869 wbcErr
wbcSetGidHwm(gid_t gid_hwm
)
871 struct winbindd_request request
;
872 struct winbindd_response response
;
873 wbcErr wbc_status
= WBC_ERR_UNKNOWN_FAILURE
;
875 /* Initialise request */
877 ZERO_STRUCT(request
);
878 ZERO_STRUCT(response
);
882 request
.data
.dual_idmapset
.id
= gid_hwm
;
883 request
.data
.dual_idmapset
.type
= _ID_TYPE_GID
;
885 wbc_status
= wbcRequestResponse(WINBINDD_SET_HWM
,
886 &request
, &response
);
887 BAIL_ON_WBC_ERROR(wbc_status
);