gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 02/06: Created digestauth.h header


From: gnunet
Subject: [libmicrohttpd] 02/06: Created digestauth.h header
Date: Sat, 28 May 2022 18:56:34 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit efaa0a6226f7be70f3d7c71f5c4394f2d2306993
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed May 18 12:08:22 2022 +0300

    Created digestauth.h header
---
 src/microhttpd/Makefile.am               |  2 +-
 src/microhttpd/digestauth.c              | 19 ++++++----------
 src/microhttpd/digestauth.h              | 38 ++++++++++++++++++++++++++++++++
 w32/common/libmicrohttpd-files.vcxproj   |  1 +
 w32/common/libmicrohttpd-filters.vcxproj |  3 +++
 5 files changed, 50 insertions(+), 13 deletions(-)

diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index 791c2a1b..20e29c66 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -163,7 +163,7 @@ endif
 
 if ENABLE_DAUTH
 libmicrohttpd_la_SOURCES += \
-  digestauth.c \
+  digestauth.c digestauth.h \
   mhd_bithelpers.h mhd_byteorder.h mhd_align.h \
   md5.c md5.h \
   sha256.c sha256.h
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index cda8b478..a560f2a6 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -25,6 +25,7 @@
  * @author Christian Grothoff (RFC 7616 support)
  * @author Karlson2k (Evgeny Grin)
  */
+#include "digestauth.h"
 #include "platform.h"
 #include "mhd_limits.h"
 #include "internal.h"
@@ -119,12 +120,6 @@
 #define VLA_CHECK_LEN_DIGEST(n) \
   do { if ((n) > MAX_DIGEST) MHD_PANIC (_ ("VLA too big.\n")); } while (0)
 
-
-/**
- * Beginning string for any valid Digest authentication header.
- */
-#define _BASE   "Digest "
-
 /**
  * Maximum length of a username for digest authentication.
  */
@@ -794,10 +789,10 @@ MHD_digest_auth_get_username (struct MHD_Connection 
*connection)
                                                NULL))
     return NULL;
   if (0 != strncmp (header,
-                    _BASE,
-                    MHD_STATICSTR_LEN_ (_BASE)))
+                    _MHD_AUTH_DIGEST_BASE,
+                    MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE)))
     return NULL;
-  header += MHD_STATICSTR_LEN_ (_BASE);
+  header += MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE);
   if (0 == lookup_sub_value (user,
                              sizeof (user),
                              header,
@@ -1244,10 +1239,10 @@ digest_auth_check_all (struct MHD_Connection 
*connection,
                                                NULL))
     return MHD_DAUTH_WRONG_HEADER;
   if (0 != strncmp (header,
-                    _BASE,
-                    MHD_STATICSTR_LEN_ (_BASE)))
+                    _MHD_AUTH_DIGEST_BASE,
+                    MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE)))
     return MHD_DAUTH_WRONG_HEADER;
-  header += MHD_STATICSTR_LEN_ (_BASE);
+  header += MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE);
   left = strlen (header);
 
   if (1)
diff --git a/src/microhttpd/digestauth.h b/src/microhttpd/digestauth.h
new file mode 100644
index 00000000..689c0487
--- /dev/null
+++ b/src/microhttpd/digestauth.h
@@ -0,0 +1,38 @@
+/*
+     This file is part of libmicrohttpd
+     Copyright (C) 2010, 2011, 2012, 2015, 2018 Daniel Pittman and Christian 
Grothoff
+     Copyright (C) 2014-2022 Evgeny Grin (Karlson2k)
+
+     This library is free software; you can redistribute it and/or
+     modify it under the terms of the GNU Lesser General Public
+     License as published by the Free Software Foundation; either
+     version 2.1 of the License, or (at your option) any later version.
+
+     This library is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     Lesser General Public License for more details.
+
+     You should have received a copy of the GNU Lesser General Public
+     License along with this library; if not, write to the Free Software
+     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 
 USA
+*/
+/**
+ * @file digestauth.c
+ * @brief Implements HTTP digest authentication
+ * @author Amr Ali
+ * @author Matthieu Speder
+ * @author Christian Grothoff (RFC 7616 support)
+ * @author Karlson2k (Evgeny Grin)
+ */
+
+#ifndef MHD_DIGESTAUTH_H
+#define MHD_DIGESTAUTH_H 1
+/**
+ * Beginning string for any valid Digest authentication header.
+ */
+#define _MHD_AUTH_DIGEST_BASE   "Digest "
+
+#endif /* ! MHD_DIGESTAUTH_H */
+
+/* end of digestauth.h */
diff --git a/w32/common/libmicrohttpd-files.vcxproj 
b/w32/common/libmicrohttpd-files.vcxproj
index 1a662755..2fa2debc 100644
--- a/w32/common/libmicrohttpd-files.vcxproj
+++ b/w32/common/libmicrohttpd-files.vcxproj
@@ -34,6 +34,7 @@
     <ClInclude Include="$(MhdSrc)microhttpd\base64.h" />
     <ClInclude Include="$(MhdSrc)microhttpd\basicauth.h" />
     <ClInclude Include="$(MhdSrc)microhttpd\connection.h" />
+    <ClInclude Include="$(MhdSrc)microhttpd\digestauth.h" />
     <ClInclude Include="$(MhdSrc)microhttpd\internal.h" />
     <ClInclude Include="$(MhdSrc)microhttpd\md5.h" />
     <ClInclude Include="$(MhdSrc)microhttpd\sha256.h" />
diff --git a/w32/common/libmicrohttpd-filters.vcxproj 
b/w32/common/libmicrohttpd-filters.vcxproj
index f91d860d..684f8beb 100644
--- a/w32/common/libmicrohttpd-filters.vcxproj
+++ b/w32/common/libmicrohttpd-filters.vcxproj
@@ -49,6 +49,9 @@
     <ClInclude Include="$(MhdSrc)microhttpd\connection.h">
       <Filter>Internal Headers</Filter>
     </ClInclude>
+    <ClInclude Include="$(MhdSrc)microhttpd\digestauth.h">
+      <Filter>Internal Headers</Filter>
+    </ClInclude>
     <ClInclude Include="$(MhdSrc)microhttpd\internal.h">
       <Filter>Internal Headers</Filter>
     </ClInclude>

-- 
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]