--- /dev/null
+static const char *scram_unescape_username(const char *in)
+{
+ string_t *out;
+
+ /* RFC 5802, Section 5.1:
+
+ The characters ',' or '=' in usernames are sent as '=2C' and '=3D'
+ respectively. If the server receives a username that contains '='
+ not followed by either '2C' or '3D', then the server MUST fail the
+ authentication.
+ */
+
+ out = t_str_new(64);
+ for (; *in != '\0'; in++) {
+ i_assert(in[0] != ','); /* strsplit should have caught this */
+
+ if (in[0] == '=') {
+ if (in[1] == '2' && in[2] == 'C')
+ str_append_c(out, ',');
+ else if (in[1] == '3' && in[2] == 'D')
+ str_append_c(out, '=');
+ else
+ return NULL;
+ in += 2;
+ } else {
+ str_append_c(out, *in);
+ }
+ }
+ return str_c(out);
+}
return str_c(str);
}
-static const char *scram_unescape_username(const char *in)
-{
- string_t *out;
-
- /* RFC 5802, Section 5.1:
-
- The characters ',' or '=' in usernames are sent as '=2C' and '=3D'
- respectively. If the server receives a username that contains '='
- not followed by either '2C' or '3D', then the server MUST fail the
- authentication.
- */
-
- out = t_str_new(64);
- for (; *in != '\0'; in++) {
- i_assert(in[0] != ','); /* strsplit should have caught this */
-
- if (in[0] == '=') {
- if (in[1] == '2' && in[2] == 'C')
- str_append_c(out, ',');
- else if (in[1] == '3' && in[2] == 'D')
- str_append_c(out, '=');
- else
- return NULL;
- in += 2;
- } else {
- str_append_c(out, *in);
- }
- }
- return str_c(out);
-}
+#include "auth-scram-server.c"
static bool
parse_scram_client_first(struct scram_auth_request *request,