summaryrefslogtreecommitdiff
path: root/source3/nsswitch/idmap_cache.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-01-14 17:58:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:08 -0500
commitc50c8d0dc31b95a98e09b1cfdd2e54e4bac336f2 (patch)
tree566e23e3e4956d2c01d48b779007fbbb4c7be21e /source3/nsswitch/idmap_cache.c
parentfb9a229643015fc6fea67bac9317f5d6a6283fc4 (diff)
downloadsamba-c50c8d0dc31b95a98e09b1cfdd2e54e4bac336f2.tar.gz
samba-c50c8d0dc31b95a98e09b1cfdd2e54e4bac336f2.tar.bz2
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_cache.c')
-rw-r--r--source3/nsswitch/idmap_cache.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/source3/nsswitch/idmap_cache.c b/source3/nsswitch/idmap_cache.c
index 535083fb2b..897dd9c4f5 100644
--- a/source3/nsswitch/idmap_cache.c
+++ b/source3/nsswitch/idmap_cache.c
@@ -304,7 +304,7 @@ NTSTATUS idmap_cache_fill_map(struct id_map *id, const char *value)
goto failed;
}
- id->mapped = True;
+ id->status = ID_MAPPED;
return NT_STATUS_OK;
}
@@ -331,13 +331,13 @@ NTSTATUS idmap_cache_fill_map(struct id_map *id, const char *value)
goto failed;
}
- id->mapped = True;
+ id->status = ID_MAPPED;
return NT_STATUS_OK;
failed:
DEBUG(1, ("invalid value: %s\n", value));
- id->mapped = False;
+ id->status = ID_UNKNOWN;
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -354,11 +354,11 @@ BOOL idmap_cache_is_negative(const char *val)
* 3 cases are possible
*
* 1 map found
- * in this case id->mapped = True and NT_STATUS_OK is returned
+ * in this case id->status = ID_MAPPED and NT_STATUS_OK is returned
* 2 map not found
- * in this case id->mapped = False and NT_STATUS_NONE_MAPPED is returned
+ * in this case id->status = ID_UNKNOWN and NT_STATUS_NONE_MAPPED is returned
* 3 negative cache found
- * in this case id->mapped = False and NT_STATUS_OK is returned
+ * in this case id->status = ID_UNMAPPED and NT_STATUS_OK is returned
*
* As a special case if the cache is expired NT_STATUS_SYNCHRONIZATION_REQUIRED
* is returned instead of NT_STATUS_OK. In this case revalidation of the cache
@@ -374,7 +374,7 @@ NTSTATUS idmap_cache_map_sid(struct idmap_cache_ctx *cache, struct id_map *id)
char *endptr;
/* make sure it is marked as not mapped by default */
- id->mapped = False;
+ id->status = ID_UNKNOWN;
ret = idmap_cache_build_sidkey(cache, &sidkey, id);
if (!NT_STATUS_IS_OK(ret)) return ret;
@@ -415,21 +415,21 @@ NTSTATUS idmap_cache_map_sid(struct idmap_cache_ctx *cache, struct id_map *id)
goto done;
}
- /* here ret == NT_STATUS_OK and id->mapped = True */
+ /* here ret == NT_STATUS_OK and id->status = ID_MAPPED */
if (t <= time(NULL)) {
/* We're expired, set an error code for upper layer */
ret = NT_STATUS_SYNCHRONIZATION_REQUIRED;
}
} else {
- /* this is not mapped (id->mapped = False),
- * and that's right as it was a negative cache hit */
- ret = NT_STATUS_OK;
-
if (t <= time(NULL)) {
/* We're expired, delete the entry and return not mapped */
tdb_delete(cache->tdb, keybuf);
ret = NT_STATUS_NONE_MAPPED;
+ } else {
+ /* this is not mapped as it was a negative cache hit */
+ id->status = ID_UNMAPPED;
+ ret = NT_STATUS_OK;
}
}
@@ -444,11 +444,11 @@ done:
* 3 cases are possible
*
* 1 map found
- * in this case id->mapped = True and NT_STATUS_OK is returned
+ * in this case id->status = ID_MAPPED and NT_STATUS_OK is returned
* 2 map not found
- * in this case id->mapped = False and NT_STATUS_NONE_MAPPED is returned
+ * in this case id->status = ID_UNKNOWN and NT_STATUS_NONE_MAPPED is returned
* 3 negative cache found
- * in this case id->mapped = False and NT_STATUS_OK is returned
+ * in this case id->status = ID_UNMAPPED and NT_STATUS_OK is returned
*
* As a special case if the cache is expired NT_STATUS_SYNCHRONIZATION_REQUIRED
* is returned instead of NT_STATUS_OK. In this case revalidation of the cache
@@ -464,7 +464,7 @@ NTSTATUS idmap_cache_map_id(struct idmap_cache_ctx *cache, struct id_map *id)
char *endptr;
/* make sure it is marked as not mapped by default */
- id->mapped = False;
+ id->status = ID_UNKNOWN;
ret = idmap_cache_build_idkey(cache, &idkey, id);
if (!NT_STATUS_IS_OK(ret)) return ret;
@@ -512,14 +512,14 @@ NTSTATUS idmap_cache_map_id(struct idmap_cache_ctx *cache, struct id_map *id)
ret = NT_STATUS_SYNCHRONIZATION_REQUIRED;
}
} else {
- /* this is not mapped (id->mapped = False),
- * and that's right as it was a negative cache hit */
- ret = NT_STATUS_OK;
-
if (t <= time(NULL)) {
/* We're expired, delete the entry and return not mapped */
tdb_delete(cache->tdb, keybuf);
ret = NT_STATUS_NONE_MAPPED;
+ } else {
+ /* this is not mapped is it was a negative cache hit */
+ id->status = ID_UNMAPPED;
+ ret = NT_STATUS_OK;
}
}
done: