From fe5120087d24cdd07ef65d85f60eb11f4ae12cf2 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 3 Oct 2024 21:18:12 -0500 Subject: lib: auth: Keep track of username Signed-off-by: Ian Moffett --- lib/include/session.h | 2 ++ lib/libostp/auth.c | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/include/session.h b/lib/include/session.h index 397fa68..39eb1bc 100644 --- a/lib/include/session.h +++ b/lib/include/session.h @@ -30,9 +30,11 @@ #ifndef LIBOSTP_SESSION_H_ #define LIBOSTP_SESSION_H_ +#include #include struct ostp_session { + char username[MAX_USERNAME_LEN]; unsigned char *session_key; int sockfd; }; diff --git a/lib/libostp/auth.c b/lib/libostp/auth.c index 5d69009..559e3b3 100644 --- a/lib/libostp/auth.c +++ b/lib/libostp/auth.c @@ -37,6 +37,7 @@ #include #include #include +#include struct session_td_args { struct ostp_client *c; @@ -79,6 +80,7 @@ passwd_auth(struct ostp_client *c, const unsigned char *session_key) { int error; struct session_auth auth; + struct ostp_session *session; const size_t LEN = sizeof(auth); if (!REQUIRE_USER_AUTH) { @@ -106,6 +108,9 @@ passwd_auth(struct ostp_client *c, const unsigned char *session_key) printf("Failed to ACK user authentication with frame\n"); return error; } + + session = &c->session; + memcpy(session->username, auth.username, sizeof(auth.username)); return 0; } -- cgit v1.2.3