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 f527e130af9bc065befa4f8f5e200f69efe69d17..7003b0cbb01183b631ce598c6a0f0b8fc4b021b8 100644 (file)
@@ -44,6 +44,11 @@ static void dummy(int x) { dummy2(x-1); }
 #endif
 
 
 #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
 /* 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) {}
 
   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*/
 
 
 #else   /*!MACRO_PREDEF*/
 
 
@@ -905,6 +918,11 @@ fprintf(f, "Library version: GNU SASL: Compile: %s\n"
        GSASL_VERSION, runtime);
 }
 
        GSASL_VERSION, runtime);
 }
 
+
+
+/* Dummy */
+void auth_gsasl_macros(void) {}
+
 #endif   /*!MACRO_PREDEF*/
 #endif  /* AUTH_GSASL */
 
 #endif   /*!MACRO_PREDEF*/
 #endif  /* AUTH_GSASL */
 
index 7afec7050c067dc018c173099f9083cf859d32ec..cceec77a8e55bfb4531967f6d95c7c059a731f57 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 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 */
 
 /* End of gsasl_exim.h */
index f2022880b4ab74933fb5d7546af4f7ef4c1f7fc7..635c01be475e75894f4c2611a2979ba099731e62 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,
   .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
 
   },
 #endif
 
@@ -87,7 +88,8 @@ auth_info auths_available[] = {
   .init =              auth_cyrus_sasl_init,
   .servercode =                auth_cyrus_sasl_server,
   .clientcode =                NULL,
   .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
 
   },
 #endif
 
@@ -101,7 +103,8 @@ auth_info auths_available[] = {
   .init =              auth_dovecot_init,
   .servercode =                auth_dovecot_server,
   .clientcode =                NULL,
   .init =              auth_dovecot_init,
   .servercode =                auth_dovecot_server,
   .clientcode =                NULL,
-  .version_report =    NULL
+  .version_report =    NULL,
+  .macros_create =     NULL,
   },
 #endif
 
   },
 #endif
 
@@ -115,7 +118,8 @@ auth_info auths_available[] = {
   .init =              auth_external_init,
   .servercode =                auth_external_server,
   .clientcode =                auth_external_client,
   .init =              auth_external_init,
   .servercode =                auth_external_server,
   .clientcode =                auth_external_client,
-  .version_report =    NULL
+  .version_report =    NULL,
+  .macros_create =     NULL,
   },
 #endif
 
   },
 #endif
 
@@ -129,7 +133,8 @@ auth_info auths_available[] = {
   .init =              auth_gsasl_init,
   .servercode =                auth_gsasl_server,
   .clientcode =                auth_gsasl_client,
   .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
 
   },
 #endif
 
@@ -143,7 +148,8 @@ auth_info auths_available[] = {
   .init =              auth_heimdal_gssapi_init,
   .servercode =                auth_heimdal_gssapi_server,
   .clientcode =                NULL,
   .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
 
   },
 #endif
 
@@ -157,7 +163,8 @@ auth_info auths_available[] = {
   .init =              auth_plaintext_init,
   .servercode =                auth_plaintext_server,
   .clientcode =                auth_plaintext_client,
   .init =              auth_plaintext_init,
   .servercode =                auth_plaintext_server,
   .clientcode =                auth_plaintext_client,
-  .version_report =    NULL
+  .version_report =    NULL,
+  .macros_create =     NULL,
   },
 #endif
 
   },
 #endif
 
@@ -171,7 +178,8 @@ auth_info auths_available[] = {
   .init =              auth_spa_init,
   .servercode =                auth_spa_server,
   .clientcode =                auth_spa_client,
   .init =              auth_spa_init,
   .servercode =                auth_spa_server,
   .clientcode =                auth_spa_client,
-  .version_report =    NULL
+  .version_report =    NULL,
+  .macros_create =     NULL,
   },
 #endif
 
   },
 #endif
 
@@ -185,7 +193,8 @@ auth_info auths_available[] = {
   .init =              auth_tls_init,
   .servercode =                auth_tls_server,
   .clientcode =                NULL,
   .init =              auth_tls_init,
   .servercode =                auth_tls_server,
   .clientcode =                NULL,
-  .version_report =    NULL
+  .version_report =    NULL,
+  .macros_create =     NULL,
   },
 #endif
 
   },
 #endif
 
index 08014c9af480ef00993feda19e487044a688613d..65dffe10a599f54f4e3080ac3a9ceeff8fd13ef7 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);
   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 060eccf41aa5da5717706df8f82d1868c8dc8c8d..f3fb290c6d1cec6c966b5d6bfbef0a350b01dce4 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 */
     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;
 
 
 } auth_info;