HDEBUG(D_auth)
{
- debug_printf("%s authenticator %s:\n", ablock->name, label);
+ debug_printf("%s authenticator %s:\n", ablock->drinst.name, label);
for (int i = 0; i < AUTH_VARS; i++) if (auth_vars[i])
debug_printf(" $auth%d = %s\n", i + 1, auth_vars[i]);
for (int i = 1; i <= expand_nmax; i++)
# ifdef MACRO_PREDEF
/* Dummy values */
-void auth_cram_md5_init(auth_instance *ablock) {}
+void auth_cram_md5_init(driver_instance* ablock) {}
int auth_cram_md5_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_cram_md5_client(auth_instance *ablock, void *sx, int timeout,
uschar *buffer, int buffsize) {return 0;}
to be set up. */
void
-auth_cram_md5_init(auth_instance *ablock)
+auth_cram_md5_init(driver_instance * a)
{
-auth_cram_md5_options_block *ob =
- (auth_cram_md5_options_block *)(ablock->options_block);
-if (ob->server_secret != NULL) ablock->server = TRUE;
-if (ob->client_secret != NULL)
+auth_instance * ablock = (auth_instance *)a;
+auth_cram_md5_options_block * ob =
+ (auth_cram_md5_options_block *)(a->options_block);
+
+if (ob->server_secret)
+ ablock->server = TRUE;
+if (ob->client_secret)
{
ablock->client = TRUE;
- if (ob->client_name == NULL) ob->client_name = primary_hostname;
+ if (!ob->client_name) ob->client_name = primary_hostname;
}
}
int
auth_cram_md5_server(auth_instance * ablock, uschar * data)
{
-auth_cram_md5_options_block * ob =
- (auth_cram_md5_options_block *)(ablock->options_block);
+auth_cram_md5_options_block * ob = ablock->drinst.options_block;
uschar * challenge = string_sprintf("<%d.%ld@%s>", getpid(),
(long int) time(NULL), primary_hostname);
uschar * clear, * secret;
uschar *buffer, /* for reading response */
int buffsize) /* size of buffer */
{
-auth_cram_md5_options_block *ob =
- (auth_cram_md5_options_block *)(ablock->options_block);
+auth_cram_md5_options_block * ob = ablock->drinst.options_block;
uschar *secret = expand_string(ob->client_secret);
uschar *name = expand_string(ob->client_name);
uschar *challenge, *p;
string_format(buffer, buffsize, "expansion of \"%s\" failed in "
"%s authenticator: %s",
!secret ? ob->client_secret : ob->client_name,
- ablock->name, expand_string_message);
+ ablock->drinst.name, expand_string_message);
return ERROR;
}
/* The entry points for the mechanism */
-extern void auth_cram_md5_init(auth_instance *);
+extern void auth_cram_md5_init(driver_instance*);
extern int auth_cram_md5_server(auth_instance *, uschar *);
extern int auth_cram_md5_client(auth_instance *, void *, int, uschar *, int);
#ifdef MACRO_PREDEF
/* Dummy values */
-void auth_cyrus_sasl_init(auth_instance *ablock) {}
+void auth_cyrus_sasl_init(driver_instance *ablock) {}
int auth_cyrus_sasl_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_cyrus_sasl_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
/* Here's the real function */
void
-auth_cyrus_sasl_init(auth_instance *ablock)
+auth_cyrus_sasl_init(driver_instance * a)
{
-auth_cyrus_sasl_options_block *ob =
- (auth_cyrus_sasl_options_block *)(ablock->options_block);
+auth_instance * ablock = (auth_instance *)a;
+auth_cyrus_sasl_options_block * ob = a->options_block;
const uschar *list, *listptr, *buffer;
int rc, i;
unsigned int len;
if (!(expanded_hostname = expand_string(ob->server_hostname)))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
"couldn't expand server_hostname [%s]: %s",
- ablock->name, ob->server_hostname, expand_string_message);
+ a->name, ob->server_hostname, expand_string_message);
realm_expanded = NULL;
if ( ob->server_realm
&& !(realm_expanded = CS expand_string(ob->server_realm)))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
"couldn't expand server_realm [%s]: %s",
- ablock->name, ob->server_realm, expand_string_message);
+ a->name, ob->server_realm, expand_string_message);
/* we're going to initialise the library to check that there is an
authenticator of type whatever mechanism we're using */
if ((rc = sasl_server_init(cbs, "exim")) != SASL_OK)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
- "couldn't initialise Cyrus SASL library.", ablock->name);
+ "couldn't initialise Cyrus SASL library.", a->name);
if ((rc = sasl_server_new(CS ob->server_service, CS expanded_hostname,
realm_expanded, NULL, NULL, NULL, 0, &conn)) != SASL_OK)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
- "couldn't initialise Cyrus SASL server connection.", ablock->name);
+ "couldn't initialise Cyrus SASL server connection.", a->name);
if ((rc = sasl_listmech(conn, NULL, "", ":", "", CCSS &list, &len, &i)) != SASL_OK)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
- "couldn't get Cyrus SASL mechanism list.", ablock->name);
+ "couldn't get Cyrus SASL mechanism list.", a->name);
i = ':';
listptr = list;
if (!buffer)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
- "Cyrus SASL doesn't know about mechanism %s.", ablock->name, ob->server_mech);
+ "Cyrus SASL doesn't know about mechanism %s.", a->name, ob->server_mech);
store_reset(rs_point);
-HDEBUG(D_auth) debug_printf("Cyrus SASL driver %s: %s initialised\n", ablock->name, ablock->public_name);
+HDEBUG(D_auth) debug_printf("Cyrus SASL driver %s: %s initialised\n", a->name, ablock->public_name);
/* make sure that if we get here then we're allowed to advertise. */
ablock->server = TRUE;
int
auth_cyrus_sasl_server(auth_instance * ablock, uschar * data)
{
-auth_cyrus_sasl_options_block * ob =
- (auth_cyrus_sasl_options_block *)(ablock->options_block);
+auth_cyrus_sasl_options_block * ob = ablock->drinst.options_block;
+const uschar * auname = ablock->drinst.name;
uschar * output, * out2, * input, * clear, * hname;
uschar * debug = NULL; /* Stops compiler complaining */
sasl_callback_t cbs[] = {{SASL_CB_LIST_END, NULL, NULL}};
debug_printf("Cyrus SASL library will not tell us the username: %s\n",
sasl_errstring(rc, NULL, NULL));
log_write(0, LOG_REJECT, "%s authenticator (%s): "
- "Cyrus SASL username fetch problem: %s", ablock->name, ob->server_mech,
+ "Cyrus SASL username fetch problem: %s", auname, ob->server_mech,
sasl_errstring(rc, NULL, NULL));
sasl_dispose(&conn);
sasl_done();
HDEBUG(D_auth)
debug_printf("Cyrus SASL permanent failure %d (%s)\n", rc, sasl_errstring(rc, NULL, NULL));
log_write(0, LOG_REJECT, "%s authenticator (%s): "
- "Cyrus SASL permanent failure: %s", ablock->name, ob->server_mech,
+ "Cyrus SASL permanent failure: %s", auname, ob->server_mech,
sasl_errstring(rc, NULL, NULL));
sasl_dispose(&conn);
sasl_done();
debug_printf("Cyrus SASL library will not tell us the SSF: %s\n",
sasl_errstring(rc, NULL, NULL));
log_write(0, LOG_REJECT, "%s authenticator (%s): "
- "Cyrus SASL SSF value not available: %s", ablock->name, ob->server_mech,
+ "Cyrus SASL SSF value not available: %s", auname, ob->server_mech,
sasl_errstring(rc, NULL, NULL));
sasl_dispose(&conn);
sasl_done();
HDEBUG(D_auth)
debug_printf("Exim does not implement SASL wrapping (needed for SSF %d).\n", negotiated_ssf);
log_write(0, LOG_REJECT, "%s authenticator (%s): "
- "Cyrus SASL SSF %d not supported by Exim", ablock->name, ob->server_mech, negotiated_ssf);
+ "Cyrus SASL SSF %d not supported by Exim", auname, ob->server_mech, negotiated_ssf);
sasl_dispose(&conn);
sasl_done();
return FAIL;
/* The entry points for the mechanism */
-extern void auth_cyrus_sasl_init(auth_instance *);
+extern void auth_cyrus_sasl_init(driver_instance *);
extern int auth_cyrus_sasl_server(auth_instance *, uschar *);
extern int auth_cyrus_sasl_client(auth_instance *, void *, int, uschar *, int);
extern gstring * auth_cyrus_sasl_version_report(gstring *);
/* Options specific to the authentication mechanism. */
optionlist auth_dovecot_options[] = {
- { "server_socket", opt_stringptr, OPT_OFF(auth_dovecot_options_block, server_socket) },
-/*{ "server_tls", opt_bool, OPT_OFF(auth_dovecot_options_block, server_tls) },*/
+ { "server_socket", opt_stringptr,
+ OPT_OFF(auth_dovecot_options_block, server_socket) },
+/*{ "server_tls", opt_bool,
+ OPT_OFF(auth_dovecot_options_block, server_tls) },*/
};
/* Size of the options list. An extern variable has to be used so that its
#ifdef MACRO_PREDEF
/* Dummy values */
-void auth_dovecot_init(auth_instance *ablock) {}
+void auth_dovecot_init(driver_instance *ablock) {}
int auth_dovecot_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_dovecot_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
to be set up. */
void
-auth_dovecot_init(auth_instance * ablock)
+auth_dovecot_init(driver_instance * a)
{
+auth_instance * ablock = (auth_instance *)a;
auth_dovecot_options_block * ob =
- (auth_dovecot_options_block *)(ablock->options_block);
-
-if (!ablock->public_name) ablock->public_name = ablock->name;
-if (ob->server_socket) ablock->server = TRUE;
-else DEBUG(D_auth) debug_printf("Dovecot auth driver: no server_socket for %s\n", ablock->public_name);
+ (auth_dovecot_options_block *)(a->options_block);
+
+if (!ablock->public_name)
+ ablock->public_name = a->name;
+if (ob->server_socket)
+ ablock->server = TRUE;
+else DEBUG(D_auth)
+ debug_printf("Dovecot auth driver: no server_socket for %s\n",
+ ablock->public_name);
ablock->client = FALSE;
}
int
auth_dovecot_server(auth_instance * ablock, uschar * data)
{
-auth_dovecot_options_block *ob =
- (auth_dovecot_options_block *) ablock->options_block;
+auth_dovecot_options_block * ob = ablock->drinst.options_block;
uschar buffer[DOVECOT_AUTH_MAXLINELEN];
uschar *args[DOVECOT_AUTH_MAXFIELDCOUNT];
uschar *auth_command;
/* The entry points for the mechanism */
-extern void auth_dovecot_init(auth_instance *);
+extern void auth_dovecot_init(driver_instance *);
extern int auth_dovecot_server(auth_instance *, uschar *);
/* End of dovecot.h */
#ifdef MACRO_PREDEF
/* Dummy values */
-void auth_external_init(auth_instance *ablock) {}
+void auth_external_init(driver_instance *ablock) {}
int auth_external_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_external_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
to be set up. */
void
-auth_external_init(auth_instance *ablock)
+auth_external_init(driver_instance * a)
{
-auth_external_options_block * ob = (auth_external_options_block *)ablock->options_block;
-if (!ablock->public_name) ablock->public_name = ablock->name;
-if (ablock->server_condition) ablock->server = TRUE;
-if (ob->client_send) ablock->client = TRUE;
+auth_instance * ablock = (auth_instance *)a;
+auth_external_options_block * ob = a->options_block;
+
+if (!ablock->public_name)
+ ablock->public_name = a->name;
+if (ablock->server_condition)
+ ablock->server = TRUE;
+if (ob->client_send)
+ ablock->client = TRUE;
}
int
auth_external_server(auth_instance * ablock, uschar * data)
{
-auth_external_options_block * ob = (auth_external_options_block *)ablock->options_block;
+auth_external_options_block * ob = ablock->drinst.options_block;
int rc;
/* If data was supplied on the AUTH command, decode it, and split it up into
uschar *buffer, /* buffer for reading response */
int buffsize) /* size of buffer */
{
-auth_external_options_block *ob =
- (auth_external_options_block *)(ablock->options_block);
+auth_external_options_block * ob = ablock->drinst.options_block;
const uschar * text = ob->client_send;
int rc;
/* The entry points for the mechanism */
-extern void auth_external_init(auth_instance *);
+extern void auth_external_init(driver_instance *);
extern int auth_external_server(auth_instance *, uschar *);
extern int auth_external_client(auth_instance *, void *, int, uschar *, int);
return CANCELLED;
}
string_format(buffer, buffsize, "expansion of \"%s\" failed in %s "
- "authenticator: %s", *inout, ablock->name, expand_string_message);
+ "authenticator: %s", *inout, ablock->drinst.name, expand_string_message);
return ERROR;
}
if (smtp_write_command(sx, SCMD_FLUSH, "*\r\n") >= 0)
(void)smtp_read_response(sx, US buffer, buffsize, '2', timeout);
string_format(buffer, buffsize, "Too few items in client_send in %s "
- "authenticator", ablock->name);
+ "authenticator", ablock->drinst.name);
return ERROR;
}
# include "../macro_predef.h"
/* Dummy values */
-void auth_gsasl_init(auth_instance *ablock) {}
+void auth_gsasl_init(driver_instance *ablock) {}
int auth_gsasl_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_gsasl_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
to be set up. */
void
-auth_gsasl_init(auth_instance *ablock)
+auth_gsasl_init(driver_instance * a)
{
+auth_instance * ablock = (auth_instance *)a;
+auth_gsasl_options_block * ob = a->options_block;
static char * once = NULL;
int rc;
-auth_gsasl_options_block *ob =
- (auth_gsasl_options_block *)(ablock->options_block);
/* As per existing Cyrus glue, use the authenticator's public name as
the default for the mechanism name; we don't handle multiple mechanisms
if ((rc = gsasl_init(&gsasl_ctx)) != GSASL_OK)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
"couldn't initialise GNU SASL library: %s (%s)",
- ablock->name, gsasl_strerror_name(rc), gsasl_strerror(rc));
+ a->name, gsasl_strerror_name(rc), gsasl_strerror(rc));
gsasl_callback_set(gsasl_ctx, main_callback);
}
if ((rc = gsasl_server_mechlist(gsasl_ctx, &once)) != GSASL_OK)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
"failed to retrieve list of mechanisms: %s (%s)",
- ablock->name, gsasl_strerror_name(rc), gsasl_strerror(rc));
+ a->name, gsasl_strerror_name(rc), gsasl_strerror(rc));
debug_printf("GNU SASL supports: %s\n", once);
}
if (!gsasl_client_support_p(gsasl_ctx, CCS ob->server_mech))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
"GNU SASL does not support mechanism \"%s\"",
- ablock->name, ob->server_mech);
+ a->name, ob->server_mech);
if (ablock->server_condition)
ablock->server = TRUE;
ablock->server = FALSE;
HDEBUG(D_auth) debug_printf("%s authenticator: "
"Need server_condition for %s mechanism\n",
- ablock->name, ob->server_mech);
+ a->name, ob->server_mech);
}
/* This does *not* scale to new SASL mechanisms. Need a better way to ask
ablock->server = FALSE;
HDEBUG(D_auth) debug_printf("%s authenticator: "
"Need server_realm for %s mechanism\n",
- ablock->name, ob->server_mech);
+ a->name, ob->server_mech);
}
ablock->client = ob->client_username && ob->client_password;
rc = server_callback(ctx, sctx, prop, cb_state->ablock);
else
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
- "unhandled callback state, bug in Exim", cb_state->ablock->name);
+ "unhandled callback state, bug in Exim", cb_state->ablock->drinst.name);
/* NOTREACHED */
callback_loop = 0;
int
auth_gsasl_server(auth_instance * ablock, uschar * initial_data)
{
+auth_gsasl_options_block * ob = ablock->drinst.options_block;
+const uschar * auname = ablock->drinst.name;
uschar * tmps;
char * to_send, * received;
Gsasl_session * sctx = NULL;
-auth_gsasl_options_block * ob =
- (auth_gsasl_options_block *)(ablock->options_block);
struct callback_exim_state cb_state;
int rc, auth_result, exim_error, exim_error_override;
HDEBUG(D_auth)
debug_printf("GNU SASL: initialising session for %s, mechanism %s\n",
- ablock->name, ob->server_mech);
+ auname, ob->server_mech);
#ifndef DISABLE_TLS
if (tls_in.channelbinding && ob->server_channelbinding)
if (ob->server_channelbinding)
{
HDEBUG(D_auth) debug_printf("Auth %s: Enabling channel-binding\n",
- ablock->name);
+ auname);
# ifndef CHANNELBIND_HACK
preload_prop(sctx,
# ifdef EXIM_GSASL_HAVE_EXPORTER
else
HDEBUG(D_auth)
debug_printf("Auth %s: Not enabling channel-binding (data available)\n",
- ablock->name);
+ auname);
}
else
HDEBUG(D_auth)
debug_printf("Auth %s: no channel-binding data available\n",
- ablock->name);
+ auname);
#endif
checked_server_condition = FALSE;
gsasl_strerror_name(rc), gsasl_strerror(rc));
log_write(0, LOG_REJECT, "%s authenticator (%s):\n "
"GNU SASL permanent failure: %s (%s)",
- ablock->name, ob->server_mech,
+ auname, ob->server_mech,
gsasl_strerror_name(rc), gsasl_strerror(rc));
if (rc == GSASL_BASE64_ERROR)
exim_error_override = BAD64;
case FAIL: return GSASL_AUTHENTICATION_ERROR;
default: log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator: "
"Unhandled return from checking %s: %d",
- ablock->name, label, exim_rc);
+ ablock->drinst.name, label, exim_rc);
}
/* NOTREACHED */
server_callback(Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop,
auth_instance *ablock)
{
+auth_gsasl_options_block * ob = ablock->drinst.options_block;
char * tmps;
uschar * s;
int cbrc = GSASL_NO_CALLBACK;
-auth_gsasl_options_block * ob =
- (auth_gsasl_options_block *)(ablock->options_block);
HDEBUG(D_auth) debug_printf("GNU SASL callback %s for %s/%s as server\n",
- gsasl_prop_code_to_name(prop), ablock->name, ablock->public_name);
+ gsasl_prop_code_to_name(prop), ablock->drinst.name, ablock->public_name);
for (int i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL;
expand_nmax = 0;
uschar * buffer, /* buffer for reading response */
int buffsize) /* size of buffer */
{
-auth_gsasl_options_block * ob =
- (auth_gsasl_options_block *)(ablock->options_block);
+auth_gsasl_options_block * ob = ablock->drinst.options_block;
+const uschar * auname = ablock->drinst.name;
Gsasl_session * sctx = NULL;
struct callback_exim_state cb_state;
uschar * s;
HDEBUG(D_auth)
debug_printf("GNU SASL: initialising session for %s, mechanism %s\n",
- ablock->name, ob->server_mech);
+ auname, ob->server_mech);
*buffer = 0;
if (ob->client_channelbinding)
{
HDEBUG(D_auth) debug_printf("Auth %s: Enabling channel-binding\n",
- ablock->name);
+ auname);
# ifndef CHANNELBIND_HACK
preload_prop(sctx,
# ifdef EXIM_GSASL_HAVE_EXPORTER
else
HDEBUG(D_auth)
debug_printf("Auth %s: Not enabling channel-binding (data available)\n",
- ablock->name);
+ auname);
#endif
/* Run the SASL conversation with the server */
client_callback(Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop, auth_instance *ablock)
{
HDEBUG(D_auth) debug_printf("GNU SASL callback %s for %s/%s as client\n",
- gsasl_prop_code_to_name(prop), ablock->name, ablock->public_name);
+ gsasl_prop_code_to_name(prop), ablock->drinst.name, ablock->public_name);
switch (prop)
{
#ifdef EXIM_GSASL_HAVE_EXPORTER
case GSASL_SCRAM_SALTED_PASSWORD:
{
uschar * client_spassword =
- ((auth_gsasl_options_block *) ablock->options_block)->client_spassword;
+ ((auth_gsasl_options_block *) ablock->drinst.options_block)->client_spassword;
uschar dummy[4];
HDEBUG(D_auth) if (!client_spassword)
debug_printf(" client_spassword option unset\n");
/* The entry points for the mechanism */
-extern void auth_gsasl_init(auth_instance *);
+extern void auth_gsasl_init(driver_instance *);
extern int auth_gsasl_server(auth_instance *, uschar *);
extern int auth_gsasl_client(auth_instance *, void *,
int, uschar *, int);
#ifdef MACRO_PREDEF
/* Dummy values */
-void auth_heimdal_gssapi_init(auth_instance *ablock) {}
+void auth_heimdal_gssapi_init(driver_instance *ablock) {}
int auth_heimdal_gssapi_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_heimdal_gssapi_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
the keytab contents, for -D+auth debugging. */
void
-auth_heimdal_gssapi_init(auth_instance *ablock)
+auth_heimdal_gssapi_init(driver_instance * a)
{
+auth_instance * ablock = (auth_instance *)a;
+auth_heimdal_gssapi_options_block * ob =
+ (auth_heimdal_gssapi_options_block *)(a->options_block);
krb5_context context;
krb5_keytab keytab;
krb5_kt_cursor cursor;
krb5_error_code krc;
char *principal, *enctype_s;
const char *k_keytab_typed_name = NULL;
-auth_heimdal_gssapi_options_block *ob =
- (auth_heimdal_gssapi_options_block *)(ablock->options_block);
ablock->server = FALSE;
ablock->client = FALSE;
int
auth_heimdal_gssapi_server(auth_instance *ablock, uschar *initial_data)
{
+auth_heimdal_gssapi_options_block * ob =
+ (auth_heimdal_gssapi_options_block *)(ablock->drinfo.options_block);
gss_name_t gclient = GSS_C_NO_NAME;
gss_name_t gserver = GSS_C_NO_NAME;
gss_cred_id_t gcred = GSS_C_NO_CREDENTIAL;
OM_uint32 maj_stat, min_stat;
int step, error_out;
uschar *tmp1, *tmp2, *from_client;
-auth_heimdal_gssapi_options_block *ob =
- (auth_heimdal_gssapi_options_block *)(ablock->options_block);
BOOL handled_empty_ir;
rmark store_reset_point;
uschar *keytab;
/* The entry points for the mechanism */
-extern void auth_heimdal_gssapi_init(auth_instance *);
+extern void auth_heimdal_gssapi_init(driver_instance *);
extern int auth_heimdal_gssapi_server(auth_instance *, uschar *);
extern int auth_heimdal_gssapi_client(auth_instance *, void *, int, uschar *, int);
extern void auth_heimdal_gssapi_version_report(BOOL);
#ifdef MACRO_PREDEF
/* Dummy values */
-void auth_plaintext_init(auth_instance *ablock) {}
+void auth_plaintext_init(driver_instance *ablock) {}
int auth_plaintext_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_plaintext_client(auth_instance *ablock, void * sx, int timeout,
uschar *buffer, int buffsize) {return 0;}
to be set up. */
void
-auth_plaintext_init(auth_instance *ablock)
+auth_plaintext_init(driver_instance * a)
{
-auth_plaintext_options_block *ob =
- (auth_plaintext_options_block *)(ablock->options_block);
-if (!ablock->public_name) ablock->public_name = ablock->name;
-if (ablock->server_condition) ablock->server = TRUE;
-if (ob->client_send) ablock->client = TRUE;
+auth_instance * ablock = (auth_instance *)a;
+auth_plaintext_options_block * ob = a->options_block;
+
+if (!ablock->public_name)
+ ablock->public_name = ablock->drinst.name;
+if (ablock->server_condition)
+ ablock->server = TRUE;
+if (ob->client_send)
+ ablock->client = TRUE;
}
int
auth_plaintext_server(auth_instance * ablock, uschar * data)
{
-auth_plaintext_options_block * ob =
- (auth_plaintext_options_block *)(ablock->options_block);
+auth_plaintext_options_block * ob = ablock->drinst.options_block;
const uschar * prompts = ob->server_prompts;
uschar * s;
int number = 1;
uschar *buffer, /* buffer for reading response */
int buffsize) /* size of buffer */
{
-auth_plaintext_options_block *ob =
- (auth_plaintext_options_block *)(ablock->options_block);
+auth_plaintext_options_block * ob = ablock->drinst.options_block;
const uschar * text = ob->client_send;
const uschar * s;
int sep = 0;
/* The entry points for the mechanism */
-extern void auth_plaintext_init(auth_instance *);
+extern void auth_plaintext_init(driver_instance *);
extern int auth_plaintext_server(auth_instance *, uschar *);
extern int auth_plaintext_client(auth_instance *, void *, int, uschar *, int);
#ifdef MACRO_PREDEF
/* Dummy values */
-void auth_spa_init(auth_instance *ablock) {}
+void auth_spa_init(driver_instance *ablock) {}
int auth_spa_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_spa_client(auth_instance *ablock, void * sx, int timeout,
uschar *buffer, int buffsize) {return 0;}
to be set up. */
void
-auth_spa_init(auth_instance *ablock)
+auth_spa_init(driver_instance * a)
{
-auth_spa_options_block *ob =
- (auth_spa_options_block *)(ablock->options_block);
+auth_instance * ablock = (auth_instance *)a;
+auth_spa_options_block * ob = a->options_block;
/* The public name defaults to the authenticator name */
-if (ablock->public_name == NULL) ablock->public_name = ablock->name;
+if (!ablock->public_name)
+ ablock->public_name = ablock->drinst.name;
/* Both username and password must be set for a client */
if ((ob->spa_username == NULL) != (ob->spa_password == NULL))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator:\n "
"one of client_username and client_password cannot be set without "
- "the other", ablock->name);
+ "the other", ablock->drinst.name);
ablock->client = ob->spa_username != NULL;
/* For a server we have just one option */
int
auth_spa_server(auth_instance *ablock, uschar *data)
{
-auth_spa_options_block *ob = (auth_spa_options_block *)(ablock->options_block);
+auth_spa_options_block * ob = ablock->drinst.options_block;
uint8x lmRespData[24];
uint8x ntRespData[24];
SPAAuthRequest request;
uschar *buffer, /* buffer for reading response */
int buffsize) /* size of buffer */
{
-auth_spa_options_block *ob =
- (auth_spa_options_block *)(ablock->options_block);
+auth_spa_options_block * ob = ablock->drinst.options_block;
+const uschar * auname = ablock->drinst.name;
SPAAuthRequest request;
SPAAuthChallenge challenge;
SPAAuthResponse response;
{
if (f.expand_string_forcedfail) return CANCELLED;
string_format(buffer, buffsize, "expansion of \"%s\" failed in %s "
- "authenticator: %s", ob->spa_username, ablock->name,
+ "authenticator: %s", ob->spa_username, auname,
expand_string_message);
return ERROR;
}
{
if (f.expand_string_forcedfail) return CANCELLED;
string_format(buffer, buffsize, "expansion of \"%s\" failed in %s "
- "authenticator: %s", ob->spa_password, ablock->name,
+ "authenticator: %s", ob->spa_password, auname,
expand_string_message);
return ERROR;
}
{
if (f.expand_string_forcedfail) return CANCELLED;
string_format(buffer, buffsize, "expansion of \"%s\" failed in %s "
- "authenticator: %s", ob->spa_domain, ablock->name,
+ "authenticator: %s", ob->spa_domain, auname,
expand_string_message);
return ERROR;
}
if (!smtp_read_response(sx, US buffer, buffsize, '3', timeout))
return FAIL;
-DSPA("\n\n%s authenticator: using domain %s\n\n", ablock->name, domain);
+DSPA("\n\n%s authenticator: using domain %s\n\n", auname, domain);
spa_build_auth_request(&request, username, domain);
spa_bits_to_base64(US msgbuf, US &request, spa_request_length(&request));
-DSPA("\n\n%s authenticator: sending request (%s)\n\n", ablock->name, msgbuf);
+DSPA("\n\n%s authenticator: sending request (%s)\n\n", auname, msgbuf);
/* send the encrypted password */
if (smtp_write_command(sx, SCMD_FLUSH, "%s\r\n", msgbuf) < 0)
return FAIL;
/* convert the challenge into the challenge struct */
-DSPA("\n\n%s authenticator: challenge (%s)\n\n", ablock->name, buffer + 4);
+DSPA("\n\n%s authenticator: challenge (%s)\n\n", auname, buffer + 4);
spa_base64_to_bits(CS (&challenge), sizeof(challenge), CCS (buffer + 4));
spa_build_auth_response(&challenge, &response, username, password);
spa_bits_to_base64(US msgbuf, US &response, spa_request_length(&response));
-DSPA("\n\n%s authenticator: challenge response (%s)\n\n", ablock->name, msgbuf);
+DSPA("\n\n%s authenticator: challenge response (%s)\n\n", auname, msgbuf);
/* send the challenge response */
if (smtp_write_command(sx, SCMD_FLUSH, "%s\r\n", msgbuf) < 0)
/* The entry points for the mechanism */
-extern void auth_spa_init(auth_instance *);
+extern void auth_spa_init(driver_instance *);
extern int auth_spa_server(auth_instance *, uschar *);
extern int auth_spa_client(auth_instance *, void *, int, uschar *, int);
#ifdef MACRO_PREDEF
/* Dummy values */
-void auth_tls_init(auth_instance *ablock) {}
+void auth_tls_init(driver_instance *ablock) {}
int auth_tls_server(auth_instance *ablock, uschar *data) {return 0;}
int auth_tls_client(auth_instance *ablock, void * sx,
int timeout, uschar *buffer, int buffsize) {return 0;}
to be set up. */
void
-auth_tls_init(auth_instance *ablock)
+auth_tls_init(driver_instance * a)
{
-ablock->public_name = ablock->name; /* needed for core code */
+auth_instance * ablock = (auth_instance *)a;
+ablock->public_name = a->name; /* needed for core code */
}
int
auth_tls_server(auth_instance *ablock, uschar *data)
{
-auth_tls_options_block * ob = (auth_tls_options_block *)ablock->options_block;
+auth_tls_options_block * ob = ablock->drinst.options_block;
if (ob->server_param1)
auth_vars[expand_nmax++] = expand_string(ob->server_param1);
/* The entry points for the mechanism */
-extern void auth_tls_init(auth_instance *);
+extern void auth_tls_init(driver_instance *);
extern int auth_tls_server(auth_instance *, uschar *);
/* End of tls.h */
#ifdef AUTH_CRAM_MD5
{
- .driver_name = US"cram_md5", /* lookup name */
- .options = auth_cram_md5_options,
- .options_count = &auth_cram_md5_options_count,
- .options_block = &auth_cram_md5_option_defaults,
- .options_len = sizeof(auth_cram_md5_options_block),
- .init = auth_cram_md5_init,
+ .drinfo = {
+ .driver_name = US"cram_md5", /* lookup name */
+ .options = auth_cram_md5_options,
+ .options_count = &auth_cram_md5_options_count,
+ .options_block = &auth_cram_md5_option_defaults,
+ .options_len = sizeof(auth_cram_md5_options_block),
+ .init = auth_cram_md5_init,
+ },
.servercode = auth_cram_md5_server,
.clientcode = auth_cram_md5_client,
.version_report = NULL,
#ifdef AUTH_CYRUS_SASL
{
- .driver_name = US"cyrus_sasl",
- .options = auth_cyrus_sasl_options,
- .options_count = &auth_cyrus_sasl_options_count,
- .options_block = &auth_cyrus_sasl_option_defaults,
- .options_len = sizeof(auth_cyrus_sasl_options_block),
- .init = auth_cyrus_sasl_init,
+ .drinfo = {
+ .driver_name = US"cyrus_sasl",
+ .options = auth_cyrus_sasl_options,
+ .options_count = &auth_cyrus_sasl_options_count,
+ .options_block = &auth_cyrus_sasl_option_defaults,
+ .options_len = sizeof(auth_cyrus_sasl_options_block),
+ .init = auth_cyrus_sasl_init,
+ },
.servercode = auth_cyrus_sasl_server,
.clientcode = NULL,
.version_report = auth_cyrus_sasl_version_report,
#ifdef AUTH_DOVECOT
{
- .driver_name = US"dovecot",
- .options = auth_dovecot_options,
- .options_count = &auth_dovecot_options_count,
- .options_block = &auth_dovecot_option_defaults,
- .options_len = sizeof(auth_dovecot_options_block),
- .init = auth_dovecot_init,
+ .drinfo = {
+ .driver_name = US"dovecot",
+ .options = auth_dovecot_options,
+ .options_count = &auth_dovecot_options_count,
+ .options_block = &auth_dovecot_option_defaults,
+ .options_len = sizeof(auth_dovecot_options_block),
+ .init = auth_dovecot_init,
+ },
.servercode = auth_dovecot_server,
.clientcode = NULL,
.version_report = NULL,
#ifdef AUTH_EXTERNAL
{
- .driver_name = US"external",
- .options = auth_external_options,
- .options_count = &auth_external_options_count,
- .options_block = &auth_external_option_defaults,
- .options_len = sizeof(auth_external_options_block),
- .init = auth_external_init,
+ .drinfo = {
+ .driver_name = US"external",
+ .options = auth_external_options,
+ .options_count = &auth_external_options_count,
+ .options_block = &auth_external_option_defaults,
+ .options_len = sizeof(auth_external_options_block),
+ .init = auth_external_init,
+ },
.servercode = auth_external_server,
.clientcode = auth_external_client,
.version_report = NULL,
#ifdef AUTH_GSASL
{
- .driver_name = US"gsasl",
- .options = auth_gsasl_options,
- .options_count = &auth_gsasl_options_count,
- .options_block = &auth_gsasl_option_defaults,
- .options_len = sizeof(auth_gsasl_options_block),
- .init = auth_gsasl_init,
+ .drinfo = {
+ .driver_name = US"gsasl",
+ .options = auth_gsasl_options,
+ .options_count = &auth_gsasl_options_count,
+ .options_block = &auth_gsasl_option_defaults,
+ .options_len = sizeof(auth_gsasl_options_block),
+ .init = auth_gsasl_init,
+ },
.servercode = auth_gsasl_server,
.clientcode = auth_gsasl_client,
.version_report = auth_gsasl_version_report,
#ifdef AUTH_HEIMDAL_GSSAPI
{
- .driver_name = US"heimdal_gssapi",
- .options = auth_heimdal_gssapi_options,
- .options_count = &auth_heimdal_gssapi_options_count,
- .options_block = &auth_heimdal_gssapi_option_defaults,
- .options_len = sizeof(auth_heimdal_gssapi_options_block),
- .init = auth_heimdal_gssapi_init,
+ .drinfo = {
+ .driver_name = US"heimdal_gssapi",
+ .options = auth_heimdal_gssapi_options,
+ .options_count = &auth_heimdal_gssapi_options_count,
+ .options_block = &auth_heimdal_gssapi_option_defaults,
+ .options_len = sizeof(auth_heimdal_gssapi_options_block),
+ .init = auth_heimdal_gssapi_init,
+ },
.servercode = auth_heimdal_gssapi_server,
.clientcode = NULL,
.version_report = auth_heimdal_gssapi_version_report,
#ifdef AUTH_PLAINTEXT
{
- .driver_name = US"plaintext",
- .options = auth_plaintext_options,
- .options_count = &auth_plaintext_options_count,
- .options_block = &auth_plaintext_option_defaults,
- .options_len = sizeof(auth_plaintext_options_block),
- .init = auth_plaintext_init,
+ .drinfo = {
+ .driver_name = US"plaintext",
+ .options = auth_plaintext_options,
+ .options_count = &auth_plaintext_options_count,
+ .options_block = &auth_plaintext_option_defaults,
+ .options_len = sizeof(auth_plaintext_options_block),
+ .init = auth_plaintext_init,
+ },
.servercode = auth_plaintext_server,
.clientcode = auth_plaintext_client,
.version_report = NULL,
#ifdef AUTH_SPA
{
- .driver_name = US"spa",
- .options = auth_spa_options,
- .options_count = &auth_spa_options_count,
- .options_block = &auth_spa_option_defaults,
- .options_len = sizeof(auth_spa_options_block),
- .init = auth_spa_init,
+ .drinfo = {
+ .driver_name = US"spa",
+ .options = auth_spa_options,
+ .options_count = &auth_spa_options_count,
+ .options_block = &auth_spa_option_defaults,
+ .options_len = sizeof(auth_spa_options_block),
+ .init = auth_spa_init,
+ },
.servercode = auth_spa_server,
.clientcode = auth_spa_client,
.version_report = NULL,
#ifdef AUTH_TLS
{
- .driver_name = US"tls",
- .options = auth_tls_options,
- .options_count = &auth_tls_options_count,
- .options_block = &auth_tls_option_defaults,
- .options_len = sizeof(auth_tls_options_block),
- .init = auth_tls_init,
+ .drinfo = {
+ .driver_name = US"tls",
+ .options = auth_tls_options,
+ .options_count = &auth_tls_options_count,
+ .options_block = &auth_tls_option_defaults,
+ .options_len = sizeof(auth_tls_options_block),
+ .init = auth_tls_init,
+ },
.servercode = auth_tls_server,
.clientcode = NULL,
.version_report = NULL,
},
#endif
- { .driver_name = US"" } /* end marker */
+ { .drinfo = { .driver_name = US"" }} /* end marker */
};
.ri_flags = ri_notransport
},
#endif
- { US"" }
+ { .drinfo = { .driver_name = US"" }}
};
.local = FALSE
},
#endif
- { US"" }
+ { .drinfo = { .driver_name = US"" }}
};
#ifndef MACRO_PREDEF
auth_show_supported(gstring * g)
{
g = string_cat(g, US"Authenticators:");
-for (auth_info * ai = auths_available; ai->driver_name[0]; ai++)
- g = string_fmt_append(g, " %s", ai->driver_name);
+for (auth_info * ai = auths_available; ai->drinfo.driver_name[0]; ai++)
+ g = string_fmt_append(g, " %s", ai->drinfo.driver_name);
return string_cat(g, US"\n");
}
show_string(is_stdout, g);
g = NULL;
-for (auth_info * authi = auths_available; *authi->driver_name != '\0'; ++authi)
- if (authi->version_report)
- g = (*authi->version_report)(g);
+for (auth_info * ai= auths_available; *ai->drinfo.driver_name != '\0'; ai++)
+ if (ai->version_report)
+ g = (*ai->version_report)(g);
/* PCRE_PRERELEASE is either defined and empty or a bare sequence of
characters; unless it's an ancient version of PCRE in which case it
{ "client_set_id", opt_stringptr | opt_public,
OPT_OFF(auth_instance, set_client_id) },
{ "driver", opt_stringptr | opt_public,
- OPT_OFF(auth_instance, driver_name) },
+ OPT_OFF(auth_instance, drinst.driver_name) },
{ "public_name", opt_stringptr | opt_public,
OPT_OFF(auth_instance, public_name) },
{ "server_advertise_condition", opt_stringptr | opt_public,
auth_instance *auths = NULL;
uschar *auth_advertise_hosts = US"*";
auth_instance auth_defaults = {
- .next = NULL,
- .name = NULL,
- .info = NULL,
- .options_block = NULL,
- .driver_name = NULL,
+ .drinst = {
+ .next = NULL,
+ .name = NULL,
+ .info = NULL,
+ .options_block = NULL,
+ .driver_name = NULL,
+ },
.advertise_condition = NULL,
.client_condition = NULL,
.public_name = NULL,
{
uschar buf[EXIM_DRIVERNAME_MAX];
-options_from_list(optionlist_auths, optionlist_auths_size, US"AUTHENTICATORS", NULL);
+options_from_list(optionlist_auths, optionlist_auths_size,
+ US"AUTHENTICATORS", NULL);
-for (struct auth_info * ai = auths_available; ai->driver_name[0]; ai++)
+for (struct auth_info * ai = auths_available; ai->drinfo.driver_name[0]; ai++)
{
- spf(buf, sizeof(buf), US"_DRIVER_AUTHENTICATOR_%T", ai->driver_name);
+ driver_info * di = &ai->drinfo;
+ spf(buf, sizeof(buf), US"_DRIVER_AUTHENTICATOR_%T", di->driver_name);
builtin_macro_create(buf);
- options_from_list(ai->options, (unsigned)*ai->options_count, US"AUTHENTICATOR", ai->driver_name);
+ options_from_list(di->options, (unsigned)*di->options_count,
+ US"AUTHENTICATOR", di->driver_name);
if (ai->macros_create) (ai->macros_create)();
}
optionlist_auths, /* generic options */
optionlist_auths_size);
-for (auth_instance * au = auths; au; au = au->next)
+for (auth_instance * au = auths; au; au = au->drinst.next)
{
if (!au->public_name)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "no public name specified for "
- "the %s authenticator", au->name);
+ "the %s authenticator", au->drinst.name);
- for (auth_instance * bu = au->next; bu; bu = bu->next)
+ for (auth_instance * bu = au->drinst.next; bu; bu = bu->drinst.next)
if (strcmpic(au->public_name, bu->public_name) == 0)
if ( au->client && bu->client
|| au->server && bu->server)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "two %s authenticators "
"(%s and %s) have the same public name (%s)",
au->client && bu->client ? US"client" : US"server",
- au->name, bu->name, au->public_name);
+ au->drinst.name, bu->drinst.name, au->public_name);
#ifndef DISABLE_PIPE_CONNECT
nauths++;
#endif
/* Set up globals for error messages */
-authenticator_name = au->name;
-driver_srcfile = au->srcfile;
-driver_srcline = au->srcline;
+authenticator_name = au->drinst.name;
+driver_srcfile = au->drinst.srcfile;
+driver_srcline = au->drinst.srcline;
/* Run the checking code, passing the remainder of the command line as
data. Initials the $auth<n> variables as empty. Initialize $0 empty and set
expand_nmax = 0;
expand_nlength[0] = 0; /* $0 contains nothing */
-rc = (au->info->servercode)(au, smtp_cmd_data);
+ {
+ auth_info * ai = au->drinst.info;
+ rc = (ai->servercode)(au, smtp_cmd_data);
+ }
if (au->set_id) set_id = expand_string(au->set_id);
expand_nmax = -1; /* Reset numeric variables */
for (int i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL; /* Reset $auth<n> */
if (!au->set_id || set_id) /* Complete success */
{
if (set_id) authenticated_id = string_copy_perm(set_id, TRUE);
- sender_host_authenticated = au->name;
+ sender_host_authenticated = au->drinst.name;
sender_host_auth_pubname = au->public_name;
authentication_failed = FALSE;
authenticated_fail_id = NULL; /* Impossible to already be set? */
{
cmd_list[CL_TLAU].is_mail_cmd = FALSE;
- for (auth_instance * au = auths; au; au = au->next)
- if (strcmpic(US"tls", au->driver_name) == 0)
+ for (auth_instance * au = auths; au; au = au->drinst.next)
+ if (strcmpic(US"tls", au->drinst.driver_name) == 0)
{
GET_OPTION("acl_smtp_auth");
if ( acl_smtp_auth
#ifndef DISABLE_EVENT
{
uschar * save_name = sender_host_authenticated, * logmsg;
- sender_host_authenticated = au->name;
+ sender_host_authenticated = au->drinst.name;
if ((logmsg = event_raise(event_action, US"auth:fail", s, NULL)))
log_write(0, LOG_MAIN, "%s", logmsg);
sender_host_authenticated = save_name;
auth_instance * au;
uschar * smtp_resp, * errmsg;
- for (au = auths; au; au = au->next)
+ for (au = auths; au; au = au->drinst.next)
if (strcmpic(s, au->public_name) == 0 && au->server &&
(au->advertised || f.allow_auth_unadvertised))
break;
uschar * logmsg = NULL;
#ifndef DISABLE_EVENT
{uschar * save_name = sender_host_authenticated;
- sender_host_authenticated = au->name;
+ sender_host_authenticated = au->drinst.name;
logmsg = event_raise(event_action, US"auth:fail", smtp_resp, NULL);
sender_host_authenticated = save_name;
}
log_write(0, LOG_MAIN|LOG_REJECT, "%s", logmsg);
else
log_write(0, LOG_MAIN|LOG_REJECT, "%s authenticator failed for %s: %s",
- au->name, host_and_ident(FALSE), errmsg);
+ au->drinst.name, host_and_ident(FALSE), errmsg);
}
}
else
)
{
BOOL first = TRUE;
- for (auth_instance * au = auths; au; au = au->next)
+ for (auth_instance * au = auths; au; au = au->drinst.next)
{
au->advertised = FALSE;
if (au->server)
{
DEBUG(D_auth+D_expand) debug_printf_indent(
"Evaluating advertise_condition for %s %s athenticator\n",
- au->name, au->public_name);
+ au->drinst.name, au->public_name);
if ( !au->advertise_condition
- || expand_check_condition(au->advertise_condition, au->name,
- US"authenticator")
+ || expand_check_condition(au->advertise_condition,
+ au->drinst.name, US"authenticator")
)
{
int saveptr;
if (authenticated_by == NULL ||
authenticated_by->mail_auth_condition == NULL ||
expand_check_condition(authenticated_by->mail_auth_condition,
- authenticated_by->name, US"authenticator"))
+ authenticated_by->drinst.name, US"authenticator"))
break; /* Accept the AUTH */
ignore_msg = US"server_mail_auth_condition failed";
mechanisms */
typedef struct auth_instance {
- struct auth_instance *next;
- uschar *name; /* Exim instance name */
- struct auth_info *info; /* Pointer to driver info block */
- void *options_block; /* Pointer to private options */
- uschar *driver_name; /* Must be first */
- const uschar *srcfile;
- int srcline;
+ driver_instance drinst;
uschar *advertise_condition; /* Are we going to advertise this?*/
uschar *client_condition; /* Should the client try this? */
/* Structure for holding information about an authentication mechanism. The
-first six fields must match driver_info above. */
+first element must be a struct driver_info, to match routers and transports. */
typedef struct auth_info {
- uschar *driver_name; /* e.g. "condition" */
- optionlist *options; /* Table of private options names */
- int *options_count; /* -> Number of entries in table */
- void *options_block; /* Points to default private block */
- int options_len; /* Length of same in bytes */
- void (*init)( /* initialization function */
- struct auth_instance *);
-/****/
+ driver_info drinfo;
+
int (*servercode)( /* server function */
auth_instance *, /* the instance data */
uschar *); /* rest of AUTH command */
expand_nmax = -1; /* reset */
names = string_copyn(expand_nstring[1], expand_nlength[1]);
-for (au = auths, authnum = 0; au; au = au->next, authnum++) if (au->client)
- {
- const uschar * list = names;
- uschar * s;
- for (int sep = ' '; s = string_nextinlist(&list, &sep, NULL, 0); )
- if (strcmpic(au->public_name, s) == 0)
- { authbits |= BIT(authnum); break; }
- }
+for (au = auths, authnum = 0; au; au = au->drinst.next, authnum++)
+ if (au->client)
+ {
+ const uschar * list = names;
+ uschar * s;
+ for (int sep = ' '; s = string_nextinlist(&list, &sep, NULL, 0); )
+ if (strcmpic(au->public_name, s) == 0)
+ { authbits |= BIT(authnum); break; }
+ }
DEBUG(D_transport)
debug_printf("server offers %s AUTH, methods '%s', usable-bitmap 0x%04x\n",
/* Set up globals for error messages */
-authenticator_name = au->name;
-driver_srcfile = au->srcfile;
-driver_srcline = au->srcline;
+authenticator_name = au->drinst.name;
+driver_srcfile = au->drinst.srcfile;
+driver_srcline = au->drinst.srcline;
-sx->outblock.authenticating = TRUE;
-rc = (au->info->clientcode)(au, sx, ob->command_timeout,
- sx->buffer, sizeof(sx->buffer));
-sx->outblock.authenticating = FALSE;
+ {
+ auth_info * ai = au->drinst.info;
+ sx->outblock.authenticating = TRUE;
+ rc = (ai->clientcode)(au, sx, ob->command_timeout,
+ sx->buffer, sizeof(sx->buffer));
+ sx->outblock.authenticating = FALSE;
+ }
driver_srcfile = authenticator_name = NULL; driver_srcline = 0;
-DEBUG(D_transport) debug_printf("%s authenticator yielded %s\n", au->name, rc_names[rc]);
+DEBUG(D_transport) debug_printf("%s authenticator yielded %s\n",
+ au->drinst.name, rc_names[rc]);
/* A temporary authentication failure must hold up delivery to
this host. After a permanent authentication failure, we carry on
{
case OK:
f.smtp_authenticated = TRUE; /* stops the outer loop */
- client_authenticator = au->name;
+ client_authenticator = au->drinst.name;
if (au->set_client_id)
client_authenticated_id = expand_string(au->set_client_id);
break;
#ifndef DISABLE_EVENT
{
uschar * save_name = sender_host_authenticated;
- sender_host_authenticated = au->name;
- if ((logmsg = event_raise(sx->conn_args.tblock->event_action, US"auth:fail",
- sx->buffer, NULL)))
+ sender_host_authenticated = au->drinst.name;
+ if ((logmsg = event_raise(sx->conn_args.tblock->event_action,
+ US"auth:fail", sx->buffer, NULL)))
log_write(0, LOG_MAIN, "%s", logmsg);
sender_host_authenticated = save_name;
}
#endif
if (!logmsg)
log_write(0, LOG_MAIN, "%s authenticator failed H=%s [%s] %s",
- au->name, host->name, host->address, sx->buffer);
+ au->drinst.name, host->name, host->address, sx->buffer);
break;
}
case CANCELLED:
if (*sx->buffer != 0)
log_write(0, LOG_MAIN, "%s authenticator cancelled "
- "authentication H=%s [%s] %s", au->name, host->name,
+ "authentication H=%s [%s] %s", au->drinst.name, host->name,
host->address, sx->buffer);
break;
for (bitnum = 0, au = auths;
!f.smtp_authenticated && au && bitnum < 16;
- bitnum++, au = au->next) if (authbits & BIT(bitnum))
- {
- if ( au->client_condition
- && !expand_check_condition(au->client_condition, au->name,
- US"client authenticator"))
+ bitnum++, au = au->drinst.next)
+ if (authbits & BIT(bitnum))
{
- DEBUG(D_transport) debug_printf("skipping %s authenticator: %s\n",
- au->name, "client_condition is false");
- continue;
- }
+ if ( au->client_condition
+ && !expand_check_condition(au->client_condition, au->drinst.name,
+ US"client authenticator"))
+ {
+ DEBUG(D_transport) debug_printf("skipping %s authenticator: %s\n",
+ au->drinst.name, "client_condition is false");
+ continue;
+ }
- /* Found data for a listed mechanism. Call its client entry. Set
- a flag in the outblock so that data is overwritten after sending so
- that reflections don't show it. */
+ /* Found data for a listed mechanism. Call its client entry. Set
+ a flag in the outblock so that data is overwritten after sending so
+ that reflections don't show it. */
- fail_reason = US"authentication attempt(s) failed";
+ fail_reason = US"authentication attempt(s) failed";
- if ((rc = try_authenticator(sx, au)) != OK)
- return rc;
- }
+ if ((rc = try_authenticator(sx, au)) != OK)
+ return rc;
+ }
}
else
#endif
If one is found, attempt to authenticate by calling its client function.
*/
- for (auth_instance * au = auths; !f.smtp_authenticated && au; au = au->next)
+ for (auth_instance * au = auths; !f.smtp_authenticated && au;
+ au = au->drinst.next)
{
- uschar *p = names;
+ uschar * p = names;
if ( !au->client
|| ( au->client_condition
- && !expand_check_condition(au->client_condition, au->name,
+ && !expand_check_condition(au->client_condition, au->drinst.name,
US"client authenticator")))
{
DEBUG(D_transport) debug_printf("skipping %s authenticator: %s\n",
- au->name,
+ au->drinst.name,
au->client ? "client_condition is false"
: "not configured as a client");
continue;