diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-18 12:08:22 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-20 13:12:21 +0300 |
commit | efaa0a6226f7be70f3d7c71f5c4394f2d2306993 (patch) | |
tree | ca0cfdd9709fe6f3202ef9fa6c3c743084f3f677 /src/microhttpd | |
parent | 223013b2e70dfcf4f2fe529224fec10ee5272aa2 (diff) | |
download | libmicrohttpd-efaa0a6226f7be70f3d7c71f5c4394f2d2306993.tar.gz libmicrohttpd-efaa0a6226f7be70f3d7c71f5c4394f2d2306993.zip |
Created digestauth.h header
Diffstat (limited to 'src/microhttpd')
-rw-r--r-- | src/microhttpd/Makefile.am | 2 | ||||
-rw-r--r-- | src/microhttpd/digestauth.c | 19 | ||||
-rw-r--r-- | src/microhttpd/digestauth.h | 38 |
3 files changed, 46 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 | |||
163 | 163 | ||
164 | if ENABLE_DAUTH | 164 | if ENABLE_DAUTH |
165 | libmicrohttpd_la_SOURCES += \ | 165 | libmicrohttpd_la_SOURCES += \ |
166 | digestauth.c \ | 166 | digestauth.c digestauth.h \ |
167 | mhd_bithelpers.h mhd_byteorder.h mhd_align.h \ | 167 | mhd_bithelpers.h mhd_byteorder.h mhd_align.h \ |
168 | md5.c md5.h \ | 168 | md5.c md5.h \ |
169 | sha256.c sha256.h | 169 | 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 @@ | |||
25 | * @author Christian Grothoff (RFC 7616 support) | 25 | * @author Christian Grothoff (RFC 7616 support) |
26 | * @author Karlson2k (Evgeny Grin) | 26 | * @author Karlson2k (Evgeny Grin) |
27 | */ | 27 | */ |
28 | #include "digestauth.h" | ||
28 | #include "platform.h" | 29 | #include "platform.h" |
29 | #include "mhd_limits.h" | 30 | #include "mhd_limits.h" |
30 | #include "internal.h" | 31 | #include "internal.h" |
@@ -119,12 +120,6 @@ | |||
119 | #define VLA_CHECK_LEN_DIGEST(n) \ | 120 | #define VLA_CHECK_LEN_DIGEST(n) \ |
120 | do { if ((n) > MAX_DIGEST) MHD_PANIC (_ ("VLA too big.\n")); } while (0) | 121 | do { if ((n) > MAX_DIGEST) MHD_PANIC (_ ("VLA too big.\n")); } while (0) |
121 | 122 | ||
122 | |||
123 | /** | ||
124 | * Beginning string for any valid Digest authentication header. | ||
125 | */ | ||
126 | #define _BASE "Digest " | ||
127 | |||
128 | /** | 123 | /** |
129 | * Maximum length of a username for digest authentication. | 124 | * Maximum length of a username for digest authentication. |
130 | */ | 125 | */ |
@@ -794,10 +789,10 @@ MHD_digest_auth_get_username (struct MHD_Connection *connection) | |||
794 | NULL)) | 789 | NULL)) |
795 | return NULL; | 790 | return NULL; |
796 | if (0 != strncmp (header, | 791 | if (0 != strncmp (header, |
797 | _BASE, | 792 | _MHD_AUTH_DIGEST_BASE, |
798 | MHD_STATICSTR_LEN_ (_BASE))) | 793 | MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE))) |
799 | return NULL; | 794 | return NULL; |
800 | header += MHD_STATICSTR_LEN_ (_BASE); | 795 | header += MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE); |
801 | if (0 == lookup_sub_value (user, | 796 | if (0 == lookup_sub_value (user, |
802 | sizeof (user), | 797 | sizeof (user), |
803 | header, | 798 | header, |
@@ -1244,10 +1239,10 @@ digest_auth_check_all (struct MHD_Connection *connection, | |||
1244 | NULL)) | 1239 | NULL)) |
1245 | return MHD_DAUTH_WRONG_HEADER; | 1240 | return MHD_DAUTH_WRONG_HEADER; |
1246 | if (0 != strncmp (header, | 1241 | if (0 != strncmp (header, |
1247 | _BASE, | 1242 | _MHD_AUTH_DIGEST_BASE, |
1248 | MHD_STATICSTR_LEN_ (_BASE))) | 1243 | MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE))) |
1249 | return MHD_DAUTH_WRONG_HEADER; | 1244 | return MHD_DAUTH_WRONG_HEADER; |
1250 | header += MHD_STATICSTR_LEN_ (_BASE); | 1245 | header += MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE); |
1251 | left = strlen (header); | 1246 | left = strlen (header); |
1252 | 1247 | ||
1253 | if (1) | 1248 | 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 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2010, 2011, 2012, 2015, 2018 Daniel Pittman and Christian Grothoff | ||
4 | Copyright (C) 2014-2022 Evgeny Grin (Karlson2k) | ||
5 | |||
6 | This library is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU Lesser General Public | ||
8 | License as published by the Free Software Foundation; either | ||
9 | version 2.1 of the License, or (at your option) any later version. | ||
10 | |||
11 | This library is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with this library; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | /** | ||
21 | * @file digestauth.c | ||
22 | * @brief Implements HTTP digest authentication | ||
23 | * @author Amr Ali | ||
24 | * @author Matthieu Speder | ||
25 | * @author Christian Grothoff (RFC 7616 support) | ||
26 | * @author Karlson2k (Evgeny Grin) | ||
27 | */ | ||
28 | |||
29 | #ifndef MHD_DIGESTAUTH_H | ||
30 | #define MHD_DIGESTAUTH_H 1 | ||
31 | /** | ||
32 | * Beginning string for any valid Digest authentication header. | ||
33 | */ | ||
34 | #define _MHD_AUTH_DIGEST_BASE "Digest " | ||
35 | |||
36 | #endif /* ! MHD_DIGESTAUTH_H */ | ||
37 | |||
38 | /* end of digestauth.h */ | ||