]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Extract private header from mech-digest-md5
authorMarkus Valentin <markus.valentin@open-xchange.com>
Thu, 2 Apr 2020 06:38:32 +0000 (08:38 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 24 Apr 2020 12:00:22 +0000 (12:00 +0000)
This is needed to allow testing of the mech-digest-md5 mechanism.

src/auth/Makefile.am
src/auth/mech-digest-md5-private.h [new file with mode: 0644]
src/auth/mech-digest-md5.c

index 1e4a24d7a73b2aabf50e3b223f07046c7a93bf3e..cf46e430a0f2fce68e679c6ffa069a04838f4277 100644 (file)
@@ -166,6 +166,7 @@ headers = \
        auth-master-connection.h \
        mech-otp-skey-common.h \
        mech-plain-common.h \
+       mech-digest-md5-private.h \
        mech-scram.h \
        auth-penalty.h \
        auth-policy.h \
diff --git a/src/auth/mech-digest-md5-private.h b/src/auth/mech-digest-md5-private.h
new file mode 100644 (file)
index 0000000..fb9ff80
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef MECH_DIGEST_MD5_PRIVATE_H
+#define MECH_DIGEST_MD5_PRIVATE_H
+
+#include "auth-request.h"
+
+enum qop_option {
+       QOP_AUTH        = 0x01, /* authenticate */
+       QOP_AUTH_INT    = 0x02, /* + integrity protection, not supported yet */
+       QOP_AUTH_CONF   = 0x04, /* + encryption, not supported yet */
+
+       QOP_COUNT       = 3
+};
+
+struct digest_auth_request {
+       struct auth_request auth_request;
+
+       pool_t pool;
+
+       /* requested: */
+       char *nonce;
+       enum qop_option qop;
+
+       /* received: */
+       char *username;
+       char *cnonce;
+       char *nonce_count;
+       char *qop_value;
+       char *digest_uri; /* may be NULL */
+       char *authzid; /* may be NULL, authorization ID */
+       unsigned char response[32];
+       unsigned long maxbuf;
+       bool nonce_found:1;
+
+       /* final reply: */
+       char *rspauth;
+};
+
+#endif
index 9e81907b781759e86d3251b546dc3af9d324b870..98057eb41017791141b295691f736fa7ef363b10 100644 (file)
@@ -6,6 +6,7 @@
 #include "base64.h"
 #include "buffer.h"
 #include "hex-binary.h"
+#include "mech-digest-md5-private.h"
 #include "md5.h"
 #include "randgen.h"
 #include "str.h"
 /* Linear whitespace */
 #define IS_LWS(c) ((c) == ' ' || (c) == '\t')
 
-enum qop_option {
-       QOP_AUTH        = 0x01, /* authenticate */
-       QOP_AUTH_INT    = 0x02, /* + integrity protection, not supported yet */
-       QOP_AUTH_CONF   = 0x04, /* + encryption, not supported yet */
-
-       QOP_COUNT       = 3
-};
-
 static const char *qop_names[] = { "auth", "auth-int", "auth-conf" };
 
-struct digest_auth_request {
-       struct auth_request auth_request;
-
-       pool_t pool;
-
-       /* requested: */
-       char *nonce;
-       enum qop_option qop;
-
-       /* received: */
-       char *username;
-       char *cnonce;
-       char *nonce_count;
-       char *qop_value;
-       char *digest_uri; /* may be NULL */
-       char *authzid; /* may be NULL, authorization ID */
-       unsigned char response[32];
-       unsigned long maxbuf;
-       bool nonce_found:1;
-
-       /* final reply: */
-       char *rspauth;
-};
-
 static string_t *get_digest_challenge(struct digest_auth_request *request)
 {
        const struct auth_settings *set = request->auth_request.set;