Browse code

case insensitive in auth method checking (e.g. DIGEST). should authenticate against voipswitch now.

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@918 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Stefan Sayer authored on 30/04/2008 13:32:21
Showing 1 changed files
... ...
@@ -32,6 +32,9 @@
32 32
 
33 33
 #include <map>
34 34
 
35
+#include <cctype>
36
+#include <algorithm>
37
+
35 38
 #define MOD_NAME "uac_auth"
36 39
 
37 40
 EXPORT_SESSION_EVENT_HANDLER_FACTORY(UACAuthFactory, MOD_NAME);
... ...
@@ -245,7 +248,10 @@ string UACAuth::find_attribute(const string& name, const string& header) {
245 248
 
246 249
 bool UACAuth::parse_header(const string& auth_hdr, UACAuthDigestChallenge& challenge) {
247 250
   size_t p = auth_hdr.find_first_not_of(' ');
248
-  if (auth_hdr.substr(p, 6) != "Digest") {
251
+  string method = auth_hdr.substr(p, 6);
252
+  std::transform(method.begin(), method.end(), method.begin(), 
253
+		 (int(*)(int)) toupper);
254
+  if (method != "DIGEST") {
249 255
     ERROR("only Digest auth supported\n");
250 256
     return false;
251 257
   }