diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2014-08-18 17:40:41 -0400 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-08-22 16:35:31 +0200 |
commit | 49a73ff732215e59e51eb0f2eae56fff0d94f29b (patch) | |
tree | 2cd22a9246d3b44c5d2ccee95f514762a1eb9909 /src | |
parent | 5446f2a749d3e641b3ffc9feb3240a9b0f4b0598 (diff) | |
download | sssd-49a73ff732215e59e51eb0f2eae56fff0d94f29b.tar.gz sssd-49a73ff732215e59e51eb0f2eae56fff0d94f29b.tar.xz sssd-49a73ff732215e59e51eb0f2eae56fff0d94f29b.zip |
sss_client: Fix "struct sss_cli_mc_ctx" reinitialize-on-errors
When we have difficulty setting up an sss_cli_mc_ctx structure, we try
to clean things up so that we'll be ready to try again the next time
we're called.
Part of that is closing the descriptor of the file if we've opened it
and using memset() to clear the structure.
Now that sss_nss_mc_get_ctx() does its work in two phases, and each one
may end up doing the cleanup, each needs to be careful to reset the
descriptor field so that the new value provided by memset() (0) isn't
mistakenly treated as a file which should be closed by the other.
Resolves:
https://fedorahosted.org/sssd/ticket/2409
Reviewed-by: Simo Sorce <simo@redhat.com>
(cherry picked from commit 5a4df83d769ace54f92513f0be78e753e0985a25)
Diffstat (limited to 'src')
-rw-r--r-- | src/sss_client/nss_mc_common.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sss_client/nss_mc_common.c b/src/sss_client/nss_mc_common.c index edbf7b824..119d528c0 100644 --- a/src/sss_client/nss_mc_common.c +++ b/src/sss_client/nss_mc_common.c @@ -164,6 +164,7 @@ done: close(ctx->fd); } memset(ctx, 0, sizeof(struct sss_cli_mc_ctx)); + ctx->fd = -1; } free(file); sss_nss_unlock(); @@ -197,6 +198,7 @@ done: close(ctx->fd); } memset(ctx, 0, sizeof(struct sss_cli_mc_ctx)); + ctx->fd = -1; } return ret; } |