1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 |
|
---|
4 | Winbind client API
|
---|
5 |
|
---|
6 | Copyright (C) Gerald (Jerry) Carter 2007
|
---|
7 |
|
---|
8 |
|
---|
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.
|
---|
13 |
|
---|
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.
|
---|
18 |
|
---|
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/>.
|
---|
21 | */
|
---|
22 |
|
---|
23 | /* Required Headers */
|
---|
24 |
|
---|
25 | #include "libwbclient.h"
|
---|
26 |
|
---|
27 | /** @brief Convert a Windows SID to a Unix uid, allocating an uid if needed
|
---|
28 | *
|
---|
29 | * @param *sid Pointer to the domain SID to be resolved
|
---|
30 | * @param *puid Pointer to the resolved uid_t value
|
---|
31 | *
|
---|
32 | * @return #wbcErr
|
---|
33 | *
|
---|
34 | **/
|
---|
35 |
|
---|
36 | wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
|
---|
37 | {
|
---|
38 | struct winbindd_request request;
|
---|
39 | struct winbindd_response response;
|
---|
40 | char *sid_string = NULL;
|
---|
41 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
42 |
|
---|
43 | if (!sid || !puid) {
|
---|
44 | wbc_status = WBC_ERR_INVALID_PARAM;
|
---|
45 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
46 | }
|
---|
47 |
|
---|
48 | /* Initialize request */
|
---|
49 |
|
---|
50 | ZERO_STRUCT(request);
|
---|
51 | ZERO_STRUCT(response);
|
---|
52 |
|
---|
53 | wbc_status = wbcSidToString(sid, &sid_string);
|
---|
54 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
55 |
|
---|
56 | strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
|
---|
57 | wbcFreeMemory(sid_string);
|
---|
58 |
|
---|
59 | /* Make request */
|
---|
60 |
|
---|
61 | wbc_status = wbcRequestResponse(WINBINDD_SID_TO_UID,
|
---|
62 | &request,
|
---|
63 | &response);
|
---|
64 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
65 |
|
---|
66 | *puid = response.data.uid;
|
---|
67 |
|
---|
68 | wbc_status = WBC_ERR_SUCCESS;
|
---|
69 |
|
---|
70 | done:
|
---|
71 | return wbc_status;
|
---|
72 | }
|
---|
73 |
|
---|
74 | /** @brief Convert a Windows SID to a Unix uid if there already is a mapping
|
---|
75 | *
|
---|
76 | * @param *sid Pointer to the domain SID to be resolved
|
---|
77 | * @param *puid Pointer to the resolved uid_t value
|
---|
78 | *
|
---|
79 | * @return #wbcErr
|
---|
80 | *
|
---|
81 | **/
|
---|
82 |
|
---|
83 | wbcErr wbcQuerySidToUid(const struct wbcDomainSid *sid,
|
---|
84 | uid_t *puid)
|
---|
85 | {
|
---|
86 | return WBC_ERR_NOT_IMPLEMENTED;
|
---|
87 | }
|
---|
88 |
|
---|
89 | /** @brief Convert a Unix uid to a Windows SID, allocating a SID if needed
|
---|
90 | *
|
---|
91 | * @param uid Unix uid to be resolved
|
---|
92 | * @param *sid Pointer to the resolved domain SID
|
---|
93 | *
|
---|
94 | * @return #wbcErr
|
---|
95 | *
|
---|
96 | **/
|
---|
97 |
|
---|
98 | wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
|
---|
99 | {
|
---|
100 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
101 | struct winbindd_request request;
|
---|
102 | struct winbindd_response response;
|
---|
103 |
|
---|
104 | if (!sid) {
|
---|
105 | wbc_status = WBC_ERR_INVALID_PARAM;
|
---|
106 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
107 | }
|
---|
108 |
|
---|
109 | /* Initialize request */
|
---|
110 |
|
---|
111 | ZERO_STRUCT(request);
|
---|
112 | ZERO_STRUCT(response);
|
---|
113 |
|
---|
114 | request.data.uid = uid;
|
---|
115 |
|
---|
116 | /* Make request */
|
---|
117 |
|
---|
118 | wbc_status = wbcRequestResponse(WINBINDD_UID_TO_SID,
|
---|
119 | &request,
|
---|
120 | &response);
|
---|
121 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
122 |
|
---|
123 | wbc_status = wbcStringToSid(response.data.sid.sid, sid);
|
---|
124 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
125 |
|
---|
126 | done:
|
---|
127 | return wbc_status;
|
---|
128 | }
|
---|
129 |
|
---|
130 | /** @brief Convert a Unix uid to a Windows SID if there already is a mapping
|
---|
131 | *
|
---|
132 | * @param uid Unix uid to be resolved
|
---|
133 | * @param *sid Pointer to the resolved domain SID
|
---|
134 | *
|
---|
135 | * @return #wbcErr
|
---|
136 | *
|
---|
137 | **/
|
---|
138 |
|
---|
139 | wbcErr wbcQueryUidToSid(uid_t uid,
|
---|
140 | struct wbcDomainSid *sid)
|
---|
141 | {
|
---|
142 | return WBC_ERR_NOT_IMPLEMENTED;
|
---|
143 | }
|
---|
144 |
|
---|
145 | /** @brief Convert a Windows SID to a Unix gid, allocating a gid if needed
|
---|
146 | *
|
---|
147 | * @param *sid Pointer to the domain SID to be resolved
|
---|
148 | * @param *pgid Pointer to the resolved gid_t value
|
---|
149 | *
|
---|
150 | * @return #wbcErr
|
---|
151 | *
|
---|
152 | **/
|
---|
153 |
|
---|
154 | wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
|
---|
155 | {
|
---|
156 | struct winbindd_request request;
|
---|
157 | struct winbindd_response response;
|
---|
158 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
159 | char *sid_string = NULL;
|
---|
160 |
|
---|
161 | if (!sid || !pgid) {
|
---|
162 | wbc_status = WBC_ERR_INVALID_PARAM;
|
---|
163 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
164 | }
|
---|
165 |
|
---|
166 | /* Initialize request */
|
---|
167 |
|
---|
168 | ZERO_STRUCT(request);
|
---|
169 | ZERO_STRUCT(response);
|
---|
170 |
|
---|
171 | wbc_status = wbcSidToString(sid, &sid_string);
|
---|
172 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
173 |
|
---|
174 | strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
|
---|
175 | wbcFreeMemory(sid_string);
|
---|
176 |
|
---|
177 | /* Make request */
|
---|
178 |
|
---|
179 | wbc_status = wbcRequestResponse(WINBINDD_SID_TO_GID,
|
---|
180 | &request,
|
---|
181 | &response);
|
---|
182 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
183 |
|
---|
184 | *pgid = response.data.gid;
|
---|
185 |
|
---|
186 | wbc_status = WBC_ERR_SUCCESS;
|
---|
187 |
|
---|
188 | done:
|
---|
189 | return wbc_status;
|
---|
190 | }
|
---|
191 |
|
---|
192 | /** @brief Convert a Windows SID to a Unix gid if there already is a mapping
|
---|
193 | *
|
---|
194 | * @param *sid Pointer to the domain SID to be resolved
|
---|
195 | * @param *pgid Pointer to the resolved gid_t value
|
---|
196 | *
|
---|
197 | * @return #wbcErr
|
---|
198 | *
|
---|
199 | **/
|
---|
200 |
|
---|
201 | wbcErr wbcQuerySidToGid(const struct wbcDomainSid *sid,
|
---|
202 | gid_t *pgid)
|
---|
203 | {
|
---|
204 | return WBC_ERR_NOT_IMPLEMENTED;
|
---|
205 | }
|
---|
206 |
|
---|
207 | /** @brief Convert a Unix gid to a Windows SID, allocating a SID if needed
|
---|
208 | *
|
---|
209 | * @param gid Unix gid to be resolved
|
---|
210 | * @param *sid Pointer to the resolved domain SID
|
---|
211 | *
|
---|
212 | * @return #wbcErr
|
---|
213 | *
|
---|
214 | **/
|
---|
215 |
|
---|
216 | wbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid)
|
---|
217 | {
|
---|
218 | struct winbindd_request request;
|
---|
219 | struct winbindd_response response;
|
---|
220 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
221 |
|
---|
222 | if (!sid) {
|
---|
223 | wbc_status = WBC_ERR_INVALID_PARAM;
|
---|
224 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
225 | }
|
---|
226 |
|
---|
227 | /* Initialize request */
|
---|
228 |
|
---|
229 | ZERO_STRUCT(request);
|
---|
230 | ZERO_STRUCT(response);
|
---|
231 |
|
---|
232 | request.data.gid = gid;
|
---|
233 |
|
---|
234 | /* Make request */
|
---|
235 |
|
---|
236 | wbc_status = wbcRequestResponse(WINBINDD_GID_TO_SID,
|
---|
237 | &request,
|
---|
238 | &response);
|
---|
239 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
240 |
|
---|
241 | wbc_status = wbcStringToSid(response.data.sid.sid, sid);
|
---|
242 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
243 |
|
---|
244 | done:
|
---|
245 | return wbc_status;
|
---|
246 | }
|
---|
247 |
|
---|
248 | /** @brief Convert a Unix gid to a Windows SID if there already is a mapping
|
---|
249 | *
|
---|
250 | * @param gid Unix gid to be resolved
|
---|
251 | * @param *sid Pointer to the resolved domain SID
|
---|
252 | *
|
---|
253 | * @return #wbcErr
|
---|
254 | *
|
---|
255 | **/
|
---|
256 |
|
---|
257 | wbcErr wbcQueryGidToSid(gid_t gid,
|
---|
258 | struct wbcDomainSid *sid)
|
---|
259 | {
|
---|
260 | return WBC_ERR_NOT_IMPLEMENTED;
|
---|
261 | }
|
---|
262 |
|
---|
263 | /** @brief Obtain a new uid from Winbind
|
---|
264 | *
|
---|
265 | * @param *puid *pointer to the allocated uid
|
---|
266 | *
|
---|
267 | * @return #wbcErr
|
---|
268 | **/
|
---|
269 |
|
---|
270 | wbcErr wbcAllocateUid(uid_t *puid)
|
---|
271 | {
|
---|
272 | struct winbindd_request request;
|
---|
273 | struct winbindd_response response;
|
---|
274 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
275 |
|
---|
276 | if (!puid)
|
---|
277 | return WBC_ERR_INVALID_PARAM;
|
---|
278 |
|
---|
279 | /* Initialise request */
|
---|
280 |
|
---|
281 | ZERO_STRUCT(request);
|
---|
282 | ZERO_STRUCT(response);
|
---|
283 |
|
---|
284 | /* Make request */
|
---|
285 |
|
---|
286 | wbc_status = wbcRequestResponse(WINBINDD_ALLOCATE_UID,
|
---|
287 | &request, &response);
|
---|
288 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
289 |
|
---|
290 | /* Copy out result */
|
---|
291 | *puid = response.data.uid;
|
---|
292 |
|
---|
293 | wbc_status = WBC_ERR_SUCCESS;
|
---|
294 |
|
---|
295 | done:
|
---|
296 | return wbc_status;
|
---|
297 | }
|
---|
298 |
|
---|
299 | /** @brief Obtain a new gid from Winbind
|
---|
300 | *
|
---|
301 | * @param *pgid Pointer to the allocated gid
|
---|
302 | *
|
---|
303 | * @return #wbcErr
|
---|
304 | **/
|
---|
305 |
|
---|
306 | wbcErr wbcAllocateGid(gid_t *pgid)
|
---|
307 | {
|
---|
308 | struct winbindd_request request;
|
---|
309 | struct winbindd_response response;
|
---|
310 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
311 |
|
---|
312 | if (!pgid)
|
---|
313 | return WBC_ERR_INVALID_PARAM;
|
---|
314 |
|
---|
315 | /* Initialise request */
|
---|
316 |
|
---|
317 | ZERO_STRUCT(request);
|
---|
318 | ZERO_STRUCT(response);
|
---|
319 |
|
---|
320 | /* Make request */
|
---|
321 |
|
---|
322 | wbc_status = wbcRequestResponse(WINBINDD_ALLOCATE_GID,
|
---|
323 | &request, &response);
|
---|
324 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
325 |
|
---|
326 | /* Copy out result */
|
---|
327 | *pgid = response.data.gid;
|
---|
328 |
|
---|
329 | wbc_status = WBC_ERR_SUCCESS;
|
---|
330 |
|
---|
331 | done:
|
---|
332 | return wbc_status;
|
---|
333 | }
|
---|
334 |
|
---|
335 | /* we can't include smb.h here... */
|
---|
336 | #define _ID_TYPE_UID 1
|
---|
337 | #define _ID_TYPE_GID 2
|
---|
338 |
|
---|
339 | /** @brief Set an user id mapping
|
---|
340 | *
|
---|
341 | * @param uid Uid of the desired mapping.
|
---|
342 | * @param *sid Pointer to the sid of the diresired mapping.
|
---|
343 | *
|
---|
344 | * @return #wbcErr
|
---|
345 | **/
|
---|
346 | wbcErr wbcSetUidMapping(uid_t uid, const struct wbcDomainSid *sid)
|
---|
347 | {
|
---|
348 | struct winbindd_request request;
|
---|
349 | struct winbindd_response response;
|
---|
350 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
351 | char *sid_string = NULL;
|
---|
352 |
|
---|
353 | if (!sid) {
|
---|
354 | return WBC_ERR_INVALID_PARAM;
|
---|
355 | }
|
---|
356 |
|
---|
357 | /* Initialise request */
|
---|
358 |
|
---|
359 | ZERO_STRUCT(request);
|
---|
360 | ZERO_STRUCT(response);
|
---|
361 |
|
---|
362 | /* Make request */
|
---|
363 |
|
---|
364 | request.data.dual_idmapset.id = uid;
|
---|
365 | request.data.dual_idmapset.type = _ID_TYPE_UID;
|
---|
366 |
|
---|
367 | wbc_status = wbcSidToString(sid, &sid_string);
|
---|
368 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
369 |
|
---|
370 | strncpy(request.data.dual_idmapset.sid, sid_string,
|
---|
371 | sizeof(request.data.dual_idmapset.sid)-1);
|
---|
372 | wbcFreeMemory(sid_string);
|
---|
373 |
|
---|
374 | wbc_status = wbcRequestResponse(WINBINDD_SET_MAPPING,
|
---|
375 | &request, &response);
|
---|
376 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
377 |
|
---|
378 | done:
|
---|
379 | return wbc_status;
|
---|
380 | }
|
---|
381 |
|
---|
382 | /** @brief Set a group id mapping
|
---|
383 | *
|
---|
384 | * @param gid Gid of the desired mapping.
|
---|
385 | * @param *sid Pointer to the sid of the diresired mapping.
|
---|
386 | *
|
---|
387 | * @return #wbcErr
|
---|
388 | **/
|
---|
389 | wbcErr wbcSetGidMapping(gid_t gid, const struct wbcDomainSid *sid)
|
---|
390 | {
|
---|
391 | struct winbindd_request request;
|
---|
392 | struct winbindd_response response;
|
---|
393 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
394 | char *sid_string = NULL;
|
---|
395 |
|
---|
396 | if (!sid) {
|
---|
397 | return WBC_ERR_INVALID_PARAM;
|
---|
398 | }
|
---|
399 |
|
---|
400 | /* Initialise request */
|
---|
401 |
|
---|
402 | ZERO_STRUCT(request);
|
---|
403 | ZERO_STRUCT(response);
|
---|
404 |
|
---|
405 | /* Make request */
|
---|
406 |
|
---|
407 | request.data.dual_idmapset.id = gid;
|
---|
408 | request.data.dual_idmapset.type = _ID_TYPE_GID;
|
---|
409 |
|
---|
410 | wbc_status = wbcSidToString(sid, &sid_string);
|
---|
411 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
412 |
|
---|
413 | strncpy(request.data.dual_idmapset.sid, sid_string,
|
---|
414 | sizeof(request.data.dual_idmapset.sid)-1);
|
---|
415 | wbcFreeMemory(sid_string);
|
---|
416 |
|
---|
417 | wbc_status = wbcRequestResponse(WINBINDD_SET_MAPPING,
|
---|
418 | &request, &response);
|
---|
419 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
420 |
|
---|
421 | done:
|
---|
422 | return wbc_status;
|
---|
423 | }
|
---|
424 |
|
---|
425 | /** @brief Remove a user id mapping
|
---|
426 | *
|
---|
427 | * @param uid Uid of the mapping to remove.
|
---|
428 | * @param *sid Pointer to the sid of the mapping to remove.
|
---|
429 | *
|
---|
430 | * @return #wbcErr
|
---|
431 | **/
|
---|
432 | wbcErr wbcRemoveUidMapping(uid_t uid, const struct wbcDomainSid *sid)
|
---|
433 | {
|
---|
434 | struct winbindd_request request;
|
---|
435 | struct winbindd_response response;
|
---|
436 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
437 | char *sid_string = NULL;
|
---|
438 |
|
---|
439 | if (!sid) {
|
---|
440 | return WBC_ERR_INVALID_PARAM;
|
---|
441 | }
|
---|
442 |
|
---|
443 | /* Initialise request */
|
---|
444 |
|
---|
445 | ZERO_STRUCT(request);
|
---|
446 | ZERO_STRUCT(response);
|
---|
447 |
|
---|
448 | /* Make request */
|
---|
449 |
|
---|
450 | request.data.dual_idmapset.id = uid;
|
---|
451 | request.data.dual_idmapset.type = _ID_TYPE_UID;
|
---|
452 |
|
---|
453 | wbc_status = wbcSidToString(sid, &sid_string);
|
---|
454 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
455 |
|
---|
456 | strncpy(request.data.dual_idmapset.sid, sid_string,
|
---|
457 | sizeof(request.data.dual_idmapset.sid)-1);
|
---|
458 | wbcFreeMemory(sid_string);
|
---|
459 |
|
---|
460 | wbc_status = wbcRequestResponse(WINBINDD_REMOVE_MAPPING,
|
---|
461 | &request, &response);
|
---|
462 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
463 |
|
---|
464 | done:
|
---|
465 | return wbc_status;
|
---|
466 | }
|
---|
467 |
|
---|
468 | /** @brief Remove a group id mapping
|
---|
469 | *
|
---|
470 | * @param gid Gid of the mapping to remove.
|
---|
471 | * @param *sid Pointer to the sid of the mapping to remove.
|
---|
472 | *
|
---|
473 | * @return #wbcErr
|
---|
474 | **/
|
---|
475 | wbcErr wbcRemoveGidMapping(gid_t gid, const struct wbcDomainSid *sid)
|
---|
476 | {
|
---|
477 | struct winbindd_request request;
|
---|
478 | struct winbindd_response response;
|
---|
479 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
480 | char *sid_string = NULL;
|
---|
481 |
|
---|
482 | if (!sid) {
|
---|
483 | return WBC_ERR_INVALID_PARAM;
|
---|
484 | }
|
---|
485 |
|
---|
486 | /* Initialise request */
|
---|
487 |
|
---|
488 | ZERO_STRUCT(request);
|
---|
489 | ZERO_STRUCT(response);
|
---|
490 |
|
---|
491 | /* Make request */
|
---|
492 |
|
---|
493 | request.data.dual_idmapset.id = gid;
|
---|
494 | request.data.dual_idmapset.type = _ID_TYPE_GID;
|
---|
495 |
|
---|
496 | wbc_status = wbcSidToString(sid, &sid_string);
|
---|
497 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
498 |
|
---|
499 | strncpy(request.data.dual_idmapset.sid, sid_string,
|
---|
500 | sizeof(request.data.dual_idmapset.sid)-1);
|
---|
501 | wbcFreeMemory(sid_string);
|
---|
502 |
|
---|
503 | wbc_status = wbcRequestResponse(WINBINDD_REMOVE_MAPPING,
|
---|
504 | &request, &response);
|
---|
505 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
506 |
|
---|
507 | done:
|
---|
508 | return wbc_status;
|
---|
509 | }
|
---|
510 |
|
---|
511 | /** @brief Set the highwater mark for allocated uids.
|
---|
512 | *
|
---|
513 | * @param uid_hwm The new uid highwater mark value
|
---|
514 | *
|
---|
515 | * @return #wbcErr
|
---|
516 | **/
|
---|
517 | wbcErr wbcSetUidHwm(uid_t uid_hwm)
|
---|
518 | {
|
---|
519 | struct winbindd_request request;
|
---|
520 | struct winbindd_response response;
|
---|
521 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
522 |
|
---|
523 | /* Initialise request */
|
---|
524 |
|
---|
525 | ZERO_STRUCT(request);
|
---|
526 | ZERO_STRUCT(response);
|
---|
527 |
|
---|
528 | /* Make request */
|
---|
529 |
|
---|
530 | request.data.dual_idmapset.id = uid_hwm;
|
---|
531 | request.data.dual_idmapset.type = _ID_TYPE_UID;
|
---|
532 |
|
---|
533 | wbc_status = wbcRequestResponse(WINBINDD_SET_HWM,
|
---|
534 | &request, &response);
|
---|
535 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
536 |
|
---|
537 | done:
|
---|
538 | return wbc_status;
|
---|
539 | }
|
---|
540 |
|
---|
541 | /** @brief Set the highwater mark for allocated gids.
|
---|
542 | *
|
---|
543 | * @param gid_hwm The new gid highwater mark value
|
---|
544 | *
|
---|
545 | * @return #wbcErr
|
---|
546 | **/
|
---|
547 | wbcErr wbcSetGidHwm(gid_t gid_hwm)
|
---|
548 | {
|
---|
549 | struct winbindd_request request;
|
---|
550 | struct winbindd_response response;
|
---|
551 | wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
---|
552 |
|
---|
553 | /* Initialise request */
|
---|
554 |
|
---|
555 | ZERO_STRUCT(request);
|
---|
556 | ZERO_STRUCT(response);
|
---|
557 |
|
---|
558 | /* Make request */
|
---|
559 |
|
---|
560 | request.data.dual_idmapset.id = gid_hwm;
|
---|
561 | request.data.dual_idmapset.type = _ID_TYPE_GID;
|
---|
562 |
|
---|
563 | wbc_status = wbcRequestResponse(WINBINDD_SET_HWM,
|
---|
564 | &request, &response);
|
---|
565 | BAIL_ON_WBC_ERROR(wbc_status);
|
---|
566 |
|
---|
567 | done:
|
---|
568 | return wbc_status;
|
---|
569 | }
|
---|