diff options
author | Ian Moffett <ian@osmora.org> | 2024-10-03 21:22:41 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-10-03 21:22:41 -0500 |
commit | 7f5b307413a29502791fb8cbe6209c0b0f5d2006 (patch) | |
tree | efb44f9f27580194c91857c9b3138b202ef9da29 /lib/libostp/session.c | |
parent | 85c4c48480c6f0aabcd8ccb38036392b71a05c2e (diff) |
server: Fix handling of multiple clients
Improve handling of multiple connected clients. This fixes issues related
to blocking of one client while another is connected as well as certain
race conditions.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/libostp/session.c')
-rw-r--r-- | lib/libostp/session.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libostp/session.c b/lib/libostp/session.c index 151cad9..7087cc7 100644 --- a/lib/libostp/session.c +++ b/lib/libostp/session.c @@ -63,7 +63,7 @@ static const char *auth_codestr[] = { }; static int -send_auth(int sockfd, const unsigned char *session_key) +send_auth(int sockfd, const unsigned char *session_key, struct ostp_session *s) { struct session_auth auth; struct termios oldt, newt; @@ -129,6 +129,7 @@ send_auth(int sockfd, const unsigned char *session_key) return -1; } + memcpy(s->username, auth.username, sizeof(auth.username)); return 0; } @@ -260,7 +261,7 @@ session_new(const char *host, struct ostp_session *res) gen_session_key(keypair.privkey, serv_pubkey, &session_key); /* User authentication occurs before sending SPWs */ - if ((error = send_auth(sockfd, session_key)) < 0) { + if ((error = send_auth(sockfd, session_key, res)) < 0) { return error; } |