/** * ConnThread() * * Thread generated for each connection made. **/ void *ConnThread(void *data){ string buff; string encrypt; string decrypt; string user; string pass; ServerSocket *conn = static_cast<ServerSocket*>(data); // Create a Viegnere Cipher key VC vc(10,94); vc.SetKey(); // Get username conn->Send(vc.GetKey()); conn->Recv(buff); // Decrypt username to readable format vc.decrypt(buff.c_str(), vc.szGetKey(), user); // Get password conn->Recv(buff); // Do the same vc.decrypt(buff.c_str(), vc.szGetKey(), pass); // Perform authentication method Auth a(AUTH_SHADOW, user, pass); // If authentication worked, send OK msg if(a.GetAuth()) conn->Send("OK"); else conn->Send("FAIL"); conn = NULL; }