<div class="gmail_quote">On Wed, Nov 17, 2010 at 1:07 AM, Ross Finlayson <span dir="ltr"><<a href="mailto:finlayson@live555.com">finlayson@live555.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">We updated the "UserAuthenticationDatabase" used in the RTSP server to have a "requireAuthentication" method that can be overridden in a derived class. We use it so that if default credentials are in use, we don't require authentication.<br>
<br>Basically, this allows implementations to turn authentication on and off at will while the server is running. Unless implementations override requireAuthentication, the behavior is identical to the previous code.<br>
<br>It's a pretty simple change so hopefully it's good enough for inclusion.<br></blockquote><br></div>Yes. In fact, I can think of another way to do this that's even simpler, yet more general:<br><br>Add a new member function<br>
UserAuthenticationDatabase* RTSPServer::setAuthenticationDatabase(UserAuthenticationDatabase* newDB);<br>This would change the server's authentication database, and return the existing one (perhaps NULL).<br><br>
Then, you could turn off authentication simply by doing:<br> UserAuthenticationDatabase* oldDB = myServer->setAuthenticationDatabase(NULL);<br>and turn it back on by doing:<br> myServer->setAuthenticationDatabase(oldDB);<br>
This also has the benefit of not requiring an additional check in the server; the existing check against NULL is sufficient.<br>--</blockquote>
<div> </div>
<div>That would work. But it might also lead to crashing issues if people call setAuthenticationDatabase on something other than the primary Live555 thread. (I can envision a scenario where something calls setAuthenticationDatabase(NULL) at precisely the moment between the NULL check and the actual authentication with the UserAuthenticationDatabase*, which would result in dereferencing a null pointer).</div>
<div> </div>
<div>With the previous change, it can be called anywhere and you wouldn't have to worry about whether or not it was on the primary thread of execution or some other thread. I know Live555 is "single threaded," so maybe you consider this entire line of reasoning invalid, but I think there's considerable room for error with setting the entire object to NULL.</div>
</div>