GSASL: feature macro
authorJeremy Harris <jgh146exb@wizmail.org>
Mon, 30 Dec 2019 20:53:26 +0000 (20:53 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 30 Dec 2019 20:53:26 +0000 (20:53 +0000)
src/src/auths/gsasl_exim.c
src/src/auths/gsasl_exim.h
src/src/drtables.c
src/src/readconf.c
src/src/structs.h

index f527e13..7003b0c 100644 (file)
@@ -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 */
 
index 7afec70..cceec77 100644 (file)
@@ -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 */
index f202288..635c01b 100644 (file)
@@ -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
 
index 08014c9..65dffe1 100644 (file)
@@ -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)();
   }
 }
 
index 060eccf..f3fb290 100644 (file)
@@ -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;