/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
/* Auth process maintains a random secret. Once a user authenticates the
response to the REQUEST command from a master service is augmented with an
auth_token value. This token is the SHA1 hash of the secret, the service
name and the username of the user that just logged in. Using this token the
service (e.g. imap) can login to another service (e.g. imap-urlauth) to
gain access to resources that require additional privileges (e.g. another
user's e-mail).
*/
#include "auth-common.h"
#include "hex-binary.h"
#include "hmac.h"
#include "sha1.h"
#include "randgen.h"
#include "read-full.h"
#include "write-full.h"
#include "safe-memset.h"
#include "auth-settings.h"
#include "auth-token.h"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
static int
unsigned char secret_r[AUTH_TOKEN_SECRET_LEN])
{
if (fd == -1) {
return -1;
}
i_close_fd(&fd);
return -1;
}
/* check secret len and file type */
i_close_fd(&fd);
return -1;
}
/* verify that we're not dealing with a symbolic link */
i_close_fd(&fd);
return -1;
}
/* check security parameters for compromise */
i_close_fd(&fd);
return -1;
}
/* FIXME: fail here to generate new secret if stored one is too old */
if (ret < 0)
else if (ret == 0) {
ret = -1;
}
if (global_auth_settings->debug)
return ret;
}
static int
const unsigned char secret[AUTH_TOKEN_SECRET_LEN])
{
const char *temp_path;
if (fd == -1) {
return -1;
}
if (ret < 0)
ret = -1;
}
if (ret < 0) {
return -1;
}
return -1;
}
if (global_auth_settings->debug)
return 0;
}
void auth_token_init(void)
{
const char *secret_path =
i_error("Failed to write auth token secret file; "
"returned tokens will be invalid once auth restarts");
}
}
}
void auth_token_deinit(void)
{
/* not very useful, but we do it anyway */
}
const char *username, const char *session_id)
{
}