gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12965 - in libmicrohttpd/src: daemon testcurl


From: gnunet
Subject: [GNUnet-SVN] r12965 - in libmicrohttpd/src: daemon testcurl
Date: Fri, 10 Sep 2010 14:41:31 +0200

Author: grothoff
Date: 2010-09-10 14:41:30 +0200 (Fri, 10 Sep 2010)
New Revision: 12965

Modified:
   libmicrohttpd/src/daemon/digestauth.c
   libmicrohttpd/src/testcurl/daemontest_digestauth.c
Log:
fixes

Modified: libmicrohttpd/src/daemon/digestauth.c
===================================================================
--- libmicrohttpd/src/daemon/digestauth.c       2010-09-10 12:31:43 UTC (rev 
12964)
+++ libmicrohttpd/src/daemon/digestauth.c       2010-09-10 12:41:30 UTC (rev 
12965)
@@ -120,7 +120,7 @@
 
 
 /**
- * calculate request-digest/response-digest as per RFC2617 spec 
+ * Calculate request-digest/response-digest as per RFC2617 spec 
  * 
  * @param ha1 H(A1)
  * @param nonce nonce from server
@@ -151,12 +151,17 @@
   MD5Init (&md5);
   MD5Update (&md5, method, strlen(method));
   MD5Update (&md5, ":", 1);
-  MD5Update (&md5, uri, strlen(uri));  
+  MD5Update (&md5, uri, strlen(uri)); 
+#if 0
   if (strcasecmp(qop, "auth-int") == 0) 
     {
+      /* This is dead code since the rest of this module does
+        not support auth-int. */
       MD5Update (&md5, ":", 1);
-      MD5Update (&md5, hentity, strlen(hentity));
-    }  
+      if (hentity != NULL)
+       MD5Update (&md5, hentity, strlen(hentity));
+    }
+#endif  
   MD5Final (ha2, &md5);
   cvthex(ha2, MD5_DIGEST_SIZE, ha2hex);
   MD5Init (&md5);  
@@ -317,10 +322,14 @@
       pthread_mutex_unlock(&connection->daemon->nnc_lock);
       return MHD_YES;
     }
-  if ( (nc >= connection->daemon->nnc[off].nc) ||
+  if ( (nc <= connection->daemon->nnc[off].nc) ||
        (0 != strcmp(connection->daemon->nnc[off].nonce, nonce)) )
     {
       pthread_mutex_unlock(&connection->daemon->nnc_lock);
+#if HAVE_MESSAGES
+      MHD_DLOG (connection->daemon, 
+               "Stale nonce received.  If this happens a lot, you should 
probably increase the size of the nonce array.\n");
+#endif
       return MHD_NO;
     }
   connection->daemon->nnc[off].nc = nc;
@@ -433,8 +442,7 @@
   const char *header;
   char nonce[MAX_NONCE_LENGTH];
   char cnonce[MAX_NONCE_LENGTH];
-  /* char qop[15]; // Uncomment when supporting "auth-int" */  
-  const char * qop = "auth"; /* "auth-int" is not supported */
+  char qop[15]; /* auth,auth-int */
   char nc[20];
   char response[MAX_AUTH_RESPONSE_LENGTH];
   const char *hentity = NULL; /* "auth-int" is not supported */
@@ -525,8 +533,9 @@
     if ( (0 == lookup_sub_value(cnonce,
                                sizeof (cnonce), 
                                header, "cnonce")) ||
-        /*      (0 == lookup_sub_value(qop, sizeof (qop), header, "qop")) || 
// Uncomment when supporting "auth-int" */
-        (0 != strcmp (qop, "auth")) ||
+        (0 == lookup_sub_value(qop, sizeof (qop), header, "qop")) ||
+        ( (0 != strcmp (qop, "auth")) && 
+          (0 != strcmp (qop, "")) ) ||
         (0 == lookup_sub_value(nc, sizeof (nc), header, "nc"))  ||
         (1 != sscanf (nc, "%u", &nci)) ||
         (0 == lookup_sub_value(response, sizeof (response), header, 
"response")) )
@@ -627,4 +636,5 @@
   return ret;
 }
 
+
 /* end of digestauth.c */

Modified: libmicrohttpd/src/testcurl/daemontest_digestauth.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_digestauth.c  2010-09-10 12:31:43 UTC 
(rev 12964)
+++ libmicrohttpd/src/testcurl/daemontest_digestauth.c  2010-09-10 12:41:30 UTC 
(rev 12965)
@@ -118,6 +118,7 @@
   return ret;
 }
 
+
 static int
 testDigestAuth ()
 {
@@ -158,10 +159,9 @@
   (void) close(fd);
   d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
                         1337, NULL, NULL, &ahc_echo, PAGE,
-                                               MHD_OPTION_DIGEST_AUTH_RANDOM, 
rnd,
-                                               
MHD_OPTION_DIGEST_AUTH_RAND_SIZE, sizeof(rnd),
-                                               MHD_OPTION_NONCE_NC_SIZE, 300,
-                                               MHD_OPTION_END);
+                       MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
+                       MHD_OPTION_NONCE_NC_SIZE, 300,
+                       MHD_OPTION_END);
   if (d == NULL)
     return 1;
   c = curl_easy_init ();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]