-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send DS's SDL to clients from the AuthSrv #184
Conversation
The encrypted stream class in *intended* for writing out minified copies of the SDL files for the client, but adding the ability to read encrypted SDL is just such low-hanging fruit that we might as well add support for it.
Co-authored-by: dgelessus <dgelessus@users.noreply.github.com>
The client now prefers to download SDL files from the server, even when `/LocalData` is supplied. Therefore, it is important that DS is always able to serve SDL files without intervention. So, when SDLs are requested from the AuthServ, send down an encrypted copy of the SDLs that DS loaded.
99cbdcd
to
ac7a10e
Compare
I've removed the round-trip minifying step from this PR. Encrypted SDL files are not required for ease of use - DS can encrypt files before sending them down. |
AuthServ/AuthServer.cpp
Outdated
filename = DS::Settings::AuthRoot() + filename; | ||
} | ||
|
||
std::unique_ptr<DS::Stream> stream = std::make_unique<DS::FileStream>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::unique_ptr<DS::Stream> stream = std::make_unique<DS::FileStream>(); | |
auto stream = std::make_unique<DS::FileStream>(); |
A unique_ptr<U>
can be converted to a unique_ptr<T>
if U
derives from T
, so there's no need for the extra casting complexity...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is true, later in the function, a DS::BufferStream
can be moved to this std::unique_ptr
. I'll do some work to remove the fiddly casting to make that more clear.
AuthServ/AuthServer.cpp
Outdated
try { | ||
stream->open(filename.c_str(), "rb"); | ||
static_cast<DS::FileStream*>(stream.get())->open(filename.c_str(), "rb"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static_cast<DS::FileStream*>(stream.get())->open(filename.c_str(), "rb"); | |
stream->open(filename.c_str(), "rb"); |
Co-authored-by: Michael Hansen <zrax0111@gmail.com>
H-uru/Plasma#1450 changed the meaning of
/LocalData
to "use the local PRPs and Python files" but still rely on the server's SDL. This means that clients either need to use the new/LocalSDL
flag to use their own SDL, which is known to be dangerous, or we need to make it easier to get the known correct SDL to clients connecting to DirtSand.Therefore, this adds the ability for DirtSand to automatically send down the SDL it is using internally to clients. It uses the very old auth secure preloader functionality, so it is compatible with all known clients. Most SDL files are quite small, which results in fairly poor download performance. Further, AuthSrv downloads are not compressed. So, I elected to give DirtSand the ability to write out its own SDL file containing all known state descriptors and omitting irrelevant comments and whitespace to give an optimal experience for users.
The last two commits could be deferred to another pull request, but I suspected some of the excess copying and memory management might be remarked upon, so I included those ideas for completeness' sake.