summaryrefslogtreecommitdiffstats
path: root/net/http/http_auth_handler_ntlm.h
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-11 22:21:29 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-11 22:21:29 +0000
commit385a467616a675d979514c64bda2fa5ddddb70c0 (patch)
treea50ec11679303302d305c5dffb700847ce6c93da /net/http/http_auth_handler_ntlm.h
parent5203a4f3fc6bd8bcb2d521db09bc2625bf48c2cc (diff)
downloadchromium_src-385a467616a675d979514c64bda2fa5ddddb70c0.zip
chromium_src-385a467616a675d979514c64bda2fa5ddddb70c0.tar.gz
chromium_src-385a467616a675d979514c64bda2fa5ddddb70c0.tar.bz2
Add unit tests for NTLM authentication. This requires
overriding the functions that generate random bytes or get the local host name, so that the generated NTLM messages are reproducible. R=eroman BUG=6567,6824 Review URL: http://codereview.chromium.org/42052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler_ntlm.h')
-rw-r--r--net/http/http_auth_handler_ntlm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/http/http_auth_handler_ntlm.h b/net/http/http_auth_handler_ntlm.h
index 05ce06b..00c246a 100644
--- a/net/http/http_auth_handler_ntlm.h
+++ b/net/http/http_auth_handler_ntlm.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "net/http/http_auth_handler.h"
@@ -17,6 +18,15 @@ class NTLMAuthModule;
// Code for handling HTTP NTLM authentication.
class HttpAuthHandlerNTLM : public HttpAuthHandler {
public:
+ // A function that generates n random bytes in the output buffer.
+ typedef void (*GenerateRandomProc)(uint8* output, size_t n);
+
+ // A function that returns the local host name as a null-terminated string
+ // in the output buffer. Returns an empty string if the local host name is
+ // not available.
+ // TODO(wtc): return a std::string instead.
+ typedef void (*HostNameProc)(char* name, size_t namelen);
+
HttpAuthHandlerNTLM();
virtual ~HttpAuthHandlerNTLM();
@@ -28,6 +38,10 @@ class HttpAuthHandlerNTLM : public HttpAuthHandler {
const HttpRequestInfo* request,
const ProxyInfo* proxy);
+ // For unit tests to override the GenerateRandom and GetHostName functions.
+ static void SetGenerateRandomProc(GenerateRandomProc proc);
+ static void SetHostNameProc(HostNameProc proc);
+
protected:
virtual bool Init(std::string::const_iterator challenge_begin,
std::string::const_iterator challenge_end) {