[exim-cvs] GSASL: feature macro

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] GSASL: feature macro
Gitweb: https://git.exim.org/exim.git/commitdiff/25bd12fdff615275da6b811570b0f65d57ddc441
Commit:     25bd12fdff615275da6b811570b0f65d57ddc441
Parent:     a55697acf8d60ff8fc67f8fc46f23b8f53a3b823
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Mon Dec 30 20:53:26 2019 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Mon Dec 30 20:53:26 2019 +0000


    GSASL: feature macro
---
 src/src/auths/gsasl_exim.c | 18 ++++++++++++++++++
 src/src/auths/gsasl_exim.h |  1 +
 src/src/drtables.c         | 27 ++++++++++++++++++---------
 src/src/readconf.c         |  2 ++
 src/src/structs.h          |  1 +
 5 files changed, 40 insertions(+), 9 deletions(-)


diff --git a/src/src/auths/gsasl_exim.c b/src/src/auths/gsasl_exim.c
index f527e13..7003b0c 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 7afec70..cceec77 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 f202288..635c01b 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 08014c9..65dffe1 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 060eccf..f3fb290 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;