From 9c97692f2f241cab7805dcf54f60dd2009d553b8 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 21 Feb 2025 18:37:10 -0500 Subject: auth: Handle password auth and motd Signed-off-by: Ian Moffett --- lib/libostp/auth.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/libostp/auth.c b/lib/libostp/auth.c index aee8409..5fa59e9 100644 --- a/lib/libostp/auth.c +++ b/lib/libostp/auth.c @@ -177,8 +177,24 @@ handle_srq(struct ostp_client *c, struct ostp_listener *lp, struct session_reque return errno; } + /* Try user auth, not needed if REQUIRE_USER_AUTH is 0 */ + if (passwd_auth(c, lp, session->session_key) != 0) { + free_session_key(session->session_key); + return -1; + } + + /* Handle any requested session parameters */ + if ((error = negotiate_spw(c, session->session_key)) < 0) { + free_session_key(session->session_key); + return -1; } + send_motd(c, session->session_key); + c->authed = 1; + + if (lp->on_connect != NULL) + lp->on_connect(c); + g_have_link = true; return 0; } -- cgit v1.2.3