From: Jeremy Harris Date: Mon, 30 Dec 2019 20:53:26 +0000 (+0000) Subject: GSASL: feature macro X-Git-Url: https://git.exim.org/users/jgh/exim.git/commitdiff_plain/25bd12fdff615275da6b811570b0f65d57ddc441 GSASL: feature macro --- diff --git a/src/src/auths/gsasl_exim.c b/src/src/auths/gsasl_exim.c index f527e130a..7003b0cbb 100644 --- a/src/src/auths/gsasl_exim.c +++ b/src/src/auths/gsasl_exim.c @@ -44,6 +44,11 @@ static void dummy(int x) { dummy2(x-1); } #endif +#if GSASL_VERSION_MINOR >= 9 +# define EXIM_GSASL_HAVE_SCRAM_SHA_256 +#endif + + /* Authenticator-specific options. */ /* I did have server_*_condition options for various mechanisms, but since we only ever handle one mechanism at a time, I didn't see the point in keeping @@ -100,6 +105,14 @@ int auth_gsasl_client(auth_instance *ablock, void * sx, int timeout, uschar *buffer, int buffsize) {return 0;} void auth_gsasl_version_report(FILE *f) {} +void +auth_gsasl_macros(void) +{ +# ifdef EXIM_GSASL_HAVE_SCRAM_SHA_256 + builtin_macro_create(US"_HAVE_AUTH_GSASL_SCRAM_SHA_256"); +# endif +} + #else /*!MACRO_PREDEF*/ @@ -905,6 +918,11 @@ fprintf(f, "Library version: GNU SASL: Compile: %s\n" GSASL_VERSION, runtime); } + + +/* Dummy */ +void auth_gsasl_macros(void) {} + #endif /*!MACRO_PREDEF*/ #endif /* AUTH_GSASL */ diff --git a/src/src/auths/gsasl_exim.h b/src/src/auths/gsasl_exim.h index 7afec7050..cceec77a8 100644 --- a/src/src/auths/gsasl_exim.h +++ b/src/src/auths/gsasl_exim.h @@ -45,5 +45,6 @@ extern int auth_gsasl_server(auth_instance *, uschar *); extern int auth_gsasl_client(auth_instance *, void *, int, uschar *, int); extern void auth_gsasl_version_report(FILE *f); +extern void auth_gsasl_macros(void); /* End of gsasl_exim.h */ diff --git a/src/src/drtables.c b/src/src/drtables.c index f2022880b..635c01be4 100644 --- a/src/src/drtables.c +++ b/src/src/drtables.c @@ -73,7 +73,8 @@ auth_info auths_available[] = { .init = auth_cram_md5_init, .servercode = auth_cram_md5_server, .clientcode = auth_cram_md5_client, - .version_report = NULL + .version_report = NULL, + .macros_create = NULL, }, #endif @@ -87,7 +88,8 @@ auth_info auths_available[] = { .init = auth_cyrus_sasl_init, .servercode = auth_cyrus_sasl_server, .clientcode = NULL, - .version_report = auth_cyrus_sasl_version_report + .version_report = auth_cyrus_sasl_version_report, + .macros_create = NULL, }, #endif @@ -101,7 +103,8 @@ auth_info auths_available[] = { .init = auth_dovecot_init, .servercode = auth_dovecot_server, .clientcode = NULL, - .version_report = NULL + .version_report = NULL, + .macros_create = NULL, }, #endif @@ -115,7 +118,8 @@ auth_info auths_available[] = { .init = auth_external_init, .servercode = auth_external_server, .clientcode = auth_external_client, - .version_report = NULL + .version_report = NULL, + .macros_create = NULL, }, #endif @@ -129,7 +133,8 @@ auth_info auths_available[] = { .init = auth_gsasl_init, .servercode = auth_gsasl_server, .clientcode = auth_gsasl_client, - .version_report = auth_gsasl_version_report + .version_report = auth_gsasl_version_report, + .macros_create = auth_gsasl_macros, }, #endif @@ -143,7 +148,8 @@ auth_info auths_available[] = { .init = auth_heimdal_gssapi_init, .servercode = auth_heimdal_gssapi_server, .clientcode = NULL, - .version_report = auth_heimdal_gssapi_version_report + .version_report = auth_heimdal_gssapi_version_report, + .macros_create = NULL, }, #endif @@ -157,7 +163,8 @@ auth_info auths_available[] = { .init = auth_plaintext_init, .servercode = auth_plaintext_server, .clientcode = auth_plaintext_client, - .version_report = NULL + .version_report = NULL, + .macros_create = NULL, }, #endif @@ -171,7 +178,8 @@ auth_info auths_available[] = { .init = auth_spa_init, .servercode = auth_spa_server, .clientcode = auth_spa_client, - .version_report = NULL + .version_report = NULL, + .macros_create = NULL, }, #endif @@ -185,7 +193,8 @@ auth_info auths_available[] = { .init = auth_tls_init, .servercode = auth_tls_server, .clientcode = NULL, - .version_report = NULL + .version_report = NULL, + .macros_create = NULL, }, #endif diff --git a/src/src/readconf.c b/src/src/readconf.c index 08014c9af..65dffe10a 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -417,6 +417,8 @@ for (struct auth_info * ai = auths_available; ai->driver_name[0]; ai++) spf(buf, sizeof(buf), US"_DRIVER_AUTHENTICATOR_%T", ai->driver_name); builtin_macro_create(buf); options_from_list(ai->options, (unsigned)*ai->options_count, US"AUTHENTICATOR", ai->driver_name); + + if (ai->macros_create) (ai->macros_create)(); } } diff --git a/src/src/structs.h b/src/src/structs.h index 060eccf41..f3fb290c6 100644 --- a/src/src/structs.h +++ b/src/src/structs.h @@ -433,6 +433,7 @@ typedef struct auth_info { int); /* sizeof buffer */ void (*version_report)( /* diagnostic version reporting */ FILE *); /* I/O stream to print to */ + void (*macros_create)(void); /* feature-macro creation */ } auth_info;