dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 225fe9950f2807d5fb226f6b3be1ff4cefd731f0 Mon Sep 17 00:00:00 2001
From: Alexey Tikhonov <atikhono@redhat.com>
Date: Tue, 5 May 2020 19:34:47 +0200
Subject: [PATCH 24/25] DEBUG: changed "debug_prg_name" format
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Removed wrapping "[sssd[...]]" from "debug_prg_name" as this doesn't
carry any information but eats 8 characters of debug line.
For example instead of `[[sssd[ldap_child[12492]]]]` logs will have
`[ldap_child[12492]]`

I also was considering to remove "debug_prg_name" from the output
completely but gave up this idea. It makes sense to have program name
in the output to be able to combine few logs together (sorted by
timestamp).

Reviewed-by: Pawel Polawski <ppolawsk@redhat.com>
(cherry picked from commit 00e7b1ada3d1c1071eac79b65c17cd2701c2ae6a)

Reviewed-by: Pavel Březina <pbrezina@redhat.com>

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
---
 src/p11_child/p11_child_common.c  | 2 +-
 src/providers/ad/ad_gpo_child.c   | 2 +-
 src/providers/data_provider_be.c  | 2 +-
 src/providers/ipa/selinux_child.c | 2 +-
 src/providers/krb5/krb5_child.c   | 8 ++++----
 src/providers/ldap/ldap_child.c   | 4 ++--
 src/providers/proxy/proxy_child.c | 2 +-
 src/responder/autofs/autofssrv.c  | 2 +-
 src/responder/ifp/ifpsrv.c        | 2 +-
 src/responder/kcm/kcm.c           | 2 +-
 src/responder/nss/nsssrv.c        | 2 +-
 src/responder/pac/pacsrv.c        | 2 +-
 src/responder/pam/pamsrv.c        | 2 +-
 src/responder/secrets/secsrv.c    | 2 +-
 src/responder/ssh/sshsrv.c        | 2 +-
 src/responder/sudo/sudosrv.c      | 2 +-
 src/util/util_watchdog.c          | 2 +-
 17 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/p11_child/p11_child_common.c b/src/p11_child/p11_child_common.c
index 125430d13..49d268e5a 100644
--- a/src/p11_child/p11_child_common.c
+++ b/src/p11_child/p11_child_common.c
@@ -294,7 +294,7 @@ int main(int argc, const char *argv[])
 
     DEBUG_INIT(debug_level);
 
