platform: introduce a way to hook new session start

Previously this was possible via post_fork_child, but ever since sshd
was split into multiple binaries, this is now no longer possible becase
of execv.
This commit is contained in:
Daniil Tatianin authored and Darren Tucker committed 2025-03-23 11:23:33 +11:00
1 parent 1b311b6b17
commit fdc4853c5b
4 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -140,7 +140,7 @@ SSHD_SESSION_OBJS=sshd-session.o auth-rhosts.o auth-passwd.o \
auth2-gss.o gss-serv.o gss-serv-krb5.o \
loginrec.o auth-pam.o auth-shadow.o auth-sia.o \
sftp-server.o sftp-common.o \
uidswap.o $(SKOBJS)
uidswap.o platform-listen.o $(SKOBJS)
SSHD_AUTH_OBJS=sshd-auth.o \
auth2-methods.o \
+3
View File
@@ -82,3 +82,6 @@ platform_post_fork_child(void)
#endif
}
void platform_pre_session_start(void)
{
}
+1
View File
@@ -24,6 +24,7 @@ void platform_pre_restart(void);
void platform_post_listen(void);
void platform_post_fork_parent(pid_t child_pid);
void platform_post_fork_child(void);
void platform_pre_session_start(void);
int platform_privileged_uidswap(void);
void platform_setusercontext(struct passwd *);
void platform_setusercontext_post_groups(struct passwd *);
+2
View File
@@ -999,6 +999,8 @@ main(int ac, char **av)
closefrom(REEXEC_MIN_FREE_FD);
platform_pre_session_start();
/* Reserve fds we'll need later for reexec things */
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1)
fatal("open %s: %s", _PATH_DEVNULL, strerror(errno));