Build: avoid compiling code for unused transports, routers, authenticators
[exim.git] / src / src / auths / plaintext.c
index 29c8b496ef4111d33d3edf32e6db52dcc9bf43ca..8148960473dfa622ac5af597977f22fc2d536c39 100644 (file)
@@ -2,10 +2,14 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "../exim.h"
+
+#ifdef AUTH_PLAINTEXT  /* Remainder of file */
 #include "plaintext.h"
 
 
 
 optionlist auth_plaintext_options[] = {
   { "client_ignore_invalid_base64", opt_bool,
-      (void *)(offsetof(auth_plaintext_options_block, client_ignore_invalid_base64)) },
+      OPT_OFF(auth_plaintext_options_block, client_ignore_invalid_base64) },
   { "client_send",        opt_stringptr,
-      (void *)(offsetof(auth_plaintext_options_block, client_send)) },
+      OPT_OFF(auth_plaintext_options_block, client_send) },
   { "server_prompts",     opt_stringptr,
-      (void *)(offsetof(auth_plaintext_options_block, server_prompts)) }
+      OPT_OFF(auth_plaintext_options_block, server_prompts) }
 };
 
 /* Size of the options list. An extern variable has to be used so that its
@@ -60,9 +64,9 @@ auth_plaintext_init(auth_instance *ablock)
 {
 auth_plaintext_options_block *ob =
   (auth_plaintext_options_block *)(ablock->options_block);
-if (ablock->public_name == NULL) ablock->public_name = ablock->name;
-if (ablock->server_condition != NULL) ablock->server = TRUE;
-if (ob->client_send != NULL) ablock->client = TRUE;
+if (!ablock->public_name) ablock->public_name = ablock->name;
+if (ablock->server_condition) ablock->server = TRUE;
+if (ob->client_send) ablock->client = TRUE;
 }
 
 
@@ -108,7 +112,7 @@ already been provided as part of the AUTH command. For the rest, send them
 out as prompts, and get a data item back. If the data item is "*", abandon the
 authentication attempt. Otherwise, split it into items as above. */
 
-while (  (s = string_nextinlist(&prompts, &sep, big_buffer, big_buffer_size))
+while (  (s = string_nextinlist(&prompts, &sep, NULL, 0))
       && expand_nmax < EXPAND_MAXN)
   if (number++ > expand_nmax)
     if ((rc = auth_prompt(CUS s)) != OK)
@@ -174,5 +178,6 @@ while ((s = string_nextinlist(&text, &sep, NULL, 0)))
 return FAIL;
 }
 
-#endif   /*!MACRO_PREDEF*/
+#endif /*!MACRO_PREDEF*/
+#endif /*AUTH_PLAINTEST*/
 /* End of plaintext.c */