-    debug_prg_name = talloc_asprintf(NULL, "[sssd[p11_child[%d]]]", getpid());
+    debug_prg_name = talloc_asprintf(NULL, "p11_child[%d]", getpid());
     if (debug_prg_name == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
         goto fail;
diff --git a/src/providers/ad/ad_gpo_child.c b/src/providers/ad/ad_gpo_child.c
index a0bd6e13a..eb311c9df 100644
--- a/src/providers/ad/ad_gpo_child.c
+++ b/src/providers/ad/ad_gpo_child.c
@@ -733,7 +733,7 @@ main(int argc, const char *argv[])
 
     DEBUG_INIT(debug_level);
 
-    debug_prg_name = talloc_asprintf(NULL, "[sssd[gpo_child[%d]]]", getpid());
+    debug_prg_name = talloc_asprintf(NULL, "gpo_child[%d]", getpid());
     if (debug_prg_name == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
         goto fail;
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index d13654b8b..fb72d99e3 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -613,7 +613,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    srv_name = talloc_asprintf(NULL, "sssd[be[%s]]", be_domain);
+    srv_name = talloc_asprintf(NULL, "be[%s]", be_domain);
     if (!srv_name) return 2;
 
     confdb_path = talloc_asprintf(NULL, CONFDB_DOMAIN_PATH_TMPL, be_domain);
diff --git a/src/providers/ipa/selinux_child.c b/src/providers/ipa/selinux_child.c
index 925591ec9..bd4c4b528 100644
--- a/src/providers/ipa/selinux_child.c
+++ b/src/providers/ipa/selinux_child.c
@@ -252,7 +252,7 @@ int main(int argc, const char *argv[])
 
     DEBUG_INIT(debug_level);
 
-    debug_prg_name = talloc_asprintf(NULL, "[sssd[selinux_child[%d]]]", getpid());
+    debug_prg_name = talloc_asprintf(NULL, "selinux_child[%d]", getpid());
     if (debug_prg_name == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
         goto fail;
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index ae63b14d1..47eb181ba 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -2674,9 +2674,9 @@ static krb5_error_code check_fast_ccache(TALLOC_CTX *mem_ctx,
             goto done;
         case 0:
             /* Child */
-            debug_prg_name = talloc_asprintf(NULL, "[sssd[krb5_child[%d]]]", getpid());
+            debug_prg_name = talloc_asprintf(NULL, "krb5_child[%d]", getpid());
             if (debug_prg_name == NULL) {
-                debug_prg_name = "[sssd[krb5_child]]";
+                debug_prg_name = "krb5_child";
                 DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
                 /* Try to carry on */
             }
@@ -3285,9 +3285,9 @@ int main(int argc, const char *argv[])
 
     DEBUG_INIT(debug_level);
 
-    debug_prg_name = talloc_asprintf(NULL, "[sssd[krb5_child[%d]]]", getpid());
+    debug_prg_name = talloc_asprintf(NULL, "krb5_child[%d]", getpid());
     if (!debug_prg_name) {
-        debug_prg_name = "[sssd[krb5_child]]";
+        debug_prg_name = "krb5_child";
         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
         ret = ENOMEM;
         goto done;
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 368bb91e1..ff2371855 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -633,9 +633,9 @@ int main(int argc, const char *argv[])
 
     DEBUG_INIT(debug_level);
 
-    debug_prg_name = talloc_asprintf(NULL, "[sssd[ldap_child[%d]]]", getpid());
+    debug_prg_name = talloc_asprintf(NULL, "ldap_child[%d]", getpid());
     if (!debug_prg_name) {
-        debug_prg_name = "[sssd[ldap_child]]";
+        debug_prg_name = "ldap_child";
         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
         goto fail;
     }
diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c
index f5f2e8d0a..106cc983d 100644
--- a/src/providers/proxy/proxy_child.c
+++ b/src/providers/proxy/proxy_child.c
@@ -565,7 +565,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    srv_name = talloc_asprintf(NULL, "sssd[proxy_child[%s]]", domain);
+    srv_name = talloc_asprintf(NULL, "proxy_child[%s]", domain);
     if (!srv_name) return 2;
 
     conf_entry = talloc_asprintf(NULL, CONFDB_DOMAIN_PATH_TMPL, domain);
diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c
index 922da5fd4..5755a3ee5 100644
--- a/src/responder/autofs/autofssrv.c
+++ b/src/responder/autofs/autofssrv.c
@@ -235,7 +235,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    ret = server_setup("sssd[autofs]", 0, uid, gid,
+    ret = server_setup("autofs", 0, uid, gid,
                        CONFDB_AUTOFS_CONF_ENTRY, &main_ctx);
     if (ret != EOK) {
         return 2;
diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index d71475e84..2bd4e3703 100644
--- a/src/responder/ifp/ifpsrv.c
+++ b/src/responder/ifp/ifpsrv.c
@@ -395,7 +395,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    ret = server_setup("sssd[ifp]", 0, 0, 0,
+    ret = server_setup("ifp", 0, 0, 0,
                        CONFDB_IFP_CONF_ENTRY, &main_ctx);
     if (ret != EOK) return 2;
 
diff --git a/src/responder/kcm/kcm.c b/src/responder/kcm/kcm.c
index a482234c8..2fbdef4bf 100644
--- a/src/responder/kcm/kcm.c
+++ b/src/responder/kcm/kcm.c
@@ -298,7 +298,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    ret = server_setup("sssd[kcm]", 0, uid, gid, CONFDB_KCM_CONF_ENTRY,
+    ret = server_setup("kcm", 0, uid, gid, CONFDB_KCM_CONF_ENTRY,
                        &main_ctx);
     if (ret != EOK) return 2;
 
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index d9fe28708..d429dabcf 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -583,7 +583,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    ret = server_setup("sssd[nss]", 0, uid, gid, CONFDB_NSS_CONF_ENTRY,
+    ret = server_setup("nss", 0, uid, gid, CONFDB_NSS_CONF_ENTRY,
                        &main_ctx);
     if (ret != EOK) return 2;
 
diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c
index ab61e6230..dbf3bc11c 100644
--- a/src/responder/pac/pacsrv.c
+++ b/src/responder/pac/pacsrv.c
@@ -249,7 +249,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    ret = server_setup("sssd[pac]", 0, uid, gid,
+    ret = server_setup("pac", 0, uid, gid,
                        CONFDB_PAC_CONF_ENTRY, &main_ctx);
     if (ret != EOK) return 2;
 
diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c
index fb799d28b..1804497a3 100644
--- a/src/responder/pam/pamsrv.c
+++ b/src/responder/pam/pamsrv.c
@@ -444,7 +444,7 @@ int main(int argc, const char *argv[])
         }
     }
 
-    ret = server_setup("sssd[pam]", 0, uid, gid, CONFDB_PAM_CONF_ENTRY, &main_ctx);
+    ret = server_setup("pam", 0, uid, gid, CONFDB_PAM_CONF_ENTRY, &main_ctx);
     if (ret != EOK) return 2;
 
     ret = die_if_parent_died();
diff --git a/src/responder/secrets/secsrv.c b/src/responder/secrets/secsrv.c
index 7a736a228..e3c0418a1 100644
--- a/src/responder/secrets/secsrv.c
+++ b/src/responder/secrets/secsrv.c
@@ -363,7 +363,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    ret = server_setup("sssd[secrets]", 0, uid, gid, CONFDB_SEC_CONF_ENTRY,
+    ret = server_setup("secrets", 0, uid, gid, CONFDB_SEC_CONF_ENTRY,
                        &main_ctx);
     if (ret != EOK) return 2;
 
diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c
index 9f1f618f2..458f60c0d 100644
--- a/src/responder/ssh/sshsrv.c
+++ b/src/responder/ssh/sshsrv.c
@@ -229,7 +229,7 @@ int main(int argc, const char *argv[])
 
     sss_set_logger(opt_logger);
 
-    ret = server_setup("sssd[ssh]", 0, uid, gid,
+    ret = server_setup("ssh", 0, uid, gid,
                        CONFDB_SSH_CONF_ENTRY, &main_ctx);
     if (ret != EOK) {
         return 2;
diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c
index 82315e0a8..921941c49 100644
--- a/src/responder/sudo/sudosrv.c
+++ b/src/responder/sudo/sudosrv.c
@@ -242,7 +242,7 @@ int main(int argc, const char *argv[])
         }
     }
 
-    ret = server_setup("sssd[sudo]", 0, uid, gid, CONFDB_SUDO_CONF_ENTRY,
+    ret = server_setup("sudo", 0, uid, gid, CONFDB_SUDO_CONF_ENTRY,
                        &main_ctx);
     if (ret != EOK) {
         return 2;
diff --git a/src/util/util_watchdog.c b/src/util/util_watchdog.c
index ae249c2ca..0a4d83505 100644
--- a/src/util/util_watchdog.c
+++ b/src/util/util_watchdog.c
@@ -158,7 +158,7 @@ static void watchdog_fd_read_handler(struct tevent_context *ev,
               "[%d]: %s\n", ret, sss_strerror(ret));
         orderly_shutdown(1);
     }
-    if (strncmp(debug_prg_name, "sssd[be[", sizeof("sssd[be[") - 1) == 0) {
+    if (strncmp(debug_prg_name, "be[", sizeof("be[") - 1) == 0) {
         kill(getpid(), SIGUSR2);
         DEBUG(SSSDBG_IMPORTANT_INFO, "SIGUSR2 sent to %s\n", debug_prg_name);
     }
-- 
2.21.1