tidying
authorJeremy Harris <jgh146exb@wizmail.org>
Wed, 10 Nov 2021 15:56:13 +0000 (15:56 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Wed, 10 Nov 2021 15:56:13 +0000 (15:56 +0000)
src/exim_monitor/em_init.c
src/src/acl.c
src/src/auths/gsasl_exim.c
src/src/dns.c
src/src/expand.c
src/src/malware.c
src/src/store.c
src/src/tls-openssl.c
src/src/transport.c
src/src/transports/smtp.c
src/src/verify.c

index e16897e95c4978fc63be8523641044535946f99c..e0bc3b0663d577b7564daf197ad5059d2e2386a6 100644 (file)
@@ -115,38 +115,34 @@ void init(int argc, uschar **argv)
 int x;
 size_t erroroffset;
 uschar *s;
-const uschar *error;
 
 argc = argc;     /* These are currently unused. */
 argv = argv;
 
 /* Deal with simple values in the environment. */
 
-s = US getenv("ACTION_OUTPUT");
-if (s != NULL)
+if ((s = US getenv("ACTION_OUTPUT")))
   {
   if (Ustrcmp(s, "no") == 0) action_output = FALSE;
   if (Ustrcmp(s, "yes") == 0) action_output = TRUE;
   }
 
-s = US getenv("ACTION_QUEUE_UPDATE");
-if (s != NULL)
+if ((s = US getenv("ACTION_QUEUE_UPDATE")))
   {
   if (Ustrcmp(s, "no") == 0) action_queue_update = FALSE;
   if (Ustrcmp(s, "yes") == 0) action_queue_update = TRUE;
   }
 
 s = US getenv("BODY_MAX");
-if (s != NULL && (x = Uatoi(s)) != 0) body_max = x;
+if (s && (x = Uatoi(s)) != 0) body_max = x;
 
-s = US getenv("EXIM_PATH");
-if (s != NULL) exim_path = string_copy(s);
+if ((s = US getenv("EXIM_PATH")))
+  exim_path = string_copy(s);
 
-s = US getenv("EXIMON_EXIM_CONFIG");
-if (s != NULL) alternate_config = string_copy(s);
+if ((s = US getenv("EXIMON_EXIM_CONFIG")))
+  alternate_config = string_copy(s);
 
-s = US getenv("LOG_BUFFER");
-if (s != NULL)
+if ((s = US getenv("LOG_BUFFER")))
   {
   uschar c[1];
   if (sscanf(CS s, "%d%c", &x, c) > 0)
@@ -158,63 +154,64 @@ if (s != NULL)
   }
 
 s = US getenv("LOG_DEPTH");
-if (s != NULL && (x = Uatoi(s)) != 0) log_depth = x;
+if (s && (x = Uatoi(s)) != 0) log_depth = x;
 
-s = US getenv("LOG_FILE_NAME");
-if (s != NULL) log_file = string_copy(s);
+if ((s = US getenv("LOG_FILE_NAME")))
+  log_file = string_copy(s);
 
-s = US getenv("LOG_FONT");
-if (s != NULL) log_font = string_copy(s);
+if ((s = US getenv("LOG_FONT")))
+  log_font = string_copy(s);
 
 s = US getenv("LOG_WIDTH");
-if (s != NULL && (x = Uatoi(s)) != 0) log_width = x;
+if (s && (x = Uatoi(s)) != 0) log_width = x;
 
-s = US getenv("MENU_EVENT");
-if (s != NULL) menu_event = string_copy(s);
+if ((s = US getenv("MENU_EVENT")))
+  menu_event = string_copy(s);
 
 s = US getenv("MIN_HEIGHT");
-if (s != NULL && (x = Uatoi(s)) > 0) min_height = x;
+if (s && (x = Uatoi(s)) > 0) min_height = x;
 
 s = US getenv("MIN_WIDTH");
-if (s != NULL && (x = Uatoi(s)) > 0) min_width = x;
+if (s && (x = Uatoi(s)) > 0) min_width = x;
 
-s = US getenv("QUALIFY_DOMAIN");
-if (s != NULL) qualify_domain = string_copy(s);
-  else qualify_domain = US"";  /* Don't want NULL */
+if ((s = US getenv("QUALIFY_DOMAIN")))
+  qualify_domain = string_copy(s);
+else
+  qualify_domain = US"";  /* Don't want NULL */
 
 s = US getenv("QUEUE_DEPTH");
-if (s != NULL && (x = Uatoi(s)) != 0) queue_depth = x;
+if (s && (x = Uatoi(s)) != 0) queue_depth = x;
 
-s = US getenv("QUEUE_FONT");
-if (s != NULL) queue_font = string_copy(s);
+if ((s = US getenv("QUEUE_FONT")))
+  queue_font = string_copy(s);
 
 s = US getenv("QUEUE_INTERVAL");
-if (s != NULL && (x = Uatoi(s)) != 0) queue_update = x;
+if (s && (x = Uatoi(s)) != 0) queue_update = x;
 
 s = US getenv("QUEUE_MAX_ADDRESSES");
-if (s != NULL && (x = Uatoi(s)) != 0) queue_max_addresses = x;
+if (s && (x = Uatoi(s)) != 0) queue_max_addresses = x;
 
 s = US getenv("QUEUE_WIDTH");
-if (s != NULL && (x = Uatoi(s)) != 0) queue_width = x;
+if (s && (x = Uatoi(s)) != 0) queue_width = x;
 
-s = US getenv("SPOOL_DIRECTORY");
-if (s != NULL) spool_directory = string_copy(s);
+if ((s = US getenv("SPOOL_DIRECTORY")))
+  spool_directory = string_copy(s);
 
 s = US getenv("START_SMALL");
-if (s != NULL && Ustrcmp(s, "yes") == 0) start_small = 1;
+if (s && Ustrcmp(s, "yes") == 0) start_small = 1;
 
 s = US getenv("TEXT_DEPTH");
-if (s != NULL && (x = Uatoi(s)) != 0) text_depth = x;
+if (s && (x = Uatoi(s)) != 0) text_depth = x;
 
-s = US getenv("WINDOW_TITLE");
-if (s != NULL) window_title = string_copy(s);
+if ((s = US getenv("WINDOW_TITLE")))
+  window_title = string_copy(s);
 
 /* Deal with stripchart configuration. First see if we are monitoring
 the size of a partition, then deal with log stripcharts in a separate
 function */
 
 s = US getenv("SIZE_STRIPCHART");
-if (s != NULL && *s != 0)
+if (s && *s)
   {
   stripchart_number++;
   stripchart_varstart++;
@@ -223,14 +220,14 @@ if (s != NULL && *s != 0)
   if (s != NULL && *s != 0) size_stripchart_name = string_copy(s);
   }
 
-s = US getenv("LOG_STRIPCHARTS");
-if (s != NULL) decode_stripchart_config(s);
+if ((s = US getenv("LOG_STRIPCHARTS")))
+  decode_stripchart_config(s);
 
 s = US getenv("STRIPCHART_INTERVAL");
-if (s != NULL && (x = Uatoi(s)) != 0) stripchart_update = x;
+if (s && (x = Uatoi(s)) != 0) stripchart_update = x;
 
 s = US getenv("QUEUE_STRIPCHART_NAME");
-queue_stripchart_name = (s != NULL)? string_copy(s) : US"queue";
+queue_stripchart_name = ? string_copy(s) : US"queue";
 
 /* Compile the regex for matching yyyy-mm-dd at the start of a string. */
 
index 15023c7cc68b0f118376e9057ea82959b83bc94d..5252292ffd1b6c6704f3b9d7fd7e2cd1d77d0051 100644 (file)
@@ -2884,7 +2884,7 @@ acl_seen(const uschar * arg, int where, uschar ** log_msgptr)
 enum { SEEN_DEFAULT, SEEN_READONLY, SEEN_WRITE };
 
 const uschar * list = arg;
-int slash = '/', equal = '=', interval, mode = SEEN_DEFAULT, yield = FAIL;
+int slash = '/', interval, mode = SEEN_DEFAULT, yield = FAIL;
 BOOL before;
 int refresh = 10 * 24 * 60 * 60;       /* 10 days */
 const uschar * ele, * key = sender_host_address;
index 2d060d4dac2ba7acf0f73a82a293967ad318fc24..26505446a06c6a8c3d0250798246b2970c8556ed 100644 (file)
@@ -642,10 +642,10 @@ static int
 server_callback(Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop,
   auth_instance *ablock)
 {
-char *tmps;
-uschar *s, *propval;
+char * tmps;
+uschar * s;
 int cbrc = GSASL_NO_CALLBACK;
-auth_gsasl_options_block *ob =
+auth_gsasl_options_block * ob =
   (auth_gsasl_options_block *)(ablock->options_block);
 
 HDEBUG(D_auth) debug_printf("GNU SASL callback %s for %s/%s as server\n",
@@ -786,7 +786,6 @@ set_client_prop(Gsasl_session * sctx, Gsasl_property prop, uschar * val,
   unsigned flags, uschar * buffer, int buffsize)
 {
 uschar * s;
-int rc;
 
 if (!val) return !!(flags & PROP_OPTIONAL);
 if (!(s = expand_string(val)) || !(flags & PROP_OPTIONAL) && !*s)
index 8bf7f65424dea6faeaeff8e21ce8f83f6bdc1519..07c51e2dc37447e53e29b19790dc8e3ce8748552 100644 (file)
@@ -1148,7 +1148,7 @@ switch (type)
   case T_CSA:
     {
     uschar *srvname, *namesuff, *tld;
-    int priority, weight, port;
+    int priority, dummy_weight, port;
     int limit, rc, i;
     BOOL ipv6;
     dns_record *rr;
@@ -1237,7 +1237,7 @@ switch (type)
 
        /* Extract the numerical SRV fields (p is incremented) */
        GETSHORT(priority, p);
-       GETSHORT(weight, p);
+       GETSHORT(dummy_weight, p);
        GETSHORT(port, p);
 
        /* Check the CSA version number */
index 53ad3ff9285a50bb7707d8969caf59a7e452ec4d..59554840e4f60eb620ca461b7bdda423c776ab2c 100644 (file)
@@ -4319,7 +4319,6 @@ tree_node *t = NULL;
 const uschar * list;
 int sep = 0;
 uschar * item;
-uschar * suffix = US"";
 BOOL needsep = FALSE;
 #define LISTNAMED_BUF_SIZE 256
 uschar b[LISTNAMED_BUF_SIZE];
@@ -4335,10 +4334,10 @@ if (!listtype)          /* no-argument version */
   }
 else switch(*listtype) /* specific list-type version */
   {
-  case 'a': t = tree_search(addresslist_anchor,   name); suffix = US"_a"; break;
-  case 'd': t = tree_search(domainlist_anchor,    name); suffix = US"_d"; break;
-  case 'h': t = tree_search(hostlist_anchor,      name); suffix = US"_h"; break;
-  case 'l': t = tree_search(localpartlist_anchor, name); suffix = US"_l"; break;
+  case 'a': t = tree_search(addresslist_anchor,   name); break;
+  case 'd': t = tree_search(domainlist_anchor,    name); break;
+  case 'h': t = tree_search(hostlist_anchor,      name); break;
+  case 'l': t = tree_search(localpartlist_anchor, name); break;
   default:
     expand_string_message = US"bad suffix on \"list\" operator";
     return yield;
index 1dc89ae1509c680b0f8cadb3676c47bcaefbe5f4..10a390dfa4d222ff7a69ade503e66a3677e4f135 100644 (file)
@@ -1457,7 +1457,7 @@ badseek:  err = errno;
       uschar av_buffer[1024];
       uschar *hostname = US"";
       host_item connhost;
-      int clam_fd, result;
+      int clam_fd;
       unsigned int fsize_uint;
       BOOL use_scan_command = FALSE;
       clamd_address * cv[MAX_CLAMD_SERVERS];
index 520305dbbadbd16f86bf4e0368c2c80a57d72641..e4cd722c31b7f1e5b293a71575fc9556bb96ab29 100644 (file)
@@ -283,7 +283,7 @@ Returns:      pointer to store (panic on malloc failure)
 */
 
 void *
-store_get_3(int size, BOOL tainted, const char *func, int linenumber)
+store_get_3(int size, BOOL tainted, const char * func, int linenumber)
 {
 int pool = tainted ? store_pool + POOL_TAINT_BASE : store_pool;
 
@@ -347,7 +347,13 @@ if (size > yield_length[pool])
     if (pool == POOL_CONFIG)
       {
       long pgsize = sysconf(_SC_PAGESIZE);
-      posix_memalign((void **)&newblock, pgsize, (mlength + pgsize - 1) & ~(pgsize - 1));
+      int err = posix_memalign((void **)&newblock,
+                               pgsize, (mlength + pgsize - 1) & ~(pgsize - 1));
+      if (err)
+       log_write(0, LOG_MAIN|LOG_PANIC_DIE,
+         "failed to alloc (using posix_memalign) %d bytes of memory: '%s'"
+         "called from line %d in %s",
+         size, strerror(err), linenumber, func);
       }
     else
 #endif
index e8d14398f1b5dab04544b246ddaaf6218035abc1..51eeedc5b5ad5273cbfc4e6c50f4935973d883ae 100644 (file)
@@ -2235,9 +2235,6 @@ if (!olist)
   const X509 * cert_sent = SSL_get_certificate(s);
   const ASN1_INTEGER * cert_serial = X509_get0_serialNumber(cert_sent);
   const BIGNUM * cert_bn = ASN1_INTEGER_to_BN(cert_serial, NULL);
-  const X509_NAME * cert_issuer = X509_get_issuer_name(cert_sent);
-  uschar * chash;
-  uint chash_len;
 
   for (; olist; olist = olist->next)
     {
index 0c2c6e29af9c713c20419a7ae8670aa622a55de0..8c74030f04f1e5f751489fd2eebf5822b1d112a0 100644 (file)
@@ -1398,7 +1398,7 @@ if (write_pid > 0)
         yield = FALSE;
        }
       else if (!ok)
-        {
+        {              /* Try to drain the pipe; read fails are don't care */
        int dummy = read(pfd[pipe_read], (void *)&save_errno, sizeof(int));
         dummy = read(pfd[pipe_read], (void *)&tctx->addr->more_errno, sizeof(int));
         dummy = read(pfd[pipe_read], (void *)&tctx->addr->delivery_time, sizeof(struct timeval));
index 6f4e7ab718f68fa76a446f5db4c8ac8fc924cd1b..d321bd69ecc2413068c7aca5723658594ba94795 100644 (file)
@@ -716,9 +716,11 @@ BOOL good_response;
   {    /* Hack to get QUICKACK disabled; has to be right after 3whs, and has to on->off */
   int sock = sx->cctx.sock;
   struct pollfd p = {.fd = sock, .events = POLLOUT};
-  int rc = poll(&p, 1, 1000);
-  (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &on, sizeof(on));
-  (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &off, sizeof(off));
+  if (poll(&p, 1, 1000) >= 0)  /* retval test solely for compiler quitening */
+    {
+    (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &on, sizeof(on));
+    (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &off, sizeof(off));
+    }
   }
 #endif
 good_response = smtp_read_response(sx, sx->buffer, sizeof(sx->buffer),
index 0ac6a7c744c6e0c8db27d7e5945c446495fe441a..c182e12e1cd3fc593eb9ea766e1602a841ee74e1 100644 (file)
@@ -3577,9 +3577,10 @@ else
 
 close(pfd[pipe_read]);
 errno = save_errno;
+return yield;
 
 fail:
-
+DEBUG(D_verify) debug_printf_indent("verify_quota_call fail in %s\n", where);
 return yield;
 }