summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd_sids_to_xids.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-03-23 21:11:33 +1100
committerMichael Adam <obnox@samba.org>2012-05-02 13:18:03 +0200
commitc844f657793c0f8df3b2afcf710166b628e8233b (patch)
tree52d0e4bd4fb6066dd84e789c9c1ef66cf1a7b4ae /source3/winbindd/winbindd_sids_to_xids.c
parent583b104d4b9a6ae65e4b43afaba665398a34c72f (diff)
downloadsamba-c844f657793c0f8df3b2afcf710166b628e8233b.tar.gz
samba-c844f657793c0f8df3b2afcf710166b628e8233b.tar.bz2
samba-c844f657793c0f8df3b2afcf710166b628e8233b.zip
s3-idmap: convert most idmap_cache callers to unixid API
This will eventually allow the struct unixid to be passed all the way up and down the stack. Andrew Bartlett Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/winbindd/winbindd_sids_to_xids.c')
-rw-r--r--source3/winbindd/winbindd_sids_to_xids.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/source3/winbindd/winbindd_sids_to_xids.c b/source3/winbindd/winbindd_sids_to_xids.c
index 2df5f54e75..8201739a96 100644
--- a/source3/winbindd/winbindd_sids_to_xids.c
+++ b/source3/winbindd/winbindd_sids_to_xids.c
@@ -123,34 +123,18 @@ struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx,
static bool winbindd_sids_to_xids_in_cache(struct dom_sid *sid,
struct id_map *map)
{
- uid_t uid;
- gid_t gid;
+ struct unixid id;
bool expired;
if (!winbindd_use_idmap_cache()) {
return false;
}
- /*
- * SIDS_TO_XIDS is primarily used to resolve the user's group
- * sids. So we check groups before users.
- */
- if (idmap_cache_find_sid2gid(sid, &gid, &expired)) {
+ if (idmap_cache_find_sid2unixid(sid, &id, &expired)) {
if (expired && is_domain_offline(find_our_domain())) {
return false;
}
map->sid = sid;
- map->xid.id = gid;
- map->xid.type = ID_TYPE_GID;
- map->status = ID_MAPPED;
- return true;
- }
- if (idmap_cache_find_sid2uid(sid, &uid, &expired)) {
- if (expired && is_domain_online(find_our_domain())) {
- return false;
- }
- map->sid = sid;
- map->xid.id = uid;
- map->xid.type = ID_TYPE_UID;
+ map->xid = id;
map->status = ID_MAPPED;
return true;
}
@@ -267,30 +251,27 @@ NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
type = 'G';
}
} else {
-
+ struct unixid id;
unix_id = state->ids.ids[num_non_cached].unix_id;
if (unix_id == -1) {
found = false;
}
- switch(state->ids.ids[num_non_cached].type) {
+ id.id = unix_id;
+ id.type = state->ids.ids[num_non_cached].type;
+ idmap_cache_set_sid2unixid(
+ &state->non_cached[num_non_cached],
+ &id);
+
+ switch (id.type) {
case ID_TYPE_UID:
type = 'U';
- idmap_cache_set_sid2uid(
- &state->non_cached[num_non_cached],
- unix_id);
break;
case ID_TYPE_GID:
type = 'G';
- idmap_cache_set_sid2gid(
- &state->non_cached[num_non_cached],
- unix_id);
break;
case ID_TYPE_BOTH:
type = 'B';
- idmap_cache_set_sid2both(
- &state->non_cached[num_non_cached],
- unix_id);
break;
default:
found = false;