/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
/* Used internally by Dovecot processes to authenticate against each others
(e.g. imap to imap-urlauth). See auth-token.c */
#include "auth-common.h"
#include "mech.h"
#include "safe-memset.h"
#include "auth-token.h"
static void
{
char *auth_token;
int count;
/* service \0 pid \0 username \0 session_id \0 auth_token */
count = 0;
for (i = 0; i < data_size; i++) {
if (data[i] == '\0') {
count++; i++;
if (count == 1)
else if (count == 2)
else if (count == 3)
session_id = (const char *)data + i;
else {
break;
}
}
}
if (count != 4) {
/* invalid input */
/* invalid username */
} else {
const char *valid_token =
if (auth_token != NULL &&
} else {
}
}
/* make sure it's cleared */
if (auth_token != NULL)
}
{
return request;
}
"DOVECOT-TOKEN",
};