Testsuite: tidying
[exim.git] / src / src / auths / check_serv_cond.c
index c10ff1be42d8fc5060cc09433004a9cb76a053d5..16aeebdcb51af806743922674dc31bbb47c6699c 100644 (file)
@@ -2,8 +2,10 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) The Exim Maintainers 2023 */
+/* Copyright (c) University of Cambridge 1995 - 2012 */
 /* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "../exim.h"
 
@@ -30,9 +32,9 @@ Returns:
 */
 
 int
-auth_check_serv_cond(auth_instance *ablock)
+auth_check_serv_cond(auth_instance * ablock)
 {
-  return auth_check_some_cond(ablock,
+return auth_check_some_cond(ablock,
       US"server_condition", ablock->server_condition, OK);
 }
 
@@ -57,21 +59,17 @@ Returns:
 */
 
 int
-auth_check_some_cond(auth_instance *ablock,
-    uschar *label, uschar *condition, int unset)
+auth_check_some_cond(auth_instance * ablock,
+    uschar * label, uschar * condition, int unset)
 {
-uschar *cond;
+uschar * cond;
 
 HDEBUG(D_auth)
   {
-  int i;
   debug_printf("%s authenticator %s:\n", ablock->name, label);
-  for (i = 0; i < AUTH_VARS; i++)
-    {
-    if (auth_vars[i] != NULL)
-      debug_printf("  $auth%d = %s\n", i + 1, auth_vars[i]);
-    }
-  for (i = 1; i <= expand_nmax; i++)
+  for (int i = 0; i < AUTH_VARS; i++) if (auth_vars[i])
+    debug_printf("  $auth%d = %s\n", i + 1, auth_vars[i]);
+  for (int i = 1; i <= expand_nmax; i++)
     debug_printf("  $%d = %.*s\n", i, expand_nlength[i], expand_nstring[i]);
   debug_print_string(ablock->server_debug_string);    /* customized debug */
   }
@@ -84,25 +82,23 @@ For plaintext/gsasl authenticators, it will have been pre-checked to prevent
 this.  We return the unset scenario value given to us, which for
 server_condition will be OK and otherwise will typically be FAIL. */
 
-if (condition == NULL) return unset;
+if (!condition) return unset;
 cond = expand_string(condition);
 
 HDEBUG(D_auth)
-  {
-  if (cond == NULL)
+  if (!cond)
     debug_printf("expansion failed: %s\n", expand_string_message);
   else
     debug_printf("expanded string: %s\n", cond);
-  }
 
 /* A forced expansion failure causes authentication to fail. Other expansion
 failures yield DEFER, which will cause a temporary error code to be returned to
 the AUTH command. The problem is at the server end, so the client should try
 again later. */
 
-if (cond == NULL)
+if (!cond)
   {
-  if (expand_string_forcedfail) return FAIL;
+  if (f.expand_string_forcedfail) return FAIL;
   auth_defer_msg = expand_string_message;
   return DEFER;
   }