gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 03/04: Updated example to use new digest auth function


From: gnunet
Subject: [libmicrohttpd] 03/04: Updated example to use new digest auth function
Date: Fri, 13 May 2022 16:23:44 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 001b6b87fddcb14eb176411ba96ae7d985c88c12
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri May 13 17:22:28 2022 +0300

    Updated example to use new digest auth function
---
 src/examples/digest_auth_example.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/examples/digest_auth_example.c 
b/src/examples/digest_auth_example.c
index f8208d97..b3741bc5 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -48,7 +48,7 @@ ahc_echo (void *cls,
   char *username;
   const char *password = "testpass";
   const char *realm = "test@example.com";
-  int res;
+  enum MHD_DigestAuthResult res_e;
   enum MHD_Result ret;
   static int already_called_marker;
   (void) cls;               /* Unused. Silent compiler warning. */
@@ -57,7 +57,6 @@ ahc_echo (void *cls,
   (void) version;           /* Unused. Silent compiler warning. */
   (void) upload_data;       /* Unused. Silent compiler warning. */
   (void) upload_data_size;  /* Unused. Silent compiler warning. */
-  (void) req_cls;           /* Unused. Silent compiler warning. */
 
   if (&already_called_marker != *req_cls)
   { /* Called for the first time, request not fully read yet */
@@ -80,13 +79,13 @@ ahc_echo (void *cls,
     MHD_destroy_response (response);
     return ret;
   }
-  res = MHD_digest_auth_check (connection, realm,
-                               username,
-                               password,
-                               300);
+  res_e = MHD_digest_auth_check3 (connection, realm,
+                                  username,
+                                  password,
+                                  300,
+                                  MHD_DIGEST_ALG_MD5);
   MHD_free (username);
-  if ( (res == MHD_INVALID_NONCE) ||
-       (res == MHD_NO) )
+  if (res_e != MHD_DAUTH_OK)
   {
     response =
       MHD_create_response_from_buffer_static (strlen (DENIED),
@@ -96,8 +95,8 @@ ahc_echo (void *cls,
     ret = MHD_queue_auth_fail_response2 (connection, realm,
                                          MY_OPAQUE_STR,
                                          response,
-                                         (res == MHD_INVALID_NONCE) ? MHD_YES :
-                                         MHD_NO,
+                                         (res_e == MHD_DAUTH_NONCE_STALE) ?
+                                         MHD_YES : MHD_NO,
                                          MHD_DIGEST_ALG_MD5);
     MHD_destroy_response (response);
     return ret;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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