[SSSD] [PATCH] krb5_child: set debugging sooner
Jakub Hrozek
jhrozek at redhat.com
Fri Mar 2 13:16:35 UTC 2012
Both krb5_child and ldap_child would emit a "child started" message and
only after that set up debugging to file. This might confuse users,
because unless there is an error, the krb5_child.log might actually be
empty.
I'm thinking we might also add a couple of "tracing" DEBUG messages so
that we can follow the flow in the subprocess more easily.
-------------- next part --------------
From d61a34dcee949e2a6efbc9ff02bf582b36b849af Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Thu, 1 Mar 2012 16:41:14 +0100
Subject: [PATCH] krb5_child: set debugging sooner
---
src/providers/krb5/krb5_child.c | 18 ++++++++++--------
src/providers/ldap/ldap_child.c | 18 ++++++++++--------
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index cc185260ef95c275a97e7f21bddb0580bf6a36a5..10e5da8d6557859068142921a25265478c738313 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -1582,7 +1582,7 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
- /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ /* Set debug level to invalid value so we can decide if -d 0 was used. */
debug_level = SSSDBG_INVALID;
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
@@ -1600,6 +1600,15 @@ int main(int argc, const char *argv[])
CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ debug_prg_name = argv[0]; /* Temporary, until we construct one */
+
+ if (debug_fd != -1) {
+ ret = set_debug_file_from_fd(debug_fd);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("set_debug_file_from_fd failed.\n"));
+ }
+ }
+
DEBUG(7, ("krb5_child started.\n"));
pd = talloc_zero(NULL, struct pam_data);
@@ -1610,13 +1619,6 @@ int main(int argc, const char *argv[])
debug_prg_name = talloc_asprintf(pd, "[sssd[krb5_child[%d]]]", getpid());
- if (debug_fd != -1) {
- ret = set_debug_file_from_fd(debug_fd);
- if (ret != EOK) {
- DEBUG(1, ("set_debug_file_from_fd failed.\n"));
- }
- }
-
buf = talloc_size(pd, sizeof(uint8_t)*IN_BUF_SIZE);
if (buf == NULL) {
DEBUG(1, ("malloc failed.\n"));
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 66ceb14e3d73d5af448029ef226bd97001fa008f..808778582a00cb29a57c19f3ce2d246ca9fa589b 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -388,7 +388,7 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
- /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ /* Set debug level to invalid value so we can decide if -d 0 was used. */
debug_level = SSSDBG_INVALID;
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
@@ -406,6 +406,15 @@ int main(int argc, const char *argv[])
CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ debug_prg_name = argv[0]; /* Temporary, until we construct one */
+
+ if (debug_fd != -1) {
+ ret = set_debug_file_from_fd(debug_fd);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("set_debug_file_from_fd failed.\n"));
+ }
+ }
+
DEBUG(7, ("ldap_child started.\n"));
main_ctx = talloc_new(NULL);
@@ -416,13 +425,6 @@ int main(int argc, const char *argv[])
debug_prg_name = talloc_asprintf(main_ctx, "[sssd[ldap_child[%d]]]", getpid());
- if (debug_fd != -1) {
- ret = set_debug_file_from_fd(debug_fd);
- if (ret != EOK) {
- DEBUG(1, ("set_debug_file_from_fd failed.\n"));
- }
- }
-
buf = talloc_size(main_ctx, sizeof(uint8_t)*IN_BUF_SIZE);
if (buf == NULL) {
DEBUG(1, ("talloc_size failed.\n"));
--
1.7.7.6
More information about the sssd-devel
mailing list