auth-request.h revision 1eedfce593fd29b5a5dee8d8ae3d82ab63d99cbf
#ifndef AUTH_REQUEST_H
#define AUTH_REQUEST_H
#include "net.h"
#include "var-expand.h"
#include "mech.h"
#include "userdb.h"
#include "passdb.h"
#include "auth-request-var-expand.h"
#include "password-scheme.h"
#define AUTH_REQUEST_USER_KEY_IGNORE " "
struct auth_client_connection;
enum auth_request_state {
};
enum auth_request_secured {
};
struct auth_request {
int refcount;
enum auth_request_state state;
/* user contains the user who is being authenticated.
When master user is logging in as someone else, it gets more
complicated. Initially user is set to master's username and the
requested_login_user is set to destination username. After masterdb
has validated user as a valid master user, master_user is set to
user and user is set to requested_login_user. */
/* original_username contains the username exactly as given by the
client. this is needed at least with DIGEST-MD5 for password
verification. however with master logins the master username has
been dropped from it. */
const char *original_username;
/* the username after doing all internal translations, but before
being changed by a db lookup */
const char *translated_username;
/* realm for the request, may be specified by some auth mechanisms */
const char *realm;
char *mech_password; /* set if verify_plain() is called */
char *passdb_password; /* set after password lookup if successful */
/* extra_fields are returned in authentication reply. Fields prefixed
with "userdb_" are automatically placed to userdb_reply instead. */
struct auth_fields *extra_fields;
/* the whole userdb result reply */
struct auth_fields *userdb_reply;
/* The final result of passdb lookup (delayed due to asynchronous
proxy DNS lookups) */
enum passdb_result passdb_result;
const struct mech_module *mech;
const struct auth_settings *set;
struct auth_passdb *passdb;
struct auth_userdb *userdb;
/* passdb lookups have a handler, userdb lookups don't */
struct auth_request_handler *handler;
struct auth_master_connection *master;
unsigned int connect_uid;
unsigned int client_pid;
unsigned int id;
unsigned int policy_penalty;
unsigned int last_penalty;
const unsigned char *initial_response;
union {
const char *credentials_scheme;
const unsigned char *delayed_credentials;
void *context;
/* this is a lookup on auth socket (not login socket).
skip any proxying stuff if enabled. */
bool auth_only:1;
/* we're doing a userdb lookup now (we may have done passdb lookup
earlier) */
bool userdb_lookup:1;
/* DIGEST-MD5 kludge */
bool domain_is_realm:1;
/* auth_debug is enabled for this request */
bool debug:1;
enum auth_request_secured secured;
/* flags received from auth client: */
bool final_resp_ok:1;
bool no_penalty:1;
bool valid_client_cert:1;
bool cert_username:1;
bool request_auth_token:1;
bool successful:1;
bool internal_failure:1;
bool passdbs_seen_user_unknown:1;
bool passdbs_seen_internal_failure:1;
bool userdbs_seen_internal_failure:1;
/* current state: */
bool accept_cont_input:1;
bool skip_password_check:1;
bool prefer_plain_credentials:1;
bool in_delayed_failure_queue:1;
bool removed_from_handler:1;
auth-workers to determine whether to send back a changed username. */
bool user_changed_by_lookup:1;
/* each passdb lookup can update the current success-status using the
result_* rules. the authentication succeeds only if this is TRUE
at the end. mechanisms that don't require passdb, but do a passdb
lookup anyway (e.g. GSSAPI) need to set this to TRUE by default. */
bool passdb_success:1;
/* userdb equivalent of passdb_success */
bool userdb_success:1;
/* the last userdb lookup failed either due to "tempfail" extra field
to a number */
bool userdb_lookup_tempfailed:1;
/* userdb_* fields have been set by the passdb lookup, userdb prefetch
will work. */
bool userdb_prefetch_set:1;
/* userdb lookup's results are from cache */
bool userdb_result_from_cache:1;
bool stats_sent:1;
bool policy_refusal:1;
bool policy_processed:1;
/* ... mechanism specific data ... */
};
extern unsigned int auth_request_state_count[AUTH_REQUEST_STATE_MAX];
extern const char auth_default_subsystems[2];
#define AUTH_SUBSYS_DB &auth_default_subsystems[0]
struct auth_request *
struct auth_request *auth_request_new_dummy(void);
enum auth_request_state state);
const char *password,
const char *scheme,
const char *username,
const char **error_r);
const char *field,
const char *const *fields,
const char *name,
const char *const *values);
/* returns -1 = failed, 0 = callback is called later, 1 = finished */
const char *subsystem);
const char *plain_password,
const char *crypted_password,
const char *plain_password,
const char *crypted_password,
bool log_password_mismatch);
const char *subsystem,
const char *subsystem,
const char *subsystem,
const char *subsystem,
const char *subsystem);
const char *subsystem,
const char *message);
struct auth_request *request);
const unsigned char *credentials,
struct auth_request *request);
struct auth_request *request);
#endif