diff options
author | Michael Adam <obnox@samba.org> | 2012-11-09 14:09:10 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-12-03 08:48:20 +0100 |
commit | be033a1d165f815bbddceda46384be1f9c0c2b7f (patch) | |
tree | 5709106734ebcc6fd597db58b170c97b5497bc32 /source3 | |
parent | b435e668aa8b2805cd94bde37b9ddf6a7ad335f8 (diff) | |
download | samba-be033a1d165f815bbddceda46384be1f9c0c2b7f.tar.gz samba-be033a1d165f815bbddceda46384be1f9c0c2b7f.tar.bz2 samba-be033a1d165f815bbddceda46384be1f9c0c2b7f.zip |
s3:winbindd: factor lsa_SidType_to_id_type() out of winbindd_sids_to_xids_lookupsids_done()
for readability
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/winbindd_sids_to_xids.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/source3/winbindd/winbindd_sids_to_xids.c b/source3/winbindd/winbindd_sids_to_xids.c index f1dd401950..0b040569e7 100644 --- a/source3/winbindd/winbindd_sids_to_xids.c +++ b/source3/winbindd/winbindd_sids_to_xids.c @@ -141,6 +141,7 @@ static bool winbindd_sids_to_xids_in_cache(struct dom_sid *sid, return false; } +static enum id_type lsa_SidType_to_id_type(const enum lsa_SidType sid_type); static void winbindd_sids_to_xids_lookupsids_done(struct tevent_req *subreq) { @@ -170,20 +171,7 @@ static void winbindd_sids_to_xids_lookupsids_done(struct tevent_req *subreq) struct lsa_TranslatedName *n = &state->names->names[i]; struct wbint_TransID *t = &state->ids.ids[i]; - switch (n->sid_type) { - case SID_NAME_USER: - case SID_NAME_COMPUTER: - t->type = ID_TYPE_UID; - break; - case SID_NAME_DOM_GRP: - case SID_NAME_ALIAS: - case SID_NAME_WKN_GRP: - t->type = ID_TYPE_GID; - break; - default: - t->type = ID_TYPE_NOT_SPECIFIED; - break; - }; + t->type = lsa_SidType_to_id_type(n->sid_type); t->domain_index = n->sid_index; sid_peek_rid(&state->non_cached[i], &t->rid); t->unix_id = (uint64_t)-1; @@ -200,6 +188,29 @@ static void winbindd_sids_to_xids_lookupsids_done(struct tevent_req *subreq) tevent_req_set_callback(subreq, winbindd_sids_to_xids_done, req); } +static enum id_type lsa_SidType_to_id_type(const enum lsa_SidType sid_type) +{ + enum id_type type; + + switch(sid_type) { + case SID_NAME_COMPUTER: + case SID_NAME_USER: + type = ID_TYPE_UID; + break; + case SID_NAME_DOM_GRP: + case SID_NAME_ALIAS: + case SID_NAME_WKN_GRP: + type = ID_TYPE_GID; + break; + default: + type = ID_TYPE_NOT_SPECIFIED; + break; + } + + return type; +} + + static void winbindd_sids_to_xids_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( |