diff options
Diffstat (limited to 'src/providers')
-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 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; |