diff options
author | Ondrej Kos <okos@redhat.com> | 2012-12-07 20:44:15 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-12-14 17:45:18 +0100 |
commit | 9b2bccde3d954bb15d344e1d71069f9071a7106a (patch) | |
tree | a718c16cd8bd04fc790522f7a4107b83b640e26a | |
parent | 765b9e9f3362c2a5fc9e6018a5fa8cd674216cf4 (diff) | |
download | sssd-9b2bccde3d954bb15d344e1d71069f9071a7106a.tar.gz sssd-9b2bccde3d954bb15d344e1d71069f9071a7106a.tar.xz sssd-9b2bccde3d954bb15d344e1d71069f9071a7106a.zip |
PROXY: fix negative cache1.9.2-38
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.
-rw-r--r-- | src/providers/proxy/proxy_id.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c index ce66fa128..620aadc66 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; |