272
272
return wbc_status;
275
/* we can't include smb.h here... */
276
#define _ID_TYPE_UID 1
277
#define _ID_TYPE_GID 2
279
/** @brief Set an user id mapping
281
* @param uid Uid of the desired mapping.
282
* @param *sid Pointer to the sid of the diresired mapping.
286
wbcErr wbcSetUidMapping(uid_t uid, const struct wbcDomainSid *sid)
288
struct winbindd_request request;
289
struct winbindd_response response;
290
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
291
char *sid_string = NULL;
294
return WBC_ERR_INVALID_PARAM;
297
/* Initialise request */
299
ZERO_STRUCT(request);
300
ZERO_STRUCT(response);
304
request.data.dual_idmapset.id = uid;
305
request.data.dual_idmapset.type = _ID_TYPE_UID;
307
wbc_status = wbcSidToString(sid, &sid_string);
308
BAIL_ON_WBC_ERROR(wbc_status);
310
strncpy(request.data.dual_idmapset.sid, sid_string,
311
sizeof(request.data.dual_idmapset.sid)-1);
312
wbcFreeMemory(sid_string);
314
wbc_status = wbcRequestResponse(WINBINDD_SET_MAPPING,
315
&request, &response);
316
BAIL_ON_WBC_ERROR(wbc_status);
322
/** @brief Set a group id mapping
324
* @param gid Gid of the desired mapping.
325
* @param *sid Pointer to the sid of the diresired mapping.
329
wbcErr wbcSetGidMapping(gid_t gid, const struct wbcDomainSid *sid)
331
struct winbindd_request request;
332
struct winbindd_response response;
333
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
334
char *sid_string = NULL;
337
return WBC_ERR_INVALID_PARAM;
340
/* Initialise request */
342
ZERO_STRUCT(request);
343
ZERO_STRUCT(response);
347
request.data.dual_idmapset.id = gid;
348
request.data.dual_idmapset.type = _ID_TYPE_GID;
350
wbc_status = wbcSidToString(sid, &sid_string);
351
BAIL_ON_WBC_ERROR(wbc_status);
353
strncpy(request.data.dual_idmapset.sid, sid_string,
354
sizeof(request.data.dual_idmapset.sid)-1);
355
wbcFreeMemory(sid_string);
357
wbc_status = wbcRequestResponse(WINBINDD_SET_MAPPING,
358
&request, &response);
359
BAIL_ON_WBC_ERROR(wbc_status);
365
/** @brief Set the highwater mark for allocated uids.
367
* @param uid_hwm The new uid highwater mark value
371
wbcErr wbcSetUidHwm(uid_t uid_hwm)
373
struct winbindd_request request;
374
struct winbindd_response response;
375
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
377
/* Initialise request */
379
ZERO_STRUCT(request);
380
ZERO_STRUCT(response);
384
request.data.dual_idmapset.id = uid_hwm;
385
request.data.dual_idmapset.type = _ID_TYPE_UID;
387
wbc_status = wbcRequestResponse(WINBINDD_SET_HWM,
388
&request, &response);
389
BAIL_ON_WBC_ERROR(wbc_status);
395
/** @brief Set the highwater mark for allocated gids.
397
* @param uid_hwm The new gid highwater mark value
401
wbcErr wbcSetGidHwm(gid_t gid_hwm)
403
struct winbindd_request request;
404
struct winbindd_response response;
405
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
407
/* Initialise request */
409
ZERO_STRUCT(request);
410
ZERO_STRUCT(response);
414
request.data.dual_idmapset.id = gid_hwm;
415
request.data.dual_idmapset.type = _ID_TYPE_GID;
417
wbc_status = wbcRequestResponse(WINBINDD_SET_HWM,
418
&request, &response);
419
BAIL_ON_WBC_ERROR(wbc_status);