diff options
author | Ian Moffett <ian@osmora.org> | 2025-02-21 18:37:10 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-02-21 18:37:48 -0500 |
commit | 9c97692f2f241cab7805dcf54f60dd2009d553b8 (patch) | |
tree | 5749936dcb76fbbe9bbb950dc141646fb1287152 | |
parent | f87a983a8312da4995133ad69b020579c621a99b (diff) |
auth: Handle password auth and motd
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | lib/libostp/auth.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; } |