aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-04-24 00:23:55 +0200
committerToni Uhlig <matzeton@googlemail.com>2018-04-24 00:23:55 +0200
commitb14059ea3a1f2e0a41d90ababf27473c026042d0 (patch)
treeb36e82bf6ff28805ffab4870d2405dbb62e1fe8e /src/main.c
parent8be43bc691b38b582aca2f8c3bbf232fbb4d495e (diff)
POTD skeleton #26.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index ec7b698..084f287 100644
--- a/src/main.c
+++ b/src/main.c
@@ -42,7 +42,11 @@ int main(int argc, char *argv[])
}
{
- jail_init(&jail, BUFSIZ);
+ jail_init_ctx(&jail, MAX_STACKSIZE);
+ ABORT_ON_FATAL( jail_setup(jail, "127.0.0.1", "33333"),
+ "Jail daemon setup" );
+ ABORT_ON_FATAL( jail_validate_ctx(jail),
+ "Jail validation" );
ABORT_ON_FATAL( jail_daemonize(jail),
"Jail daemon startup" );
}
@@ -64,8 +68,7 @@ int main(int argc, char *argv[])
for (size_t i = 0; i < srv_siz; ++i) {
D("Initialising redirector service on port %s", ssh_ports[i]);
- ABORT_ON_FATAL( server_init_ctx(&srv[i], ssh_fwd),
- "Server initialisation" );
+ server_init_ctx(&srv[i], ssh_fwd);
ABORT_ON_FATAL( server_setup(srv[i], NULL, ssh_ports[i]),
"Server setup" );
ABORT_ON_FATAL( server_validate_ctx(srv[i]),
@@ -77,6 +80,9 @@ int main(int argc, char *argv[])
D2("epoll_fd: %d", epoll_fd);
ABORT_ON_FATAL( epoll_fd < 0, "Server epoll setup" );
+ ABORT_ON_FATAL( setgid(65534), "Change group" );
+ ABORT_ON_FATAL( setuid(65534), "Change user" );
+
N("%s", "Server epoll mainloop");
ABORT_ON_FATAL( server_mainloop_epoll( epoll_fd, srv, srv_siz ),
"Server epoll mainloop" );