Merge remote-tracking branch 'upstream/master'

This commit is contained in:
SteveGilvarry 2015-12-20 14:09:26 +11:00
commit 9acc0c34ed
10 changed files with 27 additions and 25 deletions

3
docs/_static/zmstyle.css vendored Normal file
View File

@ -0,0 +1,3 @@
img {
border: 1px solid black !important;
}

View File

@ -1,13 +0,0 @@
@import url("default.css");
div.admonition-note {
border-top: 2px solid red;
border-bottom: 2px solid red;
border-left: 2px solid red;
border-right: 2px solid red;
background-color: #ff6347
}
img {
border: 1px solid black !important;
}

View File

@ -15,6 +15,9 @@
import sys
import os
def setup(app):
app.add_stylesheet('zmstyle.css')
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@ -98,14 +101,15 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
#html_theme = 'default'
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"stickysidebar": "true"
}
#html_theme_options = {
# "stickysidebar": "true"
#}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
@ -130,7 +134,7 @@ html_theme_options = {
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_style='zmstyles.css'
#html_style='zmstyles.css'
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied

View File

@ -71,7 +71,7 @@ void RemoteCamera::Initialise()
}
mNeedAuth = false;
mAuthenticator = new Authenticator(username,password);
mAuthenticator = new zm::Authenticator(username,password);
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));

View File

@ -50,7 +50,7 @@ protected:
// fill required fields and set needAuth
// subsequent requests can set the required authentication header.
bool mNeedAuth;
Authenticator* mAuthenticator;
zm::Authenticator* mAuthenticator;
protected:
struct addrinfo *hp;

View File

@ -306,7 +306,7 @@ int RemoteCameraHttp::GetResponse()
std::string Header = header;
mAuthenticator->checkAuthResponse(Header);
if ( mAuthenticator->auth_method() == AUTH_DIGEST ) {
if ( mAuthenticator->auth_method() == zm::AUTH_DIGEST ) {
Debug( 2, "Need Digest Authentication" );
request = stringtf( "GET %s HTTP/%s\r\n", path.c_str(), config.http_version );
request += stringtf( "User-Agent: %s/%s\r\n", config.http_ua, ZM_VERSION );
@ -750,7 +750,7 @@ Debug(3, "Need more data buffer %d < content length %d", buffer.size(), content_
Debug(2, "Checking for digest auth in %s", authenticate_header );
mAuthenticator->checkAuthResponse(Header);
if ( mAuthenticator->auth_method() == AUTH_DIGEST ) {
if ( mAuthenticator->auth_method() == zm::AUTH_DIGEST ) {
Debug( 2, "Need Digest Authentication" );
request = stringtf( "GET %s HTTP/%s\r\n", path.c_str(), config.http_version );
request += stringtf( "User-Agent: %s/%s\r\n", config.http_ua, ZM_VERSION );

View File

@ -203,9 +203,9 @@ RtspThread::RtspThread( int id, RtspMethod method, const std::string &protocol,
mNeedAuth = false;
StringVector parts = split(auth,":");
if (parts.size() > 1)
mAuthenticator = new Authenticator(parts[0], parts[1]);
mAuthenticator = new zm::Authenticator(parts[0], parts[1]);
else
mAuthenticator = new Authenticator(parts[0], "");
mAuthenticator = new zm::Authenticator(parts[0], "");
}
RtspThread::~RtspThread()

View File

@ -66,7 +66,7 @@ private:
// subsequent requests can set the required authentication header.
bool mNeedAuth;
int respCode;
Authenticator* mAuthenticator;
zm::Authenticator* mAuthenticator;
std::string mHttpSession; ///< Only for RTSP over HTTP sessions

View File

@ -24,6 +24,8 @@
#include <stdlib.h>
#include <string.h>
namespace zm {
Authenticator::Authenticator(std::string &username, std::string password) {
#ifdef HAVE_GCRYPT_H
// Special initialisation for libgcrypt
@ -227,3 +229,5 @@ void Authenticator::checkAuthResponse(std::string &response) {
Debug( 2, "Didn't find auth line in %s", authLine.c_str());
}
}
} // namespace zm

View File

@ -32,6 +32,8 @@
#include <openssl/md5.h>
#endif // HAVE_GCRYPT_H || HAVE_LIBCRYPTO
namespace zm {
enum AuthMethod { AUTH_UNDEFINED = 0, AUTH_BASIC = 1, AUTH_DIGEST = 2 };
class Authenticator {
public:
@ -62,4 +64,6 @@ private:
int nc;
};
} // namespace zm
#endif // ZM_RTSP_AUTH_H