# -----------------------------------------------------------------------------
# cockpit-session

libexec_PROGRAMS += cockpit-session

cockpit_session_LDADD = \
	$(libcockpit_common_nodeps_a_LIBS) \
	$(krb5_LIBS) \
	$(libsystemd_LIBS) \
	-lpam \
	$(NULL)

cockpit_session_SOURCES = \
	src/common/cockpitclosefrom.c \
	src/common/cockpithacks.h \
	src/session/client-certificate.h \
	src/session/client-certificate.c \
	src/session/client-certificate.h \
	src/session/session-utils.c \
	src/session/session-utils.h \
	src/session/session.c \
	$(NULL)

# If running cockpit-ws as a non-standard user, we also set up
# cockpit-session to be setuid root, but only runnable by cockpit-session
install-exec-hook::
	chown -f root:$(COCKPIT_WSINSTANCE_GROUP) $(DESTDIR)$(libexecdir)/cockpit-session || true
	test "$(COCKPIT_USER)" != "root" && chmod -f 4750 $(DESTDIR)$(libexecdir)/cockpit-session || true
