summaryrefslogtreecommitdiff
path: root/src/providers
diff options
context:
space:
mode:
authorOndrej Kos <okos@redhat.com>2012-12-07 20:44:15 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-12-10 18:54:07 +0100
commit9579839a00493830c10a856ad1f5e035b6fa3b45 (patch)
tree881cadf0b654eabf6bbec9b389961534d1cc63dd /src/providers
parent0c259cd8c8245db0364b38995e9e1fd941f79ed9 (diff)
downloadsssd-9579839a00493830c10a856ad1f5e035b6fa3b45.tar.gz
sssd-9579839a00493830c10a856ad1f5e035b6fa3b45.tar.bz2
sssd-9579839a00493830c10a856ad1f5e035b6fa3b45.zip
PROXY: fix negative cache
https://fedorahosted.org/sssd/ticket/1685 The PROXY provider wasn't storing credentials to negative cache due to bad return value. This was delegated from attempt to delete these credentials from local cache. Therefore ENOENT is replaced as EOK.
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/proxy/proxy_id.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 87eb91b1..060c4723 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -35,6 +35,9 @@ static int
handle_getpw_result(enum nss_status status, struct passwd *pwd,
struct sss_domain_info *dom, bool *del_user);
+static int
+delete_user(struct sysdb_ctx *sysdb, const char *name, uid_t uid);
+
static int get_pw_name(TALLOC_CTX *mem_ctx,
struct proxy_id_ctx *ctx,
struct sysdb_ctx *sysdb,
@@ -83,10 +86,7 @@ static int get_pw_name(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- DEBUG(SSSDBG_TRACE_FUNC,
- ("User %s does not exist (or is invalid) on remote server,"
- " deleting!\n", name));
- ret = sysdb_delete_user(sysdb, name, 0);
+ ret = delete_user(sysdb, name, 0);
goto done;
}
@@ -126,10 +126,7 @@ static int get_pw_name(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- DEBUG(SSSDBG_TRACE_FUNC,
- ("User %s does not exist (or is invalid) on remote server,"
- " deleting!\n", name));
- ret = sysdb_delete_user(sysdb, name, uid);
+ ret = delete_user(sysdb, name, uid);
goto done;
}
@@ -197,6 +194,22 @@ handle_getpw_result(enum nss_status status, struct passwd *pwd,
return ret;
}
+static int
+delete_user(struct sysdb_ctx *sysdb, const char *name, uid_t uid)
+{
+ int ret = EOK;
+
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("User %s does not exist (or is invalid) on remote server,"
+ " deleting!\n", name));
+ ret = sysdb_delete_user(sysdb, name, uid);
+ if (ret == ENOENT) {
+ ret = EOK;
+ }
+
+ return ret;
+}
+
static int save_user(struct sysdb_ctx *sysdb, bool lowercase,
struct passwd *pwd, const char *real_name,
const char *alias, uint64_t cache_timeout)
@@ -319,10 +332,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- DEBUG(SSSDBG_TRACE_FUNC,
- ("User %d does not exist (or is invalid) on remote server,"
- " deleting!\n", uid));
- ret = sysdb_delete_user(sysdb, NULL, uid);
+ ret = delete_user(sysdb, NULL, uid);
goto done;
}
@@ -1154,10 +1164,7 @@ static int get_initgr(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- DEBUG(SSSDBG_TRACE_FUNC,
- ("User %s does not exist (or is invalid) on remote server,"
- " deleting!\n", name));
- ret = sysdb_delete_user(sysdb, name, 0);
+ ret = delete_user(sysdb, name, 0);
if (ret) {
DEBUG(SSSDBG_OP_FAILURE, ("Could not delete user\n"));
goto fail;
@@ -1201,10 +1208,7 @@ static int get_initgr(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- DEBUG(SSSDBG_TRACE_FUNC,
- ("User %s does not exist (or is invalid) on remote server,"
- " deleting!\n", name));
- ret = sysdb_delete_user(sysdb, name, uid);
+ ret = delete_user(sysdb, name, uid);
if (ret) {
DEBUG(SSSDBG_OP_FAILURE, ("Could not delete user\n"));
goto fail;