summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-11-09 13:54:20 +0100
committerStefan Metzmacher <metze@samba.org>2012-12-03 08:48:20 +0100
commitb435e668aa8b2805cd94bde37b9ddf6a7ad335f8 (patch)
tree89c95b5ae1c18e68435732afd019f947220cc4f2 /source3
parent3f0c31fbd388986d636b5701f66ed7b215a1b903 (diff)
downloadsamba-b435e668aa8b2805cd94bde37b9ddf6a7ad335f8.tar.gz
samba-b435e668aa8b2805cd94bde37b9ddf6a7ad335f8.tar.bz2
samba-b435e668aa8b2805cd94bde37b9ddf6a7ad335f8.zip
s3:winbindd: simplify winbindd_sids_to_xids_recv() a bit.
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.c65
1 files changed, 25 insertions, 40 deletions
diff --git a/source3/winbindd/winbindd_sids_to_xids.c b/source3/winbindd/winbindd_sids_to_xids.c
index f500f248d4..f1dd401950 100644
--- a/source3/winbindd/winbindd_sids_to_xids.c
+++ b/source3/winbindd/winbindd_sids_to_xids.c
@@ -240,62 +240,47 @@ NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
for (i=0; i<state->num_sids; i++) {
char type = '\0';
- uint32_t unix_id = UINT32_MAX;
bool found = true;
+ struct unixid xid;
+
+ xid.id = UINT32_MAX;
if (state->cached[i].sid != NULL) {
- unix_id = state->cached[i].xid.id;
-
- switch (state->cached[i].xid.type) {
- case ID_TYPE_UID:
- type = 'U';
- break;
- case ID_TYPE_GID:
- type = 'G';
- break;
- case ID_TYPE_BOTH:
- type = 'B';
- break;
- default:
- found = false;
- break;
- }
+ xid = state->cached[i].xid;
} else {
- struct unixid id;
-
- unix_id = state->ids.ids[num_non_cached].unix_id;
+ xid.id = state->ids.ids[num_non_cached].unix_id;
+ xid.type = 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';
- break;
- case ID_TYPE_GID:
- type = 'G';
- break;
- case ID_TYPE_BOTH:
- type = 'B';
- break;
- default:
- found = false;
- break;
- }
+ &xid);
+
num_non_cached += 1;
}
- if (unix_id == UINT32_MAX) {
+ switch (xid.type) {
+ case ID_TYPE_UID:
+ type = 'U';
+ break;
+ case ID_TYPE_GID:
+ type = 'G';
+ break;
+ case ID_TYPE_BOTH:
+ type = 'B';
+ break;
+ default:
+ found = false;
+ break;
+ }
+
+ if (xid.id == UINT32_MAX) {
found = false;
}
if (found) {
result = talloc_asprintf_append_buffer(
result, "%c%lu\n", type,
- (unsigned long)unix_id);
+ (unsigned long)xid.id);
} else {
result = talloc_asprintf_append_buffer(result, "\n");
}