summaryrefslogtreecommitdiffstats
path: root/src/providers/krb5
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-10-21 22:36:59 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-11-05 19:55:09 +0100
commit77b13371c87702aee3f858f6b2b73826cf5a01bd (patch)
tree11fbb98aa528b9e35a1718b7a6f8e7fd2f0b03a7 /src/providers/krb5
parent06f10b2a0ebb26f2460cd445f8040e9205de7500 (diff)
downloadsssd-77b13371c87702aee3f858f6b2b73826cf5a01bd.tar.gz
sssd-77b13371c87702aee3f858f6b2b73826cf5a01bd.tar.xz
sssd-77b13371c87702aee3f858f6b2b73826cf5a01bd.zip
UTIL: Remove more code duplication setting up child processes
All our child processes duplicated the same code that set up the debugging all around. Instead of adding yet another copy for the selinux_child, add a common utility function. Reviewed-by: Michal Židek <mzidek@redhat.com>
Diffstat (limited to 'src/providers/krb5')
-rw-r--r--src/providers/krb5/krb5_init_shared.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/providers/krb5/krb5_init_shared.c b/src/providers/krb5/krb5_init_shared.c
index 340eab1f0..3b4bf096e 100644
--- a/src/providers/krb5/krb5_init_shared.c
+++ b/src/providers/krb5/krb5_init_shared.c
@@ -30,7 +30,6 @@ errno_t krb5_child_init(struct krb5_ctx *krb5_auth_ctx,
struct be_ctx *bectx)
{
errno_t ret;
- FILE *debug_filep;
time_t renew_intv = 0;
krb5_deltat renew_interval_delta;
char *renew_interval_str;
@@ -83,23 +82,16 @@ errno_t krb5_child_init(struct krb5_ctx *krb5_auth_ctx,
goto done;
}
- if (debug_to_file != 0) {
- ret = open_debug_file_ex(KRB5_CHILD_LOG_FILE, &debug_filep, false);
- if (ret != EOK) {
- DEBUG(SSSDBG_FATAL_FAILURE, "Error setting up logging (%d) [%s]\n",
- ret, strerror(ret));
- goto done;
- }
-
- krb5_auth_ctx->child_debug_fd = fileno(debug_filep);
- if (krb5_auth_ctx->child_debug_fd == -1) {
- DEBUG(SSSDBG_FATAL_FAILURE,
- "fileno failed [%d][%s]\n", errno, strerror(errno));
- ret = errno;
- goto done;
- }
+ krb5_auth_ctx->child_debug_fd = -1; /* -1 means not initialized */
+ ret = child_debug_init(KRB5_CHILD_LOG_FILE,
+ &krb5_auth_ctx->child_debug_fd);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, "Could not set krb5_child debugging!\n");
+ goto done;
}
+ ret = EOK;
+
done:
return ret;
}