Skip to content

Commit fdc4853

Browse files
d-tatianindaztucker
authored andcommitted
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.
1 parent 1b311b6 commit fdc4853

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ SSHD_SESSION_OBJS=sshd-session.o auth-rhosts.o auth-passwd.o \
140140
auth2-gss.o gss-serv.o gss-serv-krb5.o \
141141
loginrec.o auth-pam.o auth-shadow.o auth-sia.o \
142142
sftp-server.o sftp-common.o \
143-
uidswap.o $(SKOBJS)
143+
uidswap.o platform-listen.o $(SKOBJS)
144144

145145
SSHD_AUTH_OBJS=sshd-auth.o \
146146
auth2-methods.o \

platform-listen.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,6 @@ platform_post_fork_child(void)
8282
#endif
8383
}
8484

85+
void platform_pre_session_start(void)
86+
{
87+
}

platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ void platform_pre_restart(void);
2424
void platform_post_listen(void);
2525
void platform_post_fork_parent(pid_t child_pid);
2626
void platform_post_fork_child(void);
27+
void platform_pre_session_start(void);
2728
int platform_privileged_uidswap(void);
2829
void platform_setusercontext(struct passwd *);
2930
void platform_setusercontext_post_groups(struct passwd *);

sshd-session.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,8 @@ main(int ac, char **av)
999999

10001000
closefrom(REEXEC_MIN_FREE_FD);
10011001

1002+
platform_pre_session_start();
1003+
10021004
/* Reserve fds we'll need later for reexec things */
10031005
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1)
10041006
fatal("open %s: %s", _PATH_DEVNULL, strerror(errno));

0 commit comments

Comments
 (0)