From e6745384157b90f70f3368ca2c90321166b7720a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20=F0=9F=85=B1=2E=20Kildaire?= <21629986@sun.ac.za> Date: Wed, 23 Sep 2020 10:52:33 +0200 Subject: [PATCH] Initial command processing code added, working on authentication for clients --- source/dnetd/dconnection.d | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/dnetd/dconnection.d b/source/dnetd/dconnection.d index e75fb08..e06bb35 100644 --- a/source/dnetd/dconnection.d +++ b/source/dnetd/dconnection.d @@ -88,12 +88,17 @@ public class DConnection : Thread /* Get the command byte */ byte commandByte = message.data[0]; - /* If `auth` command */ + /* If `auth` command (requires: unauthed) */ if(commandByte == 0 && !hasAuthed) { - + /* Get the length of the username */ + byte usernameLength = message.data[1]; + + /* Get the username and password */ + string username = cast(string)message.data[2..usernameLength]; + string password = cast(string)message.data[cast(ubyte)2+usernameLength..message.data.length]; } - /* If `link` command */ + /* If `link` command (requires: unauthed) */ else if(commandByte == 1 && !hasAuthed) {