summaryrefslogtreecommitdiff
path: root/nsswitch/libwbclient
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-02-09 07:36:13 +0100
committerRalph Boehme <slow@samba.org>2016-02-22 20:29:15 +0100
commit122b1a3650fe9fd6d7cfd8f5497ccb09c6c99406 (patch)
treea30563ad90eed9e540ac33c3135682700ff0bfa1 /nsswitch/libwbclient
parentfbbe01782096c8a3c47e1d5f4f5e01de047bf9e2 (diff)
downloadsamba-122b1a3650fe9fd6d7cfd8f5497ccb09c6c99406.tar.gz
libwbclient: Use wbcCtxSidsToUnixIds in wbcCtxSidToGid
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'nsswitch/libwbclient')
-rw-r--r--nsswitch/libwbclient/wbc_idmap.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/nsswitch/libwbclient/wbc_idmap.c b/nsswitch/libwbclient/wbc_idmap.c
index 6735d3d3e9e..5cd082bd24a 100644
--- a/nsswitch/libwbclient/wbc_idmap.c
+++ b/nsswitch/libwbclient/wbc_idmap.c
@@ -123,32 +123,25 @@ wbcErr wbcQueryUidToSid(uid_t uid,
wbcErr wbcCtxSidToGid(struct wbcContext *ctx, const struct wbcDomainSid *sid,
gid_t *pgid)
{
- struct winbindd_request request;
- struct winbindd_response response;
- wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct wbcUnixId xid;
+ wbcErr wbc_status;
if (!sid || !pgid) {
wbc_status = WBC_ERR_INVALID_PARAM;
BAIL_ON_WBC_ERROR(wbc_status);
}
- /* Initialize request */
-
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
-
- wbcSidToStringBuf(sid, request.data.sid, sizeof(request.data.sid));
-
- /* Make request */
-
- wbc_status = wbcRequestResponse(ctx, WINBINDD_SID_TO_GID,
- &request,
- &response);
- BAIL_ON_WBC_ERROR(wbc_status);
-
- *pgid = response.data.gid;
+ wbc_status = wbcCtxSidsToUnixIds(ctx, sid, 1, &xid);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto done;
+ }
- wbc_status = WBC_ERR_SUCCESS;
+ if ((xid.type == WBC_ID_TYPE_GID) || (xid.type == WBC_ID_TYPE_BOTH)) {
+ *pgid = xid.id.gid;
+ wbc_status = WBC_ERR_SUCCESS;
+ } else {
+ wbc_status = WBC_ERR_DOMAIN_NOT_FOUND;
+ }
done:
return wbc_status;