From 2b60fe06b7efe4080839f810fa898907761e40b0 Mon Sep 17 00:00:00 2001 From: Alexey Tikhonov Date: Fri, 11 Aug 2023 19:42:19 +0200 Subject: [PATCH] Get rid of '--dbus-activated'. Code makes no difference handling '--socket-activated' and '--dbus-activated', it only makes things more obscure. Moreover, on a systemd enabled system, dbus activation actually starts systemd service anyway, so there is really no big difference. --- Makefile.am | 2 +- src/responder/common/responder.h | 1 - src/responder/common/responder_common.c | 10 +++------- src/sysv/systemd/sssd-ifp.service.in | 2 +- src/util/server.c | 2 +- src/util/util.c | 10 ---------- src/util/util.h | 8 +------- 7 files changed, 7 insertions(+), 28 deletions(-) diff --git a/Makefile.am b/Makefile.am index c33ff226708..d467042f828 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,7 +91,7 @@ deskprofilepath = $(sss_statedir)/deskprofile if HAVE_SYSTEMD_UNIT ifp_dbus_exec_comment = \# If system is configured to use systemd ifp service ("SystemdService=") then "Exec=" and "User=" options are not used -ifp_dbus_exec_cmd = $(sssdlibexecdir)/sssd_ifp --dbus-activated +ifp_dbus_exec_cmd = $(sssdlibexecdir)/sssd_ifp --socket-activated ifp_systemdservice = SystemdService=sssd-ifp.service # SSSD requires a configuration file (either /etc/sssd/sssd.conf, # or some snippet under /etc/sssd/sssd.conf.d/) to be present. diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h index 5f04d25eec2..90078dda782 100644 --- a/src/responder/common/responder.h +++ b/src/responder/common/responder.h @@ -141,7 +141,6 @@ struct resp_ctx { bool shutting_down; bool socket_activated; - bool dbus_activated; bool cache_first; bool enumeration_warn_logged; }; diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c index ac0e72790c0..ea9b62bf14c 100644 --- a/src/responder/common/responder_common.c +++ b/src/responder/common/responder_common.c @@ -1316,7 +1316,6 @@ int sss_process_init(TALLOC_CTX *mem_ctx, rctx->confdb_service_path = confdb_service_path; rctx->shutting_down = false; rctx->socket_activated = is_socket_activated(); - rctx->dbus_activated = is_dbus_activated(); talloc_set_destructor((TALLOC_CTX*)rctx, sss_responder_ctx_destructor); @@ -1336,7 +1335,7 @@ int sss_process_init(TALLOC_CTX *mem_ctx, rctx->client_idle_timeout = 10; } - if (rctx->socket_activated || rctx->dbus_activated) { + if (rctx->socket_activated) { ret = responder_setup_idle_timeout_config(rctx); if (ret != EOK) { goto fail; @@ -1507,11 +1506,8 @@ int sss_process_init(TALLOC_CTX *mem_ctx, goto fail; } - DEBUG(SSSDBG_TRACE_FUNC, - "Responder initialization complete (%s)\n", - rctx->socket_activated ? "socket-activated" : - rctx->dbus_activated ? "dbus-activated" : - "explicitly configured"); + DEBUG(SSSDBG_TRACE_FUNC, "Responder initialization complete (%s)\n", + rctx->socket_activated ? "socket-activated" : "explicitly configured"); *responder_ctx = rctx; return EOK; diff --git a/src/sysv/systemd/sssd-ifp.service.in b/src/sysv/systemd/sssd-ifp.service.in index 11d60683439..0d492dde0f2 100644 --- a/src/sysv/systemd/sssd-ifp.service.in +++ b/src/sysv/systemd/sssd-ifp.service.in @@ -10,7 +10,7 @@ EnvironmentFile=-@environment_file@ Type=dbus BusName=org.freedesktop.sssd.infopipe ExecStartPre=-/bin/chown @SSSD_USER@:@SSSD_USER@ @logpath@/sssd_ifp.log -ExecStart=@libexecdir@/sssd/sssd_ifp ${DEBUG_LOGGER} --dbus-activated +ExecStart=@libexecdir@/sssd/sssd_ifp ${DEBUG_LOGGER} --socket-activated CapabilityBoundingSet= @additional_caps@ CAP_IPC_LOCK CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETGID CAP_SETUID Restart=on-failure User=@SSSD_USER@ diff --git a/src/util/server.c b/src/util/server.c index e090aec4ed5..76a558fb512 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -524,7 +524,7 @@ int server_setup(const char *name, bool is_responder, sss_strerror(ret), ret); } - if (!is_socket_activated() && !is_dbus_activated()) { + if (!is_socket_activated()) { ret = chown_debug_file(NULL, uid, gid); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, diff --git a/src/util/util.c b/src/util/util.c index 6546b6027c4..226c746c693 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -34,7 +34,6 @@ #include "util/sss_utf8.h" int socket_activated = 0; -int dbus_activated = 0; static void free_args(char **args) { @@ -1006,15 +1005,6 @@ bool is_socket_activated(void) #endif } -bool is_dbus_activated(void) -{ -#ifdef HAVE_SYSTEMD - return !!dbus_activated; -#else - return false; -#endif -} - int sss_rand(void) { static bool srand_done = false; diff --git a/src/util/util.h b/src/util/util.h index e0e122cee38..6ced1d49dd2 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -97,14 +97,11 @@ _("The group ID to run the server as"), NULL}, extern int socket_activated; -extern int dbus_activated; #ifdef HAVE_SYSTEMD #define SSSD_RESPONDER_OPTS \ { "socket-activated", 0, POPT_ARG_NONE, &socket_activated, 0, \ - _("Informs that the responder has been socket-activated"), NULL }, \ - { "dbus-activated", 0, POPT_ARG_NONE, &dbus_activated, 0, \ - _("Informs that the responder has been dbus-activated"), NULL }, + _("Informs that the responder has been socket-activated"), NULL }, #else #define SSSD_RESPONDER_OPTS #endif @@ -420,9 +417,6 @@ bool is_user_or_group_name(const char *sudo_user_value); /* Returns true if the responder has been socket-activated */ bool is_socket_activated(void); -/* Returns true if the responder has been dbus-activated */ -bool is_dbus_activated(void); - /** * @brief Add two list of strings *