diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-30 21:54:09 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-31 11:45:36 +0300 |
commit | 9039d65241daf512e7756319cd64d3d54750cb22 (patch) | |
tree | 9c109e217ad1014a89de5495fcebdc1723672e31 /src/microhttpd/digestauth.h | |
parent | c15077e312ffe934b242c7ecc6559c6eb4eb62cb (diff) | |
download | libmicrohttpd-9039d65241daf512e7756319cd64d3d54750cb22.tar.gz libmicrohttpd-9039d65241daf512e7756319cd64d3d54750cb22.zip |
authentication: reworked header parsing
Added single function to parse all enabled authentication schemes header
strings.
The parsing result is cached and reused thus avoiding repetitive header
parsing.
The new function correctly "unquotes" values (backslashes are removed)
as required by RFC.
Diffstat (limited to 'src/microhttpd/digestauth.h')
-rw-r--r-- | src/microhttpd/digestauth.h | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/microhttpd/digestauth.h b/src/microhttpd/digestauth.h index 689c0487..77c7c402 100644 --- a/src/microhttpd/digestauth.h +++ b/src/microhttpd/digestauth.h | |||
@@ -28,10 +28,48 @@ | |||
28 | 28 | ||
29 | #ifndef MHD_DIGESTAUTH_H | 29 | #ifndef MHD_DIGESTAUTH_H |
30 | #define MHD_DIGESTAUTH_H 1 | 30 | #define MHD_DIGESTAUTH_H 1 |
31 | |||
32 | #include "mhd_options.h" | ||
33 | #include "mhd_str.h" | ||
34 | #ifdef HAVE_STDBOOL_H | ||
35 | #include <stdbool.h> | ||
36 | #endif /* HAVE_STDBOOL_H */ | ||
37 | |||
38 | |||
39 | /** | ||
40 | * The maximum supported size for Digest Auth parameters, like "real", | ||
41 | * "username" etc. This limitation is used only for quoted parameters. | ||
42 | * Parameters without quoted backslash character will be processed as long | ||
43 | * as they fit connection pool (buffer) size. | ||
44 | */ | ||
45 | #define _MHD_AUTH_DIGEST_MAX_PARAM_SIZE (65535) | ||
46 | |||
31 | /** | 47 | /** |
32 | * Beginning string for any valid Digest authentication header. | 48 | * Beginning string for any valid Digest Authentication header. |
33 | */ | 49 | */ |
34 | #define _MHD_AUTH_DIGEST_BASE "Digest " | 50 | #define _MHD_AUTH_DIGEST_BASE "Digest" |
51 | |||
52 | struct MHD_RqDAuthParam | ||
53 | { | ||
54 | struct _MHD_cstr_w_len value; | ||
55 | bool quoted; | ||
56 | }; | ||
57 | |||
58 | struct MHD_RqDAuth | ||
59 | { | ||
60 | struct MHD_RqDAuthParam nonce; | ||
61 | struct MHD_RqDAuthParam opaque; | ||
62 | struct MHD_RqDAuthParam algorithm; | ||
63 | struct MHD_RqDAuthParam response; | ||
64 | struct MHD_RqDAuthParam username; | ||
65 | struct MHD_RqDAuthParam username_ext; | ||
66 | struct MHD_RqDAuthParam realm; | ||
67 | struct MHD_RqDAuthParam uri; | ||
68 | struct MHD_RqDAuthParam qop; | ||
69 | struct MHD_RqDAuthParam cnonce; | ||
70 | struct MHD_RqDAuthParam nc; | ||
71 | bool userhash; | ||
72 | }; | ||
35 | 73 | ||
36 | #endif /* ! MHD_DIGESTAUTH_H */ | 74 | #endif /* ! MHD_DIGESTAUTH_H */ |
37 | 75 | ||