1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

libwbclient: Use wbcCtxSidsToUnixIds in wbcCtxSidToUid

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2016-02-09 07:36:13 +01:00 committed by Ralph Boehme
parent eeb0f3b075
commit fbbe017820

View File

@ -29,32 +29,25 @@
wbcErr wbcCtxSidToUid(struct wbcContext *ctx, const struct wbcDomainSid *sid,
uid_t *puid)
{
struct winbindd_request request;
struct winbindd_response response;
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct wbcUnixId xid;
wbcErr wbc_status;
if (!sid || !puid) {
wbc_status = WBC_ERR_INVALID_PARAM;
BAIL_ON_WBC_ERROR(wbc_status);
}
/* Initialize request */
wbc_status = wbcCtxSidsToUnixIds(ctx, sid, 1, &xid);
if (!WBC_ERROR_IS_OK(wbc_status)) {
goto done;
}
ZERO_STRUCT(request);
ZERO_STRUCT(response);
wbcSidToStringBuf(sid, request.data.sid, sizeof(request.data.sid));
/* Make request */
wbc_status = wbcRequestResponse(ctx, WINBINDD_SID_TO_UID,
&request,
&response);
BAIL_ON_WBC_ERROR(wbc_status);
*puid = response.data.uid;
wbc_status = WBC_ERR_SUCCESS;
if ((xid.type == WBC_ID_TYPE_UID) || (xid.type == WBC_ID_TYPE_BOTH)) {
*puid = xid.id.uid;
wbc_status = WBC_ERR_SUCCESS;
} else {
wbc_status = WBC_ERR_DOMAIN_NOT_FOUND;
}
done:
return wbc_status;