Skip to content

Commit

Permalink
become_user() moved to src/monitor
Browse files Browse the repository at this point in the history
Monitor is the only user of this function and only if built
with support of deprecated 'sssd.conf::user' option.
  • Loading branch information
alexey-tikhonov committed Nov 27, 2024
1 parent a25d8d3 commit 59fbad5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,6 @@ libsss_util_la_SOURCES = \
src/util/util_sss_idmap.c \
src/util/well_known_sids.c \
src/util/string_utils.c \
src/util/become_user.c \
src/util/capabilities.c \
src/util/util_watchdog.c \
src/util/sss_ptr_hash.c \
Expand Down Expand Up @@ -1528,6 +1527,11 @@ sssd_SOURCES = \
src/monitor/nscd.c \
src/confdb/confdb_setup.c \
$(NULL)

if BUILD_CONF_SERVICE_USER_SUPPORT
sssd_SOURCES += src/monitor/become_user.c
endif # BUILD_CONF_SERVICE_USER_SUPPORT

sssd_LDADD = \
$(SSSD_LIBS) \
$(INOTIFY_LIBS) \
Expand Down Expand Up @@ -2208,7 +2212,6 @@ krb5_utils_tests_SOURCES = \
src/providers/data_provider_fo.c \
src/providers/data_provider_opts.c \
src/providers/data_provider_callbacks.c \
src/util/become_user.c \
$(SSSD_FAILOVER_OBJ) \
$(NULL)
krb5_utils_tests_CFLAGS = \
Expand Down Expand Up @@ -4373,7 +4376,6 @@ libsss_krb5_common_la_SOURCES = \
src/providers/krb5/krb5_ccache.c \
src/util/sss_krb5.c \
src/util/sss_iobuf.c \
src/util/become_user.c \
src/util/pac_utils.c \
$(NULL)
libsss_krb5_common_la_CFLAGS = \
Expand Down Expand Up @@ -4684,7 +4686,6 @@ krb5_child_SOURCES = \
src/util/signal.c \
src/util/sss_chain_id.c \
src/util/strtonum.c \
src/util/become_user.c \
src/util/util_errors.c \
src/sss_client/common.c \
src/krb5_plugin/common/utils.c \
Expand Down Expand Up @@ -4727,7 +4728,6 @@ ldap_child_SOURCES = \
src/util/util_ext.c \
src/util/capabilities.c \
src/util/signal.c \
src/util/become_user.c \
src/util/util_errors.c \
$(NULL)
ldap_child_CFLAGS = \
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/monitor/monitor_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ static int check_supplementary_group(gid_t gid)
#endif /* SSSD_NON_ROOT_USER */

#ifdef BUILD_CONF_SERVICE_USER_SUPPORT
errno_t become_user(uid_t uid, gid_t gid, bool keep_set_uid);

int bootstrap_monitor_process(uid_t target_uid, gid_t target_gid)
#else
int bootstrap_monitor_process(void)
Expand Down
2 changes: 1 addition & 1 deletion src/tests/cwrap/test_become_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

/* Yes, a .c file. We need to call static functions during the test */
#include "../../../src/util/become_user.c"
#include "../../../src/monitor/become_user.c"

#include <popt.h>
#include "util/util.h"
Expand Down
3 changes: 0 additions & 3 deletions src/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,6 @@ char **concatenate_string_array(TALLOC_CTX *mem_ctx,
errno_t mod_defaults_list(TALLOC_CTX *mem_ctx, const char **defaults_list,
char **mod_list, char ***_list);

/* from become_user.c */
errno_t become_user(uid_t uid, gid_t gid, bool keep_set_uid);

/* from capabilities.c */
errno_t sss_log_caps_to_str(bool only_non_zero, char **_str);
errno_t sss_set_cap_effective(cap_value_t cap, bool effective);
Expand Down

0 comments on commit 59fbad5

Please sign in to comment.