diff options
author | Simo Sorce <idra@samba.org> | 2007-01-14 17:58:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:08 -0500 |
commit | c50c8d0dc31b95a98e09b1cfdd2e54e4bac336f2 (patch) | |
tree | 566e23e3e4956d2c01d48b779007fbbb4c7be21e /source3/nsswitch/idmap_rid.c | |
parent | fb9a229643015fc6fea67bac9317f5d6a6283fc4 (diff) | |
download | samba-c50c8d0dc31b95a98e09b1cfdd2e54e4bac336f2.tar.gz samba-c50c8d0dc31b95a98e09b1cfdd2e54e4bac336f2.tar.xz samba-c50c8d0dc31b95a98e09b1cfdd2e54e4bac336f2.zip |
r20774: I thought I committed this before Xmas holidays ...
This change is needed to make it possible to not expire
caches in disconnected mode.
Jerry, please can you look at this and confirm it is ok?
Simo.
(This used to be commit 9e8715e4e15d9cede8f4aa9652642995392617e6)
Diffstat (limited to 'source3/nsswitch/idmap_rid.c')
-rw-r--r-- | source3/nsswitch/idmap_rid.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source3/nsswitch/idmap_rid.c b/source3/nsswitch/idmap_rid.c index e74283e22e..5949aa4ba5 100644 --- a/source3/nsswitch/idmap_rid.c +++ b/source3/nsswitch/idmap_rid.c @@ -107,6 +107,7 @@ static NTSTATUS idmap_rid_id_to_sid(TALLOC_CTX *memctx, struct idmap_rid_context case SID_NAME_USER: if (map->xid.type != ID_TYPE_UID) { /* wrong type */ + map->status = ID_UNMAPPED; DEBUG(5, ("Resulting SID is of wrong ID type\n")); return NT_STATUS_NONE_MAPPED; } @@ -116,21 +117,26 @@ static NTSTATUS idmap_rid_id_to_sid(TALLOC_CTX *memctx, struct idmap_rid_context case SID_NAME_WKN_GRP: if (map->xid.type != ID_TYPE_GID) { /* wrong type */ + map->status = ID_UNMAPPED; DEBUG(5, ("Resulting SID is of wrong ID type\n")); return NT_STATUS_NONE_MAPPED; } break; default: - /* invalid sid, let's just leave it unmapped */ + /* invalid sid?? */ + map->status = ID_UNKNOWN; DEBUG(10, ("SID %s is UNKNOWN, skip mapping\n", sid_string_static(map->sid))); return NT_STATUS_NONE_MAPPED; } } else { + /* TODO: how do we known if the lookup was negative + * or something just failed? */ + map->status = ID_UNMAPPED; DEBUG(2, ("Failed: to resolve SID\n")); return NT_STATUS_UNSUCCESSFUL; } - map->mapped = True; + map->status = ID_MAPPED; return NT_STATUS_OK; } @@ -169,9 +175,13 @@ static NTSTATUS idmap_rid_sid_to_id(TALLOC_CTX *memctx, struct idmap_rid_context default: /* invalid sid, let's just leave it unmapped */ DEBUG(10, ("SID %s is UNKNOWN, skip mapping\n", sid_string_static(map->sid))); + map->status = ID_UNKNOWN; return NT_STATUS_NONE_MAPPED; } } else { + /* TODO: how do we known if the lookup was negative + * or something just failed? */ + map->status = ID_UNMAPPED; DEBUG(2, ("Failed: to resolve SID\n")); return NT_STATUS_UNSUCCESSFUL; } @@ -180,10 +190,11 @@ static NTSTATUS idmap_rid_sid_to_id(TALLOC_CTX *memctx, struct idmap_rid_context if ((map->xid.id < ctx->low_id) || (map->xid.id > ctx->high_id)) { DEBUG(5, ("Requested id (%u) out of range (%u - %u). Filtered!\n", map->xid.id, ctx->low_id, ctx->high_id)); + map->status = ID_UNMAPPED; return NT_STATUS_NONE_MAPPED; } - map->mapped = True; + map->status = ID_MAPPED; return NT_STATUS_OK; } @@ -208,8 +219,6 @@ static NTSTATUS idmap_rid_unixids_to_sids(struct idmap_domain *dom, struct id_ma } for (i = 0; ids[i]; i++) { - /* make sure it is marked as unmapped before resolveing */ - ids[i]->mapped = False; ret = idmap_rid_id_to_sid(ctx, ridctx, ids[i]); @@ -244,8 +253,6 @@ static NTSTATUS idmap_rid_sids_to_unixids(struct idmap_domain *dom, struct id_ma } for (i = 0; ids[i]; i++) { - /* make sure it is marked as unmapped before resolveing */ - ids[i]->mapped = False; ret = idmap_rid_sid_to_id(ctx, ridctx, ids[i]); |